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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7,128,444 | How does Git(Hub) handle possible collisions from short SHAs? | <p>Both Git and GitHub display short versions of SHAs -- just the first 7 characters instead of all 40 -- and both Git and GitHub support taking these short SHAs as arguments.</p>
<p>E.g. <code>git show 962a9e8</code></p>
<p>E.g. <a href="https://github.com/joyent/node/commit/962a9e8">https://github.com/joyent/node/c... | 7,128,816 | 3 | 3 | null | 2011-08-19 23:32:21.093 UTC | 12 | 2018-04-25 07:45:49.513 UTC | null | null | null | null | 132,978 | null | 1 | 64 | git|cryptography|github|sha | 14,892 | <p>These short forms are just to simplify visual recognition and to make your life <a href="http://git-scm.com/book/en/Git-Tools-Revision-Selection">easier</a>. Git doesn't really truncate anything, internally everything will be handled with the complete value. You can use a partial SHA-1 at your convenience, though:</... |
7,541,767 | How can I show a Balloon Tip over a textbox? | <p>I have a C# WPF application using XAML and MVVM. My question is: How can I show a balloon tooltip above a text box for some invalid data entered by the user?</p>
<p>I want to use Microsoft's <a href="http://msdn.microsoft.com/en-us/library/aa511451.aspx" rel="noreferrer">native balloon control</a> for this. How wou... | 7,649,590 | 4 | 2 | null | 2011-09-24 20:36:35.857 UTC | 9 | 2011-10-04 14:36:19.513 UTC | null | null | null | null | 334,053 | null | 1 | 13 | c#|wpf|mvvm|balloon-tip | 20,790 | <p>I've been searching for a better solution than the BalloonDecorator, and ran across the <a href="http://www.hardcodet.net/projects/wpf-notifyicon" rel="nofollow">http://www.hardcodet.net/projects/wpf-notifyicon</a> project. It is using the WinAPI at the lowest level, which might give you a head start on building yo... |
5,550,911 | Create array variable | <p>I wanted to create this kind of output</p>
<pre><code>var s1 = [['Sony',7],['Samsung',5],['LG',8]];
</code></pre>
<p>so that I could use it to pass on my graph as a variable</p>
<p>out from the result of my ajax</p>
<pre><code>success: function(data){
//code to extract the data value here
var s1= need to c... | 5,551,267 | 2 | 4 | null | 2011-04-05 11:14:43.787 UTC | 1 | 2020-07-28 16:40:53.01 UTC | 2020-07-28 16:40:53.01 UTC | null | 6,950,238 | null | 249,580 | null | 1 | 1 | jquery|variables|multidimensional-array|jqplot | 52,760 | <pre><code>var s1 = [];
$(".tblRows").each(function(){
// create a temp array for this row
var row = [];
// add the phone and rating as array elements
row.push($(this).find('.clsPhone').text());
row.push($(this).find('.clsRating').text());
// add the temp array to the main array
s1.push(row)... |
1,701,788 | How to convert string[] to ArrayList? | <p>I have an array of strings. How can I convert it to System.Collections.ArrayList?</p> | 1,701,807 | 4 | 2 | null | 2009-11-09 15:35:42.133 UTC | 5 | 2017-02-15 08:59:29.357 UTC | null | null | null | null | 187,644 | null | 1 | 21 | c#|.net | 62,533 | <pre><code>string[] myStringArray = new string[2];
myStringArray[0] = "G";
myStringArray[1] = "L";
ArrayList myArrayList = new ArrayList();
myArrayList.AddRange(myStringArray);
</code></pre> |
1,676,362 | JavaScript variable binding and loop | <p>Consider such loop:</p>
<pre><code>for(var it = 0; it < 2; it++)
{
setTimeout(function() {
alert(it);
}, 1);
}
</code></pre>
<p>The output is:</p>
<pre><code>=> 2
=> 2
</code></pre>
<p>I would like it to be: 0, 1. I see two ways to fix it:</p>
<p>Solution # 1.</p>
<p>This one based on ... | 1,676,422 | 4 | 0 | null | 2009-11-04 20:20:46.257 UTC | 5 | 2017-09-10 17:13:45.993 UTC | 2009-11-04 23:14:56.117 UTC | null | 1,831 | null | 62,192 | null | 1 | 31 | javascript|loops|closures|scope | 15,729 | <p>Not really anything more than the two ways that you have proposed, but here's another</p>
<pre><code>for(var it = 0; it < 2; it++)
{
(function() {
var m = it;
setTimeout(function() {
alert(m);
}, 1);
})();
}
</code></pre>
<p>Essentially, you need to capture the va... |
72,543,728 | Xcode 14 deprecates bitcode - but why? | <p><a href="https://developer.apple.com/documentation/Xcode-Release-Notes/xcode-14-release-notes" rel="noreferrer">Xcode 14 Beta release notes</a> are out, all thanks to the annual WWDC.</p>
<p>And alas, the Bitcode is now deprecated, and you'll get a warning message if you attempt to enable it.</p>
<p>And I was wonder... | 73,219,854 | 4 | 2 | null | 2022-06-08 10:00:44.557 UTC | 11 | 2022-09-17 15:11:41.813 UTC | 2022-09-06 17:32:54.65 UTC | null | 819,340 | null | 9,353,387 | null | 1 | 41 | ios|xcode|bitcode|xcode14 | 6,883 | <p>Bitccode is actually just the LLVM intermediate language. When you compile source code using the LLVM toolchain, source code is translated into an intermediate language, named Bitcode. This Bitcode is then analyzed, optimized and finally translated to CPU instructions for the desired target CPU.</p>
<p>The advantage... |
10,426,501 | How to Solve the XAMPP 1.7.7 - PHPMyAdmin - MySQL Error #2002 in Ubuntu | <p>I have been through lots of forums and checked various posts on similar topic but non seems to work out for me. </p>
<p>I have freshly installed XAMPP 1.7.7 on my Ubuntu 11.10 Operating system. Everything is running except for the phpMyAdmin. </p>
<p>Upon hitting: <a href="http://localhost/phpmyadmin" rel="norefer... | 10,443,916 | 11 | 2 | null | 2012-05-03 06:52:20.053 UTC | 10 | 2018-11-17 17:59:07.557 UTC | 2012-05-04 06:28:35.523 UTC | null | 547,894 | null | 547,894 | null | 1 | 22 | mysql|ubuntu|phpmyadmin|xampp|mysql-error-2002 | 102,159 | <p>It turns out that the solution is to stop all the related services and solve the “Another daemon is already running” issue. </p>
<p>The commands i used to solve the issue are as follows: </p>
<pre><code>sudo /opt/lampp/lampp stop
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/mysql stop
</code></... |
10,451,482 | Can I refresh an XML comment in Visual Studio to reflect parameters that have changed? | <p>If I write the function:</p>
<pre><code> public static uint FindAUint(double firstParam)
{
}
</code></pre>
<p>I can generate the xml comments by typing '///', it gives :</p>
<pre><code> /// <summary>
/// *Here I type the summary of the method*
/// </summary>
/// <param na... | 10,451,511 | 3 | 2 | null | 2012-05-04 15:08:34.583 UTC | 4 | 2021-12-30 03:48:52.51 UTC | 2012-05-04 15:14:22.19 UTC | null | 334,053 | null | 1,029,916 | null | 1 | 33 | c#|visual-studio-2010|comments | 8,455 | <p>Check out <a href="http://submain.com/products/ghostdoc.aspx">GhostDoc</a>. It is a Visual Studio extension that will generate your XML comments for you.</p> |
7,420,780 | What is a constant reference? (not a reference to a constant) | <p>Why do constant references not behave the same way as constant pointers, so that I can actually change the object they are pointing to? They really seem like another plain variable declaration. Why would I ever use them?</p>
<p>This is a short example that I run which compiles and runs with no errors:</p>
<pre><code... | 7,432,351 | 7 | 5 | null | 2011-09-14 17:55:11.99 UTC | 30 | 2022-04-17 10:38:01.497 UTC | 2022-04-17 10:38:01.497 UTC | null | 3,924,118 | null | 840,997 | null | 1 | 72 | c++|reference|constants | 139,022 | <p>The clearest answer.
<strong><a href="https://isocpp.org/wiki/faq/const-correctness#const-ref-nonsense" rel="noreferrer">Does “X& const x” make any sense?</a></strong></p>
<blockquote>
<p><strong>No, it is nonsense</strong></p>
<p>To find out what the above declaration means, read it right-to-left:
“x is a const... |
7,408,068 | tmux: hangs and do not load, and do not respond to any option command | <p>I have installed tmux from source on my localspace in Fedora. It was working nicely so far. But suddenly can not run it anymore, when run tmux, it just halts. Tried different command options like ls-sessions, none works. Killed all the processes of my user, deleted all the files of tmux and <code>libevnet</code>, an... | 7,436,243 | 8 | 1 | null | 2011-09-13 20:29:10.807 UTC | 11 | 2019-02-22 15:49:44.907 UTC | 2015-10-01 15:59:47.18 UTC | null | 1,245,190 | null | 501,337 | null | 1 | 38 | linux|tmux | 37,521 | <p>Thanks.
I found the problem. The tmux process were in D state, and I had no choice but to reboot the system.
The problem came from kerberos ticket expiring after a while. And find a scripts that solves this problem:
<a href="https://iain.cx/src/ktmux/" rel="nofollow">https://iain.cx/src/ktmux/</a></p> |
7,348,150 | Android: why setVisibility(View.GONE); or setVisibility(View.INVISIBLE); do not work | <p>I want my <code>DatePicker</code> and the button to be invisible in the begining. And when I press my magic button I want to setVisibility(View.Visible);</p>
<p>The problem here is when I <code>setVisibility(View.GONE)</code> or <code>setVisibility(View.INVISIBLE)</code> nothing changes and the component is still v... | 7,348,547 | 11 | 0 | null | 2011-09-08 12:39:27.29 UTC | 16 | 2020-11-13 11:19:25.327 UTC | 2017-10-20 06:24:35.23 UTC | null | 1,083,957 | null | 925,353 | null | 1 | 70 | java|android|android-layout|android-view|android-datepicker | 303,735 | <p>I see quite a few things wrong. For starters, you don't have your magic button defined and there is no event handler for it.</p>
<p>Also you shouldn't use:</p>
<pre><code>dp2.setVisibility(View.GONE);
dp2.setVisibility(View.INVISIBLE);
</code></pre>
<p>Use only one of the two. From <a href="http://developer.andr... |
7,389,944 | $this vs $(this) in jQuery | <p>I've seen some discussions on SO regarding <code>$(this)</code> vs <code>$this</code> in jQuery, and they make sense to me. (See <a href="https://stackoverflow.com/questions/1051782/jquery-this-vs-this">discussion here</a> for an example.)</p>
<p>But what about the snippet below, from the jQuery website plugin tuto... | 7,389,987 | 15 | 10 | null | 2011-09-12 15:03:40.507 UTC | 28 | 2015-06-24 08:48:06.38 UTC | 2017-05-23 11:46:19.453 UTC | null | -1 | null | 172,617 | null | 1 | 77 | javascript|jquery | 93,885 | <p><code>$this</code> is just an ordinary variable. The <code>$</code> character is a valid character in variable names, so <code>$this</code> acts the same as any other non-reserved variable name. It's functionally identical to calling a variable <code>JellyBean</code>.</p> |
14,059,429 | CSS: Full Size background image | <p>Trying to get full size background image with:</p>
<pre><code>html {
height: 100%;
background:url('../img/bg.jpg') no-repeat center center fixed;
background-size: cover;
}
</code></pre>
<p>It's showing the background image with correct width but height gets stretched.
I tried various options like</p>
... | 14,059,876 | 6 | 4 | null | 2012-12-27 18:29:51.18 UTC | 5 | 2017-06-21 01:53:22.027 UTC | null | null | null | null | 1,101,083 | null | 1 | 18 | css | 50,473 | <p>Your screen is obviously a different shape to your image. This is not uncommon, and you should always cater to this case even if your screen is the same shape (aspect ratio), because other people's screens will not always be. To deal with this, you have only one of three options:</p>
<ul>
<li>You can choose to comp... |
14,134,949 | jquery client side validation not working in MVC3 partial view | <p>I could not seem get client side validation work with the following partial view. This view is inside divTSettings div in the parent view. Tried lots of things from stackoverflow and other sites, nothing seems to work. Any ideas? </p>
<pre><code><script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type... | 14,135,013 | 2 | 0 | null | 2013-01-03 07:52:04.67 UTC | 14 | 2018-03-09 13:40:52.933 UTC | 2013-01-04 19:15:40.493 UTC | null | 594,235 | null | 1,246,417 | null | 1 | 20 | jquery|asp.net-mvc-3|jquery-validate | 18,219 | <blockquote>
<p>Any ideas?</p>
</blockquote>
<p>Yes, the very first thing you should do is to get rid of all those <code><script></code> tags from your partial view. Partial views should not contain any scripts. Partial views should contain only markup. I have repeated this many times and still see people putt... |
13,905,407 | Append unit type to the result of a calculation in Sass | <p>I've been refactoring my CSS to a SASS style sheet recently. I'm using the <a href="http://visualstudiogallery.msdn.microsoft.com/2b96d16a-c986-4501-8f97-8008f9db141a" rel="noreferrer">Mindscape Web Workbench extension</a> for VS2012, which re-generates the CSS each time you save your SCSS. I started with code simil... | 13,905,609 | 5 | 12 | null | 2012-12-16 20:56:56.373 UTC | 14 | 2020-12-15 18:45:07.14 UTC | 2020-12-15 18:45:07.14 UTC | null | 2,803,565 | null | 419,956 | null | 1 | 70 | css|sass | 39,780 | <p><strong>The only way to add a unit to a number is via arithmetic</strong>.</p>
<p>To perform operations like concatenation (eg. <code>1 + px</code>) or interpolation (eg. <code>#{1}px</code>) will only create a <strong>string</strong> that <em>looks</em> like a number. Even if you're absolutely 100% certain that y... |
29,987,969 | How to load a script only in IE | <p>I need a particular script to be triggered in Internet Explorer browsers Only!</p>
<p>I've tried this:</p>
<pre><code><!--[if IE]>
<script></script>
<![endif]-->
</code></pre>
<p>Unfortunately this actually stops the script from being loaded.</p>
<p>EDIT: For everyone asking why I need t... | 29,988,202 | 6 | 6 | null | 2015-05-01 13:42:13.82 UTC | 18 | 2022-05-28 07:46:14.693 UTC | 2015-05-01 16:15:35.587 UTC | null | 4,341,263 | null | 4,341,263 | null | 1 | 46 | javascript|internet-explorer|conditional-statements | 62,459 | <p>I'm curious why you specifically need to target IE browsers, but the following code should work if that really is what you need to do:</p>
<pre><code><script type="text/javascript">
if(/MSIE \d|Trident.*rv:/.test(navigator.userAgent))
document.write('<script src="somescript.js"><\/script&... |
9,015,498 | Need Haar Casscades for Nose, Eyes & Lips(Mouth) | <p>I need Haar Cascades xml files for Mouth, Eyes & Nose. Do provide me useful links.</p>
<p>Any kind of help would be highly appreciated.</p> | 9,017,165 | 3 | 1 | null | 2012-01-26 08:31:57.43 UTC | 12 | 2017-09-23 07:30:08.14 UTC | null | null | null | null | 1,142,341 | null | 1 | 22 | opencv|face-detection|emgucv|emotion | 45,701 | <p>Look at this page: <a href="http://alereimondo.no-ip.org/OpenCV/34">http://alereimondo.no-ip.org/OpenCV/34</a></p>
<p>There are haar cascades for eyes, nose and mouth :)</p> |
44,492,197 | React Native ios build : Can't find node | <p>I have a prototype ready to go and the project is jammed with build:</p>
<blockquote>
<p>error: Can't find 'node' binary to build React Native bundle If you
have non-standard nodejs installation, select your project in Xcode,
find 'Build Phases' - 'Bundle React Native code and images' and change
NODE_BINARY... | 44,494,828 | 12 | 3 | null | 2017-06-12 05:49:33.467 UTC | 25 | 2022-09-13 03:08:28.337 UTC | 2019-10-10 12:23:25.297 UTC | null | 5,660,517 | null | 6,263,936 | null | 1 | 68 | ios|node.js|react-native|build | 48,025 | <p>I found one
<a href="http://qiita.com/kztka/items/eca26d441461985d8397" rel="noreferrer">solution</a></p>
<p>First find your current node, in shell</p>
<pre><code>which node
</code></pre>
<p>then copy your node url to </p>
<pre><code>export NODE_BINARY=[your node path]
../node_modules/react-native/packager/reac... |
32,609,248 | setuptools: adding additional files outside package | <p>I have a <code>python</code> application that has a fixed layout which I cannot change. I would like to wrap it up using setuptools, e.g. write a <code>setup.py</code> script.</p>
<p>Using the official documentation, I was able to write a first template. However, the application in question uses a lot of additional... | 32,610,786 | 2 | 4 | null | 2015-09-16 12:56:40.513 UTC | 6 | 2015-09-16 15:42:49.78 UTC | 2015-09-16 15:42:49.78 UTC | null | 2,657,641 | null | 2,657,641 | null | 1 | 34 | python|setuptools | 16,750 | <p>There is also <code>data_files</code></p>
<pre><code>data_files=[("yourdir",
["additionalstuff/moredata.txt", "INFO.txt"])],
</code></pre>
<p>Have a think about where you want to put those files. More info in the <a href="https://docs.python.org/3.3/distutils/setupscript.html#installing-additional-fil... |
56,161,595 | How to use `async for` in Python? | <p>I mean what do I get from using <code>async for</code>. Here is the code I write with <code>async for</code>, <code>AIter(10)</code> could be replaced with <code>get_range()</code>.</p>
<p>But the code runs like sync not async.</p>
<pre class="lang-py prettyprint-override"><code>import asyncio
async def get_range... | 56,162,461 | 3 | 7 | null | 2019-05-16 05:49:59.927 UTC | 24 | 2022-06-27 14:07:45.597 UTC | null | null | null | null | 2,955,827 | null | 1 | 64 | python|asynchronous|python-asyncio | 53,055 | <blockquote>
<p>But it is hard for me to understand what I got by use <code>async for</code> here instead of simple <code>for</code>.</p>
</blockquote>
<p>The underlying misunderstanding is expecting <a href="https://docs.python.org/3/reference/compound_stmts.html#the-async-for-statement" rel="noreferrer"><code>async f... |
24,911,238 | programmatically import .cer certificate into keystore | <p>How can I import a .p12 certificate from the classpath into the java keystore? First I used the InstallCert <a href="https://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util/InstallCert.java" rel="noreferrer">https://code.google.com/p/java-use-examples/source/browse/trunk/src/com/aw/ad/util... | 24,927,216 | 2 | 2 | null | 2014-07-23 13:03:11.583 UTC | 8 | 2020-08-05 03:45:51 UTC | 2014-07-24 07:11:08.413 UTC | null | 1,879,409 | null | 1,879,409 | null | 1 | 13 | java|keystore|pkcs#12|key-management | 19,858 | <p>The answer:</p>
<pre class="lang-java prettyprint-override"><code>InputStream certIn = ClassLoader.class.getResourceAsStream("/package/myCert.cer");
final char sep = File.separatorChar;
File dir = new File(System.getProperty("java.home") + sep + "lib" + sep + "security");
Fil... |
379,977 | Online Assembly language resources | <p>does anyone have any resources for learning assembly language on x86? I'm trying to debug a program in MSVC++6 and frequently come across assembly (like stepping into memcpy).. Previously I just ignored these but memcpy keeps throwing exceptions and I need to find out why..</p>
<p>Any help would be appreciated :)</... | 380,003 | 5 | 2 | null | 2008-12-19 02:42:28.627 UTC | 12 | 2012-03-01 00:29:46.377 UTC | 2009-01-08 02:21:21.31 UTC | Greg Hewgill | 893 | krebstar | 29,482 | null | 1 | 9 | visual-c++|assembly|x86 | 1,167 | <p>If you just need to understand what each instruction does, the reference manual for the IA-32 (x86) & IA64 instruction sets are located <a href="http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html" rel="nofollow noreferrer">here</a>.</p> |
162,149 | Avoid being blocked by web mail companies for mass/bulk emailing? | <p>Our company is sending out a lot of emails per day and planning to send even more in future. (thousands) Also there are mass mailouts as well in the ten thousands every now and then.</p>
<p>Anybody has experience with hotmail, yahoo (web.de, gmx.net) and similar webmail companies blocking your emails because "too m... | 162,320 | 6 | 1 | null | 2008-10-02 13:06:05.47 UTC | 18 | 2013-04-29 14:30:25.793 UTC | 2010-09-19 14:51:51.657 UTC | null | 63,051 | Johannes | 925 | null | 1 | 16 | email|bulk|webmail|massmail|sendgrid | 13,472 | <p>You want to look at the following:</p>
<ul>
<li>add a bulk-header to your outgoing email (<code>Precedence: bulk</code>)</li>
<li>look into <a href="http://en.wikipedia.org/wiki/Sender_Policy_Framework" rel="noreferrer">SPF</a></li>
<li>look into <a href="http://en.wikipedia.org/wiki/SenderID" rel="noreferrer">Send... |
1,936 | How to RedirectToAction in ASP.NET MVC without losing request data | <p>Using ASP.NET MVC there are situations (such as form submission) that may require a <code>RedirectToAction</code>. </p>
<p>One such situation is when you encounter validation errors after a form submission and need to redirect back to the form, but would like the URL to reflect the URL of the form, not the action ... | 1,940 | 6 | 2 | null | 2008-08-05 05:33:41.697 UTC | 49 | 2020-06-18 13:31:52.997 UTC | 2016-08-15 02:03:16.617 UTC | Dan | 316,469 | null | 364 | null | 1 | 124 | c#|asp.net-mvc | 91,666 | <p>The solution is to use the TempData property to store the desired Request components.</p>
<p>For instance:</p>
<pre><code>public ActionResult Send()
{
TempData["form"] = Request.Form;
return this.RedirectToAction(a => a.Form());
}
</code></pre>
<p>Then in your "Form" action you can go:</p>
<pre><code>... |
42,584,368 | How do you define custom `Error` types in Rust? | <p>I'm writing a function that could return several one of several different errors.</p>
<pre><code>fn foo(...) -> Result<..., MyError> {}
</code></pre>
<p>I'll probably need to define my own error type to represent such errors. I'm presuming it would be an <code>enum</code> of possible errors, with some of ... | 42,584,607 | 3 | 3 | null | 2017-03-03 16:49:35.1 UTC | 16 | 2022-01-04 15:57:27.98 UTC | 2017-03-03 16:53:12.313 UTC | null | 155,423 | null | 525,872 | null | 1 | 68 | error-handling|rust | 36,765 | <p>You implement <a href="https://doc.rust-lang.org/std/error/trait.Error.html" rel="noreferrer"><code>Error</code></a> exactly like you would <a href="https://doc.rust-lang.org/stable/book/ch10-02-traits.html" rel="noreferrer">any other trait</a>; there's nothing extremely special about it:</p>
<pre><code>pub trait Er... |
21,164,365 | How to send image to PHP file using Ajax? | <p>my question is that is it possible to upload an image to a server using ajax(jquery)</p>
<p>below is my ajax script to send text without page reload</p>
<pre><code>$(function() {
//this submits a form
$('#post_submit').click(function(event) {
event.preventDefault();
var great_id = $("#post_container_supreme:first"... | 21,164,512 | 5 | 4 | null | 2014-01-16 14:22:18.303 UTC | 8 | 2020-11-02 14:27:03.523 UTC | 2014-01-16 14:25:18.61 UTC | null | 913,707 | null | 2,757,519 | null | 1 | 18 | jquery|ajax|image|forms | 117,810 | <p>Use JavaScript's <a href="https://developer.mozilla.org/en/docs/Web/API/FormData" rel="nofollow noreferrer">formData API</a> and set <code>contentType</code> and <code>processData</code> to <code>false</code></p>
<pre><code>$("form[name='uploader']").on("submit", function(ev) {
ev.preventDefaul... |
61,204,259 | How can I resolve the "No Font Name" issue when importing fonts into R using extrafont? | <p>I have a folder on my Windows desktop (<code>C:\Users\me\Desktop\Fonts</code>) which contains fonts that I would like to import into R using <code>extrafont</code>.</p>
<p>When I try to import the fonts using</p>
<pre><code>library(extrafont)
font_import(paths = "C:/Users/me/Desktop/Fonts", prompt=FALSE)
</code></... | 68,642,855 | 3 | 2 | null | 2020-04-14 09:12:38.573 UTC | 14 | 2022-04-12 11:45:39.227 UTC | null | null | null | null | 10,561,781 | null | 1 | 41 | r|extrafont | 13,579 | <p>As it was mentioned by @Moritz Schwarz, the problem is <a href="https://github.com/wch/extrafont/issues/32" rel="noreferrer">traced to <code>Rttf2pt1</code></a>.</p>
<p>According to a solution proposed <a href="https://github.com/wch/extrafont/issues/88#issuecomment-890426514" rel="noreferrer">here</a>, downgrading ... |
65,342,769 | Install Node on M1 Mac | <p>Kind of a noob here on questions about binaries, processors and how that all works together:</p>
<p>I have a new Mac with an M1 chip, and want to install Node. I'm used to do this with Homebrew. Now, if I install Homebrew, I'm strongly recommended to use Rosetta, so I did. Next step: installing Node. So instead of <... | 65,449,002 | 8 | 1 | null | 2020-12-17 14:39:04.557 UTC | 15 | 2022-03-02 10:54:53.76 UTC | null | null | null | null | 4,691,187 | null | 1 | 42 | node.js|homebrew|apple-silicon|rosetta | 84,565 | <p>I just got my M1 Mac mini. I did add an alias since I use oh-my-zsh to my <code>~/.zshrc</code> for <code>alias brew=arch -x86_64 brew</code> so I don't have to keep typing all that. I <code>brew install nvm</code> then <code>nvm ls-remote</code> and installed v15.5.0. It gets built <code>DV8_TARGET_ARCH_ARM64</c... |
2,211,915 | Library function for Permutation and Combination in C++ | <p>What's the most widely used existing library in C++ to give all the combination and permutation of k elements out of n elements?</p>
<p>I am not asking the algorithm but the existing library or methods.</p>
<p>Thanks.</p> | 2,212,063 | 5 | 1 | null | 2010-02-06 03:37:16.51 UTC | 29 | 2020-11-14 11:03:53.203 UTC | 2020-01-22 17:03:58.807 UTC | null | 10,251,345 | null | 233,254 | null | 1 | 35 | c++|c++-standard-library | 25,681 | <p>Combinations: from <a href="https://marknelson.us/posts/2002/03/01/next-permutation.html" rel="nofollow noreferrer">Mark Nelson's article</a> on the same topic we have <code>next_combination</code> Permutations: From STL we have <code>std::next_permutation</code></p>
<pre><code> template <typename Iterator>
... |
1,952,404 | Linux bash: Multiple variable assignment | <p>Does exist in linux bash something similar to the following code in PHP:</p>
<pre><code>list($var1, $var2, $var3) = function_that_returns_a_three_element_array() ;
</code></pre>
<p>i.e. you assign in one sentence a corresponding value to 3 different variables.</p>
<p>Let's say I have the bash function <code>myBas... | 1,952,480 | 6 | 0 | null | 2009-12-23 12:03:49.197 UTC | 54 | 2022-07-05 12:36:48.127 UTC | null | null | null | null | 25,700 | null | 1 | 151 | linux|bash|shell|variable-assignment|multiple-variable-return | 167,109 | <p>First thing that comes into my mind:</p>
<pre><code>read -r a b c <<<$(echo 1 2 3) ; echo "$a|$b|$c"
</code></pre>
<p>output is, unsurprisingly</p>
<pre><code>1|2|3
</code></pre> |
2,157,458 | Using 'const' in class's functions | <p>I've seen a lot of uses of the const keyword put after functions in classes, so i wanted to know what was it about. I read up smth at here: <a href="http://duramecho.com/ComputerInformation/WhyHowCppConst.html" rel="noreferrer">http://duramecho.com/ComputerInformation/WhyHowCppConst.html</a> .</p>
<p>It says that c... | 2,157,477 | 7 | 5 | null | 2010-01-28 19:46:52.58 UTC | 14 | 2010-01-28 23:32:20.19 UTC | null | null | null | null | 242,343 | null | 1 | 29 | c++|oop|class|constants | 49,900 | <p>A const method can be called on a const object:</p>
<pre><code>class CL2
{
public:
void const_method() const;
void method();
private:
int x;
};
const CL2 co;
CL2 o;
co.const_method(); // legal
co.method(); // illegal, can't call regular method on const object
o.const_method(); // legal, ca... |
1,394,956 | How to do "hit any key" in python? | <p>How would I do a "hit any key" (or grab a menu option) in Python?</p>
<ul>
<li>raw_input requires you hit return.</li>
<li>Windows msvcrt has getch() and getche().</li>
</ul>
<p>Is there a portable way to do this using the standard libs?</p> | 1,394,994 | 7 | 3 | null | 2009-09-08 16:32:27.99 UTC | 8 | 2020-11-29 04:56:00.853 UTC | null | null | null | null | 3,233 | null | 1 | 34 | python | 40,506 | <pre><code>try:
# Win32
from msvcrt import getch
except ImportError:
# UNIX
def getch():
import sys, tty, termios
fd = sys.stdin.fileno()
old = termios.tcgetattr(fd)
try:
tty.setraw(fd)
return sys.stdin.read(1)
finally:
termios.... |
2,251,622 | conditional execution (&& and ||) in powershell | <p>There's already question addressing my issue (<a href="https://stackoverflow.com/questions/563600/can-i-get-to-work-in-powershell">Can I get && to work in Powershell?</a>), but with one difference. I need an <strong>OUTPUT</strong> from both commands. See, if I just run:</p>
<pre><code>(command1 -arg1 -arg2... | 2,252,734 | 7 | 5 | null | 2010-02-12 12:05:46.55 UTC | 8 | 2020-11-27 12:48:35.407 UTC | 2017-05-23 12:32:05.06 UTC | null | -1 | null | 199,621 | null | 1 | 44 | syntax|powershell|command-execution | 36,490 | <p><strong>2019</strong>: the Powershell team are <a href="https://github.com/PowerShell/PowerShell/pull/9849" rel="noreferrer">considering adding support for <code>&&</code> to Powershell - weigh in at this GitHub PR</a></p>
<p>Try this:</p>
<pre><code>$(command -arg1 -arg2 | Out-Host;$?) -and $(command2 -ar... |
1,505,206 | Imitating the "IN" Operator | <p>How can one achieve:</p>
<pre><code>if X in (1,2,3) then
</code></pre>
<p>instead of:</p>
<pre><code>if x=1 or x=2 or x=3 then
</code></pre>
<p>In other words, how can one best imitate the <code>IN</code> operator in VBA for excel?</p> | 1,505,248 | 8 | 0 | null | 2009-10-01 17:02:18.323 UTC | 2 | 2022-06-25 22:16:34.657 UTC | 2018-07-09 19:34:03.733 UTC | null | -1 | null | 66,696 | null | 1 | 29 | excel|operators|in-operator|vba | 84,442 | <p>I don't think there is a very elegant solution.</p>
<p>However, you could try:</p>
<pre><code>If Not IsError(Application.Match(x, Array("Me", "You", "Dog", "Boo"), False)) Then
</code></pre>
<p>or you could write your own function:</p>
<pre><code>Function ISIN(x, StringSetElementsAsArray)
ISIN = InStr(1, Joi... |
1,553,704 | Round a number to nearest .25 in JavaScript | <p>I want to convert all numbers to the nearest .25</p>
<p>So...</p>
<pre><code>5 becomes 5.00
2.25 becomes 2.25
4 becomes 4.00
3.5 becomes 3.50
</code></pre> | 1,553,728 | 8 | 1 | null | 2009-10-12 09:59:56.817 UTC | 9 | 2022-08-15 07:21:02.86 UTC | 2022-08-15 07:12:37.967 UTC | null | 479,156 | null | 164,230 | null | 1 | 30 | javascript|rounding | 26,106 | <p>Here’s an implementation of what rslite said:</p>
<pre><code>var number = 5.12345;
number = (Math.round(number * 4) / 4).toFixed(2);
</code></pre> |
1,905,446 | How to debug compiled Java code in Eclipse | <p>I wonder if there are any solutions for Eclipse IDE to debug Java code for which I have no source, i.e. to debug dynamically decompiled code, step through it, etc.? I tried to use <a href="http://java.decompiler.free.fr/?q=jdeclipse" rel="noreferrer">JD-Eclipse</a>, <a href="http://jadclipse.sourceforge.net/wiki/ind... | 1,906,302 | 8 | 3 | null | 2009-12-15 06:02:27.76 UTC | 13 | 2013-01-16 15:22:53.367 UTC | 2009-12-15 08:35:46.407 UTC | null | 82,804 | null | 102,917 | null | 1 | 37 | java|eclipse|debugging|decompiler | 45,497 | <p>I have good experience with Jadclipse - <a href="http://jadclipse.sourceforge.net/wiki/index.php/Main_Page" rel="noreferrer">http://jadclipse.sourceforge.net/wiki/index.php/Main_Page</a> - there is an update site at <a href="http://jadclipse.sf.net/update" rel="noreferrer">http://jadclipse.sf.net/update</a></p>
<p>... |
1,573,593 | What's the fastest way to iterate over an object's properties in Javascript? | <p>I know that I can iterate over an object's properties like this:</p>
<pre><code>for (property in object)
{
// do stuff
}
</code></pre>
<p>I also know that the fastest way to iterate over an array in Javascript is to use a decreasing while loop:</p>
<pre><code>var i = myArray.length;
while (i--)
{
// do st... | 1,574,813 | 8 | 8 | null | 2009-10-15 16:40:34.687 UTC | 16 | 2021-08-26 09:25:33.53 UTC | 2009-10-16 06:23:19.93 UTC | null | 1,026 | null | 139,010 | null | 1 | 48 | javascript|performance|optimization | 42,799 | <p>1) There are many different ways to enumerate properties:</p>
<ul>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in" rel="noreferrer"><code>for..in</code></a> (iterates over enumerable properties of the object and its prototype chain)</li>
<li><a href="https://devel... |
1,903,252 | Extract Integer Part in String | <p>What is the best way to extract the integer part of a string like</p>
<pre><code>Hello123
</code></pre>
<p>How do you get the 123 part. You can sort of hack it using Java's Scanner, is there a better way?</p> | 1,903,279 | 9 | 1 | null | 2009-12-14 20:23:21.51 UTC | 8 | 2022-06-20 02:14:43.653 UTC | 2011-05-15 12:55:02.673 UTC | null | 21,234 | null | 84,399 | null | 1 | 25 | java|string|parsing|integer|java.util.scanner | 110,831 | <p>Why don't you just use a Regular Expression to match the part of the string that you want?</p>
<pre><code>[0-9]
</code></pre>
<p>That's all you need, plus whatever surrounding chars it requires.</p>
<p>Look at <a href="http://www.regular-expressions.info/tutorial.html" rel="noreferrer">http://www.regular-expressi... |
1,835,756 | Using 'try' vs. 'if' in Python | <p>Is there a rationale to decide which one of <code>try</code> or <code>if</code> constructs to use, when testing variable to have a value?</p>
<p>For example, there is a function that returns either a list or doesn't return a value. I want to check result before processing it. Which of the following would be more pre... | 1,835,844 | 9 | 1 | null | 2009-12-02 20:58:37.69 UTC | 90 | 2022-02-02 17:45:47.89 UTC | 2022-02-02 17:45:47.89 UTC | null | 63,550 | null | 214,178 | null | 1 | 195 | python | 88,767 | <p>You often hear that Python encourages <a href="https://docs.python.org/3.6/glossary.html#term-eafp" rel="noreferrer">EAFP</a> style ("it's easier to ask for forgiveness than permission") over <a href="https://docs.python.org/3.6/glossary.html#term-lbyl" rel="noreferrer">LBYL</a> style ("look before you leap"). To me... |
1,690,400 | Getting an instance name inside class __init__() | <p>While building a new class object in python, I want to be able to create a default value based on the instance name of the class without passing in an extra argument. How can I accomplish this? Here's the basic pseudo-code I'm trying for:</p>
<pre><code>class SomeObject():
defined_name = u""
def __init__(s... | 1,690,433 | 10 | 3 | null | 2009-11-06 20:58:57.747 UTC | 15 | 2019-08-15 18:08:27.99 UTC | 2009-11-06 21:03:10.557 UTC | null | 143,938 | null | 143,078 | null | 1 | 24 | python|class|variables|object|instance | 61,676 | <p>Instances don't have names. By the time the global name <code>ThisObject</code> gets <strong>bound</strong> to the instance created by evaluating the <code>SomeObject</code> constructor, the constructor has finished running.</p>
<p>If you want an object to have a name, just pass the name along in the constructor.</... |
2,016,249 | How to programmatically set style attribute in a view | <p>I'm getting a view from the XML with the code below: </p>
<pre><code>Button view = (Button) LayoutInflater.from(this).inflate(R.layout.section_button, null);
</code></pre>
<p>I would like to set a "style" for the button how can I do that in java since a want to use several style for each button I will use.</p> | 2,016,344 | 11 | 0 | null | 2010-01-06 21:08:13.42 UTC | 26 | 2021-11-22 03:14:31.357 UTC | 2018-02-13 15:08:12.48 UTC | null | 2,837,443 | null | 221,204 | null | 1 | 116 | android|styles | 257,172 | <p>Generally you can't change styles programmatically; you can set the look of a screen, or part of a layout, or individual button in your XML layout using <a href="http://developer.android.com/guide/topics/ui/themes.html" rel="noreferrer">themes or styles</a>. Themes can, however, <a href="http://developer.android.co... |
2,032,149 | Optional Parameters in Go? | <p>Can Go have optional parameters? Or can I just define two different functions with the same name and a different number of arguments?</p> | 2,032,160 | 15 | 8 | null | 2010-01-09 02:38:57.707 UTC | 88 | 2022-09-13 15:06:12.293 UTC | 2022-06-02 22:17:31.063 UTC | null | 3,739,391 | null | 371,407 | null | 1 | 679 | go|overloading | 417,716 | <p>Go does not have optional parameters <a href="http://golang.org/doc/faq#overloading" rel="noreferrer">nor does it support method overloading</a>:</p>
<blockquote>
<p>Method dispatch is simplified if it
doesn't need to do type matching as
well. Experience with other languages
told us that having a variety of... |
1,715,697 | What is the best IDE to develop Android apps in? | <p>I am about to start developing an android app and need to get an IDE. Eclipse and the android eclipse plugin appears to be the natural choice. However I am familiar with intelliJ and re-sharper so I would prefer use intelliJ. </p>
<p>Has anyone used <a href="https://code.google.com/archive/p/idea-android/" rel="nor... | 1,715,759 | 20 | 3 | null | 2009-11-11 14:56:09.893 UTC | 81 | 2017-09-10 14:31:21.027 UTC | 2017-09-10 14:31:21.027 UTC | null | 1,033,581 | null | 30,099 | null | 1 | 251 | android|eclipse|intellij-idea | 266,674 | <p><strong>LATEST NEWS</strong></p>
<p>Android Studio has officially come out of beta and been released. It is now the official IDE for Android Development - Eclipse won't be supported anymore. It is definitely the IDE of choice for Android Development. Link to download page: <a href="http://developer.android.com/sdk/... |
33,668,668 | CoordinatorLayout not drawing behind status bar even with windowTranslucentStatus and fitsSystemWindows | <p>I am trying to draw views behind the status bar like this:
<a href="https://i.stack.imgur.com/C56Qd.png"><img src="https://i.stack.imgur.com/C56Qd.png" alt="Desired result"></a></p>
<p>I tried to produce this effect with the recommended techniques, but I get this:</p>
<p><a href="https://i.stack.imgur.com/Y2IT4.pn... | 33,669,264 | 4 | 4 | null | 2015-11-12 09:57:28.657 UTC | 15 | 2020-08-01 19:28:27.13 UTC | null | null | null | null | 1,057,393 | null | 1 | 27 | android|material-design|android-support-library|statusbar|android-coordinatorlayout | 27,004 | <p><strong>edit for future readers:</strong> there's a lot of good information on the subject and the issue on the comments too, make sure to read through them.</p>
<p><strong>original answer:</strong>
Your theme is wrong, that's why.
Unfortunately, there're differences on how to activate in in Kitkat or Lollipop. On ... |
18,148,884 | Difference between no-cache and must-revalidate for Cache-Control? | <p>From the RFC 2616</p>
<p><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1" rel="noreferrer">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1</a></p>
<blockquote>
<p>no-cache</p>
<p>If the no-cache directive does not specify a field-name, then a cache
MUST NOT use t... | 19,938,619 | 6 | 4 | null | 2013-08-09 14:19:30.463 UTC | 58 | 2022-09-14 02:45:56.703 UTC | 2022-09-14 02:45:56.703 UTC | null | 1,718,491 | null | 107,783 | null | 1 | 217 | caching|http-headers|browser-cache|cache-control | 156,620 | <p>I believe that <code>must-revalidate</code> means :</p>
<blockquote>
<p>Once the cache expires, refuse to return stale responses to the user
even if they say that stale responses are acceptable.</p>
</blockquote>
<p>Whereas <code>no-cache</code> implies :</p>
<blockquote>
<p><code>must-revalidate</code> plu... |
17,727,386 | DropDownList in MVC 4 with Razor | <p>I'm trying to create a <code>DropDownList</code> on a razor view.</p>
<p>Would someone help me with this?</p>
<p><strong>Normal HTML5 code:</strong></p>
<pre><code><select id="dropdowntipo">
<option value="Exemplo1">Exemplo1</option>
<option value="Exemplo2">Exemplo2</option>... | 17,727,558 | 13 | 10 | null | 2013-07-18 15:13:37.693 UTC | 47 | 2022-09-16 12:47:15.813 UTC | 2017-12-29 16:35:06.9 UTC | null | 5,622,941 | null | 2,232,273 | null | 1 | 148 | c#|asp.net-mvc|razor | 563,883 | <pre><code>@{
List<SelectListItem> listItems= new List<SelectListItem>();
listItems.Add(new SelectListItem
{
Text = "Exemplo1",
Value = "Exemplo1"
});
listItems.Add(new SelectListItem
{
Text = "Exemplo2",
Value = "Exemplo2",
... |
6,953,528 | Best way to internationalize simple PHP website | <p>I have to develop a pretty simple php website so I don't need framework.
But it's must support multi language (EN/FR/CHINESE).
I have looked for php built in system and I found two ways :</p>
<ul>
<li>intl module from php5.3 (<a href="http://php.net/manual/fr/book.intl.php" rel="noreferrer">http://php.net/manual/f... | 6,954,120 | 4 | 2 | null | 2011-08-05 08:34:55.527 UTC | 11 | 2016-10-14 12:11:07.423 UTC | 2011-08-05 09:40:05.537 UTC | null | 636,472 | null | 636,472 | null | 1 | 17 | php|internationalization|multilingual | 29,591 | <p>Although <code>ext/gettext</code> and <code>ext/intl</code> are both related to i18 (internationalization), <code>gettext</code> deals with translation while <code>intl</code> deals with internationalizing things like number and date display, sorting orders and transliteration. So you'd actually need both for a comp... |
16,009,608 | Combine columns from multiple columns into one in Hive | <p>Is there any way to do kind of reverse thing for explode() function in Apache Hive.
Let's say I have a table in this form <code>id int, description string, url string, ...</code></p>
<p>And from this table I would like to create table which looks like <code>id int, json string</code> where in <code>json</code> colu... | 16,020,378 | 2 | 0 | null | 2013-04-15 07:15:03.797 UTC | 1 | 2017-07-16 07:49:50.77 UTC | null | null | null | null | 1,831,986 | null | 1 | 5 | hadoop|hive | 46,263 | <p>Hive has access to some <a href="https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-StringFunctions" rel="noreferrer">string operations</a> which can be used to combine multiple columns into one column</p>
<pre><code>SELECT id, CONCAT(CONCAT("(", CONCAT_WS(", ", description, url))... |
19,284,193 | 'Invalid value' when setting default value in HTML5 datetime-local input | <p>Can someone explain why when I set the default value of a datetime-local input with seconds other than :00, the browser gives me an error of "Invalid value."?</p>
<p>This may be a bug in Chrome's implementation of datetime-local since this bug does not appear in the latest Firefox and Safari.</p>
<p><strong>Error ... | 39,536,563 | 3 | 2 | null | 2013-10-09 22:54:58.747 UTC | 6 | 2016-09-22 19:49:20.69 UTC | 2016-06-25 23:24:47.937 UTC | null | 6,510,354 | null | 361,833 | null | 1 | 30 | html|google-chrome | 16,507 | <p>This works in Chrome Version 52.0.2743.116 m</p>
<pre><code><input type="datetime-local" name="pub_date" value="2013-10-09T15:38:15" />
</code></pre> |
40,148,442 | Mainline parent number when cherry picking merge commits | <p>Suppose this is my git history</p>
<pre>
Z
/
A -- C -- D
\ /
B
</pre>
<p>My HEAD is currently at <code>Z</code>. I want to cherry-pick <code>B</code> and <code>C</code>. If my understanding is correct, I should do this:</p>
<pre><code>git cherry-pick B
git cherry-pick C -m 1
git commit --allow-empty
</c... | 40,166,605 | 2 | 4 | null | 2016-10-20 07:47:48.42 UTC | 20 | 2016-10-21 01:24:46.13 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 404,623 | null | 1 | 50 | git|cherry-pick|git-cherry-pick | 43,979 | <p>My understanding based off <a href="//stackoverflow.com/a/12628579/2747593">this answer</a> is that parent 1 is the branch being merged into, and parent 2 is the branch being merged from. So in your case, parent 1 is <code>A</code>, and parent 2 is <code>B</code>. Since a cherry-pick is really applying the diff betw... |
4,966,592 | Hadoop safemode recovery - taking too long! | <p>I have a Hadoop cluster with 18 data nodes.
I restarted the name node over two hours ago and the name node is still in safe mode.</p>
<p>I have been searching for why this might be taking too long and I cannot find a good answer.
The posting here:
<a href="https://stackoverflow.com/questions/2792020/hadoop-safemode... | 5,020,881 | 2 | 3 | null | 2011-02-11 07:28:07.597 UTC | 11 | 2019-08-15 06:50:30.547 UTC | 2017-05-23 12:26:19.87 UTC | null | -1 | null | 612,644 | null | 1 | 28 | hadoop|safe-mode | 35,194 | <p>I had it once, where some blocks were never reported in. I had to forcefully let the namenode leave safemode (<code>hadoop dfsadmin -safemode leave</code>) and then run an fsck to delete missing files.</p> |
1,180,606 | Using subprocess.Popen for Process with Large Output | <p>I have some Python code that executes an external app which works fine when the app has a small amount of output, but hangs when there is a lot. My code looks like:</p>
<pre><code>p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
errcode = p.wait()
retval = p.stdout.read()
errmes... | 1,180,641 | 7 | 1 | null | 2009-07-24 23:08:07.763 UTC | 12 | 2018-03-29 05:41:11.857 UTC | 2009-07-25 19:40:14.307 UTC | null | 12,855 | null | 5,284 | null | 1 | 39 | python|subprocess | 26,844 | <p>You're doing blocking reads to two files; the first needs to complete before the second starts. If the application writes a lot to <code>stderr</code>, and nothing to <code>stdout</code>, then your process will sit waiting for data on <code>stdout</code> that isn't coming, while the program you're running sits ther... |
36,350 | How to pass a single object[] to a params object[] | <p>I have a method which takes params object[] such as:</p>
<pre><code>void Foo(params object[] items)
{
Console.WriteLine(items[0]);
}
</code></pre>
<p>When I pass two object arrays to this method, it works fine:</p>
<pre><code>Foo(new object[]{ (object)"1", (object)"2" }, new object[]{ (object)"3", (object)"4"... | 36,367 | 7 | 0 | null | 2008-08-30 21:22:06.433 UTC | 15 | 2022-06-26 10:17:37.633 UTC | 2008-08-31 06:35:08.897 UTC | Rob Cooper | 832 | buyutec | 31,505 | null | 1 | 128 | c#|arrays | 131,263 | <p>A simple typecast will ensure the compiler knows what you mean in this case.</p>
<pre><code>Foo((object)new object[]{ (object)"1", (object)"2" }));
</code></pre>
<p>As an array is a subtype of object, this all works out. Bit of an odd solution though, I'll agree.</p> |
32,034 | In C#, isn't the observer pattern already implemented using Events? | <p>After reading the Head First Design Patterns book and using a number of other design patterns, I'm trying to understand the Observer pattern. Isn't this already implemented using Events in the .NET Framework?</p> | 32,036 | 8 | 0 | null | 2008-08-28 11:36:52.297 UTC | 9 | 2016-02-24 10:50:19.637 UTC | 2016-02-24 10:50:19.637 UTC | null | 4,454,567 | Sean Chambers | 2,993 | null | 1 | 33 | c#|.net|design-patterns | 13,730 | <p>Yes, it is. The observer pattern is also called the publish/subscribe pattern, which is exactly what events allow you to do.</p> |
76,327 | How can I prevent Java from creating hsperfdata files? | <p>I'm writing a Java application that runs on Linux (using Sun's JDK). It keeps creating <code>/tmp/hsperfdata_username</code> directories, which I would like to prevent. Is there any way to stop java from creating these files?</p> | 76,423 | 8 | 0 | null | 2008-09-16 20:03:08.087 UTC | 11 | 2018-10-03 15:12:48.857 UTC | 2016-01-13 20:56:51.623 UTC | user719662 | null | null | 13,582 | null | 1 | 50 | java|performance|report | 76,136 | <p>Try JVM option <strong>-XX:-UsePerfData</strong></p>
<p><a href="http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html" rel="noreferrer">more info</a></p>
<p>The following might be helpful that is from link <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/unix/java.html" rel="n... |
936,969 | Formatting NSDate into particular styles for both year, month, day, and hour, minute, seconds | <p>I basically need to get current date and time separately, formatted as:</p>
<pre>
2009-04-26
11:06:54
</pre>
<p>The code below, from another question on the same topic, generates</p>
<pre>
now: |2009-06-01 23:18:23 +0100|
dateString: |Jun 01, 2009 23:18|
parsed: |2009-06-01 23:18:00 +0100|
</pre>
<... | 937,143 | 8 | 1 | null | 2009-06-01 21:48:28.35 UTC | 62 | 2017-05-09 15:50:50.39 UTC | 2016-03-03 21:25:39.67 UTC | null | 603,977 | null | 112,313 | null | 1 | 132 | cocoa|cocoa-touch|nsdate|nsdateformatter|date-formatting | 295,901 | <p>iPhone format strings are in <a href="http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns" rel="noreferrer">Unicode format</a>. Behind the link is a table explaining what all the letters above mean so you can build your own.</p>
<p>And of course don't forget to release your date formatters when you're... |
74,620 | Date.getTime() not including time? | <p>Can't understand why the following takes place:</p>
<pre><code>String date = "06-04-2007 07:05";
SimpleDateFormat fmt = new SimpleDateFormat("MM-dd-yyyy HH:mm");
Date myDate = fmt.parse(date);
System.out.println(myDate); //Mon Jun 04 07:05:00 EDT 2007
long timestamp = myDate.getTime();
System.out.println(timesta... | 74,652 | 9 | 2 | null | 2008-09-16 17:08:16.943 UTC | 1 | 2020-05-02 22:43:01.38 UTC | 2015-01-18 01:08:34.317 UTC | Hank Gay | 1,264,804 | Jake | 10,675 | null | 1 | 7 | java|date|timestamp|gettime | 47,396 | <p>What milliseconds? You are providing only minutes information in the first example, whereas your second example grabs current date from the system with milliseconds, what is it you're looking for?</p>
<pre><code>String date = "06-04-2007 07:05:00.999";
SimpleDateFormat fmt = new SimpleDateFormat("MM-dd-yyyy HH:mm:s... |
1,001,290 | Console based progress in Java | <p>Is there are easy way to implement a rolling percentage for a process in Java, to be displayed in the console? I have a percentage data type (double) I generated during a particular process, but can I force it to the console window and have it refresh, instead of just printing a new line for each new update to the p... | 1,001,340 | 9 | 1 | null | 2009-06-16 12:51:48.15 UTC | 20 | 2018-02-27 18:13:02.697 UTC | 2015-01-06 08:45:25.243 UTC | null | 258,400 | null | 107,092 | null | 1 | 36 | java|console|progress-bar|refresh | 40,079 | <p>You can print a carriage return <code>\r</code> to put the cursor back to the beginning of line.</p>
<p>Example:</p>
<pre><code>public class ProgressDemo {
static void updateProgress(double progressPercentage) {
final int width = 50; // progress bar width in chars
System.out.print("\r[");
int i = 0;... |
592,931 | Why doesn't Python have static variables? | <p>There is a <a href="https://stackoverflow.com/questions/460586/simulating-a-local-static-variable-in-python">questions asking how to simulate static variables in python</a>.</p>
<p>Also, on the web one can find many different solutions to create static variables. (Though I haven't seen one that I like yet.)</p>
<p... | 593,046 | 9 | 2 | null | 2009-02-26 23:28:09.013 UTC | 18 | 2012-11-15 14:31:16.087 UTC | 2017-05-23 12:25:23.57 UTC | gs | -1 | gs | 24,587 | null | 1 | 47 | python | 31,994 | <p>The idea behind this omission is that static variables are only useful in two situations: when you really should be using a class and when you really should be using a generator.</p>
<p>If you want to attach stateful information to a function, what you need is a class. A trivially simple class, perhaps, but a clas... |
1,069,621 | Are members of a C++ struct initialized to 0 by default? | <p>I have this <code>struct</code>:</p>
<pre><code>struct Snapshot
{
double x;
int y;
};
</code></pre>
<p>I want <code>x</code> and <code>y</code> to be 0. Will they be 0 by default or do I have to do:</p>
<pre><code>Snapshot s = {0,0};
</code></pre>
<p>What are the other ways to zero out the structure?</p... | 1,069,634 | 9 | 2 | null | 2009-07-01 14:58:39.757 UTC | 80 | 2021-10-28 16:13:31.81 UTC | 2018-03-29 10:01:02.46 UTC | null | 72,178 | Sasha | null | null | 1 | 231 | c++ | 186,694 | <p>They are not null if you don't initialize the struct. </p>
<pre><code>Snapshot s; // receives no initialization
Snapshot s = {}; // value initializes all members
</code></pre>
<p>The second will make all members zero, the first leaves them at unspecified values. Note that it is recursive:</p>
<pre><code>struct Pa... |
370,518 | How do I start with working Sub-Version + Delphi? | <p>I'm new to this SCM, but since SVN is gaining popularity I was going to give it a try.</p>
<p>Things I noticed:</p>
<ol>
<li>SVN is only the backbone of the SCM, no front-end?</li>
<li>Why is there several versions of Windows Binaries? Tigris? SlikSVN? VisualSVN?</li>
<li>Do I need a Web Server like Apache in orde... | 370,528 | 10 | 3 | null | 2008-12-16 05:18:06.287 UTC | 18 | 2019-04-30 19:41:43.553 UTC | 2008-12-16 07:02:01.647 UTC | Atlas | 30,787 | Atlas | 30,787 | null | 1 | 16 | svn|delphi | 7,577 | <p><a href="http://blog.excastle.com/2007/04/09/subversion-in-delphis-tools-menu/" rel="nofollow noreferrer">Here's a great guide</a> for integrating TortoiseSVN with Delphi's "Tools" menu.</p>
<p>This site shows how to add the following into the IDE:</p>
<ol>
<li><p><code>svn Commit</code>: Opens the TortoiseSVN com... |
231,211 | Using Git how do I find changes between local and remote | <p>Here are two different questions but I think they are related.</p>
<ol>
<li><p>When using Git, how do I find which changes I have committed locally, but haven't yet pushed to a remote branch? I'm looking for something similar to the Mercurial command <code>hg outgoing</code>.</p></li>
<li><p>When using Git, how do ... | 231,379 | 11 | 1 | null | 2008-10-23 19:52:30.02 UTC | 64 | 2020-10-08 12:51:48.697 UTC | 2013-02-19 23:47:24.827 UTC | null | 2,354 | ejunker | 796 | null | 1 | 155 | git|mercurial | 104,157 | <p>Git can't send that kind of information over the network, like Hg can. But you can run <code>git fetch</code> (which is more like <code>hg pull</code> than <code>hg fetch</code>) to fetch new commits from your remote servers.</p>
<p>So, if you have a branch called <code>master</code> and a remote called <code>origi... |
598,913 | Most important things about C++ templates… lesson learned | <p>What are most important things you know about templates: hidden features, common mistakes, best and most useful practices, tips...<strong>common mistakes/oversight/assumptions</strong></p>
<p>I am starting to implement most of my library/API using templates and would like to collect most common patterns, tips, etc.... | 599,050 | 12 | 2 | null | 2009-02-28 23:47:18.92 UTC | 14 | 2022-07-29 13:21:07.17 UTC | 2009-03-01 01:30:55.817 UTC | strager | 39,992 | Sasha | null | null | 1 | 13 | c++|templates | 6,085 | <p>From <strong>"Exceptional C++ style", Item 7:</strong> function overload resolution happens <em>before</em> templates specialization. Do not mix overloaded function and specializations of template functions, or you are in for a nasty surprise at which function actually gets called.</p>
<pre><code>template<class ... |
335,293 | Human factors design (meeting psychological needs in UI design) | <p>Reading about the <a href="http://en.wikipedia.org/wiki/G.729" rel="nofollow noreferrer">G.729 codec</a>, I found this interesting tidbit about "<a href="http://en.wikipedia.org/wiki/Comfort_noise" rel="nofollow noreferrer">Comfort Noise</a>":</p>
<blockquote>
<p>A comfort noise generator (CNG) is
also set up b... | 488,259 | 12 | 0 | null | 2008-12-02 20:22:53.11 UTC | 26 | 2018-07-01 09:19:00.01 UTC | 2018-07-01 09:19:00.01 UTC | Rich B | 4,099,593 | Adam Davis | 2,915 | null | 1 | 29 | user-interface | 2,518 | <p>I think what you need to know varies depending upon the type of application you are trying to develop and the user environment it will be in.</p>
<p>From the enormous company/product perspective - it's wise to have an HMI/UI Style Guide that spells out the basic precepts developers should be using their interface d... |
683,462 | Best way to integrate Python and JavaScript? | <p>Is it possible to integrate Python and JavaScript? For example, imagine you wanted to be able to define classes in JavaScript and use them from Python (or vice versa). If so, what's the best way? I'm interested not only if this is possible but if <strong>anyone has done it within a "serious" project or product</s... | 683,481 | 13 | 4 | null | 2009-03-25 21:08:11.837 UTC | 36 | 2021-07-23 10:15:05.01 UTC | 2017-01-29 19:35:58.41 UTC | null | 1,577,341 | Jacob Gabrielson | 68,127 | null | 1 | 71 | javascript|python|brython|transcrypt|rapydscript | 131,739 | <p>Here's something, a Python wrapper around the SeaMonkey Javascript interpreter... <a href="http://pypi.python.org/pypi/python-spidermonkey" rel="noreferrer">http://pypi.python.org/pypi/python-spidermonkey</a></p> |
192,957 | Efficiently querying one string against multiple regexes | <p>Lets say that I have 10,000 regexes and one string and I want to find out if the string matches any of them and get all the matches.
The trivial way to do it would be to just query the string one by one against all regexes. Is there a faster,more efficient way to do it? </p>
<p>EDIT:
I have tried substituting it wi... | 1,346,398 | 18 | 2 | null | 2008-10-10 20:42:16.683 UTC | 22 | 2019-09-02 15:34:27.287 UTC | 2008-10-10 21:41:15.503 UTC | Sridhar Iyer | 13,820 | Sridhar Iyer | 13,820 | null | 1 | 54 | regex|algorithm|pcre | 13,186 | <p><a href="http://sulzmann.blogspot.com/" rel="noreferrer">Martin Sulzmann</a> Has done quite a bit of work in this field.
He has <a href="http://hackage.haskell.org/cgi-bin/hackage-scripts/package/regexpr-symbolic" rel="noreferrer">a HackageDB project</a> explained breifly <a href="http://sulzmann.blogspot.com/2008/1... |
129,628 | What is declarative programming? | <p>I keep hearing this term tossed around in several different contexts. What is it?</p> | 129,639 | 18 | 4 | null | 2008-09-24 20:15:26.857 UTC | 75 | 2018-04-17 06:48:11.387 UTC | 2008-09-29 11:25:20.603 UTC | Sam Hasler | 2,541 | Brian | 3,208 | null | 1 | 193 | programming-languages|declarative|glossary | 127,961 | <p>Declarative programming is when you write your code in such a way that it describes what you want to do, and not how you want to do it. It is left up to the compiler to figure out the how. </p>
<p>Examples of declarative programming languages are SQL and Prolog.</p> |
374,644 | How do I capture response of form.submit | <p>I have the following code:</p>
<pre><code><script type="text/javascript">
function SubmitForm()
{
form1.submit();
}
function ShowResponse()
{
}
</script>
.
.
.
<div>
<a href="#" onclick="SubmitForm();">Click</a>
</di... | 374,677 | 20 | 0 | null | 2008-12-17 14:15:01.85 UTC | 43 | 2020-09-25 20:58:30.71 UTC | 2019-10-17 10:06:49.843 UTC | sblundy | 4,370,109 | Ngm | 46,279 | null | 1 | 158 | javascript|forms|dom-events|form-submit | 424,425 | <p>You won't be able to do this easily with plain javascript. When you post a form, the form inputs are sent to the server and your page is refreshed - the data is handled on the server side. That is, the <code>submit()</code> function doesn't actually return anything, it just sends the form data to the server.</p>
<p... |
511,761 | js function to get filename from url | <p>I have a url like <a href="http://www.example.com/blah/th.html" rel="noreferrer">http://www.example.com/blah/th.html</a></p>
<p>I need a javascript function to give me the 'th' value from that.</p>
<p>All my urls have the same format (2 letter filenames, with .html extension).</p>
<p>I want it to be a safe functi... | 17,143,667 | 23 | 2 | null | 2009-02-04 15:11:45.09 UTC | 12 | 2022-08-13 01:35:11.267 UTC | null | null | null | Blankman | 39,677 | null | 1 | 76 | javascript|function | 93,178 | <pre><code>var filename = url.split('/').pop()
</code></pre> |
6,934,752 | Combining multiple commits before pushing in Git | <p>I have a bunch of commits on my local repository which are thematically similar. I'd like to combine them into a single commit before pushing up to a remote. How do I do it? I think <code>rebase</code> does this, but I can't make sense of the docs.</p> | 6,934,882 | 8 | 4 | null | 2011-08-04 00:04:00.567 UTC | 183 | 2022-05-21 03:34:51.97 UTC | 2014-06-06 08:09:07.86 UTC | user456814 | null | null | 288,843 | null | 1 | 465 | git|git-squash | 322,720 | <p>What you want to do is referred to as "squashing" in git. There are lots of options when you're doing this (too many?) but if you just want to merge all of your unpushed commits into a single commit, do this:</p>
<pre><code>git rebase -i origin/master
</code></pre>
<p>This will bring up your text editor (<code>-i... |
6,563,091 | Can Excel interpret the URLs in my CSV as hyperlinks? | <p>Can Excel interpret the URLs in my CSV as hyperlinks? If so, how?</p> | 8,027,013 | 9 | 1 | null | 2011-07-03 13:13:26.97 UTC | 7 | 2022-05-25 19:15:35.887 UTC | 2011-07-03 13:54:37.56 UTC | null | 343,238 | null | 618,355 | null | 1 | 76 | excel|csv|hyperlink | 52,306 | <p>You can actually do this and have Excel show a clickable link. Use this format in the CSV file:</p>
<pre><code>=HYPERLINK("URL")
</code></pre>
<p>So the CSV would look like:</p>
<pre><code>1,23.4,=HYPERLINK("http://www.google.com")
</code></pre>
<p>However, I'm trying to get some links with commas in them to wo... |
15,987,014 | How to remove jQuery Mobile styling? | <p>I chose jQuery Mobile over other frameworks for its animation capabilities and dynamic pages support.</p>
<p>However, I'm running into troubles with styling. I'd like to keep the basic page style in order to perform page transitions. But I also need to fully customize the look'n feel of headers, listviews, buttons,... | 15,997,162 | 5 | 3 | null | 2013-04-13 10:50:37.643 UTC | 12 | 2015-06-12 09:57:50.167 UTC | 2015-06-12 09:57:50.167 UTC | null | 1,848,600 | null | 79,445 | null | 1 | 31 | javascript|html|css|jquery-mobile | 36,691 | <h2>Methods of markup enhancement prevention:</h2>
<p>This can be done in few ways, sometimes you will need to combine them to achieve a desired result.</p>
<ul>
<li><p>Method 1:</p>
<p>It can do it by adding this attribute:</p>
<pre><code>data-enhance="false"
</code></pre>
<p>to the header, content, footer contai... |
15,873,153 | Explanation of Algorithm for finding articulation points or cut vertices of a graph | <p>I have searched the net and could not find any explanation of a DFS algorithm for finding all articulation vertices of a graph. There is not even a wiki page.</p>
<p>From reading around, I got to know the basic facts from here. <a href="https://web.archive.org/web/20130718095926/http://sydney.edu.au/engineering/it/... | 16,203,988 | 4 | 5 | null | 2013-04-08 07:04:42.64 UTC | 15 | 2021-07-23 01:29:05.157 UTC | 2021-07-23 01:29:05.157 UTC | null | 553,073 | null | 728,407 | null | 1 | 34 | algorithm|graph|complexity-theory|graph-algorithm|depth-first-search | 51,279 | <p>Finding articulation vertices is an application of DFS.</p>
<p>In a nutshell,</p>
<ol>
<li>Apply DFS on a graph. Get the DFS tree.</li>
<li>A node which is visited earlier is a "parent" of those nodes which are reached by it and visited later.</li>
<li>If any child of a node does not have a path to any of the ance... |
15,882,326 | Angular, onLoad function on an iFrame | <p>I have this iframe working with basic JavaScript:</p>
<pre><code><iframe id="upload_iframe" name="upload_iframe" onLoad="uploadDone();"></iframe>
</code></pre>
<p>Which triggers the method <code>uploadDone();</code> when the content of the iframe has been loaded.</p>
<p>How do I do the same thing in A... | 15,882,735 | 5 | 0 | null | 2013-04-08 14:53:44.39 UTC | 15 | 2021-03-14 21:43:46.167 UTC | 2014-11-26 21:27:06.637 UTC | null | 303,914 | null | 1,180,686 | null | 1 | 56 | iframe|angularjs | 81,284 | <p>try defining the function within controller as:</p>
<pre><code>window.uploadDone=function(){
/* have access to $scope here*/
}
</code></pre> |
15,607,873 | What does the * * CSS selector do? | <p>Recently I came across <code>* *</code> in <a href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets" rel="noreferrer">CSS</a>.</p>
<p>Site reference - <a href="http://semlabs.co.uk/journal/how-to-stop-your-wordpress-blog-getting-hacked" rel="noreferrer">Site Link</a>.</p>
<p>For a single <code>*</code> usage i... | 15,607,906 | 5 | 0 | null | 2013-03-25 04:52:52.253 UTC | 27 | 2014-12-18 08:09:25.197 UTC | 2013-07-04 18:58:53.373 UTC | null | 639,406 | null | 639,406 | null | 1 | 97 | html|css|css-selectors | 3,272 | <p>Just like any other time you put two selectors one after another (for example <code>li a</code>), you get the descendant combinator. So <code>* *</code> is any element that is a descendant of any other element — in other words, any element that <em>isn't</em> the root element of the whole document.</p> |
10,537,294 | Multiple string matches with indexOf() | <p>Im pretty sure my syntax this wrong because the script only works if the string matches "Video", if the string has the "word "Audio" it is ignored. Also since the href tags have a value of "#" the redirect for "../../../index.html" doesnt work.</p>
<p>js</p>
<pre><code>var ua = navigator.userAgent.toLowerCase();
v... | 10,537,354 | 9 | 5 | null | 2012-05-10 15:25:47.103 UTC | 13 | 2020-10-16 09:22:55.317 UTC | 2012-05-10 15:47:56.547 UTC | null | 54,680 | null | 1,159,429 | null | 1 | 24 | javascript|jquery|html | 69,426 | <p>It's far shorter to turn this into a regular expression.</p>
<pre><code>if ( srcTag.match( /(video|audio)/ ) ) {
/* Found */
} else {
/* Not Found */
}
</code></pre>
<p>On a side note, please don't do what you're attempting to do. Asking users to download Safari when they're using Internet Explorer 8 is doing ... |
10,299,901 | How do sites like goo.gl or jsfiddle generate their URL codes? | <p>I would like to generate a code like <a href="http://goo.gl/UEhtg" rel="noreferrer">goo.gl</a> and <a href="http://jsfiddle.net/XzKvP/" rel="noreferrer">jsfiddle</a> websites (<code>http://jsfiddle.net/XzKvP/</code>). </p>
<p>I tried different things that give me too large of a guid, a repeating alphanumeric code, ... | 17,592,413 | 3 | 7 | null | 2012-04-24 14:21:07.443 UTC | 17 | 2013-07-11 14:09:44.13 UTC | null | null | null | null | 442,580 | null | 1 | 26 | c#|algorithm | 3,321 | <p>The solutions based on a random substring are no good because the outputs will collide. It may happen prematurely (with bad luck), and it will eventually happen when the list of generated values grows large. It doesn't even have to be that large for the probability of collisions to become high (see <a href="http://e... |
13,696,906 | Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension | <p>I have tried many ways( all documented procedures)to inject script into a specific page upon checking URL at onUpdated.addListener. Finally the below code with 'executescript' seems to work, but not perfectly. I could able to get alerts but can not able to find document elements of the page through getElementById/ge... | 13,696,976 | 3 | 0 | null | 2012-12-04 05:52:17.497 UTC | 9 | 2017-08-11 12:55:36.623 UTC | 2017-08-11 12:55:36.623 UTC | null | 2,724,961 | null | 1,865,673 | null | 1 | 32 | google-chrome|google-chrome-extension | 70,499 | <p><strong>UPDATE:</strong> Finally figured out your problem. In eventPage.js, you tried to inject js/Leoscript.js, which is NOT whitelisted, instead of js/LeoScript.js (with a capital 'S'), which is whitelisted. Note that URLs are <em>case-sensitive</em>!</p>
<pre><code>chrome.tabs.executeScript(tabId, {file: 'js/Leo... |
13,678,993 | How should I test a Future in Dart? | <p>How can one test a method that returns <code>Future</code> before the test runner completes? I have a problem where my unit test runner completes before the asynchronous methods are completed. </p> | 13,678,996 | 6 | 0 | null | 2012-12-03 07:36:20.083 UTC | 3 | 2020-12-04 04:38:40.613 UTC | 2013-02-07 00:45:17.763 UTC | null | 123,471 | null | 1,127,340 | null | 1 | 33 | unit-testing|dart | 14,470 | <p>Full example of how to test with the <code>completion</code> matcher is as follows.</p>
<pre class="lang-java prettyprint-override"><code>import 'package:unittest/unittest.dart';
class Compute {
Future<Map> sumIt(List<int> data) {
Completer completer = new Completer();
int sum = 0;
data.f... |
13,590,139 | Remove numbers from alphanumeric characters | <p>I have a list of alphanumeric characters that looks like: </p>
<pre><code>x <-c('ACO2', 'BCKDHB456', 'CD444')
</code></pre>
<p>I would like the following output: </p>
<pre><code>x <-c('ACO', 'BCKDHB', 'CD')
</code></pre>
<p>Any suggestions?</p>
<pre><code># dput(tmp2)
structure(c(432L, 326L, 217L, 371L,... | 13,590,204 | 4 | 0 | null | 2012-11-27 17:52:16.663 UTC | 14 | 2021-09-01 20:40:26.003 UTC | 2016-02-29 22:25:07.363 UTC | null | 680,068 | null | 1,791,307 | null | 1 | 56 | regex|r | 93,695 | <p>You can use <code>gsub</code> for this:</p>
<pre><code>gsub('[[:digit:]]+', '', x)
</code></pre>
<p>or</p>
<pre><code>gsub('[0-9]+', '', x)
# [1] "ACO" "BCKDHB" "CD"
</code></pre> |
13,366,730 | Proper REST response for empty table? | <p>Let's say you want to get list of users by calling <code>GET</code> to <code>api/users</code>, but currently the table was truncated so there are no users. What is the proper response for this scenario: <code>404</code> or <code>204</code>?</p> | 13,367,198 | 5 | 5 | null | 2012-11-13 18:43:33.267 UTC | 26 | 2021-03-26 10:57:28.317 UTC | 2021-03-26 10:57:28.317 UTC | null | 9,213,345 | null | 748,789 | null | 1 | 141 | http|rest | 54,630 | <p>I'd say, neither.</p>
<h2>Why not 404 (Not Found) ?</h2>
<p>The 404 status code should be reserved for situations, in which a resource is not found. In this case, your resource is <em>a collection of users</em>. This collection exists but it's currently empty. Personally, I'd be very confused as an author of a cli... |
20,581,920 | Static IP Address with Heroku (not Proximo) | <p>Is there a way to get one Static IP address for a Heroku Server? I'm trying to integrate various API's which ask for an IP address. Because of Heroku's server setup, you never have one server with a static IP - instead your IP is dynamic.</p>
<p>I've looked into add-ons like Proximo, however this appears to be a pa... | 20,777,622 | 3 | 2 | null | 2013-12-14 10:03:20.373 UTC | 13 | 2019-05-13 06:05:46.093 UTC | null | null | null | null | 1,775,598 | null | 1 | 34 | heroku|ip|static-ip-address | 27,353 | <p>You can use <a href="https://addons.heroku.com/quotaguardstatic" rel="noreferrer">QuotaGuard Static</a> Heroku add-on.</p>
<p>QuotaGuard can be attached to a Heroku application via the command line:</p>
<pre><code>$ heroku addons:add quotaguardstatic
</code></pre>
<p>After installing, the application should be co... |
24,071,525 | What is the equivalent for java interfaces or objective c protocols in swift? | <p>I've been looking in to the new Swift language trying to find what's the equivalent for an interface(in java) or a protocol(in objective-c) in Swift, after surfing on the internet and searching in the book provided by Apple, I still can't seem to find it.</p>
<p>Does any one know what's the name of this component i... | 24,071,596 | 2 | 2 | null | 2014-06-05 22:54:38.68 UTC | 7 | 2017-11-06 20:27:46.307 UTC | 2017-06-30 15:42:40.713 UTC | null | 1,033,581 | null | 1,965,099 | null | 1 | 32 | ios|macos|interface|protocols|swift | 37,528 | <p><a href="https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Protocols.html" rel="noreferrer">Protocols in Swift</a> are very similar to Objc, except you may use them not only on classes, but also on structs and enums.</p>
<pre><code>protocol SomeProtocol {
var... |
3,837,394 | MongoDB map/reduce over multiple collections? | <p>First, the background. I used to have a collection <code>logs</code> and used map/reduce to generate various reports. Most of these reports were based on data from within a single day, so I always had a condition <code>d: SOME_DATE</code>. When the <code>logs</code> collection grew extremely big, inserting became ex... | 3,837,773 | 2 | 0 | null | 2010-10-01 08:01:10.8 UTC | 13 | 2017-12-01 21:26:25.897 UTC | 2010-10-01 08:27:39.803 UTC | null | 5,475 | null | 5,475 | null | 1 | 16 | mongodb|mapreduce | 17,600 | <p>A reduce function may be called once, with a key and <strong>all corresponding values</strong> (but only if there are multiple values for the key - it won't be called at all if there's only 1 value for the key).</p>
<p>It may also be called multiple times, each time with a key and only a <strong>subset of the corre... |
3,922,461 | Extract Column from data.frame as a Vector | <p>I'm new to R.</p>
<p>I have a a Data.frame with a column called "Symbol".</p>
<pre><code> Symbol
1 "IDEA"
2 "PFC"
3 "RPL"
4 "SOBHA"
</code></pre>
<p>I need to store its values as a vector(<code>x = c("IDEA","PFC","RPL","SOBHA")</code>). Which is the most concise way of doing this?</p> | 3,922,499 | 2 | 0 | null | 2010-10-13 09:53:36.003 UTC | 7 | 2020-12-05 07:03:03.207 UTC | 2016-12-01 15:44:05.697 UTC | null | 2,040,375 | null | 216,517 | null | 1 | 27 | r|vector|dataframe | 80,500 | <pre><code>your.data <- data.frame(Symbol = c("IDEA","PFC","RPL","SOBHA"))
new.variable <- as.vector(your.data$Symbol) # this will create a character vector
</code></pre>
<p>VitoshKa suggested to use the following code.</p>
<pre><code>new.variable.v <- your.data$Symbol # this will retain the factor nature of... |
3,463,256 | What are some great Quartz 2D drawing tutorials? | <p>I'm searching for some great Quartz 2D drawing tutorials aimed at the iPhone. I'm new to Quartz and want to start off with something easy and then progress to more difficult stuff.</p>
<p>Does anyone know of any Quartz 2D drawing tutorials that they would recommend?</p> | 3,464,136 | 2 | 0 | null | 2010-08-11 22:10:57.12 UTC | 24 | 2019-06-08 09:57:27.99 UTC | 2010-08-12 01:38:38.38 UTC | null | 19,679 | null | 414,336 | null | 1 | 30 | iphone|core-graphics|quartz-graphics | 16,847 | <p>I devoted an entire class to Quartz 2D drawing last semester in my advanced iPhone development course. The video for that is available <a href="https://podcasts.apple.com/us/podcast/advanced-iphone-development-spring-2010/id407243032" rel="nofollow noreferrer">on iTunes U</a>, along with the rest of the class. The... |
3,369,791 | Java VM tuning - Xbatch and -Xcomp | <p>I am looking at the JVM configuration options for running Alfresco, mainly <a href="http://wiki.alfresco.com/wiki/JVM_Tuning" rel="noreferrer">this</a> document on the <a href="http://wiki.alfresco.com/wiki/Main_Page" rel="noreferrer">Alfresco Wiki</a>. One of the recommendations is to use the JVM flags <code>-Xcomp... | 3,439,450 | 2 | 2 | null | 2010-07-30 08:27:13.297 UTC | 10 | 2012-07-29 14:48:35.013 UTC | 2012-07-27 23:01:11.587 UTC | null | 1,288 | null | 68,283 | null | 1 | 34 | java|jvm|jvm-hotspot|jvm-arguments | 11,353 | <p>Generally speaking, it's always preferable to let HotSpot compiler tune itself. Even using Server VM (-server) is default for 64bits and some 'server-class' machines.</p>
<p>-Xbatch was intended mostly for debugging as described in <a href="http://blogs.oracle.com/fatcatair/entry/more_tiered_compilation" rel="noref... |
3,684,421 | What is WCF RIA services? | <p>I hate MSDN's site for WCF RIA services. It does not say what it is, it only says what it does. It says what it can achieve but does not say why I need it. </p>
<p>For example:</p>
<blockquote>
<p>"A common problem when developing an
n-tier RIA solution is coordinating
application logic between the middle
... | 3,684,710 | 2 | 4 | null | 2010-09-10 12:00:28.477 UTC | 25 | 2016-03-28 06:58:40.677 UTC | 2011-03-05 16:46:07.907 UTC | null | 440,502 | null | 440,502 | null | 1 | 103 | c#|.net|wcf|ria | 63,447 | <p>RIA services is a server-side technology that automatically generates client-side (Silverlight) objects that take care of the communication with the server for you and provide client-side validation.</p>
<p>The main object inside a RIA service is a <a href="http://msdn.microsoft.com/en-us/library/system.servicemode... |
28,644,616 | Android - EditText gives IndexOutOfBounds Exception while using textAllCaps | <p>I'm trying to create a very simple registration page using a relative layout. This registration page is linked to a fragment called RegistrationFragment.</p>
<p>I have five EditText fields for this layout: name, phone number, email, password, and confirm password. For some reason, I can enter text into password and... | 28,803,492 | 4 | 4 | null | 2015-02-21 10:17:24.083 UTC | 7 | 2021-07-18 13:30:12.363 UTC | 2015-04-04 10:42:28.367 UTC | null | 3,535,925 | null | 3,866,448 | null | 1 | 47 | android|android-fragments|android-edittext | 12,224 | <p>I had the same problem with <code>textAllCaps</code> for <code>EditText</code> in my application.</p>
<blockquote>
<p>I have found that <code>textAllCaps</code> is a property for <code>TextView</code> only. You can not use this property for <code>EditText</code>.</p>
</blockquote>
<p>So, I did R&D for it and fou... |
9,189,575 | git submodule tracking latest | <p>We are moving our (huge) project to git and we are thinking about using submodules. Our plan is to have three different heads in the superproject:</p>
<blockquote>
<p>release, stable, latest</p>
</blockquote>
<p>The project leads will handle the release and stable branches. They will move the submodules as required.... | 9,189,815 | 1 | 2 | null | 2012-02-08 08:00:41.6 UTC | 76 | 2021-08-21 11:50:40.28 UTC | 2021-05-30 08:29:27.457 UTC | null | 12,632,699 | null | 226,889 | null | 1 | 172 | git|git-submodules|git-track | 131,072 | <p>Edit (2020.12.28): GitHub change default <strong>master</strong> branch to <strong>main</strong> branch since October 2020. See <a href="https://github.com/github/renaming" rel="noreferrer">https://github.com/github/renaming</a><br />
This answer below still reflect the old naming convention.</p>
<hr />
<p>Update Ma... |
16,086,870 | Assert.That vs Assert.True | <p>What to prefer:</p>
<pre><code>Assert.That(obj.Foo, Is.EqualTo(true))
</code></pre>
<p>or</p>
<pre><code>Assert.True(obj.Foo)
</code></pre>
<p>For me, both asserts are equivalent, so which one should be prefered?</p> | 16,086,949 | 4 | 5 | null | 2013-04-18 15:19:50.103 UTC | 2 | 2018-05-10 14:54:31.947 UTC | 2018-05-10 14:54:31.947 UTC | null | 23,512 | null | 967,164 | null | 1 | 43 | c#|unit-testing|nunit | 57,861 | <p>In this particular case, there is no difference: you will see the output of roughly the same level of detail (i.e. it tells you that something that was expected to evaluate to <code>true</code> has evaluated to <code>false</code>). Same goes for</p>
<pre><code>Assert.IsTrue(obj.Foo);
</code></pre>
<p>and</p>
<pre... |
16,156,594 | How to change border color of textarea on :focus | <p>I want to change border color of TEXTAREA on focus. But my code doesn't seem to working properly.</p>
<p>The code is on <a href="http://fiddle.jshell.net/ffS4S/" rel="noreferrer">fiddle</a>.</p>
<pre class="lang-html prettyprint-override"><code><form name = "myform" method = "post" action=&quo... | 16,156,683 | 9 | 1 | null | 2013-04-22 20:58:47.88 UTC | 33 | 2022-04-22 19:26:09.11 UTC | 2022-04-21 08:38:27.103 UTC | null | 5,446,749 | null | 2,207,792 | null | 1 | 191 | html|css | 499,075 | <pre class="lang-css prettyprint-override"><code>.input:focus {
outline: none !important;
border:1px solid red;
box-shadow: 0 0 10px #719ECE;
}
</code></pre> |
29,130,208 | How to redirect to an external URL | <p>When trying to redirect to an external page using <code>$window.location.href</code>, the page is just refreshing and not redirecting to the expected URL.</p> | 29,130,767 | 2 | 8 | null | 2015-03-18 18:42:40.84 UTC | null | 2018-03-19 17:54:36.1 UTC | 2015-10-08 16:18:26.693 UTC | null | 1,486,275 | null | 4,686,777 | null | 1 | 16 | angularjs | 48,990 | <pre><code><html ng-app="myApp">
<head>
</head>
<body ng-controller="myCtrl">
<p> <a href="https://www.google.co.in/"><button>Click me to redirect from template</button></a></p>
<p ng-click="myFunction()"> <button>Click me to redirect from ... |
14,964,649 | Loop through all the records of datablock in Oracle forms | <p>I am trying to learn Oracle forms (v6.0). In a when-button-pressed trigger I am trying to loop through all of the records from a datablock. So far I have following code:</p>
<pre><code>BEGIN
GO_BLOCK('MY_BLOCK');
FIRST_RECORD;
LOOP
MESSAGE(:MY_BLOCK.DSP_NAME);
EXIT WHEN :SYSTEM.LAST_RECORD = 'TR... | 14,965,634 | 2 | 0 | null | 2013-02-19 18:22:35.4 UTC | null | 2014-03-25 08:54:50.037 UTC | null | null | null | null | 303,605 | null | 1 | 8 | forms|oracle | 65,928 | <p>Your loop is correct. I suspect the last message is showing up in the status bar at the bottom of the form instead of as a popup window.</p> |
17,464,515 | How do I clear the text in Android TextView? | <p>So I have an Android program like so: </p>
<pre><code>package com.example.androiddemo;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
public class AndroidDemo extends Activity {
... | 17,464,568 | 5 | 2 | null | 2013-07-04 07:41:53.013 UTC | null | 2019-10-07 06:31:52.887 UTC | 2013-07-04 08:29:11.48 UTC | null | 494,879 | null | 1,894,684 | null | 1 | 6 | android|android-edittext|onclicklistener | 43,036 | <p>Try this,</p>
<pre><code>public class AndroidDemo extends Activity implements OnClickListener{
Button add, clear;
EditText text;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
add = (Button) findViewById(... |
24,625,687 | Swift - UIImagePickerController - how to use it? | <p>I am trying hard to understand how this works, but it's pretty hard for me. =)
I have 1 view, there is one button and one small ImageView area for preview.
The button triggers imagepickercontroller, and the UIView will display picked image.
There is no error but the image doesn't show in the UIImageView area. </p>
... | 24,626,808 | 6 | 4 | null | 2014-07-08 07:07:54.523 UTC | 11 | 2021-11-08 07:46:23.827 UTC | 2021-11-08 07:46:23.827 UTC | null | 8,090,893 | null | 3,806,731 | null | 1 | 50 | ios|swift|xcode|cocoa-touch|uiimagepickercontroller | 95,195 | <p>You're grabbing a <code>UIImage</code> named <code>UIImagePickerControllerOriginalImage</code> and there exists no such image. You're meant to grab the <code>UIImage</code> with the key <code>UIImagePickerControllerOriginalImage</code> from the <code>editingInfo</code> dictionary:</p>
<pre><code>let tempImage = edi... |
24,661,857 | Ruby: colon before vs after | <p>When using Ruby, I keep getting mixed up with the <code>:</code>.</p>
<p>Can someone please explain when I'm supposed to use it before the variable name, like <code>:name</code>, and when I'm supposed to use it after the variable like <code>name:</code>?</p>
<p>An example would be sublime.</p> | 24,661,893 | 4 | 5 | null | 2014-07-09 19:06:15.62 UTC | 19 | 2017-08-13 16:58:10.64 UTC | 2017-08-13 16:58:10.64 UTC | null | 3,924,118 | null | 2,022,751 | null | 1 | 95 | ruby | 40,142 | <p>You are welcome for both, while creating <code>Hash</code> :</p>
<pre><code>{:name => "foo"}
#or
{name: 'foo'} # This is allowed since Ruby 1.9
</code></pre>
<p>But basically <code>:name</code> is a <a href="http://www.ruby-doc.org/core-2.1.2/Symbol.html"><code>Symbol</code></a> object in Ruby.</p>
<p>From <a ... |
22,264,502 | In Rust, what is the difference between clone() and to_owned()? | <p>In Rust, <code>Clone</code> is a trait that specifies the <code>clone</code> method (and <code>clone_from</code>). Some traits, like <code>StrSlice</code> and <code>CloneableVector</code> specify a <code>to_owned</code> fn. Why would an implementation need both? What is the difference?</p>
<p>I did an experimen... | 22,265,792 | 1 | 3 | null | 2014-03-08 03:09:52.33 UTC | 12 | 2022-08-05 18:40:48.353 UTC | 2016-09-24 15:32:31.153 UTC | null | 871,012 | null | 871,012 | null | 1 | 92 | rust | 35,105 | <p><code>.clone()</code> returns its receiver. <code>clone()</code> on a <code>&str</code> returns a <code>&str</code>. If you want a <code>String</code>, you need a different method, which in this case is <code>.to_owned()</code>.</p>
<p>For most types, <code>clone()</code> is sufficient because it's only defi... |
37,429,519 | Font Awesome error: downloadable font: rejected by sanitizer | <blockquote>
<p>downloadable font: rejected by sanitizer (font-family: "FontAwesome"
style:normal weight:normal stretch:normal src index:1) source:
<a href="http://192.168.1.254/theme/font-awesome/fonts/fontawesome-webfont.woff2?v=4.6.3" rel="noreferrer">http://192.168.1.254/theme/font-awesome/fonts/fontawesome-w... | 37,429,520 | 5 | 2 | null | 2016-05-25 06:37:55.6 UTC | 2 | 2022-09-13 07:24:51.973 UTC | 2019-09-19 13:27:56.857 UTC | null | 2,088,053 | null | 5,463,169 | null | 1 | 14 | html|css|firefox|fonts|font-awesome | 40,410 | <p>Remove the <code>?v=4.6.3</code> and remaining tail from this block (<code>font-awesome.css</code> / <code>font-awesome.min.css</code>).</p>
<pre class="lang-css prettyprint-override"><code>@font-face {
font-family: 'FontAwesome';
src: url('../fonts/fontawesome-webfont.eot?v=4.6.3');
src: url('../fonts/fontaw... |
27,078,285 | Simple throttle in JavaScript | <p>I am looking for a simple throttle in JavaScript. I know libraries like lodash and underscore have it, but only for one function it will be overkill to include any of those libraries.</p>
<p>I was also checking if jQuery has a similar function - could not find.</p>
<p><a href="https://remysharp.com/2010/07/21/thrott... | 27,078,401 | 24 | 5 | null | 2014-11-22 14:09:06.727 UTC | 35 | 2022-09-24 06:34:31.973 UTC | 2021-09-23 07:56:41.037 UTC | null | 1,480,391 | null | 1,806,399 | null | 1 | 118 | javascript|jquery|throttling | 130,378 | <p>I would use the <a href="https://github.com/jashkenas/underscore/blob/master/underscore.js" rel="noreferrer" title="underscore.js">underscore.js</a> or <a href="https://lodash.com" rel="noreferrer">lodash</a> source code to find a well tested version of this function.</p>
<p>Here is the slightly modified version of ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.