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,523,479 | What does the variable $this mean in PHP? | <p>I see the variable <code>$this</code> in PHP all the time and I have no idea what it's used for. I've never personally used it. </p>
<p>Can someone tell me how the variable <code>$this</code> works in PHP?</p> | 1,523,484 | 11 | 0 | null | 2009-10-06 03:45:08.45 UTC | 44 | 2020-12-13 17:02:07.023 UTC | 2019-11-18 13:34:23.207 UTC | null | 2,370,483 | null | 89,334 | null | 1 | 123 | php|class|oop|this | 247,173 | <p>It's a reference to the current object, it's most commonly used in object oriented code.</p>
<ul>
<li>Reference: <a href="http://www.php.net/manual/en/language.oop5.basic.php" rel="noreferrer">http://www.php.net/manual/en/language.oop5.basic.php</a></li>
<li>Primer: <a href="http://www.phpro.org/tutorials/Object-Or... |
1,938,614 | In what case would I use a tuple as a dictionary key? | <p>I was studying the <a href="https://docs.python.org/3/faq/design.html#why-are-there-separate-tuple-and-list-data-types" rel="noreferrer">difference between lists and tuples</a> (in Python). An obvious one is that tuples are immutable (the values cannot be changed after initial assignment), while lists are mutable.</... | 1,938,638 | 12 | 1 | null | 2009-12-21 07:01:29.587 UTC | 23 | 2022-02-14 00:33:46.21 UTC | 2018-05-16 08:36:54.643 UTC | null | 9,298,629 | null | 104,427 | null | 1 | 99 | python|list|dictionary|tuples | 98,382 | <p>Classic Example: You want to store point value as tuple of (x, y) </p> |
1,441,562 | Detect language from string in PHP | <p>In PHP, is there a way to detect the language of a string? Suppose the string is in UTF-8 format.</p> | 1,441,575 | 18 | 5 | null | 2009-09-17 22:06:44.5 UTC | 16 | 2022-09-24 15:27:29.553 UTC | 2014-03-14 11:33:27.907 UTC | null | 1,598,477 | null | 156,153 | null | 1 | 35 | php|language-detection | 67,983 | <p>You can not detect the language from the character type. And there are no foolproof ways to do this.</p>
<p>With any method, you're just doing an educated guess. There are available some math related <a href="http://tnlessone.wordpress.com/2007/05/13/how-to-detect-which-language-a-text-is-written-in-or-when-science... |
33,942,849 | Border Position | <p>I want to try and achieve something in CSS using borders but they don't seem to have something I want. In Photoshop, when you add a Stroke (border), you select the position. Outside, Inside, or Center. Outside being where the entire border wraps around the object. Inside is where it sits on the inside (obviously), a... | 33,943,318 | 3 | 3 | null | 2015-11-26 16:04:13.38 UTC | 3 | 2018-02-19 23:18:44.113 UTC | 2015-11-26 16:12:51.1 UTC | null | 2,081,719 | null | 2,179,057 | null | 1 | 5 | css | 60,418 | <p>There's a work around, since <code>border</code> represents outer stroke for you, you can make use of <code>outline</code> css property with <code>outline-offset</code> set to negative value to have the inner <code>1px</code> stroke<sup>( 1 )</sup> <a href="http://jsfiddle.net/Mi_Creativity/2bx6jL9s/2/" rel="norefer... |
8,497,103 | What are the naming conventions in C#? | <blockquote>
<p>There are a few questions on this, but they all seemed to be targeting a specific part of the language;</p>
<ul>
<li><a href="https://stackoverflow.com/questions/1228478/what-are-the-most-common-naming-conventions-in-c">What are the most common naming conventions in C#?</a> - Asking specificall... | 8,497,240 | 4 | 2 | null | 2011-12-13 22:27:32.443 UTC | 16 | 2020-03-11 14:03:42.99 UTC | 2017-05-23 12:18:24.66 UTC | null | -1 | null | 699,632 | null | 1 | 47 | c#|naming-conventions | 50,824 | <p>There is the <a href="http://www.scribd.com/doc/56782158/All-In-One-Code-Framework-Coding-Standards" rel="nofollow noreferrer">All-In-One Code Framework Coding Standards</a> from Microsoft which contains a complete set of rules and guidelines. (also used to be available <a href="https://web.archive.org/web/201703050... |
46,288,170 | Is it possible to mix --class-path and --module-path in javac (JDK 9)? | <p>When I compile a module that depends on other modules I've compiled previously I have to specify the <code>--module-path <directory></code> option. This makes modules I depend on visible. </p>
<p>But at the same time I would also like to make some non-modular Jar files visible. However if don't make them auto... | 46,289,257 | 2 | 3 | null | 2017-09-18 21:02:57.377 UTC | 15 | 2021-05-06 16:34:06.98 UTC | 2021-05-06 16:34:06.98 UTC | null | 1,746,118 | null | 509,276 | null | 1 | 31 | java|classpath|java-9|java-platform-module-system|module-path | 24,214 | <p>You can use class path and module path in parallel, but there are a few details to consider.</p>
<h1>Dependency Module Path ~> Class Path</h1>
<p>Explicit modules (JARs with a module descriptor on the module path) can not read the unnamed module (JARs on the class path) - that was done on purpose to prevent modula... |
46,312,956 | Why can't I connect AWS RDS instance from EC2 instance in another VPC after peering | <p>I am running Tableau Server on our EC2 instance in VPC A. Meanwhile, I created a postgres RDS in another VPC B. Now I want to establish the connection between the Tableau Server and RDS. CIDR of RDS VPC is 172.31.0.0/16 and that of EC2 VPC is 10.0.0.0/16.</p>
<p>According to <a href="http://docs.aws.amazon.com/Amaz... | 46,331,624 | 7 | 5 | null | 2017-09-20 03:46:31.3 UTC | 8 | 2021-12-31 01:21:41.443 UTC | 2018-06-05 21:16:30.383 UTC | null | 174,777 | null | 3,358,927 | null | 1 | 19 | amazon-web-services|amazon-ec2|amazon-rds|amazon-vpc | 14,476 | <p>VPC Peering works much the same way as how Public Subnets connect to the Internet Gateway -- the <strong>Route Tables</strong> define how traffic goes in/out of the Subnets.</p>
<p>For VPC Peering to work:</p>
<ul>
<li><strong>Invite & Accept</strong> the peering connection (Done)</li>
<li>Create a <strong>Route... |
41,946,156 | Strange diagonal lines in Chrome/Chromium (bug?) | <p>When I use CSS filters, shadows, transformations, SVG (or similar), my Chrome/Chromium shows a strange diagonal lines:</p>
<pre><code> filter:drop-shadow(0px 0px 10px #dce810);
transform:skew(-15deg);
</code></pre>
<p><a href="https://i.stack.imgur.com/pfPL4.png" rel="noreferrer"><img src="https://i.stack.... | 44,545,448 | 3 | 3 | null | 2017-01-30 22:00:19.603 UTC | 8 | 2017-10-14 13:35:53.287 UTC | null | null | null | null | 500,214 | null | 1 | 27 | google-chrome|webkit|chromium|blink | 3,402 | <p>It's almost certainly this Chrome/Chromium rasterization bug, which appears to be specific to certain NVidia GPUs: </p>
<blockquote>
<p><A href="https://bugs.chromium.org/p/chromium/issues/detail?id=691262" rel="noreferrer">Issue 691262 Corrupted background with GPU rasterization</a>.</p>
</blockquote> |
44,589,738 | Angular2 - Error: The selector "app-root" did not match any elements | <p>I am learning Angular 2, without prior experience of Angular.
I was following this tutorial: <a href="https://www.barbarianmeetscoding.com/blog/2016/03/25/getting-started-with-angular-2-step-by-step-1-your-first-component/" rel="noreferrer">https://www.barbarianmeetscoding.com/blog/2016/03/25/getting-started-with-an... | 44,625,753 | 7 | 10 | null | 2017-06-16 12:52:43.347 UTC | 3 | 2021-09-25 08:11:14.493 UTC | 2017-06-17 14:19:18.893 UTC | null | 1,730,904 | null | 1,730,904 | null | 1 | 34 | angular | 63,022 | <p>Angular starts with a root component. When you give</p>
<pre><code>bootstrap: [ AppComponent ]
</code></pre>
<p>in your <code>app.modules.ts</code>, angular searches for first instance of <code>app-root</code> in your HTML and replaces that tag with angular application.
So, your AppComponent <code>selector</code> sh... |
41,053,901 | How to display base64 encoded image in html | <p>I have image URL, so I downloaded the image and converted image into base 64 by online converter.</p>
<p>base 64 code:</p>
<pre><code>iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2Voa... | 41,053,963 | 1 | 3 | null | 2016-12-09 05:49:31.843 UTC | 2 | 2018-09-06 11:52:02.877 UTC | null | null | null | null | 6,333,230 | null | 1 | 10 | html|image|base64 | 74,307 | <p>You can use a <a href="https://en.wikipedia.org/wiki/Data_URI_scheme" rel="noreferrer">data URI</a>:</p>
<pre class="lang-html prettyprint-override"><code><img src="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54b... |
5,010,754 | Do collaborators have commit access on GitHub? | <p>One thing I noticed: Using the GitHub UI, I added a collaborator to a repository. I saw that they committed changes without any authority / approval from me. It was a private repository.</p>
<p>With private repositories, how do I give someone read access versus write access?</p> | 5,010,789 | 2 | 0 | null | 2011-02-15 23:29:11.377 UTC | 3 | 2016-07-03 06:24:58.393 UTC | 2016-07-03 06:23:58.623 UTC | null | 63,550 | null | 129,774 | null | 1 | 42 | git|github | 34,445 | <blockquote>
<p>With private repositories, how do I give someone read access versus write access?</p>
</blockquote>
<p>This kind of permission is not available for simple accounts. When you add an user as a collaborator, he gains read/write permissions.</p>
<p>The story changes if you own an <a href="https://github... |
492,627 | Change border color on <select> HTML form | <p>Is it possible to change the border color on a <code><select/></code> element in an HTML form?</p>
<p>The <code>border-color</code> style works in Firefox but not IE.</p>
<p>I could find no real answers on Google.</p> | 492,670 | 7 | 1 | null | 2009-01-29 17:34:15.65 UTC | 4 | 2020-06-29 05:44:41.08 UTC | 2013-06-06 19:41:58.93 UTC | null | 2,156,756 | Too embarrassed to say | null | null | 1 | 20 | html|css|html-select | 151,770 | <p>I would consinder enclosing that select block within a div block and setting the border property like this:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><div styl... |
724,857 | How to find JavaScript variable by its name | <p>Is there a way to find JavaScript variable on the page (get it as an object) by its name? Variable name is available as a string constant.</p> | 724,906 | 7 | 1 | null | 2009-04-07 09:43:47.033 UTC | 11 | 2018-08-29 09:32:37.947 UTC | null | null | null | null | 59,713 | null | 1 | 40 | javascript | 54,864 | <pre><code><script>
var a ="test";
alert(a);
alert(window["a"]);
alert(eval("a"));
</script>
</code></pre> |
324,045 | Windows temporary files behaviour - are they deleted by the system? | <p>Using the .net framework you have the option to create temporary files with</p>
<pre><code>Path.GetTempFileName();
</code></pre>
<p>The MSDN doesn't tell us what happens to temporary files. I remember reading somewhere that they are deleted by the OS when it gets a restart. Is this true?</p>
<p>If the files aren... | 324,345 | 7 | 1 | null | 2008-11-27 15:34:21.163 UTC | 5 | 2016-07-15 12:49:21.1 UTC | 2008-11-27 15:40:18.64 UTC | Bogdan Gavril | 21,634 | Bogdan Gavril | 21,634 | null | 1 | 43 | .net|windows|file | 13,852 | <p>The short answer: they don't get deleted.</p>
<p>The long answer:
The managed <a href="http://msdn.microsoft.com/en-us/library/system.io.path.gettempfilename.aspx" rel="noreferrer"><code>Path.GetTempFileName()</code></a> method calls the native Win32API <a href="http://msdn.microsoft.com/en-us/library/aa364991.asp... |
542,705 | How do I combine 2 select statements into one? | <p>I am a noob when it comes to SQL syntax. </p>
<p>I have a table with lots of rows and columns of course :P
Lets say it looks like this:</p>
<pre><code> AAA BBB CCC DDD
-----------------------
Row1 | 1 A D X
Row2 | 2 B C X
Row3 | 3 C D Z
</code></pre>
<p>Now I want to create an advanced sele... | 542,735 | 8 | 1 | null | 2009-02-12 18:41:39.093 UTC | 18 | 2017-07-03 10:06:00.643 UTC | 2013-05-04 10:44:21.317 UTC | null | 635,608 | Wolf5 | 37,643 | null | 1 | 59 | sql|select|conditional | 326,898 | <p>You have two choices here. The first is to have two result sets which will set 'Test1' or 'Test2' based on the condition in the <code>WHERE</code> clause, and then <code>UNION</code> them together:</p>
<pre><code>select
'Test1', *
from
TABLE
Where
CCC='D' AND DDD='X' AND exists(select ...)
UNION
s... |
1,169,248 | Test if a vector contains a given element | <p>How to check if a vector contains a given value?</p> | 1,169,262 | 8 | 7 | null | 2009-07-23 02:20:53.34 UTC | 149 | 2022-07-16 18:43:31.497 UTC | 2018-05-09 09:33:59.3 UTC | null | 680,068 | null | 2,002,705 | null | 1 | 609 | r|vector|r-faq | 882,574 | <p>Both the <code>match()</code> (returns the first appearance) and <code>%in%</code> (returns a Boolean) functions are designed for this.</p>
<pre><code>v <- c('a','b','c','e')
'b' %in% v
## returns TRUE
match('b',v)
## returns the first location of 'b', in this case: 2
</code></pre> |
644,975 | Deleting a LOT of data in Oracle | <p>I am not a database person, exactly, and most of my db work has been with MySQL, so forgive me if something in this question is incredibly naïve.</p>
<p>I need to delete 5.5 million rows from an Oracle table that has about 100 million rows. I have all the IDs of the rows I need to delete in a temporary table. If it... | 645,021 | 9 | 1 | null | 2009-03-13 23:31:02.24 UTC | 6 | 2016-09-23 20:23:40.08 UTC | 2016-09-23 20:23:40.08 UTC | Sarah Mei | 4,370,109 | Sarah Mei | 66,801 | null | 1 | 15 | sql|oracle|plsql | 55,011 | <p>The first approach is better, because you give the query optimizer a clear picture of what you are trying to do, instead of trying to hide it. The database engine might take a different approach to deleting 5.5m (or 5.5% of the table) internally than to deleting 200k (or 0.2%). </p>
<p>Here is also an <a href="http... |
283,749 | The VB.NET 'With' Statement - embrace or avoid? | <p>At work, I'm frequently working on projects where numerous properties of certain objects have to be set during their construction or early during their lifetime. For the sake of convenience and readability, I often use the <code>With</code> statement to set these properties. I find that</p>
<pre><code>With Me.Eleme... | 283,820 | 10 | 1 | null | 2008-11-12 12:09:32.713 UTC | 13 | 2017-08-17 14:39:48.467 UTC | 2009-11-09 20:47:30.373 UTC | Tom | 20 | Tom | 20 | null | 1 | 72 | vb.net|with-statement | 61,028 | <p>If you have long variablenames and would end up with:</p>
<pre><code>UserHandler.GetUser.First.User.FirstName="Stefan"
UserHandler.GetUser.First.User.LastName="Karlsson"
UserHandler.GetUser.First.User.Age="39"
UserHandler.GetUser.First.User.Sex="Male"
UserHandler.GetUser.First.User.Occupation="Programmer"
UserHandl... |
603,785 | Environment variables in Mac OS X | <p>Update: The link below <em>does not have a complete answer</em>. Having to set the path or variable in two places (one for GUI and one for shell) is lame.</p>
<p><strong>Not Duplicate of</strong>: <a href="https://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x">Setting environment variable... | 3,756,674 | 10 | 1 | null | 2009-03-02 20:07:20.46 UTC | 176 | 2022-01-10 08:29:44.683 UTC | 2017-05-23 12:26:37.537 UTC | Abdullah Jibaly | -1 | Abdullah Jibaly | 47,110 | null | 1 | 203 | macos|environment-variables | 246,773 | <p>There's no need for duplication. You can set environment variables used by launchd (and child processes, i.e. anything you start from Spotlight) using <code>launchctl setenv</code>.</p>
<p>For example, if you want to mirror your current path in launchd after setting it up in <code>.bashrc</code> or wherever:</p>
<... |
4,371 | How do I retrieve my MySQL username and password? | <p>I lost my MySQL username and password. How do I retrieve it?</p> | 4,376 | 11 | 0 | null | 2008-08-07 03:54:14.593 UTC | 63 | 2022-07-03 11:14:22.733 UTC | 2022-05-14 20:46:50.21 UTC | null | 12,492,890 | null | 131 | null | 1 | 180 | mysql|mysql-workbench | 744,650 | <blockquote>
<p>Stop the MySQL process.</p>
<p>Start the MySQL process with the --skip-grant-tables option.</p>
<p>Start the MySQL console client with the -u root option.</p>
</blockquote>
<p>List all the users;</p>
<pre><code>SELECT * FROM mysql.user;
</code></pre>
<p>Reset password;</p>
<pre><code>UPDATE mysql.user S... |
927,006 | LINQ to SQL -- Can't modify return type of stored procedure | <p>When I drag a particular stored procedure into the VS 2008 dbml designer, it shows up with Return Type set to "none", and it's read only so I can't change it. The designer code shows it as returning an int, and if I change that manually, it just gets undone on the next build. </p>
<p>But with another (nearly ident... | 928,319 | 12 | 1 | null | 2009-05-29 16:48:39.373 UTC | 15 | 2019-01-31 14:26:51.05 UTC | 2013-08-24 15:46:48.46 UTC | null | 861,716 | null | 113,435 | null | 1 | 21 | linq-to-sql|stored-procedures|asp.net-3.5 | 27,980 | <p>Okay, I found the problem... kind of. I had changed the name of the table "Assignments" and forgot to update the stored procudure, so the DBML designer was confused. BUT even after I updated the stored procedure, deleted it from the DBML designer and readded it, it wasn't working! </p>
<p>This is nearly the same... |
1,160,004 | Setup Factory Girl with Test::Unit and Shoulda | <p>I'm trying to set up Factory Girl with Test::Unit and Shoulda in Ruby on Rails. I have installed the gem, created my factory file under the test/factories directory, and created my spec file under the test/models directory. The current error I'm getting is 'ArgumentError: No such factory: test', which leads me to be... | 1,359,180 | 13 | 0 | null | 2009-07-21 15:38:18.363 UTC | 10 | 2011-09-19 14:50:48.367 UTC | 2009-07-21 16:12:08.497 UTC | null | 141,615 | null | 141,615 | null | 1 | 16 | ruby-on-rails|ruby|shoulda|factory-bot|testunit | 14,465 | <p>I've run into this problem on one of my projects too. I'm not sure precisely what's causing the initialization code to be skipped but you can force load the factory definitions like this: </p>
<pre><code>require 'factory_girl'
Factory.find_definitions
</code></pre>
<p>Hope this helps.</p> |
985,725 | Tools for JPEG optimization? | <p>Do you know of any tools (preferrably command-line) to automatically and losslessly optimize JPEGs that I could integrate into our build environment? For PNGs I'm currently using <a href="http://www.advsys.net/ken/util/pngout.htm" rel="noreferrer">PNGOUT</a>, and it generally saves around 40% bandwidth/image size.</... | 986,642 | 14 | 6 | null | 2009-06-12 09:03:05.827 UTC | 56 | 2017-04-07 12:34:10.097 UTC | null | null | null | null | 108,655 | null | 1 | 115 | optimization|jpeg | 65,618 | <p>I use libjpeg for lossless operations. It contains a command-line tool <a href="http://en.wikipedia.org/wiki/Jpegtran" rel="noreferrer"><strong>jpegtran</strong></a> that can do all you want. With the commandline option <code>-copy none</code> all the metadata is stripped, and <code>-optimize</code> does a lossless ... |
70,303 | How do you implement GetHashCode for structure with two string, when both strings are interchangeable | <p>I have a structure in C#:</p>
<pre><code>public struct UserInfo
{
public string str1
{
get;
set;
}
public string str2
{
get;
set;
}
}
</code></pre>
<p>The only rule is that <code>UserInfo(str1="AA", str2="BB").Equals(UserInfo(str1="BB", str2="AA"))</code></p>
<p>How to o... | 70,375 | 15 | 2 | null | 2008-09-16 08:17:43.553 UTC | 9 | 2021-05-10 11:48:17.053 UTC | 2014-09-24 11:28:56.553 UTC | aku | 3,834 | Ngu Soon Hui | 3,834 | null | 1 | 72 | c#|hashtable | 44,180 | <p><a href="http://msdn.microsoft.com/en-us/library/system.object.gethashcode.aspx" rel="noreferrer">MSDN</a>:</p>
<p>A hash function must have the following properties:</p>
<blockquote>
<ul>
<li>If two objects compare as equal, the <code>GetHashCode</code> method for each object must return the same value. Howev... |
436,411 | Where should I put <script> tags in HTML markup? | <p>When embedding JavaScript in an HTML document, where is the proper place to put the <code><script></code> tags and included JavaScript? I seem to recall that you are not supposed to place these in the <code><head></code> section, but placing at the beginning of the <code><body></code> section is ba... | 24,070,373 | 21 | 4 | null | 2009-01-12 18:15:54.57 UTC | 909 | 2022-07-29 00:56:57.257 UTC | 2022-07-29 00:56:57.257 UTC | null | 7,941,251 | mipadi | 28,804 | null | 1 | 1,795 | javascript|html|script-tag | 735,480 | <p>Here's what happens when a browser loads a website with a <code><script></code> tag on it:</p>
<ol>
<li>Fetch the HTML page (e.g. <em>index.html</em>)</li>
<li>Begin parsing the HTML</li>
<li>The parser encounters a <code><script></code> tag referencing an external script file.</li>
<li>The browser reque... |
914,895 | How to change credentials for SVN repository in Eclipse? | <p>I have Eclipse 3.4.2 installed on Windows with subclipse. Another developer added an SVN repository with his credentials and selected 'Save password'. Now every time I do anything with SVN his cached credentials are used. How can I change them to mine?</p>
<p>I have already checked the 'workspace/.metadata/.plugins... | 914,926 | 21 | 0 | null | 2009-05-27 09:53:40.243 UTC | 39 | 2021-05-19 10:04:47.32 UTC | 2013-01-04 19:24:28.727 UTC | null | 543,738 | null | 112,971 | null | 1 | 124 | eclipse|svn|subclipse|subversive | 262,083 | <p><a href="http://subclipse.tigris.org/wiki/PluginFAQ#head-d507c29676491f4419997a76735feb6ef0aa8cf8" rel="noreferrer">http://subclipse.tigris.org/wiki/PluginFAQ#head-d507c29676491f4419997a76735feb6ef0aa8cf8</a>:</p>
<blockquote>
<p><strong>Usernames and passwords</strong></p>
<p>Subclipse does not collect or store use... |
1,106,377 | Detect when a browser receives a file download | <p>I have a page that allows the user to download a dynamically-generated file. It takes a long time to generate, so I'd like to show a "waiting" indicator. The problem is, I can't figure out how to detect when the browser has received the file so that I can hide the indicator.</p>
<p>I'm requesting a hidden ... | 4,168,965 | 24 | 8 | null | 2009-07-09 20:51:12.227 UTC | 218 | 2022-04-27 09:40:59.343 UTC | 2022-01-11 02:15:11.13 UTC | null | 63,550 | null | 4,321 | null | 1 | 557 | javascript|http|mime | 401,679 | <p>One <a href="http://gruffcode.com/2010/10/28/detecting-the-file-download-dialog-in-the-browser/" rel="noreferrer">possible solution</a> uses JavaScript on the client.</p>
<p>The client algorithm:</p>
<ol>
<li>Generate a random unique token.</li>
<li>Submit the download request, and include the token in a GET/POST ... |
1,017,624 | When is a function name too long? | <p>I try to be rather descriptive with my function names, where possible. This occasionally results in function names in the twenty to thirty character range such as <code>GetActionFromTypeName</code> or <code>GetSelectedActionType</code>. At what point do functions get too long to manage (not too long for the compile... | 1,017,638 | 27 | 9 | 2009-06-19 12:15:54.81 UTC | 2009-06-19 12:12:22.04 UTC | 6 | 2021-02-05 09:24:05.45 UTC | 2021-02-05 09:24:05.45 UTC | null | 2,287,576 | null | 16,487 | null | 1 | 49 | language-agnostic|naming-conventions | 24,760 | <p>If there's a shorter, but yet descriptive way to name the function, then the function name is too long.</p> |
905,551 | Are there any O(1/n) algorithms? | <p>Are there any O(1/n) algorithms?</p>
<p>Or anything else which is less than O(1)? </p> | 905,832 | 31 | 6 | 2010-07-09 01:14:17.793 UTC | 2009-05-25 06:15:28.03 UTC | 136 | 2021-01-24 22:40:04.077 UTC | 2010-07-10 11:57:02.92 UTC | null | 334,220 | null | 14,559 | null | 1 | 355 | theory|complexity-theory|big-o | 70,804 | <p>This question isn't as silly as it might seem to some. At least theoretically, something such as <em>O</em>(1/<em>n</em>) is completely sensible when we take the mathematical definition of the <a href="http://en.wikipedia.org/wiki/Big_O_notation" rel="noreferrer">Big O notation</a>:</p>
<p><img src="https://i.stack.... |
685,060 | design a stack such that getMinimum( ) should be O(1) | <p>This is an interview question.</p>
<blockquote>
<p>You need to design a stack which holds an integer value such that <code>getMinimum()</code> function should return the minimum element in the stack.</p>
<p>For example:</p>
<blockquote>
<p>case #1</p>
<p>5 ← TOP<br />
1<br />
4<br />
6<br />
2</p>
<p>When getMinimum... | 685,074 | 31 | 1 | null | 2009-03-26 09:29:17.827 UTC | 93 | 2021-03-28 15:02:24.807 UTC | 2021-03-28 14:31:52.437 UTC | null | 3,789,665 | Ganesh M | 43,502 | null | 1 | 124 | algorithm|language-agnostic|data-structures|stack | 116,312 | <p>EDIT: This fails the "constant space" constraint - it basically doubles the space required. I very much doubt that there's a solution which <em>doesn't</em> do that though, without wrecking the runtime complexity somewhere (e.g. making push/pop O(n)). Note that this doesn't change the <em>complexity</em> of the spac... |
6,327,631 | Displaying an image on Javascript function call ! | <p>I am a javascript noob and I need help with this problem !</p>
<p>On a specific condition a function is called and when it is called , I want an image to be displayed ! How do I do that ? this is not working!</p>
<pre><code><script type="text/javascript">
function _enabled() {
document.write("<img border=... | 6,327,694 | 5 | 0 | null | 2011-06-13 07:22:24.203 UTC | null | 2011-06-13 07:39:07.247 UTC | null | null | null | null | 787,563 | null | 1 | 1 | javascript|function|image | 44,341 | <p>The syntax error is that you're using double quotes for your <code>document.write</code> string literal, but you've also used a double quotes your HTML attributes:</p>
<pre><code>document.write("<img border="0" src="http://4.bp.blogspot.com/-C4vvMEB9MyI/TfW0lduV2NI/AAAAAAAAAZc/N7HL1pUusGw/s1600/some image.png" /... |
6,496,866 | Best way to do a weighted search over multiple fields in mysql? | <p>Here's what i want to do:</p>
<ul>
<li>match a search subject against multiple fields of my table</li>
<li>order the results by importance of the field and relevance of the matching (in that order)</li>
</ul>
<p>Ex: let's assume I have a blog. Then someone searches for "php". The results would appear that way:</p>... | 6,496,964 | 6 | 0 | null | 2011-06-27 17:52:57.83 UTC | 17 | 2020-06-25 09:14:55.47 UTC | 2014-11-17 17:55:07.537 UTC | null | 434,293 | null | 434,293 | null | 1 | 25 | php|mysql|search | 11,575 | <p>Probably this approach of doing a weighted search / results is suitable for you:</p>
<pre><code>SELECT *,
IF(
`name` LIKE "searchterm%", 20,
IF(`name` LIKE "%searchterm%", 10, 0)
)
+ IF(`description` LIKE "%searchterm%", 5, 0)
+ IF(`url` LIKE "%searchterm%", 1, ... |
6,452,731 | Remove ' ' - still trying | <p>Still looking for a way to delete <code>'&nbsp;'</code> from my html code, found number of ways on stackoverlow.com, but neither of those seam to work!</p>
<p><strong>HTML</strong></p>
<pre><code><p>No Space</p>
<p>&nbsp;1 Space</p>
<p>&nbsp;&nbsp;2 Spaces</p>
&l... | 6,452,789 | 6 | 4 | null | 2011-06-23 10:41:25.837 UTC | 7 | 2016-05-27 14:34:28.9 UTC | 2016-05-27 14:25:06.843 UTC | null | 3,518,452 | null | 616,643 | null | 1 | 26 | javascript|jquery|string|whitespace|html-entities | 65,292 | <p>You have &nbsp in your code instead of <code>&nbsp;</code></p>
<pre><code>$('p').each(function(){
$(this).html($(this).html().replace(/&nbsp;/gi,''));
});
</code></pre>
<p><a href="http://jsfiddle.net/genesis/hbvjQ/76/" rel="noreferrer">http://jsfiddle.net/genesis/hbvjQ/76/</a></p> |
6,594,014 | javascript innerHTML adding instead of replacing | <p>quick question, i know we can <strong>change</strong> the content of a</p>
<p><code><div id="whatEverId">hello one<div></code> by using:</p>
<pre><code>document.getElementById("whatEverId").innerHTML="hello two";
</code></pre>
<p>now, is there a way I can <strong>ADD</strong> stuff to the div instead ... | 6,594,082 | 6 | 0 | null | 2011-07-06 09:11:47.44 UTC | 10 | 2022-07-12 23:01:49.387 UTC | 2018-06-14 18:34:52.667 UTC | user4639281 | null | null | 827,499 | null | 1 | 31 | javascript|ajax|dom|innerhtml | 67,326 | <pre><code><div id="whatever">hello one</div>
<script>
document.getElementById("whatever").innerHTML += " hello two";
</script>
</code></pre> |
6,588,265 | jQuery Select first and second td | <p>How can I add a class to the first and second td in each tr?</p>
<pre><code><div class='location'>
<table>
<tbody>
<tr>
<td>THIS ONE</td>
<td>THIS ONE</td>
<td>else</td>
<td>here</td>
</tr>
<tr>
<td>THIS ONE</td>
<td&... | 6,588,327 | 7 | 2 | null | 2011-07-05 20:08:42.58 UTC | 10 | 2018-12-14 21:33:11.727 UTC | null | null | null | null | 149,664 | null | 1 | 47 | jquery | 167,027 | <pre><code>$(".location table tbody tr td:first-child").addClass("black");
$(".location table tbody tr td:nth-child(2)").addClass("black");
</code></pre>
<p><a href="http://jsfiddle.net/68wbx/1/" rel="noreferrer">http://jsfiddle.net/68wbx/1/</a></p> |
38,105,507 | When should I ever use file.read() or file.readlines()? | <p>I noticed that if I iterate over a file that I opened, it is much faster to iterate over it without "read"-ing it. </p>
<p>i.e. </p>
<pre><code>l = open('file','r')
for line in l:
pass (or code)
</code></pre>
<p>is much faster than </p>
<pre><code>l = open('file','r')
for line in l.read() / l.readlines():
... | 38,105,733 | 5 | 2 | null | 2016-06-29 16:39:42.813 UTC | 24 | 2021-12-01 17:41:49.613 UTC | 2018-06-21 19:24:37.19 UTC | null | 6,862,601 | null | 6,296,435 | null | 1 | 41 | python|io|timeit | 89,705 | <p>The short answer to your question is that each of these three methods of reading bits of a file have different use cases. As noted above, <code>f.read()</code> reads the file as an individual string, and so allows relatively easy file-wide manipulations, such as a file-wide regex search or substitution.</p>
<p><cod... |
15,556,813 | Why is cmp( ) useful? | <p>According to the <a href="http://docs.python.org/2/library/functions.html#cmp" rel="nofollow noreferrer">doc</a> and this <a href="http://www.tutorialspoint.com/python/number_cmp.htm" rel="nofollow noreferrer">tutorial</a>,</p>
<p><code>cmp() returns -1 if x < y</code> </p>
<p>and </p>
<p><code>cmp() returns 0... | 26,515,234 | 5 | 0 | null | 2013-03-21 19:54:34.86 UTC | 4 | 2020-04-06 05:55:48.92 UTC | 2020-04-06 05:55:48.92 UTC | null | 6,862,601 | null | 1,031,955 | null | 1 | 23 | python | 41,916 | <blockquote>
<h1>Why cmp( ) is useful?</h1>
</blockquote>
<p>It isn't very useful, which is why it was deprecated (the builtin <code>cmp</code> is gone and builtin sorts no longer accept one in Python 3). <a href="https://docs.python.org/3/reference/datamodel.html#object.__lt__" rel="noreferrer">Rich comparison meth... |
50,835,303 | 2 column layout with flexBox on React Native | <p>I'm trying to do a two column layout in React Native from a list of items. It only seems to work if I define the width of the items, I would like to define just a percentage of the parent width (0.5 would make a 2 column layout, but 0.25 would make a 4 column one). Can this be done?</p>
<pre class="lang-js prettypr... | 50,835,908 | 2 | 1 | null | 2018-06-13 10:48:20.25 UTC | 7 | 2021-08-12 13:59:47.193 UTC | 2018-06-13 12:22:09.453 UTC | null | 5,068,574 | null | 1,488,518 | null | 1 | 36 | react-native|flexbox | 68,525 | <p>It is possible if you use percentage values for the widths:</p>
<pre class="lang-js prettyprint-override"><code><View style={styles.container}>
<View style={styles.item}>
...
</View>
</View>
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'row',
... |
10,742,749 | Get name of function using reflection | <p>I'm trying to use Go's reflection system to retrieve the name of a function but I get an empty string when calling the Name method on its type. Is this the expected behavior?</p>
<p>This is a simple example of how I approach the problem:</p>
<pre><code>package main
import "fmt"
import "reflect"
func main() {
... | 10,742,933 | 4 | 3 | null | 2012-05-24 17:51:32.32 UTC | 10 | 2021-10-22 16:24:37.283 UTC | 2019-11-25 21:46:04.72 UTC | user6169399 | 13,860 | null | 11,758 | null | 1 | 24 | go|reflection|go-reflect | 17,114 | <p>The solution is to use <a href="http://golang.org/pkg/runtime/#FuncForPC" rel="noreferrer">FuncForPc</a> which returns a <code>*Func</code>.</p>
<p>This returns <code>"main.main"</code> :</p>
<pre><code>package main
import "fmt"
import "reflect"
import "runtime"
func main() {
name := runtime.FuncForPC(refle... |
31,870,206 | How to insert new cell into UITableView in Swift | <p>I'm working on a project where I have two <code>UITableView</code>s and two <code>UITextField</code>s, when the user presses the button the data in the first <code>textField</code> should go into the <code>tableView</code> and the second go into the second <code>tableView</code>. My problem is that I don't know how ... | 31,870,301 | 5 | 2 | null | 2015-08-07 05:19:11.533 UTC | 34 | 2021-09-10 11:52:16.47 UTC | 2015-09-04 10:51:12.483 UTC | null | 4,601,170 | null | 5,108,131 | null | 1 | 80 | ios|iphone|swift|uitableview | 150,738 | <p>Use <code>beginUpdates</code> and <code>endUpdates</code> to insert a new cell when the button clicked.</p>
<blockquote>
<p>As @vadian said in comment, <code>begin/endUpdates</code> has no effect for a single insert/delete/move operation</p>
</blockquote>
<p>First of all, append data in your tableview array</p>
<pre... |
31,784,519 | Show number of notifications on icon | <p>I have a notification icon (<a href="/questions/tagged/font-awesome" class="post-tag" title="show questions tagged 'font-awesome'" rel="tag">font-awesome</a>) which shows the number of notifications.</p>
<p>I am having a problem trying to get the number to display in the correct position, as shown in see be... | 31,784,825 | 1 | 4 | null | 2015-08-03 10:00:59.28 UTC | 5 | 2017-11-03 05:59:16.02 UTC | 2015-08-03 11:57:31.893 UTC | null | 3,540,289 | null | 3,092,953 | null | 1 | 18 | html|css|css-position|font-awesome | 43,536 | <h3>example1: using background image</h3>
<p>The best way to do this is to use <code>position:absolute</code> to child span of parent anchor.</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... |
10,754,665 | Change column types in a huge table | <p>I have a table in SQL Server 2008 R2 with close to a billion rows. I want to change the datatype of two columns from int to bigint. Two times <code>ALTER TABLE zzz ALTER COLUMN yyy</code> works, but it's very slow. How can I speed the process up? I was thinking to copy the data to another table, drop, create, copy b... | 10,754,753 | 3 | 8 | null | 2012-05-25 12:43:47.42 UTC | 9 | 2022-04-06 07:15:34.883 UTC | null | null | null | null | 1,417,408 | null | 1 | 24 | sql|sql-server|sql-server-2008|sql-server-2008-r2 | 29,207 | <p>Depending on what change you are making, sometimes it can be easier to take a maintenance window. During that window (where nobody should be able to change the data in the table) you can:</p>
<ol>
<li>drop any indexes/constraints pointing to the old column, and disable triggers</li>
<li>add a new <em>nullable</em> ... |
13,659,517 | Non-max suppression | <p>We've learned that you can get the gradient direction with <code>atan(dy/dx)</code> which is the direction orthogonal to the edge.
Now we had a homework where we were supposed to discretize this direction into four classes (x- and y-direction and both diagonals) and then check both pixel neighbors in the best matchi... | 13,840,446 | 3 | 5 | null | 2012-12-01 12:36:56.51 UTC | 5 | 2017-09-20 11:08:13.213 UTC | 2015-01-22 03:17:37.177 UTC | null | 1,630 | null | 1,709,708 | null | 1 | 13 | computer-vision|non-maximum-suppression | 51,670 | <p>Non-max suppression is a way to eliminate points that do not lie in important edges. In your first case if the gradient is close to zero degrees at a given point, that means the edge is to the north or to the south, and that point will be considered to be on the edge if the magnitude of this point is greater than bo... |
13,297,157 | Best ways to deal with properties values in XML file in Spring, Maven and Eclipses | <p>I am working on a Spring WebFlow project which has a lot of property values in XML files, as any Spring programmer knows. I have database user names, password, URLs, etc. </p>
<p>We are using Eclipse with Spring WebFlow and Maven. We are trying to have an SA do the builds but the SA does not want to go into the XML... | 13,297,686 | 3 | 1 | null | 2012-11-08 20:22:02.527 UTC | 14 | 2020-12-23 14:22:58.763 UTC | 2014-06-19 13:39:34.897 UTC | null | 1,354,590 | null | 1,652,096 | null | 1 | 22 | eclipse|spring|svn|maven|spring-mvc | 93,262 | <p>Most SA are more willing and confident to deal with <code>.properties</code> file rather than <code>.xml</code>.</p>
<p>Spring provide <a href="http://static.springsource.org/spring/docs/3.0.x/api/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.html" rel="noreferrer">PropertyPlaceholderConfig... |
13,779,508 | open url in new tab or reuse existing one whenever possible | <p>Now I have a link</p>
<pre><code><a href="blabla" target="_blank">link</a>
</code></pre>
<p>However, this always open up a new tab. I want the following effect</p>
<ol>
<li>If the user already has a tab with the same URL, reuse that tab, and refresh if possible</li>
<li>Otherwise, open a new tab</li>
... | 13,779,966 | 2 | 1 | null | 2012-12-08 16:43:08.547 UTC | 8 | 2022-08-10 15:18:33.78 UTC | null | null | null | null | 940,313 | null | 1 | 34 | javascript|html|tabs | 45,394 | <p>You can set specific window's name, in order to open reuse the tab. The problem is, as far as the href will be the same, it won't be reloaded. So you can't obtain the <code>refresh</code> part easily.</p>
<p>So, for instance, you can have:</p>
<pre><code><a href="blabla" target="blabla">link</a>
<a ... |
13,517,222 | Facebook SDK for Android duplicate support library on dependencies | <p>I have implemented the new Facebook SDK 3.0 beta. The library project contains the Android support library v4. I also have the support library on my own proyect (a different version though). When I add the Facebook SDK as a library I get the next error on the console:</p>
<pre><code>Jar mismatch! Fix your dependenc... | 13,517,304 | 3 | 0 | null | 2012-11-22 17:00:37.41 UTC | 5 | 2014-11-30 14:42:56.773 UTC | 2014-11-30 14:38:38.077 UTC | null | 63,550 | null | 1,587,785 | null | 1 | 34 | android|facebook-android-sdk|android-support-library | 15,965 | <p>It seems like the different projects are using two separate support libraries and therefore the checksum is different.</p>
<p>You must <strong><em>repeat this for both</em></strong> the Facebook SDK project and the app you are building.</p>
<p>What I do when I get this error is:</p>
<ol>
<li><p>Right click the pr... |
13,346,824 | ViewPager detect when user is trying to swipe out of bounds | <p>I am using the ViewPager consisting of 6 pages to display some data. I want to be able to call a method when the user is at position 0 and tries to swipe to the right (backwards), or at position 5 and tries to swipe to the left (forward), even though no more pages exist for these directions. Is there any way I can l... | 13,347,008 | 5 | 1 | null | 2012-11-12 15:46:41.72 UTC | 16 | 2021-09-05 09:14:35.957 UTC | 2014-01-06 19:51:26.577 UTC | null | 595,881 | null | 980,782 | null | 1 | 35 | android | 37,026 | <p>Extend ViewPager and override <code>onInterceptTouchEvent()</code> like this:</p>
<pre><code>public class CustomViewPager extends ViewPager {
float mStartDragX;
OnSwipeOutListener mListener;
public void setOnSwipeOutListener(OnSwipeOutListener listener) {
mListener = listener;
}
@Ov... |
13,476,267 | Hide div element when screen size is smaller than a specific size | <p>I have a div element that I want to hide when the width of the browser is less than or equal to 1026px. Is this possible to do with the css: <strong><code>@media only screen and (min-width: 1140px) {}</code></strong> If it isn't possible with css, Is there any alternative?</p>
<p>Extra info:
When the div elem... | 13,476,297 | 9 | 2 | null | 2012-11-20 15:17:29.38 UTC | 16 | 2020-02-07 09:00:14.78 UTC | 2017-02-22 04:47:23.263 UTC | null | 7,083,302 | null | 1,720,220 | null | 1 | 60 | javascript|html|css | 165,997 | <p>You can do this with CSS:</p>
<pre><code>@media only screen and (max-width: 1026px) {
#fadeshow1 {
display: none;
}
}
</code></pre>
<p>We're using <code>max-width</code>, because we want to make an exception to the CSS, when a screen is <em>smaller</em> than the 1026px.
<code>min-width</code> would... |
51,760,640 | Why helm upgrade --install failed when previous install is failure? | <p>This is the helm and tiller version:</p>
<pre><code>> helm version --tiller-namespace data-devops
Client: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390eb... | 60,995,790 | 4 | 5 | null | 2018-08-09 06:58:25.823 UTC | 6 | 2021-01-25 09:40:11.513 UTC | 2018-08-09 19:47:30.32 UTC | null | 434,742 | null | 476,917 | null | 1 | 30 | kubernetes|kubernetes-helm | 40,618 | <p>Try:</p>
<pre><code>helm delete --purge <deployment>
</code></pre>
<p>This will do the trick</p>
<p>and for helm3 onwards you need to uninstall eg.</p>
<pre><code>helm uninstall <deployment> -n <namespace>
</code></pre> |
39,615,142 | Bash get last line from a variable | <p>If I have a variable with multiple lines (text) in it, how can I get the last line out of it?</p>
<p>I already figured out how to get the first line:</p>
<pre><code>STRING="This is a
multiple line
variable test"
FIRST_LINE=(${STRING[@]})
echo "$FIRST_LINE"
# output:
"This is a"
</code></pre>
<p>Probably there sh... | 39,615,292 | 3 | 4 | null | 2016-09-21 11:21:05.557 UTC | 6 | 2016-09-21 11:36:30.357 UTC | 2016-09-21 11:34:52.467 UTC | null | 1,815,797 | null | 2,119,043 | null | 1 | 38 | bash|variables|line | 41,119 | <p>Using bash string manipulations:</p>
<pre><code>$> str="This is a
multiple line
variable test"
$> echo "${str##*$'\n'}"
variable test
</code></pre>
<p><code>${str##*$'\n'}</code> will remove the longest match till <code>\n</code> from start of the string thus leaving only the last line in input.</p> |
24,245,105 | How to get the filename from the Javascript FileReader? | <p>I'm using the Javascript FileReader to load an image in the browser:</p>
<pre><code>e = e.originalEvent;
e.dataTransfer.dropEffect = 'copy';
this.documentFile = e.dataTransfer.files[0];
var reader = new FileReader();
reader.onloadend = function () {
if (reader.result) {
console.log(reader);
$('... | 27,927,981 | 5 | 3 | null | 2014-06-16 13:38:54.02 UTC | 3 | 2021-06-08 00:11:55.567 UTC | 2014-06-16 13:56:23.033 UTC | null | 1,650,012 | null | 1,650,012 | null | 1 | 39 | javascript|jquery|io|filereader | 59,959 | <p>This is prob not the best solution, BUT it worked for me.</p>
<pre><code>var reader = new FileReader();
reader.fileName = file.name // file came from a input file element. file = el.files[0];
reader.onload = function(readerEvt) {
console.log(readerEvt.target.fileName);
};
</code></pre>
<p>Not the best answer, ... |
24,278,220 | Amazon RDS: Restore snapshot to existing instance | <p>I have created a snapshot of my instance and made some unwanted changes in DB.</p>
<p>Now I want to restore my instance from this snapshot.</p>
<p>When I try to do it - it creates me one more instance, additionally to the one I have.</p>
<p>I specify "DB Instance Identifier" and after that I get two instances wit... | 24,279,273 | 7 | 3 | null | 2014-06-18 06:11:31.537 UTC | 11 | 2021-01-12 21:52:36.613 UTC | 2016-08-02 16:00:58.707 UTC | null | 881,229 | null | 3,751,064 | null | 1 | 107 | mysql|amazon-web-services|amazon-rds | 59,288 | <p>No you can't restore back your existing DB instance to any of the either manual backup or point-in-time snapshot.</p>
<p>The only way you can make use of the manual backup or automated snapshot is to create a new RDS DB instance using that. Once the new DB instance is created, you can change the endpoint of DB in y... |
28,853,952 | Total number of palindromic subsequences in a string | <p>The question is like this--</p>
<p>For every string given as input, you need to tell the number of subsequences of it that are palindromes (need not necessarily be distinct). Note that the empty string is not a palindrome.
For example, the palindromic subsequences of "aab" are:</p>
<p>"a", "a", "b", "aa", and the ... | 28,858,100 | 3 | 5 | null | 2015-03-04 12:00:39.41 UTC | 11 | 2016-11-04 18:48:09.647 UTC | null | null | null | null | 1,598,079 | null | 1 | 7 | algorithm|data-structures|dynamic-programming | 7,762 | <p><strong>[EDIT 19/10/2015: An anonymous reviewer pointed out a problem with the formula, which prompted me to notice another, even bigger mistake... Now fixed.]</strong></p>
<p>I now see how to drop the solution time down to <strong>O(n^2)</strong>. I'll leave my other answer up in case it's interesting as a stepp... |
29,509,010 | How to play a short beep to Android Phone's loudspeaker programmatically | <p>In order to receive the only short beep sound on loudspeaker I want to send single bit to the loudspeaker directly. Similarly to the LED blink. Is there any possibility to do short beep without any kind of Media Players?</p> | 29,509,305 | 4 | 3 | null | 2015-04-08 07:56:43.74 UTC | 11 | 2021-08-13 06:21:34.11 UTC | null | null | null | null | 3,175,098 | null | 1 | 42 | android | 45,738 | <p>I recommend you use the <a href="https://developer.android.com/reference/android/media/ToneGenerator" rel="noreferrer"><code>ToneGenerator</code></a> class. It requires no audio files, no media player, and you can customize the beep's volume, duration (in milliseconds) and Tone type. I like this one:</p>
<pre><code... |
29,620,783 | Apply multiple functions to multiple columns in data.table | <p>I am trying to apply multiple functions to multiple columns of a <code>data.table</code>. Example:</p>
<pre><code>DT <- data.table("a"=1:5,
"b"=2:6,
"c"=3:7)
</code></pre>
<p>Let's say I want to get the mean and the median of columns <code>a</code> and <code>b</code>.
This work... | 29,621,821 | 5 | 4 | null | 2015-04-14 06:42:47.337 UTC | 22 | 2019-08-07 07:02:04.867 UTC | 2018-11-28 10:29:38.437 UTC | null | 1,851,712 | null | 2,795,440 | null | 1 | 39 | r|data.table | 13,345 | <p>I'd normally do this:</p>
<pre><code>my.summary = function(x) list(mean = mean(x), median = median(x))
DT[, unlist(lapply(.SD, my.summary)), .SDcols = c('a', 'b')]
#a.mean a.median b.mean b.median
# 3 3 4 4
</code></pre> |
16,128,604 | Scrollable canvas inside div | <p>I have a html5 canvas. I need to show the fixed portion of it in the div(<code>Div1</code>). When I swipe inside <code>Div1</code>, I need to scroll the canvas. So as I scroll, I'll see corresponding part of the canvas. </p>
<p><img src="https://i.stack.imgur.com/3wAW6.png" alt="enter image description here"></p>
... | 36,511,409 | 5 | 5 | null | 2013-04-21 06:35:54.027 UTC | 7 | 2018-10-09 21:47:52.59 UTC | 2013-04-21 06:57:26.337 UTC | null | 845,310 | null | 1,506,282 | null | 1 | 28 | javascript|jquery|css|html | 37,224 | <p>Here is a demo of using an oversize canvas, and scrolling with mouse movements by adjusting the CSS margin: <a href="https://jsfiddle.net/ax7n8944/" rel="noreferrer">https://jsfiddle.net/ax7n8944/</a></p>
<p>HTML:</p>
<pre><code><div id="canvasdiv" style="width: 500px; height: 250px; overflow: hidden">
&... |
16,346,206 | Targeting $(this) within nested for each loops in jQuery | <p>I'm trying to figure out, when iterating through some list items, how to target each "$(this)" equivalent within nested foreach loops. Here is an example of my problem:</p>
<pre><code>$('li').each(function(){
// I believe $(this) would target each li item...
$(this).children("li").each(function(){
... | 16,346,239 | 5 | 2 | null | 2013-05-02 19:29:18.32 UTC | 16 | 2013-05-02 19:36:46.257 UTC | null | null | null | null | 984,323 | null | 1 | 50 | javascript|jquery|html | 59,506 | <pre><code>$('li').each(function(){
var $this = $(this);
$this.children("li").each(function(){
$this; // parent li
this; // child li
});
});
</code></pre> |
24,914,513 | Display google maps in iframe dynamically | <p>I would like to dynamically create a "google maps" link in javascript and than set it as src for my iframe, but I don't know if it is not possible with google maps, because this doesn't work:</p>
<pre><code> document.getElementById('map_canvas').src='http://maps.google.com/maps/ms?ie=UTF8&amp;msa=0&amp;m... | 24,934,734 | 4 | 6 | null | 2014-07-23 15:20:58.83 UTC | 1 | 2014-07-24 13:13:13.837 UTC | null | null | null | null | 2,205,582 | null | 1 | 1 | javascript|html|google-maps|iframe | 38,188 | <p>I solved it this way:
I have added iframe per jQuery and set the desired src attr.</p>
<pre><code>function displayMapAt(lat, lon, zoom) {
$("#map")
.html(
"<iframe id=\"map_frame\" "
+ "width=\"100%\" height=\"600px\" frameborder=\"0... |
27,382,777 | Set Parent Width equal to Children Total Width using only CSS? | <p>I don't know how many <code>.child</code> elements <code>.parent</code> will contain but I know their individual width.</p>
<p>I want to set the width of <code>.parent</code> to be equal to (width of each <code>.child</code>) <strong>*</strong> (total number of <code>.child</code>)</p>
<p>I don't want to use <code>f... | 41,476,558 | 7 | 4 | null | 2014-12-09 15:33:22.063 UTC | 6 | 2022-04-06 08:11:19.043 UTC | 2022-04-06 08:11:19.043 UTC | null | 11,829,408 | null | 2,272,048 | null | 1 | 47 | html|css | 102,649 | <p>I know this is a bit late, but Hope this will help somebody who is looking for similar solution:</p>
<pre><code><div class="parent" style="display: inline-flex">
<div class="child" style="display: inline-table">some button</div>
<div class="child" style="display: inline-... |
21,671,456 | WampServer orange icon | <p>I am having problems with Wamp Server, the icon will never turn green. It is constantly stuck at orange.</p>
<p>I have tried many ways, editing HOSTS file, .config files, disabling IIS, changing SKYPE's port, quitting SKYPE, disabling World Wide Web publishing services etc... And under wamp server icon > Apache > T... | 21,678,795 | 13 | 6 | null | 2014-02-10 07:38:21.517 UTC | 17 | 2022-02-20 06:46:26.747 UTC | 2014-06-24 08:07:08.513 UTC | null | 2,310,830 | null | 3,240,916 | null | 1 | 44 | php|apache|wamp|wampserver | 181,630 | <p>Before you can fix anything you need to know which service has not started, Apache or MySQL.</p>
<p>As the TEST PORT 80 utility is saying Apache is running its probably the MySQL service that has not started. Unless you have another Apache running!</p>
<p>So which service has not started???</p>
<p>If the wampmanager... |
45,027,400 | reading csv file to pandas dataframe as float | <p>I have a <code>.csv</code> file with strings in the top row and first column, with the rest of the data as floating point numbers. I want to read it into a dataframe with the first row and column as column names and index respectively, and all the floating values as <code>float64</code>.</p>
<p>If I use <code>df = ... | 45,049,446 | 2 | 4 | null | 2017-07-11 06:54:06.617 UTC | 2 | 2017-07-12 05:54:20.287 UTC | null | null | null | null | 6,567,949 | null | 1 | 6 | python|csv|pandas|parsing | 39,531 | <p>The original code was correct</p>
<pre><code>df = pd.read_csv(filename,index_col=0)
</code></pre>
<p>but the <code>.csv</code> file had been constructed incorrectly.</p>
<p>As @juanpa.arrivillaga pointed out, pandas will infer the <code>dtypes</code> without any arguments, provided all the data in a column is of ... |
17,322,990 | How can I refresh my git repository? | <p>I have a git repo offline copy, and after some time somebody else might have made changes to it. How can I bring my repository up to speed with the new changes? How can I check that my repo is at its latest update?</p> | 17,323,073 | 1 | 2 | null | 2013-06-26 14:31:10.213 UTC | null | 2013-06-26 14:34:30.953 UTC | null | null | null | null | 1,489,886 | null | 1 | -1 | git | 46,131 | <p><code>git pull</code> will pull the latest changes.</p>
<p><code>git fetch</code> will update the list of changes.<br>
<code>git status</code> will check the status of the repo. Without the fetch first, you will not see remote changes.</p>
<p>Also, <strong><em>please</em></strong> read the <a href="http://git-scm.... |
5,519,674 | Using JQuery to set CKEditor Value | <p>I have a CKEditor textarea:</p>
<pre><code> <textarea cols="80" id="taBody" name="taBody" class="ckeditor" rows="10" runat="server"></textarea>
</code></pre>
<p>I have jQuery trying to set the value from the database:</p>
<pre><code>$('#ContentPlaceHolder_taBody').val(substr[5]);
</code></pre>
<p>Don... | 5,519,706 | 3 | 0 | null | 2011-04-01 22:47:45.79 UTC | 4 | 2021-03-11 12:55:56.343 UTC | null | null | null | null | 316,429 | null | 1 | 12 | jquery|ajax|ckeditor | 46,473 | <p>You need to use CKEditor's API instead.</p>
<p>Specifically, <a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setData" rel="noreferrer"><strong>http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setData</strong></a></p> |
9,394,909 | Add values from two textboxes and display the sum in third textbox | <p>I have tried this code to add from textbox1.text and textbox2.text into textbox3.text</p>
<pre><code>private void textBox1_TextChanged(object sender, EventArgs e)
{
if(!string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text))
{
textBox3.Text = (Convert.ToInt32(... | 9,395,091 | 4 | 3 | null | 2012-02-22 12:38:56.18 UTC | 3 | 2017-03-21 08:47:15.597 UTC | 2012-02-22 12:52:28.203 UTC | null | 1,216,024 | null | 1,216,024 | null | 1 | 3 | c#|winforms|textbox | 144,589 | <p>You made a mistake <code>||</code> should be replace with <code>&&</code> so it will check both the text boxes are filled with value.</p>
<p>You have used <code>.ToString()</code> method wrongly which applies only to <code>textbox2</code>, check the brackets properly.</p>
<pre><code>textBox3.Text = (Conver... |
20,186,081 | Understanding Node.JS async.parallel | <p>I need to request data from two web servers. The tasks are independent; therefore, I am using <a href="https://github.com/caolan/async" rel="noreferrer">aync.parallel</a>. Now I am only writing 'abc', 'xyz', and 'Done' to the body of my web page.</p>
<p>Since tasks are performed at the same time, can I run into a s... | 20,189,732 | 1 | 2 | null | 2013-11-25 06:28:44.333 UTC | 13 | 2018-04-15 08:20:57.463 UTC | 2013-11-25 06:37:25.897 UTC | null | 559,028 | null | 1,065,835 | null | 1 | 25 | javascript|node.js|parallel-processing | 74,590 | <p>If you want to be absolutely certain in the order in which the results are printed, you should pass your data (<code>abc\n</code> and <code>xyz\n</code>) through the <a href="https://github.com/caolan/async#parallel" rel="noreferrer">callbacks</a> (first parameter is the error) and handle/write them in the final <co... |
19,931,929 | Reading a column from CSV file using JAVA | <p>Hi I am trying to read a CSV File called <code>test.csv</code> in JAVA .
Below is my code : </p>
<pre><code>import java.io.BufferedReader;
import java.io.FileReader;
public class InsertValuesIntoTestDb {
@SuppressWarnings("rawtypes")
public static void main(String[] args) throws Exception {
... | 19,931,945 | 4 | 3 | null | 2013-11-12 14:31:51.043 UTC | 5 | 2018-02-23 16:00:48.677 UTC | null | null | null | null | 2,559,838 | null | 1 | 24 | java|csv | 119,629 | <p>Read the input continuously within the loop so that the variable <code>line</code> is assigned a value other than the initial value</p>
<pre><code>while ((line = br.readLine()) !=null) {
...
}
</code></pre>
<p>Aside: This problem has already been solved using CSV libraries such as <a href="http://opencsv.sourcef... |
20,176,959 | uWSGI: No request plugin is loaded, you will not be able to manage requests | <p>I've loaded uWSGI v 1.9.20, built from source. I'm getting this error, but how do I tell which plugin is needed?</p>
<pre><code>!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!
no request plugin is loaded, you will not be able to manage requests.
you may need to install the package for your language of choice, or simply load... | 24,719,979 | 7 | 3 | null | 2013-11-24 16:33:01.323 UTC | 3 | 2021-01-14 12:35:49.21 UTC | null | null | null | null | 451,007 | null | 1 | 43 | python|uwsgi | 30,368 | <p>I had this problem and was stuck for hours.</p>
<h3>Python2</h3>
<p>My issue is different than the answer listed, make sure you have <code>plugins = python</code> in your uwsgi <code>.ini</code> file and you install the <code>uwsgi python</code> plugin:</p>
<pre class="lang-sh prettyprint-override"><code>sudo apt-ge... |
15,006,849 | What's the difference between $locationChangeSuccess and $locationChangeStart? | <p>What's the difference between <code>$locationChangeSuccess</code> and <code>$locationChangeStart</code>?</p>
<p>They are both undocumented events related to <code>window.location</code>.</p> | 15,007,296 | 1 | 0 | null | 2013-02-21 16:05:39.727 UTC | 9 | 2013-08-19 20:16:01.567 UTC | 2013-08-19 20:16:01.567 UTC | null | 40,342 | null | 146,636 | null | 1 | 25 | angularjs|window.location | 26,408 | <p>The <code>$locationChangeStart</code> is fired when AngularJS starts to update browser's location based on mutations done via <code>$location</code> service (<code>$location.path()</code>, <code>$location.search()</code>). </p>
<p>It might happen that an application will listen to the <code>$locationChangeStart</co... |
15,292,175 | How to send a key to another application | <p>I want to send a specific key (e.g. k) to another program named notepad, and below is the code that I used:</p>
<pre><code>private void SendKey()
{
[DllImport ("User32.dll")]
static extern int SetForegroundWindow(IntPtr point);
var p = Process.GetProcessesByName("notepad")[0];
va... | 15,292,428 | 3 | 9 | null | 2013-03-08 10:45:39.593 UTC | 17 | 2021-11-04 00:56:48.09 UTC | 2021-08-09 10:11:28.45 UTC | null | 466,862 | null | 1,212,812 | null | 1 | 36 | c#|sendkeys | 152,289 | <p>If notepad is already started, you should write:</p>
<pre><code>// import the function in your class
[DllImport ("User32.dll")]
static extern int SetForegroundWindow(IntPtr point);
//...
Process p = Process.GetProcessesByName("notepad").FirstOrDefault();
if (p != null)
{
IntPtr h = p.MainWindowHandle;
Set... |
14,984,555 | NSLocalizedString with format | <p>How would I use <code>NSLocalizedString</code> for this string:</p>
<pre><code>[NSString stringWithFormat:@"Is “%@“ still correct for “%@“ tap “OK“ otherwise tap “Change“ to choose new contact details", individual.contactInfo, individual.name];
</code></pre>
<p>When using stringWithFormat before I've used it in th... | 14,984,616 | 4 | 4 | null | 2013-02-20 16:10:42.287 UTC | 4 | 2019-02-20 13:55:12.533 UTC | null | null | null | null | 294,661 | null | 1 | 42 | objective-c|nslocalizedstring | 25,077 | <pre><code>[NSString stringWithFormat:NSLocalizedString(@"Is “%@“ still correct for “%@“ tap “OK“ otherwise tap “Change“ to choose new contact details", @"Query if parm 1 is still correct for parm 2"), individual.contactInfo, individual.name];
</code></pre> |
15,108,229 | How to count number of words from String using shell | <p>I want to count number of words from a String using Shell.</p>
<p>Suppose the String is:</p>
<pre><code>input="Count from this String"
</code></pre>
<p>Here the delimiter is space <code>' '</code> and expected output is 4.
There can also be trailing space characters in the input string like <code>"Count from this... | 15,108,286 | 8 | 0 | null | 2013-02-27 09:17:16.14 UTC | 3 | 2022-02-22 11:26:39.553 UTC | 2016-12-21 10:45:47.473 UTC | null | 55,075 | null | 1,679,435 | null | 1 | 64 | bash | 121,738 | <pre><code>echo "$input" | wc -w
</code></pre>
<p>Use wc -w to count the number of words.</p>
<p>Or as per dogbane's suggestion, the echo can be got rid of as well:</p>
<pre><code>wc -w <<< "$input"
</code></pre>
<p>If <<< is not supported by your shell you can try this variant:</p>
<pre><code>wc... |
9,491,001 | Closing a Userform with Unload Me doesn't work | <p>I need to close an Excel userform using VBA when a user has clicked a submit button and operations have been carried out.</p>
<p>How can I close a Userform from itself?</p>
<p>I have tried this but it returns a 361 error.</p>
<pre><code>Unload Me
</code></pre> | 25,938,039 | 4 | 9 | null | 2012-02-28 22:45:27.283 UTC | 1 | 2019-11-20 19:36:08.437 UTC | 2016-05-11 15:43:23.513 UTC | null | 2,756,409 | null | 873,565 | null | 1 | 24 | vba|excel|excel-2010 | 220,407 | <p>As specified by the top answer, I used the following in the code behind the button control.</p>
<pre><code>Private Sub btnClose_Click()
Unload Me
End Sub
</code></pre>
<p>In doing so, it will not attempt to unload a control, but rather will unload the user form where the button control resides. The "Me" keywor... |
8,460,037 | List of Delphi language features and version in which they were introduced/deprecated | <p>Before I begin, I would like to point out that I have honestly and genuinely searched repeatedly and exhaustively via Google for such a thing, and been unable to find one.</p>
<p>I require (for a project I'm developing) a list of all Delphi (2007 to the very latest released version, I no longer support any version ... | 8,460,108 | 3 | 3 | null | 2011-12-10 21:31:31.86 UTC | 98 | 2022-08-01 23:03:04.927 UTC | 2022-08-01 22:56:20.193 UTC | null | 62,576 | null | 590,975 | null | 1 | 120 | delphi | 32,437 | <p><strong>Note that this answer only lists new <em>language</em> features</strong><br />
<em><strong>not</strong> new VCL/FMX features.</em></p>
<p>Here are the links to the RAD Studio docwiki:</p>
<ul>
<li><a href="https://docwiki.embarcadero.com/RADStudio/Alexandria/en/What%27s_New" rel="nofollow noreferrer">What's ... |
8,882,753 | Clang on Windows | <p>First of all, I've followed <a href="http://clang.llvm.org/get_started.html" rel="noreferrer">"Getting Started: Building and Running Clang"</a>. In particular, I've built it according to "Using Visual Studio" section. In other words, I've built it using Visual Studio 2010.</p>
<p>Secondly, I've manually set include... | 8,883,505 | 2 | 4 | null | 2012-01-16 16:08:03.25 UTC | 12 | 2020-11-04 08:51:28.077 UTC | null | null | null | null | 1,743,860 | null | 1 | 23 | c++|windows|mingw|llvm|clang | 37,222 | <p>If you build Clang with MSVS, it will automatically search the default VS include paths, and pull in those headers. This is the reason the libstdc++ headers are producing errors: they are importing C functions not present in the VS headers. Using Clang for C++ with VS is for now a no-go: you will get link failures d... |
8,400,101 | Android: Accessing images from assets/drawable folders | <p>The app I am currently working on has hundreds of images. At the moment I store them in the 'Drawable' folder. I was thinking about moving all of them to Assets folder. </p>
<p>My question is: Is there any difference in performance when using both approaches? </p> | 8,400,282 | 4 | 4 | null | 2011-12-06 12:47:48.04 UTC | 5 | 2015-04-04 13:01:14.877 UTC | null | null | null | null | 400,493 | null | 1 | 28 | android|image|drawable|assets | 9,791 | <p><strong>I don't think so there is bit difference in performance of using these two folders</strong>, I think using drawable folder you can get easily images (All will be indexed in the R file, which makes it much faster (and much easier!) to load them.), and If you want to use it from asset then you have to use <cod... |
5,321,344 | Android Animation: Wait until finished? | <p>I would like to wait until an animation is finished* in an Android ImageView before continuing program execution, what is the proper way to do this?</p>
<ul>
<li>(in this context "finished" means that it runs through all of its frames exactly one time and stops on the last one. I am unclear whether this animation w... | 5,321,508 | 4 | 3 | null | 2011-03-16 05:16:15.323 UTC | 14 | 2015-02-06 09:31:32.203 UTC | 2017-05-23 12:03:02.517 UTC | null | -1 | null | 530,634 | null | 1 | 33 | java|android|concurrency|android-animation | 63,262 | <p>Suggest you </p>
<ul>
<li>Create an object to encapsulate the "animation" lifetime</li>
<li>In the object, you'll have a thread OR a Timer</li>
<li>Provide methods to <code>start()</code> the animation and <code>awaitCompletion()</code></li>
<li>Use a <code>private final Object completionMonitor</code> field to tra... |
4,928,557 | How do I create and use a class arrow operator? | <p>So, after researching everywhere for it, I cannot seem to find how to create a class arrow operator, i.e.,</p>
<pre><code>class Someclass
{
operator-> () /* ? */
{
}
};
</code></pre>
<p>I just need to know how to work with it and use it appropriately.
- what are its inputs?
- what does it return?
- how d... | 4,928,626 | 4 | 1 | null | 2011-02-08 01:02:14.473 UTC | 17 | 2018-06-07 05:49:24.087 UTC | null | null | null | null | 586,652 | null | 1 | 44 | c++|class|operator-keyword | 53,270 | <p>The operator -> is used to overload member access. A small example:</p>
<pre><code>#include <iostream>
struct A
{
void foo() {std::cout << "Hi" << std::endl;}
};
struct B
{
A a;
A* operator->() {
return &a;
}
};
int main() {
B b;
b->foo();
}
</code></... |
5,165,753 | How to get full stack of StackOverflowError | <p><strong>When observing a StackOverflowError how to retrieve the full call stack?</strong></p>
<p>Consider this simple example:</p>
<pre><code>public class Overflow {
public Overflow() {
new Overflow();
}
public static void a() {
new Overflow();
}
public static void main(String[... | 19,331,083 | 5 | 8 | null | 2011-03-02 09:50:09.717 UTC | 8 | 2019-07-25 13:07:47.01 UTC | 2011-03-02 10:01:18.927 UTC | null | 21,234 | null | 118,587 | null | 1 | 38 | java|stack-overflow | 11,562 | <p>The JVM has an artificial limit of 1024 entries that you can have in the stack trace of an Exception or Error, probably to save memory when it occurs (since the VM has to allocate memory to store the stack trace).</p>
<p>Fortunately, there is a flag that allows to increase this limit. Just run your program with the... |
5,589,491 | jQuery click event, after appending content | <p>Wondering why the example below doesn't work? </p>
<pre><code><a id="load_list" href="#">Load the list</a>
<ul></ul>
<script type="text/javascript">
$(document).ready(function() {
$('#load_list').click(function() {
$('ul').append('<li><a href="#">Click here<... | 5,589,510 | 6 | 2 | null | 2011-04-08 01:31:42.91 UTC | 5 | 2017-04-25 16:27:19.97 UTC | 2013-04-18 13:34:18.11 UTC | null | 1,862,225 | null | 661,803 | null | 1 | 25 | jquery | 68,526 | <p>Because the elements that you are appending do not exist when you define the the <code>click</code> handler, they are created dynamically. To fix this you can use the <a href="http://api.jquery.com/delegate/" rel="noreferrer">delegate()</a> method from jQuery.</p>
<pre><code>$('ul').delegate('a','click',function() ... |
5,323,777 | How to Change Font Size of Cell in uitableview | <p>I tried this, but it is not working.</p>
<pre><code>cell.textLabel.adjustsFontSizeToFitWidth=NO;
cell.textLabel.minimumFontSize=6;
</code></pre>
<p>I need a code snippet.</p> | 5,323,929 | 8 | 0 | null | 2011-03-16 10:13:45.037 UTC | 5 | 2019-05-15 04:26:27.86 UTC | 2019-05-15 04:26:27.86 UTC | null | 4,348,556 | null | 642,943 | null | 1 | 40 | iphone|cocoa-touch|uitableview|iphone-sdk-3.0 | 47,079 | <pre><code>UIFont *myFont = [ UIFont fontWithName: @"Arial" size: 18.0 ];
cell.textLabel.font = myFont;
</code></pre>
<p><a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIFont_Class/Reference/Reference.html" rel="noreferrer">UIFont reference</a> </p> |
4,862,385 | SQL Server add auto increment primary key to existing table | <p>As the title, I have an existing table which is already populated with 150000 records. I have added an Id column (which is currently null).</p>
<p>I'm assuming I can run a query to fill this column with incremental numbers, and then set as primary key and turn on auto increment. Is this the correct way to proceed? ... | 4,862,427 | 16 | 0 | null | 2011-02-01 12:11:45.067 UTC | 80 | 2021-08-29 09:55:29.903 UTC | 2017-07-14 09:51:28.86 UTC | null | 13,302 | null | 207,752 | null | 1 | 303 | sql-server|sql-server-2008|primary-key|alter-table | 667,982 | <p>No - you have to do it the other way around: add it right from the get go as <code>INT IDENTITY</code> - it will be filled with identity values when you do this:</p>
<pre><code>ALTER TABLE dbo.YourTable
ADD ID INT IDENTITY
</code></pre>
<p>and then you can make it the primary key:</p>
<pre><code>ALTER TABLE db... |
16,748,074 | How to convert video to gif in android programmatically | <p>Is it possible to convert recorded <strong>video</strong> into <strong>GIF</strong> in Android programmatically?
Can you help me with some sniped code or tell me how to do it? </p> | 16,749,193 | 2 | 0 | null | 2013-05-25 09:12:50.28 UTC | 11 | 2013-12-01 18:27:46.953 UTC | null | null | null | null | 1,812,147 | null | 1 | 7 | android | 11,690 | <ol>
<li><p>Import <code>ffmpeg</code> in your project, grab the portion or entire video and convert it to gif.</p>
<p>or </p></li>
<li><p>Use <code>MediaRetriever</code> to extract range of frames with simple looping through the range and then converting to Drawable or Bitmap so you can save it.</p>
<p>or</p></li>
<... |
16,749,522 | symbol table and relocation table in object file | <p>From what I understand, instructions and data in an object file all have addresses. First data item start at address 0 and first instruction also start at address 0. </p>
<p>The relocation table contains information about instructions that need to be updated if the addresses in the file change, for example if the f... | 16,750,324 | 1 | 0 | null | 2013-05-25 12:21:44.84 UTC | 9 | 2013-05-25 14:02:49.11 UTC | null | null | null | null | 1,047,423 | null | 1 | 11 | assembly|compilation|object-files|symbol-table | 21,168 | <p>Yes, your assumptions are correct. There are various types of relocations, what the assembler emits into the instruction depends on the type. Generally it's an offset to be added. You can use <code>objdump -dr</code> to see relocations. For better illustration I have changed your code a little:</p>
<pre><code>.data... |
29,538,527 | MongoDB + Elasticsearch or only Elasticsearch? | <p>We have a new project there for index a large amount of data and for provide real time. I have also complexe search with facets, full text, geospatial...</p>
<p>The first prototype is to index in MongoDB and next, into Elasticsearch, because I had read that Elasticsearch does not apply a checksum on stored files an... | 29,561,593 | 4 | 8 | null | 2015-04-09 12:29:35.203 UTC | 15 | 2019-08-23 12:51:36.397 UTC | 2017-09-22 18:01:22.247 UTC | null | -1 | null | 1,853,777 | null | 1 | 36 | mongodb|elasticsearch|nosql | 32,292 | <p>Talking about arguments <em>to use</em> Mongo instead of/together with ES:</p>
<ol>
<li><p>User/role management.</p>
<ul>
<li>Built-in in MongoDB. May not fit all your needs, may be clumsy somewhere, but it exists and it was implemented pretty long time ago.</li>
<li>The only thing for security in ES is <a href="h... |
12,539,772 | Adding an index on a boolean field | <p>I have a Rails model with a boolean field that I search on (I use a scope that finds all instances where the field is set to true). I'm using Postgres.</p>
<p>My instinct is to add an index on the boolean field. Is that good practice, or is there something in Postgres that makes an index on a boolean field unnecess... | 12,539,801 | 2 | 0 | null | 2012-09-22 00:47:03.74 UTC | 4 | 2016-05-10 22:20:42.527 UTC | null | null | null | null | 1,279,844 | null | 1 | 29 | ruby-on-rails|postgresql | 7,882 | <p>No, you can index a boolean field if you'll be filtering by it. That's a perfectly reasonable thing to do, although as with all indexes, PostgreSQL may choose to ignore it if it won't exclude enough of the table -- an index scan plus a ton of row fetches may be more expensive than a sequential scan -- which may or m... |
12,129,077 | Content Security Policy: cannot load Google API in Chrome extension | <p>This is relative an Chrome extension. I am trying a simple one which uses the Google Chart API</p>
<p>I have this code in my html document "popup.html", which is loaded on the click on the Icon.</p>
<pre><code><!doctype html>
<html>
<head>
<script type="text/javascript" src="js/libs/jquery-1... | 12,129,214 | 3 | 1 | null | 2012-08-26 09:40:23.3 UTC | 9 | 2019-07-12 05:10:22.377 UTC | 2012-11-09 10:11:04.757 UTC | null | 99,220 | null | 1,128,999 | null | 1 | 31 | javascript|google-chrome-extension|google-api|content-security-policy | 43,088 | <p>Just make it use the <code>https</code> protocol instead. The error you're getting is regarding the <a href="https://developer.chrome.com/extensions/contentSecurityPolicy" rel="nofollow noreferrer">Content Security Policy</a>.</p>
<p>See the <code>Relaxing the default policy</code> section of the page. It mentions ... |
12,311,346 | How to set fixed aspect ratio for a layout in Android | <p>I am trying to set the width of the layout to "fill_parent" while having the height of the view just the same length, to make the layout a square.</p>
<p>Any suggestions will be appreciate, thanks in advance! :D </p> | 45,964,536 | 8 | 5 | null | 2012-09-07 03:31:41.23 UTC | 8 | 2020-09-16 08:36:55.307 UTC | 2012-09-07 03:36:25.3 UTC | null | 1,628,832 | null | 505,530 | null | 1 | 46 | android | 74,321 | <p>With introduction of <a href="https://developer.android.com/training/constraint-layout/index.html" rel="noreferrer">ConstraintLayout</a> you don't have to write either a single line of code or use third-parties or rely on <code>PercentFrameLayout</code> which were deprecated in 26.0.0.</p>
<p>Here's the example of ... |
3,440,082 | java vector to arraylist | <p>Is there any way to copy or convert a vector to arraylist in Java?</p> | 3,440,087 | 3 | 0 | null | 2010-08-09 12:44:24.377 UTC | 2 | 2012-10-23 00:20:38.283 UTC | null | null | null | null | 236,112 | null | 1 | 28 | java|vector|arraylist | 30,691 | <p>Yup - just use the constructor which takes a collection as its parameter:</p>
<pre><code>Vector<String> vector = new Vector<String>();
// (... Populate vector here...)
ArrayList<String> list = new ArrayList<String>(vector);
</code></pre>
<p>Note that it only does a shallow copy.</p> |
22,539,779 | How to tell if JRE or JDK is installed | <p>I have one computer that I intentionally installed JDK on. I have another computer with JRE, for, among other things, testing. However, when I got a java application working on this computer, and then tried it on another, it complained that JDK was required. How can I check if JDK was somehow installed on my system?... | 23,267,681 | 6 | 4 | null | 2014-03-20 16:47:58.657 UTC | 32 | 2019-11-06 21:44:20.883 UTC | null | null | null | null | 3,000,704 | null | 1 | 152 | java|macos|java-8 | 302,152 | <p>You can open up terminal and simply type </p>
<pre><code>java -version // this will check your jre version
javac -version // this will check your java compiler version if you installed
</code></pre>
<p>this should show you the version of java installed on the system (assuming that you have set the path of the jav... |
18,795,028 | javascript remove li without removing ul? | <p>Is there any way to remove the li elements of a ul without also removing the ul? I can only seem to find this.</p>
<pre><code>var element = document.getElementById('myList');
element.parentNode.removeChild(element);
</code></pre>
<p>But, this removes the ul. I'm hoping to be able to remove and append li elements o... | 18,795,074 | 7 | 10 | null | 2013-09-13 20:50:30.63 UTC | 3 | 2021-12-18 14:43:57.51 UTC | 2013-09-13 20:56:30.653 UTC | null | 756,487 | null | 756,487 | null | 1 | 30 | javascript|html-lists|removechild | 87,734 | <p>You can do something like this.</p>
<pre><code>var myList = document.getElementById('myList');
myList.innerHTML = '';
</code></pre>
<p>If you are using jQuery</p>
<pre><code>$('#myList').empty();
</code></pre>
<p>Both of these will remove EVERYTHING inside the list.</p> |
8,709,001 | Git asks me to commit or stash changes on checkout master, even though all changes were committed? | <p>I have two branches locally, <code>master</code> and <code>Berislav</code>. The latter is currently active, and I have committed all the changes. When I try to checkout to <code>master</code>, I get the following message:</p>
<blockquote>
<p>error: Your local changes to the following files would be overwritten
... | 11,860,766 | 8 | 6 | null | 2012-01-03 07:07:55.527 UTC | 7 | 2019-07-12 08:13:45.023 UTC | 2017-04-16 03:32:04.19 UTC | null | 1,033,581 | null | 122,033 | null | 1 | 40 | git | 65,825 | <p>I encountered a similar problem today. <code>git status</code> wasn't listing the files which checkout was complaining about. I did a:</p>
<pre><code>git checkout -- path/to/file
</code></pre>
<p>And that undoes any changes to the file.</p>
<p>An even easier way to undo all unstaged changes on current working dir... |
26,050,899 | How to mount host volumes into docker containers in Dockerfile during build | <p><em>Since 2014 when this question has been asked, many situations had happened and many things has changed. I'm revisiting the topic again today, and I'm editing this question for the 12th time to reflect the latest changes</em>. The question may seem long but it is arranged in the reverse chronological order, so th... | 52,762,779 | 11 | 4 | null | 2014-09-26 02:00:44.447 UTC | 71 | 2022-09-06 20:10:15.323 UTC | 2022-02-18 20:24:23.987 UTC | null | 2,125,837 | null | 2,125,837 | null | 1 | 313 | share|docker|host|mount | 282,805 | <p>First, to answer "why doesn't <code>VOLUME</code> work?" When you define a <code>VOLUME</code> in the Dockerfile, you can only define the target, not the source of the volume. During the build, you will only get an anonymous volume from this. That anonymous volume will be mounted at every <code>RUN</code> command, p... |
22,075,140 | Am I doing this split, reverse, join correctly? | <p>Having a little trouble understanding what this does. If I have a string, </p>
<p>Using <code>"Mcdonalds"</code> as an example, I do:</p>
<pre><code>"McDonalds".split("").reverse().join();
</code></pre>
<p>What exactly am I doing?</p>
<p>Am I splitting each character <code>(M c D o n a l d s)</code>, then rever... | 22,075,215 | 2 | 4 | null | 2014-02-27 16:56:04.283 UTC | 3 | 2016-06-24 14:36:13.52 UTC | 2016-06-24 14:36:13.52 UTC | null | 1,715,579 | user2344665 | null | null | 1 | 8 | javascript|join|split|reverse | 42,398 | <p>Make sure you specify an empty string to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join"><code>.join</code></a>, otherwise you'll get commas between each character:</p>
<pre><code>"McDonalds".split("").reverse().join(""); // "sdlanoDcM"
</code></pre> |
10,934,420 | FFmpeg - How to scale a video then apply a watermark? | <p>Im trying to scale a video so that it is always 512 wide where the height changes in proportion to the original video.
Once scaled, I then want to apply a watermark/overlay to the video, therefore the video will scale but the watermark wont.</p>
<p>I am able to achieve each of these separately using the following fi... | 11,566,178 | 3 | 2 | null | 2012-06-07 15:00:49.873 UTC | 11 | 2016-08-28 20:41:46.077 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 717,373 | null | 1 | 13 | filter|ffmpeg|overlay|scale|watermark | 32,494 | <p>Thank you to both @DiJuMx and @LordNeckbeard, you both got me closer to my solution. Ive not tried the filter_complex option yet but it certainly looks simpler.</p>
<p>The solution I found to work is:</p>
<pre><code>-vf "movie=watermark.png [watermark]; [in]scale=512:trunc(ow/a/2)*2 [scale]; [scale][watermark] ove... |
10,897,996 | Gethomepath not working on iOS 5 / OSxLion | <p>Whenever I use the Gethomepath function of Delphi I keep getting Shell Script Invocation Error.</p>
<p>Was this function replaced by a newer one? </p> | 13,246,212 | 1 | 5 | null | 2012-06-05 13:14:04.587 UTC | 2 | 2012-11-06 07:18:19.517 UTC | 2012-11-02 13:25:57.36 UTC | null | 912,495 | null | 1,437,074 | null | 1 | 29 | delphi|osx-lion|firemonkey | 592 | <p>I finally found a workaround for this:
blogs.embarcadero.com/ao/2011/10/04/39144#comment-7998 </p>
<p>So "S := ExtractFilePath(paramstr(0)); S := Copy(S, 1, length(S) - 14);" gets the job done.</p>
<p>Note that the length of S depends on your application title.</p> |
11,107,608 | What's "wrong" with C++ wchar_t and wstrings? What are some alternatives to wide characters? | <p>I have seen a lot of people in the C++ community(particularly ##c++ on freenode) resent the use of <code>wstrings</code> and <code>wchar_t</code>, and their use in the windows api. What is exactly "wrong" with <code>wchar_t</code> and <code>wstring</code>, and if I want to support internationalization, what are some... | 11,107,667 | 2 | 9 | null | 2012-06-19 19:00:50.673 UTC | 39 | 2014-05-11 06:56:37.883 UTC | 2013-08-23 09:03:44.65 UTC | null | 1,237,747 | null | 596,065 | null | 1 | 87 | c++|winapi|unicode|internationalization|wstring | 32,869 | <h3>What is wchar_t?</h3>
<p>wchar_t is defined such that any locale's char encoding can be converted to a wchar_t representation where every wchar_t represents exactly one codepoint:</p>
<blockquote>
<p>Type wchar_t is a distinct type whose values can represent distinct codes for all members of the largest extende... |
11,403,932 | Python AttributeError: 'module' object has no attribute 'Serial' | <p>I'm trying to access a serial port with Python 2.6 on my Raspberry Pi running Debian.
My script named <code>serial.py</code> tries to import pySerial:</p>
<pre><code>import serial
ser = serial.Serial('/dev/ttyAMA0', 9600)
ser.write("hello world!")
</code></pre>
<p>For some reason it refuses to establish th... | 11,404,052 | 7 | 10 | null | 2012-07-09 22:09:25.193 UTC | 28 | 2022-01-04 13:43:44.837 UTC | 2022-01-04 13:43:44.837 UTC | null | 8,839,059 | null | 547,398 | null | 1 | 163 | python|serial-port|raspberry-pi | 516,098 | <p>You're importing the module, not the class. So, you must write:</p>
<pre><code>from serial import Serial
</code></pre>
<p>You need to install <code>serial</code> module correctly: <code>pip install pyserial</code>.</p> |
13,102,963 | Word wrap in Chrome Dev Tools? | <p>I cannot figure out how to get the HTML elements to wrap lines in Chrome dev tools. I'm working with some long and complicated SVG paths and I hate scrolling horizontally to check the other element attributes. Word wrap is checked under the settings area in chrome dev tools. Suggestions?</p>
<p><a href="https://i.s... | 16,240,802 | 3 | 1 | null | 2012-10-27 18:30:54.413 UTC | 5 | 2021-09-14 22:33:07.907 UTC | 2018-03-04 09:36:58.527 UTC | null | 863,110 | null | 1,204,209 | null | 1 | 38 | google-chrome|console|google-chrome-devtools|word-wrap | 25,568 | <p>Looks like there is no Word Wrap available for now :( and seems like people have been asking forever, I just posted my vote for word wrap too</p>
<p><a href="https://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owne... |
30,351,529 | Find and replace with a newline in Visual Studio Code | <p>I am trying out the new Microsoft Visual Studio Code editor in Linux Fedora environment. I would like to know how to replace new line (\n) in place of some other text. </p>
<p>For example, I have html text like this</p>
<pre><code><tag><tag>
</code></pre>
<p>which I would like to replace as </p>
<pr... | 30,775,857 | 11 | 6 | null | 2015-05-20 13:43:37.393 UTC | 85 | 2022-08-09 09:40:00.513 UTC | 2016-04-14 22:24:20.8 UTC | null | 100,596 | null | 1,179,958 | null | 1 | 663 | visual-studio-code | 520,541 | <p>In the local searchbox (<kbd>ctrl</kbd> + <kbd>f</kbd>) you can insert newlines by pressing <kbd>ctrl</kbd> + <kbd>enter</kbd>.</p>
<p><a href="https://code.visualstudio.com/assets/updates/1_38/multiple-line-support.gif" rel="noreferrer"><img src="https://code.visualstudio.com/assets/updates/1_38/multiple-line-supp... |
17,101,903 | What does LayoutInflater class do? (in Android) | <p>I am unable to understand the use of LayoutInflater in Android.</p>
<p>What exactly is the role of LayoutInflater, and how to use it for a simple Android app?</p> | 17,102,180 | 5 | 3 | null | 2013-06-14 05:49:44.9 UTC | 13 | 2016-12-23 14:34:15.53 UTC | 2016-12-08 13:41:32.99 UTC | null | 4,666,542 | null | 2,484,803 | null | 1 | 31 | android|android-layout | 38,672 | <p><strong>What is Layoutinflater ?</strong></p>
<p><code>LayoutInflater</code> is a class (wrapper of some implementation or service), you can get one:</p>
<pre><code>LayoutInflater li = LayoutInflater.from(context);
</code></pre>
<hr>
<p><strong>How to use Layoutinflater ?</strong></p>
<p>You feed it an XML layo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.