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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,040,681 | XCode 4.3 Unable to load persistent store UserDictionary.sqlite | <p>I have been working on an iOS app for some time, all of a sudden I am getting the following crash every time I run the app in the iOS 5.1 Simulator. </p>
<p>The App does not use Core Data and I am not sure what brought this about. </p>
<p>I have deleted the app from the simulator, done Clean, and a rebuild but not... | 11,042,584 | 2 | 3 | null | 2012-06-14 20:13:21.603 UTC | 10 | 2013-03-16 23:46:11.477 UTC | 2013-03-16 23:46:11.477 UTC | null | 1,457,196 | null | 1,457,196 | null | 1 | 42 | iphone|ios|xcode|store|persistent | 5,141 | <p>I have fixed the problem. I clicked 'iOS Simulator' -> Reset Content and Settings</p> |
11,078,016 | Change event on select with knockout binding, how can I know if it is a real change? | <p>I am building a permissions UI, I have a list of permissions with a select list next to each permission. The permissions are represented by an observable array of objects which are bound to a select list:</p>
<pre><code><div data-bind="foreach: permissions">
<div class="permission_row">
&... | 20,397,649 | 11 | 0 | null | 2012-06-18 06:42:56.477 UTC | 18 | 2021-01-20 12:49:15.117 UTC | 2020-12-15 11:08:06.577 UTC | null | 1,783,163 | null | 333,466 | null | 1 | 95 | knockout.js | 173,241 | <p>Actually <strong>you want to find whether the event is triggered by user or program</strong> , and its obvious that event will trigger while initialization.</p>
<p>The knockout approach of adding <code>subscription</code> won't help in all cases, why because in most of the model will be implemented like this</p>
<... |
11,223,403 | What are the differences between Clojure, Scheme/Racket and Common Lisp? | <p>I know they are dialects of the same family of language called lisp, but what exactly are the differences? Could you give an overview, if possible, covering topics such as syntax, characteristics, features and resources.</p> | 11,223,779 | 4 | 6 | null | 2012-06-27 09:44:28.293 UTC | 41 | 2017-03-05 14:25:12.173 UTC | 2012-06-27 16:35:30.897 UTC | null | 898,073 | null | 1,031,791 | null | 1 | 143 | clojure|lisp|scheme|common-lisp|racket | 39,717 | <p>They all have a lot in common:</p>
<ul>
<li>Dynamic languages</li>
<li><a href="http://en.wikipedia.org/wiki/Strong_typing" rel="noreferrer">Strongly typed</a></li>
<li>Compiled</li>
<li>Lisp-style syntax, i.e. code is written as a Lisp data structures (forms) with the most common pattern being function calls like:... |
10,995,165 | What is the opposite of :hover (on mouse leave)? | <p>Is there any way to do the opposite of <code>:hover</code> <strong>using only</strong> CSS? As in: if <code>:hover</code> is <code>on Mouse Enter</code>, is there a CSS equivalent to <code>on Mouse Leave</code>?</p>
<p>Example:</p>
<p>I have a HTML menu using list items. When I hover one of the items, there is a C... | 10,995,287 | 12 | 8 | null | 2012-06-12 10:51:01.953 UTC | 26 | 2022-09-09 22:26:13.153 UTC | 2017-11-20 16:30:38.063 UTC | null | 2,756,409 | null | 1,041,673 | null | 1 | 152 | css|hover | 299,452 | <p>If I understand correctly you could do the same thing by moving your transitions to the link rather than the hover state:</p>
<pre><code>ul li a {
color:#999;
transition: color 0.5s linear; /* vendorless fallback */
-o-transition: color 0.5s linear; /* opera */
-ms-transition: color 0.5s line... |
13,151,196 | How to cast from Object to Integer in VB.NET? | <p>How should I cast from an <code>Object</code> to an <code>Integer</code> in VB.NET?</p>
<p>When I do:</p>
<pre><code>Dim intMyInteger as Integer = TryCast(MyObject, Integer)
</code></pre>
<p>it says:</p>
<blockquote>
<p>TryCast operand must be reference type, but Integer is a value type.</p>
</blockquote> | 13,151,219 | 4 | 4 | null | 2012-10-31 04:15:39.133 UTC | 4 | 2017-04-03 16:39:26.703 UTC | null | null | null | null | 327,528 | null | 1 | 18 | vb.net|string|casting|integer | 44,014 | <p><code>TryCast</code> is the equivalent of C#'s <code>as</code> operator. It is a "safe cast" operator that doesn't throw an exception if the cast fails. Instead, it returns <code>Nothing</code> (<code>null</code> in C#). The problem is, you can't assign <code>Nothing</code> (<code>null</code>) (a reference type) to ... |
12,981,150 | iOS app with Django | <p>So we currently have a website that was created using Django. Now, we would like to create a native iOS app that uses the same backend, so we don't have to re-code the whole thing. From my understanding, there are two alternative routes:</p>
<p>1) Call directly Django URLs, which then calls a function. Within that ... | 12,981,293 | 3 | 0 | null | 2012-10-19 19:28:53.747 UTC | 15 | 2016-01-17 23:40:59.987 UTC | null | null | null | null | 1,248,709 | null | 1 | 19 | ios|django|restkit|tastypie | 18,105 | <p>I am currently working on an iOS app for iPhone, with Django / Tastypie in the backend. We do both 1 and 2. The resources are offered REST-style (after auth) via Tastypie, and any custom function calls (for example, creating a new user) are handled by views.py at various REST endpoints, which returns JSON.</p> |
12,693,423 | Clean way to throw php exception through jquery/ajax and json | <p>Is there a clean, easy way to throw php exceptions through a json response jquery/ajax call.</p> | 12,693,543 | 5 | 2 | null | 2012-10-02 15:29:45.34 UTC | 16 | 2019-05-05 10:17:01.507 UTC | null | null | null | null | 443,793 | null | 1 | 32 | php|jquery | 48,129 | <p>You could do something like this in PHP (assuming this gets called via AJAX):</p>
<pre><code><?php
try {
if (some_bad_condition) {
throw new Exception('Test error', 123);
}
echo json_encode(array(
'result' => 'vanilla!',
));
} catch (Exception $e) {
echo json_encode(array(... |
13,058,521 | Is this a bug in MonoTouch GC? | <blockquote>
<p>Note: <a href="http://dl.dropbox.com/u/76095045/MTMemoryTest.zip" rel="nofollow noreferrer">I've created a simple project</a>—you can see how switching types between <code>UIButton</code> and <code>CustomButton</code> in storyboard changes GC behavior.</p>
</blockquote>
<p>I'm trying to get my head w... | 13,059,140 | 1 | 1 | null | 2012-10-24 22:03:03.433 UTC | 25 | 2012-11-15 14:30:32.07 UTC | 2017-05-23 12:25:48.557 UTC | null | -1 | null | 458,193 | null | 1 | 33 | xamarin.ios|garbage-collection|xamarin | 9,591 | <p>This is an unfortunate side-effect of MonoTouch (who is garbage collected) having to live in a reference counted world (ObjectiveC).</p>
<p>There are a few pieces of information required to be able to understand what's going on:</p>
<ul>
<li>For every managed object (derived from NSObject), there is a correspondin... |
13,118,738 | Can you make newline characters \n display as breaks <br />? | <p>I'm trying to display emails with IMAP. When the email is text though, the newlines \n don't display properly. I'd rather not convert them to breaks < br /> because if the user wanted to reply to that email, it would now be in HTML instead of plain text. Is there perhaps a javascript function that could display i... | 13,118,763 | 3 | 0 | null | 2012-10-29 09:18:47.16 UTC | 4 | 2019-12-03 12:22:51.327 UTC | null | null | null | null | 778,352 | null | 1 | 36 | javascript|html|css|formatting | 30,005 | <p>How about HTML/CSS? If you put your text inside a <code><pre></code> tag, it will show all newlines exactly as they were. Alternatively, you can achieve the same effect by applying the CSS style <code>white-space:pre</code> to any element.</p>
<p>Don't forget to HTMLencode it still (<code><</code> to <code... |
16,808,471 | Ruby On Rails: way to create different seeds file for environments | <p>How can one make the task <code>rake db:seed</code> to use different seeds.rb file on production and development? </p>
<p>edit: any better strategy will be welcome</p> | 16,808,734 | 2 | 1 | null | 2013-05-29 08:02:27.92 UTC | 12 | 2015-12-02 19:14:27.71 UTC | null | null | null | null | 1,942,204 | null | 1 | 25 | ruby-on-rails | 10,024 | <p>You can have a rake task behave differently based on the current environment, and you can change the environment a task runs in by passing <code>RAILS_ENV=production</code> to the command. Using these two together you could produce something like so:</p>
<p>Create the following files with your environment specific ... |
17,039,119 | How to get separate price and currency information for an in-app purchase? | <p>I am implementing in-app purchases for an app with support for several countries.</p>
<p>The In-App Billing Version 3 API <a href="http://android-developers.blogspot.jp/2012/12/in-app-billing-version-3.html" rel="noreferrer">claims that</a>:</p>
<blockquote>
<p>No currency conversion or formatting is necessary: ... | 29,510,024 | 8 | 4 | null | 2013-06-11 07:57:26.097 UTC | 11 | 2018-12-11 12:47:30.727 UTC | null | null | null | null | 1,802,240 | null | 1 | 27 | android|in-app-purchase|in-app-billing | 24,486 | <p>Full information can be found <a href="http://developer.android.com/google/play/billing/billing_reference.html#getSkuDetails">here</a>, but essentially in August 2014 this was resolved with:</p>
<p><strong>The getSkuDetails() method</strong></p>
<p><em>This method returns product details for a list of product IDs.... |
17,023,376 | Get view of Fragment from FragmentActivity | <p>I have a <code>FragmentActivity</code> where I add a <code>Fragment</code>.
Depending on some situation, I want to access <code>Buttons</code> from that fragment's layout and change click listeners of them.</p>
<p>What I do is:</p>
<pre><code>View view = myFragment.getView();
Button myButton = (Button) view.findV... | 17,023,533 | 5 | 7 | null | 2013-06-10 11:59:26.32 UTC | 2 | 2017-01-04 14:21:09.14 UTC | 2013-06-10 12:12:36.293 UTC | null | 2,450,717 | null | 2,450,717 | null | 1 | 31 | android|android-fragments|android-fragmentactivity | 77,375 | <p>If you want to access your component and set some data, I suggest you to make a method inside the fragment like this:</p>
<pre><code>import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Bu... |
16,749,637 | RESTful API Server in C# | <p>Are there any frameworks that allow a RESTful API Server to be written in C#?</p>
<p>I have seen MVC 4, however this seems to be providing a view that you can see in the browser, I just require the API server and no view. It would be great if it was able to provide a streaming API too.</p>
<p>Thanks</p> | 16,749,693 | 5 | 0 | null | 2013-05-25 12:38:20.247 UTC | 6 | 2019-02-10 09:51:05.6 UTC | null | null | null | null | 451,678 | null | 1 | 34 | c#|api|rest | 68,671 | <p>If you are using .NET Framework 4.5 you can use <a href="https://docs.microsoft.com/en-us/aspnet/web-api/" rel="noreferrer">Web API</a></p>
<p>If you are using .NET Framework 3.5 I highly recommend <a href="https://github.com/ServiceStackV3/ServiceStackV3" rel="noreferrer">ServiceStack</a></p>
<p>If you are using ... |
16,792,841 | Detect if user clicks inside a circle | <p>How can I detect when the user clicks inside the red bubble?</p>
<p>It should not be like a square field. The mouse must be really inside the circle:</p>
<p><a href="https://i.stack.imgur.com/dylT0.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/dylT0.jpg" alt="img"></a></p>
<p>Here's the code:</p>
<pr... | 16,792,888 | 4 | 4 | null | 2013-05-28 13:03:34.777 UTC | 17 | 2016-11-23 03:42:15.877 UTC | 2015-12-17 12:06:09.91 UTC | null | 794,749 | user2039981 | null | null | 1 | 40 | javascript|html|events|canvas|click | 28,521 | <p>A circle, is the geometric position of all the points whose distance from a central point is equal to some number "R".</p>
<p>You want to find the points whose distance is less than or equal to that "R", our radius.</p>
<p>The distance equation in 2d euclidean space is <code>d(p1,p2) = root((p1.x-p2.x)^2 + (p1.y-p... |
16,586,899 | Android Studio cannot resolve R in imported project? | <p>I'm trying the new Android Studio. I've exported a project from eclipse, using the build gradle option. I've then imported it in Android Studio. The R.java file under gen has a j in a little red circle on it. And in my source files, I get "cannot resolve symbol R" wherever I have a reference to a resource, e.g. "R.l... | 16,588,886 | 31 | 6 | null | 2013-05-16 12:02:52.823 UTC | 12 | 2016-10-24 09:15:12.643 UTC | null | null | null | null | 2,340,402 | null | 1 | 48 | android|intellij-idea|android-resources|android-studio | 105,519 | <ol>
<li>Press F4 into <strong>Project Structure</strong>, Check <strong>SDKs</strong> on left</li>
<li>Click <strong>Modules</strong> ---> <strong>Source</strong> Tab, check <strong>gen</strong> and <strong>src</strong> as sources </li>
</ol>
<p>PS: The answer over a year old and the menus have changed. </p> |
16,841,382 | what is the performance impact of using int64_t instead of int32_t on 32-bit systems? | <p>Our C++ library currently uses time_t for storing time values. I'm beginning to need sub-second precision in some places, so a larger data type will be necessary there anyway. Also, it might be useful to get around the Year-2038 problem in some places. So I'm thinking about completely switching to a single Time clas... | 16,841,814 | 4 | 10 | null | 2013-05-30 16:28:18.587 UTC | 14 | 2018-02-13 06:55:33.397 UTC | null | null | null | null | 2,148,773 | null | 1 | 54 | c++|performance|32bit-64bit|32-bit|int64 | 21,915 | <blockquote>
<p>which factors influence performance of these operations? Probably the
compiler and compiler version; but does the operating system or the
CPU make/model influence this as well?</p>
</blockquote>
<p>Mostly the processor architecture (and model - please read model where I mention processor architec... |
16,998,432 | Sublime Text 2: How to get scss and Less files to have color? | <p>I'm using Sublime Text 2 and the <code>css.scss</code> and <code>css.less</code> files are in all white text - the comments, brackets, syntax - everything. If I look at my regular <code>css</code> files, they have color to differentiate all of the above. Has anyone else dealt with this? Is this some bug I'm getting?... | 16,998,463 | 6 | 0 | null | 2013-06-08 10:14:48.557 UTC | 11 | 2019-01-18 09:15:21.517 UTC | null | null | null | null | 562,125 | null | 1 | 66 | sublimetext2|sublimetext | 45,501 | <p>You can set the syntax for any specific extension. Please see this:</p>
<p><a href="http://www.codechewing.com/library/set-default-syntax-highlight-for-different-filetypes-sublime-text/" rel="noreferrer">http://www.codechewing.com/library/set-default-syntax-highlight-for-different-filetypes-sublime-text/</a></p>
<... |
16,839,658 | Printf width specifier to maintain precision of floating-point value | <p>Is there a <code>printf</code> width specifier which can be applied to a floating point specifier that would automatically format the output to the necessary number of <em>significant digits</em> such that when scanning the string back in, the original floating point value is acquired?</p>
<p>For example, suppose I... | 19,897,395 | 8 | 10 | null | 2013-05-30 15:04:36.327 UTC | 51 | 2021-09-18 13:19:19.487 UTC | 2017-05-23 12:02:44.073 UTC | null | -1 | null | 1,806,289 | null | 1 | 145 | c|floating-point|printf|c99|floating-point-precision | 335,288 | <p>I recommend @Jens Gustedt hexadecimal solution: use %a.</p>
<p>OP wants “print with maximum precision (or at least to the most significant decimal)”.</p>
<p>A simple example would be to print one seventh as in:</p>
<pre><code>#include <float.h>
int Digs = DECIMAL_DIG;
double OneSeventh = 1.0/7.0;
printf("%.... |
4,453,352 | What goes in Model in MVVM? | <p>The things which are supposed to go into the Model are also allowed to go into the View-Model i.e. Public Properties, IDataErroInfo and INotifyPropertyChanged, then what should actually go into the model?</p> | 4,453,396 | 2 | 0 | null | 2010-12-15 18:10:51.007 UTC | 10 | 2020-09-10 21:49:04.777 UTC | null | null | null | null | 538,091 | null | 1 | 16 | wpf|mvvm | 6,712 | <h2>Model</h2>
<p>Business Data + Business Logic + Business Rules</p>
<h2>View</h2>
<p>Application UI</p>
<h2>ViewModel</h2>
<p>Wrapper Over Model which is easily readable/bindable by View using minimum Effort/Code.</p>
<ol>
<li><strong><code>IDataErrorInfo</code></strong> - Should go into ViewModel</li>
<li><strong><c... |
4,720,597 | Profile bug (Error launching remote program: failed to get the task for process XXX.) | <p>Today I was messing with my Developer/Distribution settings and I seem to have changed something that I can not figure out. I am running Xcode 3.2.5 and iOS 4.2.</p>
<p>When I set to build on my device in Debug mode, I can install my app on my device with no problem</p>
<p>When I set to build on my device in Relea... | 4,720,689 | 2 | 0 | null | 2011-01-18 04:54:02.933 UTC | 7 | 2012-08-07 13:19:36.853 UTC | null | null | null | null | 563,360 | null | 1 | 33 | iphone|ios4|adhoc | 17,989 | <p>The problem is because you are trying to debug your application using distribution provisioning profile. If you want to run your application in debug mode, you have to sign it with development provisioning profile and certificate (<strong>both in build settings and in target</strong>). If you are trying to create a ... |
4,727,536 | How do I stop a process running in IntelliJ such that it calls the shutdown hooks? | <p>When I run my program in IntelliJ then use the STOP button, it does not call my shutdown hooks that I've created. Is there a way in IntelliJ to have those called on shutdown?</p> | 4,727,696 | 2 | 0 | null | 2011-01-18 18:16:02.933 UTC | 8 | 2020-05-08 02:15:34.03 UTC | 2020-05-08 02:15:34.03 UTC | null | 1,402,846 | null | 252,253 | null | 1 | 78 | java|intellij-idea | 32,578 | <p>You need to use the <strong>Exit</strong> button in the <strong>Run</strong> panel, not the Stop button. Note that it will only work when Running and will not work when Debugging.</p>
<p>Here is the screenshot if you can't find it:</p>
<p><img src="https://i.stack.imgur.com/7geJA.png" alt="Exit"></p>
<p>This feat... |
9,767,054 | Read the log file (*.LDF) in SQL Server 2008 | <p>I'm searching for a way to read the <a href="http://en.wikipedia.org/wiki/Microsoft_SQL_Server#SQL_Server_2008" rel="nofollow">SQL Server 2008</a> log file, not to show the information, but to read the meaning of the symbols and the structure of the LOG table. I'm using <code>DBCC LOG('my_table', 3)</code>.</p> | 19,081,922 | 3 | 9 | null | 2012-03-19 08:35:40.003 UTC | 4 | 2016-02-13 10:13:21.877 UTC | 2016-02-13 10:09:01.813 UTC | null | 63,550 | null | 1,265,987 | null | 1 | 5 | sql|sql-server-2008|logfiles | 81,112 | <p>See my answer in this Stack Overflow post: <em><a href="https://stackoverflow.com/questions/4153514/how-can-i-view-sql-server-2005-transaction-log-file/19081839#19081839">How can I view SQL Server 2005 Transaction log file</a></em></p>
<p>Or</p>
<p>Use this command:</p>
<pre><code>Select * from ::fn_dblog(nu... |
9,752,137 | How to format column to number format in Excel sheet? | <p>Below is the VBA code. Sheet2 contains all of the values in general format. After running the code, values in column 'C' of Sheet3 contain exponential values for numbers which are 13 or more digits.</p>
<p>What should be done so that column 'C' of Sheet3 does not contain exponential values?</p>
<pre><code>privat... | 9,752,956 | 4 | 4 | null | 2012-03-17 17:28:25.55 UTC | 1 | 2021-07-16 07:31:18.71 UTC | 2014-08-07 18:16:56.687 UTC | null | 2,541,090 | null | 1,249,645 | null | 1 | 8 | excel|vba | 133,463 | <p>This will format column A as text, B as General, C as a number.</p>
<pre><code>Sub formatColumns()
Columns(1).NumberFormat = "@"
Columns(2).NumberFormat = "General"
Columns(3).NumberFormat = "0"
End Sub
</code></pre> |
9,873,990 | Round to .5 or 1.0 in SQL | <p>I'm looking to round values like</p>
<blockquote>
<p>2.3913 -> 2.5</p>
<p>4.6667 -> 4.5</p>
<p>2.11 -> 2</p>
</blockquote>
<p>How can I manage this in SQL?</p>
<p>Thanks</p> | 9,874,054 | 2 | 4 | null | 2012-03-26 14:25:46.817 UTC | 1 | 2020-10-15 14:51:21.05 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 251,671 | null | 1 | 24 | sql|tsql|numbers|decimal|rounding | 38,776 | <pre><code>SELECT ROUND(2.2 * 2, 0) / 2
</code></pre>
<p>gets you to the nearest .5</p> |
10,030,362 | App is behaving different on iPhone 5.1 simulator and real iPhone 4 with iOS 5.1 | <h2>In a nutshell:</h2>
<p>When the title of a back-button of a navigation controller gets changed, in some cases the old title is stuck and the new title will not be displayed. This happens only in some reproduceable situations, while it works as designed in other situations.</p>
<p><strong>It depends on the hardwar... | 10,245,035 | 3 | 7 | null | 2012-04-05 14:17:08.96 UTC | 4 | 2012-04-20 11:06:39.05 UTC | 2012-04-10 11:37:12.093 UTC | null | 1,302,716 | null | 1,302,716 | null | 1 | 29 | iphone|ios|ios-simulator | 2,247 | <h2><strong>Apple support did answer</strong></h2>
<p>I contacted Apple support for that issue and they did answer.</p>
<p>The problem was, that the navigation bar holds all back-buttons for views on the navigation controllers stack and all this buttons needs to be updated at the same time. Updating the views that la... |
10,174,420 | Why can't I reference System.ComponentModel.DataAnnotations? | <p>I'm trying to use DataAnnotations in my WPF project to specify a maximum length of strings, with the following:</p>
<pre><code>using System.ComponentModel.DataAnnotations;
</code></pre>
<p>However, I get the error</p>
<blockquote>
<p>The type or namespace name 'DataAnnotations' does not exist in the
namespace... | 10,174,457 | 17 | 4 | null | 2012-04-16 12:50:56.783 UTC | 11 | 2022-06-16 18:04:57.757 UTC | null | null | null | null | 181,771 | null | 1 | 120 | c#|wpf|data-annotations | 154,044 | <p>You have to reference the assembly in which this namespace is defined (it is not referenced by default in the visual studio templates). Open your reference manager and add a reference to the System.ComponentModel.DataAnnotations assembly (Solution explorer -> Add reference -> Select .Net tab -> select System.Compone... |
10,085,806 | Extracting specific columns from a data frame | <p>I have an R data frame with 6 columns, and I want to create a new dataframe that only has three of the columns.</p>
<p>Assuming my data frame is <code>df</code>, and I want to extract columns <code>A</code>, <code>B</code>, and <code>E</code>, this is the only command I can figure out:</p>
<pre><code> data.frame(d... | 29,736,003 | 10 | 1 | null | 2012-04-10 02:24:04.437 UTC | 129 | 2020-06-30 14:20:29.953 UTC | 2020-04-16 22:35:01.54 UTC | null | 6,461,462 | Aren Cambre | 425,477 | null | 1 | 432 | r|dataframe|r-faq | 1,496,055 | <p>Using the <a href="http://cran.rstudio.com/web/packages/dplyr/vignettes/introduction.html">dplyr</a> package, if your data.frame is called <code>df1</code>:</p>
<pre><code>library(dplyr)
df1 %>%
select(A, B, E)
</code></pre>
<p>This can also be written without the <code>%>%</code> pipe as:</p>
<pre><code... |
8,192,185 | Using std::array with initialization lists | <p>Unless I am mistaken, it should be possible to create a std:array in these ways:</p>
<pre><code>std::array<std::string, 2> strings = { "a", "b" };
std::array<std::string, 2> strings({ "a", "b" });
</code></pre>
<p>And yet, using GCC 4.6.1 I am unable to get any of these to work. The compiler simply say... | 8,192,275 | 3 | 6 | null | 2011-11-19 05:46:51.007 UTC | 10 | 2021-08-12 11:15:14.587 UTC | 2011-11-19 06:32:35.037 UTC | null | 897,778 | null | 897,778 | null | 1 | 56 | c++|c++11|libstdc++ | 43,354 | <p><code>std::array</code> is funny. It is defined basically like this:</p>
<pre><code>template<typename T, int size>
struct std::array
{
T a[size];
};
</code></pre>
<p>It is a struct which contains an array. It does not have a constructor that takes an initializer list. But <code>std::array</code> is an aggr... |
7,778,723 | What are the .db-shm and .db-wal extensions in Sqlite databases? | <p>I am seeing some strange behavior with my application and the state of its database file after running some tests that close the database, delete it, and replace it with a test fixture. When I examine the database file with a tool on my debugging PC, it doesn't match what the application itself seems to be reportin... | 7,779,752 | 3 | 2 | null | 2011-10-15 15:25:03.107 UTC | 14 | 2022-04-28 17:41:23.69 UTC | 2011-10-15 18:09:16.26 UTC | null | 403,455 | null | 403,455 | null | 1 | 90 | android|sqlite|file-extension | 94,747 | <p>You are correct, these are temporary files created by SQLite. If you are manually deleting the main db you should probably delete these too. From what I can gather the WAL is a replacement for the rollback journal that enables SQLite to rollback changes when a transaction fails. How SQLite uses them and why they are... |
11,686,854 | How to register a Zend\Log Instance in the ServiceManager in ZF2 | <p>I am wondering what is the best way to initiate and re-use a logger instance through the ServiceManager in ZF2.
Of course I can do a simple method to be used in any class, like: </p>
<pre><code>public function getLogger () {
$this->logger = new Logger();
$this->logger->addWriter(new Writer\... | 12,886,079 | 5 | 0 | null | 2012-07-27 11:28:04.097 UTC | 10 | 2014-06-20 19:15:14.537 UTC | 2012-09-19 00:10:05.4 UTC | null | 1,483,513 | null | 277,861 | null | 1 | 7 | zend-framework|zend-framework2|zend-log | 11,257 | <p>Add the following data to 'global.php'</p>
<pre><code>'service_manager' => array(
'factories' => array(
'Zend\Log' => function ($sm) {
$log = new Zend\Log\Logger();
$writer = new Zend\Log\Writer\Stream('./data/logs/logfile');
$log->addWriter($writer);
... |
12,003,660 | Javascript DateDiff | <p>I am having a problem with the DateDiff function. I am trying to figure out the Difference between two dates/times. I have read this posting (<a href="https://stackoverflow.com/questions/327429/whats-the-best-way-to-calculate-date-difference-in-javascript">What's the best way to calculate date difference in Java... | 12,003,702 | 4 | 0 | null | 2012-08-17 10:00:43.877 UTC | 1 | 2019-03-03 10:15:30.853 UTC | 2019-03-03 10:15:30.853 UTC | null | 4,519,059 | null | 1,227,427 | null | 1 | 8 | javascript|date|datediff | 71,749 | <p>Your first try does addition first and then subtraction. You cannot subtract strings anyway, so that yields <code>NaN</code>.</p>
<p>The second trry has no closing <code>)</code>. Apart from that, you're calling <code>getTime</code> on strings. You'd need to use <code>new Date(...).getTime()</code>. Note that you g... |
11,923,317 | creating django forms | <p>I'm struggling to get my head round django forms.. I've been reading various documentation but just can't quite grasp the concepts. I have got to grips with models, views and templates. What I am trying to do is to create a form with various fields composing of dropdown lists and checkboxes which are populated by va... | 11,924,616 | 3 | 2 | null | 2012-08-12 15:19:50.823 UTC | 14 | 2020-07-24 06:10:16.963 UTC | null | null | null | null | 1,436,318 | null | 1 | 15 | python|django|django-forms | 16,337 | <p>Forms are just a tool to simplify and speed-up (the development of) the process of fetching POST data from the request. A manual way would be to do <code>request.POST.get('somefield')</code> for all the fields there are in some HTML form. But Django can do better than that...</p>
<p>In its essence, a Form class hol... |
11,689,557 | Delete all views from Sql Server | <p>By using this statement in SQL Server: </p>
<pre><code>EXEC sp_msforeachtable 'DROP TABLE ?'
</code></pre>
<p>I know it's possible to delete all tables at once.</p>
<p>Is there a similar statement for views? I tried this hoping to be lucky:
EXEC sp_msforeachview 'DROP VIEW ?' but it doesn't work!</p> | 11,689,661 | 7 | 1 | null | 2012-07-27 14:11:42.227 UTC | 9 | 2018-05-02 17:42:08.757 UTC | 2017-11-21 07:04:12.403 UTC | null | 2,451,726 | null | 1,464,026 | null | 1 | 35 | sql|sql-server-2008|sp-msforeachtable | 52,489 | <p>Here you have, no cursor needed:</p>
<pre><code>DECLARE @sql VARCHAR(MAX) = ''
, @crlf VARCHAR(2) = CHAR(13) + CHAR(10) ;
SELECT @sql = @sql + 'DROP VIEW ' + QUOTENAME(SCHEMA_NAME(schema_id)) + '.' + QUOTENAME(v.name) +';' + @crlf
FROM sys.views v
PRINT @sql;
EXEC(@sql);
</code></pre> |
11,697,943 | When should one use CONNECT and GET HTTP methods at HTTP Proxy Server? | <p>I'm building a WebClient library. Now I'm implementing a proxy feature, so I am making some research and I saw some code using the <code>CONNECT</code> method to request a URL.</p>
<p>But checking it within my web browser, it doesn't use the <code>CONNECT</code> method but calls the GET method instead.</p>
<p>So I... | 11,698,002 | 4 | 0 | null | 2012-07-28 03:12:00.047 UTC | 27 | 2021-04-13 21:36:32.693 UTC | 2016-01-12 20:27:28.113 UTC | null | 432,681 | null | 1,015,090 | null | 1 | 85 | proxy|httpwebrequest|http-request|http-proxy|proxy-server | 104,155 | <p>A CONNECT request urges your proxy to establish an HTTP tunnel to the remote end-point.
<strong>Usually</strong> is it used for SSL connections, though it can be used with HTTP as well (used for the purposes of proxy-chaining and tunneling)</p>
<pre><code>CONNECT www.google.com:443
</code></pre>
<p>The above lin... |
11,692,613 | Python - sum values in dictionary | <p>I have got pretty simple list:</p>
<pre><code>example_list = [
{'points': 400, 'gold': 2480},
{'points': 100, 'gold': 610},
{'points': 100, 'gold': 620},
{'points': 100, 'gold': 620}
]
</code></pre>
<p>How can I sum all <em>gold</em> values? I'm looking for nice oneliner.</p>
<p>Now I'm using this... | 11,692,630 | 5 | 3 | null | 2012-07-27 17:21:44.23 UTC | 28 | 2022-02-25 12:07:13.093 UTC | 2012-07-27 17:27:40.403 UTC | null | 382,971 | null | 382,971 | null | 1 | 91 | python|list|dictionary | 106,323 | <pre><code>sum(item['gold'] for item in myList)
</code></pre> |
11,686,690 | Handle ModelState Validation in ASP.NET Web API | <p>I was wondering how I can achieve model validation with ASP.NET Web API. I have my model like so:</p>
<pre><code>public class Enquiry
{
[Key]
public int EnquiryId { get; set; }
[Required]
public DateTime EnquiryDate { get; set; }
[Required]
public string CustomerAccountNumber { get; set; }
... | 11,724,405 | 11 | 0 | null | 2012-07-27 11:16:42.95 UTC | 44 | 2022-01-27 10:12:24.623 UTC | 2017-05-15 07:45:20.22 UTC | null | 492,336 | null | 1,005,030 | null | 1 | 112 | c#|asp.net-web-api | 132,524 | <p>For separation of concern, I would suggest you use action filter for model validation, so you don't need to care much how to do validation in your api controller:</p>
<pre><code>using System.Net;
using System.Net.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Filters;
namespace System.Web.Http.Filt... |
11,977,102 | Order data frame rows according to vector with specific order | <p>Is there an easier way to ensure that a data frame's rows are ordered according to a "target" vector as the one I implemented in the short example below?</p>
<pre><code>df <- data.frame(name = letters[1:4], value = c(rep(TRUE, 2), rep(FALSE, 2)))
df
# name value
# 1 a TRUE
# 2 b TRUE
# 3 c FALSE
# ... | 11,977,256 | 6 | 0 | null | 2012-08-15 20:53:10.033 UTC | 58 | 2021-01-12 00:41:59.13 UTC | 2019-01-24 13:26:37.887 UTC | null | 2,370,483 | null | 989,691 | null | 1 | 200 | r|sorting|dataframe | 171,500 | <p>Try <code>match</code>:</p>
<pre><code>df <- data.frame(name=letters[1:4], value=c(rep(TRUE, 2), rep(FALSE, 2)))
target <- c("b", "c", "a", "d")
df[match(target, df$name),]
name value
2 b TRUE
3 c FALSE
1 a TRUE
4 d FALSE
</code></pre>
<p>It will work as long as your <code>target</code> cont... |
20,038,673 | My html page is not scrolling in browsers | <p>The page on my website is not scrolling. If there are more content than screen can fit you can not actually see it because scroll is not working. I'm not and CSS guru and I don't know if the problem is actually with CSS or HTML. </p>
<p>I've spend some time trying to understand the problem but i'm not a CSS guru so... | 20,038,715 | 5 | 6 | null | 2013-11-18 01:39:36.017 UTC | 3 | 2020-03-29 18:36:55.173 UTC | 2013-11-20 13:04:11.093 UTC | null | 492,620 | null | 375,373 | null | 1 | 15 | css|html|twitter-bootstrap|twitter-bootstrap-3 | 53,641 | <p>remove <code>overflow: hidden;</code> from <code>body</code> in the bootstrap-theme.css file.</p> |
3,303,312 | How do I convert a string to a valid variable name in Python? | <p>I need to convert an arbitrary string to a string that is a valid variable name in Python.</p>
<p>Here's a very basic example:</p>
<pre><code>s1 = 'name/with/slashes'
s2 = 'name '
def clean(s):
s = s.replace('/', '')
s = s.strip()
return s
# the _ is there so I can see the end of the string
print clea... | 3,303,361 | 4 | 3 | null | 2010-07-21 19:59:30.433 UTC | 8 | 2022-08-05 10:00:44.063 UTC | 2022-08-05 10:00:44.063 UTC | null | 4,865,723 | null | 89,766 | null | 1 | 34 | python|validation|string|variables | 14,120 | <p><a href="http://docs.python.org/reference/lexical_analysis.html#identifiers" rel="noreferrer">According to Python</a>, an identifier is a letter or underscore, followed by an unlimited string of letters, numbers, and underscores:</p>
<pre><code>import re
def clean(s):
# Remove invalid characters
s = re.sub(... |
3,333,461 | Regular expression which matches a pattern, or is an empty string | <p>I have the following Regular Expression which matches an email address format:</p>
<pre><code>^[\w\.\-]+@([\w\-]+\.)+[a-zA-Z]+$
</code></pre>
<p>This is used for validation with a form using JavaScript. However, this is an optional field. Therefore how can I change this regex to match an email address format, or a... | 3,333,525 | 4 | 4 | null | 2010-07-26 09:04:49.053 UTC | 21 | 2018-08-09 18:06:38.627 UTC | 2012-07-27 09:55:09.807 UTC | null | 225,037 | null | 370,103 | null | 1 | 115 | javascript|regex|email-validation|string | 145,560 | <p>To match <code>pattern</code> or an empty string, use</p>
<pre><code>^$|pattern
</code></pre>
<h3>Explanation</h3>
<ul>
<li><code>^</code> and <code>$</code> are the beginning and end of the string anchors respectively.</li>
<li><code>|</code> is used to denote alternates, e.g. <code>this|that</code>.</li>
</ul>
... |
3,846,296 | How to overload the operator++ in two different ways for postfix a++ and prefix ++a? | <p>How to overload the operator++ in two different ways for postfix <code>a++</code> and prefix <code>++a</code>?</p> | 3,846,374 | 5 | 2 | null | 2010-10-02 15:09:55.98 UTC | 39 | 2018-07-04 22:11:26.137 UTC | 2015-06-16 08:27:17.03 UTC | null | 895,245 | null | 457,445 | null | 1 | 115 | c++|operator-overloading | 94,426 | <p>Should look like this:</p>
<pre><code>class Number
{
public:
Number& operator++ () // prefix ++
{
// Do work on this. (increment your object here)
return *this;
}
// You want to make the ++ operator work like the standard operators
// The... |
3,607,593 | Is it faster to add to a collection then sort it, or add to a sorted collection? | <p>If I have a <code>Map</code> like this:</p>
<pre><code>HashMap<Integer, ComparableObject> map;
</code></pre>
<p>and I want to obtain a collection of values sorted using natural ordering, which method is fastest?</p>
<h2>(A)</h2>
<p>Create an instance of a sortable collection like <code>ArrayList</code>, ad... | 3,607,684 | 7 | 6 | null | 2010-08-31 09:12:46.327 UTC | 22 | 2020-08-07 18:59:23.89 UTC | null | null | null | null | 402,033 | null | 1 | 84 | java|sorting|collections | 35,419 | <p>TreeSet has a <code>log(n)</code> time complexity guarantuee for <code>add()/remove()/contains()</code> methods.
Sorting an <code>ArrayList</code> takes <code>n*log(n)</code> operations, but <code>add()/get()</code> takes only <code>1</code> operation.</p>
<p>So if you're mainly retrieving, and don't sort often, <... |
3,601,013 | UITableViewCell separator not showing up | <p>I made a custom UITableViewCell in IB, but for some reason, despite the single line option for separator being selected, there are no separator lines on my table.</p>
<p>Has this happened to any of you before? What gives?</p>
<p>Thanks!</p> | 3,601,169 | 8 | 0 | null | 2010-08-30 13:59:32.143 UTC | 5 | 2016-07-08 16:03:32.86 UTC | null | null | null | null | 323,929 | null | 1 | 33 | iphone|uitableview|cell|separator | 21,133 | <p>Is the UITableViewCell in IB associated with a UITableViewCell subclass that overrides <code>drawRect:</code>? If so, make sure you are calling the super implementation, as that's what draws the line at the bottom. If you are overriding <code>layoutSubviews</code> make sure no views are obscuring the bottom of the... |
3,590,165 | How can I convert each item in the list to string, for the purpose of joining them? | <p>I need to join a list of items. Many of the items in the list are integer values returned from a function; i.e.,</p>
<pre><code>myList.append(munfunc())
</code></pre>
<p>How should I convert the returned result to a string in order to join it with the list?</p>
<p>Do I need to do the following for every inte... | 3,590,168 | 9 | 0 | null | 2010-08-28 09:07:38.59 UTC | 49 | 2022-07-01 01:07:31.463 UTC | 2022-07-01 01:07:31.463 UTC | null | 523,612 | null | 429,507 | null | 1 | 366 | python|string|list | 480,464 | <p>Calling <code>str(...)</code> is the Pythonic way to convert something to a string.</p>
<p>You might want to consider why you want a list of strings. You could instead keep it as a list of integers and only convert the integers to strings when you need to display them. For example, if you have a list of integers th... |
3,958,615 | Import file size limit in PHPMyAdmin | <p>I have changed all the php.ini parameters I know:
<code>upload_max_filesize</code>, <code>post_max_size</code>.</p>
<p>Why am I still seeing 2MB?</p>
<p>Im using Zend Server CE, on a Ubuntu VirtualBox over a Windows 7 host.</p> | 3,958,659 | 29 | 4 | null | 2010-10-18 11:24:55.727 UTC | 120 | 2021-11-17 04:13:23.91 UTC | 2018-03-17 01:37:49.23 UTC | null | 5,771,029 | null | 234,253 | null | 1 | 368 | php|mysql|phpmyadmin | 1,078,514 | <p>You probably didn't restart your server ;)</p>
<p>Or you modified the wrong <code>php.ini</code>.</p>
<p>Or you actually managed to do both ^^</p> |
7,932,060 | Create a vertical Menu in a Wpf | <p>How is it possible to create a vertical menu on the left side of the window in Visual Studio (in a wpf) with xaml like the one in <a href="http://www.wpftutorial.net/">http://www.wpftutorial.net/</a>? I try the code:</p>
<pre><code><Menu DockPanel.Dock="Left" VerticalAlignment="Top" Background="Gray" BorderBrush... | 7,932,115 | 4 | 3 | null | 2011-10-28 16:27:37.33 UTC | 5 | 2022-01-08 17:54:42.8 UTC | 2011-10-28 16:36:14.697 UTC | null | 41,071 | null | 954,724 | null | 1 | 18 | wpf|xaml | 44,911 | <p>Sure, just change <code>MenuItem.ItemsPanel</code> to use a Vertical StackPanel instead of the Default Horizontal one</p>
<pre><code><Menu>
<Menu.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
... |
7,890,488 | How to perform a LEFT JOIN in SQL Server between two SELECT statements? | <p>I have two SELECT statements in SQL Server like these:</p>
<pre><code>(SELECT [UserID] FROM [User])
(SELECT [TailUser], [Weight] FROM [Edge] WHERE [HeadUser] = 5043)
</code></pre>
<p>I want to perform a LEFT JOIN between these two SELECT statements on [UserID] attribute and [TailUser] attribute. I want to join exi... | 7,890,528 | 4 | 1 | null | 2011-10-25 14:03:18.64 UTC | 9 | 2021-04-29 13:14:44.073 UTC | 2011-10-25 14:42:39.6 UTC | null | 13,302 | null | 774,437 | null | 1 | 43 | sql|sql-server-2008|relational-database | 183,204 | <pre><code>SELECT * FROM
(SELECT [UserID] FROM [User]) a
LEFT JOIN (SELECT [TailUser], [Weight] FROM [Edge] WHERE [HeadUser] = 5043) b
ON a.UserId = b.TailUser
</code></pre> |
8,296,170 | What is a .pid file and what does it contain? | <p>I recently come across a file with the extension .pid and explored inside it but didn't find much. The documentation says:</p>
<blockquote>
<p>A Pid-File is a file containing the process identification number (pid) that is stored in a well-defined location of the filesystem thus allowing other programs to find ou... | 8,296,204 | 4 | 0 | null | 2011-11-28 13:01:52.643 UTC | 56 | 2022-03-23 20:41:50.91 UTC | 2017-08-05 00:35:06.743 UTC | null | 4,694,621 | null | 468,896 | null | 1 | 233 | linux|unix|pid | 199,054 | <p>The pid files contains the process id (a number) of a given program. For example, Apache HTTPD may write its main process number to a pid file - which is a regular text file, nothing more than that - and later use the information there contained to stop itself. You can also use that information to kill the process y... |
4,640,934 | make characters optional in regular expression | <p>I am trying to validate a (US) phone number with no extra characters in it. so the format is 1-555-555-5555 with no dashes, spaces, etc and the 1 is optional. However, my regular expression will ONLY except numbers with the leading 1 and says numbers without it are invalid. Here is what I am using where did I go ... | 4,640,950 | 3 | 2 | null | 2011-01-09 18:30:01.12 UTC | 1 | 2014-11-09 01:21:49.553 UTC | null | null | null | null | 384,306 | null | 1 | 22 | java|regex | 38,074 | <p>Use:</p>
<pre><code>"^1?\\d{10}$"
</code></pre>
<p>The ? means "optional".</p> |
4,487,546 | Do while loop in SQL Server 2008 | <p>Is there any method for implement <code>do while</code> loop in SQL server 2008?</p> | 4,487,576 | 5 | 3 | null | 2010-12-20 07:03:20.817 UTC | 41 | 2017-09-22 11:08:35.15 UTC | 2013-08-08 03:38:20.93 UTC | null | 1,750,719 | null | 1,750,719 | null | 1 | 136 | sql-server|sql-server-2008|loops|while-loop|do-while | 584,513 | <p>I am not sure about DO-WHILE IN MS SQL Server 2008 but you can change your WHILE loop logic, so as to USE like DO-WHILE loop.</p>
<p>Examples are taken from here: <a href="http://blog.sqlauthority.com/2007/10/24/sql-server-simple-example-of-while-loop-with-continue-and-break-keywords/" rel="noreferrer">http://blog.... |
4,617,914 | How to create a "unique" constraint on a boolean MySQL column? | <p>I would like to add a <code>BOOLEAN</code> column to a MySQL table which will be named <code>is_default</code>. In this column, only one record can have <code>is_default</code> set to <code>true</code>.</p>
<p>How can I add this constraint to my column with MySQL?</p>
<p>Thanks!</p>
<hr>
<p>UPDATE</p>
<p>If it ... | 4,618,525 | 6 | 0 | null | 2011-01-06 17:43:44.717 UTC | 5 | 2020-06-15 20:24:53.777 UTC | 2020-06-15 20:24:53.777 UTC | null | 814,702 | null | 266,406 | null | 1 | 28 | sql|mysql|constraints | 17,049 | <p>I think this is not the best way to model the situation of a single default value.</p>
<p>Instead, I would leave the IsDefault column out and create a separate table with one row and only the column(s) that make(s) up the primary key of your main table. In this table you place the PK value(s) that identify the def... |
4,820,094 | Programmatically creating Views in IOS (how does it work)? | <p>A little background: I'm going through the CS193P iTune videos and I was stuck on the assignment 3 for the longest time. Basically, the assignment asks you to programmatically create a custom view to display a shape on the screen. I'm not using any view controllers by the way.</p>
<p>I could not get my view to di... | 4,820,729 | 8 | 5 | null | 2011-01-27 18:07:04.233 UTC | 11 | 2019-04-16 18:34:31.76 UTC | 2011-01-28 17:14:27.64 UTC | null | 591,651 | null | 591,651 | null | 1 | 16 | iphone|objective-c|ios|views | 68,154 | <p>To be even more specific to your question, the syntax would be</p>
<pre><code>UIWindow* window = [UIApplication sharedApplication].keyWindow;
UIView *polygonView = [[UIView alloc] initWithFrame: CGRectMake ( 0, 0, 200, 150)];
//add code to customize, e.g. polygonView.backgroundColor = [UIColor blackColor];
[windo... |
4,384,829 | jQuery onClick capture the id of the element | <p>i have many input fields like this</p>
<pre><code><input type="radio" name="name" id="name" onchange="enableTxt()" />
</code></pre>
<p>when i click this radio button i wanna capture the id of the radio input. i am using the following code</p>
<pre><code>function enableTxt() {
var id = $(this).attr("id"... | 4,384,858 | 8 | 3 | null | 2010-12-08 06:41:14.767 UTC | 6 | 2022-07-01 03:52:36.743 UTC | null | null | null | null | 155,196 | null | 1 | 38 | jquery|jquery-selectors | 111,170 | <p>HTML:</p>
<pre><code><input type="radio" name="name" id="name" onchange="enableTxt(this)" />
</code></pre>
<p>JS:</p>
<pre><code>function enableTxt(elem) {
var id = $(elem).attr("id");
alert(id);
}
</code></pre> |
4,328,947 | Limit file format when using <input type="file">? | <p>I'd like to restrict the type of file that can be chosen from the native OS file chooser when the user clicks the Browse button in the <code><input type="file"></code> element in HTML. I have a feeling it's impossible, but I'd like to know if there <em>is</em> a solution. I'd like to keep solely to HTML and Ja... | 23,706,177 | 12 | 4 | null | 2010-12-01 20:44:40.973 UTC | 168 | 2022-09-06 05:28:52.503 UTC | 2017-02-27 12:45:33.55 UTC | null | 1,724,702 | null | 383,609 | null | 1 | 876 | html|file|types | 703,013 | <p>Strictly speaking, the answer is <strong>no</strong>. A developer <em>cannot</em> prevent a user from uploading files of any type or extension.<br/><br/>But still, the <strong><a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept" rel="noreferrer">accept</a></strong> attribute of <code><inp... |
4,288,303 | Can't install PostgreSQL: An error occurred executing the Microsoft VC++ runtime installer on Windows XP | <p>I downloaded installer postgresql-9.0.1-1-windows.exe from the official site, ran it, and then got an error:</p>
<blockquote>
<p>An error occurred executing the Microsoft VC++ runtime installer</p>
</blockquote>
<p>What is the reason for this error message?</p>
<p>Platform: Windows XP SP3, Dell Inspiron 1501. P... | 4,289,626 | 14 | 1 | null | 2010-11-26 20:14:37.457 UTC | 17 | 2020-09-28 09:31:58.637 UTC | 2019-10-22 07:36:12.687 UTC | null | 63,550 | null | 250,849 | null | 1 | 101 | postgresql|windows-xp | 109,615 | <p>One of the reasons this can happen is because the installer attempts to install an older version of the VC++ runtime than what you are currently using.</p>
<p>See this installation log, found in your user's temporary directory (e.g. <code>dd_vcredist_amd64_20190214193107.log</code>):</p>
<blockquote>
<p>[20C0:20... |
4,426,442 | Unix tail equivalent command in Windows Powershell | <p>I have to look at the last few lines of a large file (typical size is 500MB-2GB). I am looking for a equivalent of Unix command <code>tail</code> for Windows Powershell. A few alternatives available on are,</p>
<p><a href="http://tailforwin32.sourceforge.net/">http://tailforwin32.sourceforge.net/</a></p>
<p>and</p... | 4,427,285 | 14 | 5 | null | 2010-12-13 06:55:28.41 UTC | 129 | 2022-01-05 16:30:09.77 UTC | 2010-12-13 08:47:52.667 UTC | null | 310,574 | null | 520,382 | null | 1 | 436 | windows|powershell|tail | 419,514 | <p>Use the <code>-wait</code> parameter with Get-Content, which displays lines as they are added to the file. This feature was present in PowerShell v1, but for some reason not documented well in v2.</p>
<p>Here is an example</p>
<pre><code>Get-Content -Path "C:\scripts\test.txt" -Wait
</code></pre>
<p>Once you run ... |
14,430,321 | Underscore.js: Sum of items in a collection | <p>I made a small plnkr <a href="http://plnkr.co/edit/B5HGxhwvWsfvOR97z7TL?p=preview" rel="noreferrer">here</a> to show what I am trying to achieve. I have a big dataset, where I like to sum the individual type to get a total.</p>
<p>I could think of iterating and adding the results to an object hash, but wonder more ... | 14,430,590 | 3 | 0 | null | 2013-01-20 23:00:00.787 UTC | 8 | 2014-11-03 19:20:36.517 UTC | null | null | null | null | 303,477 | null | 1 | 17 | javascript|underscore.js | 32,376 | <pre><code>var data = [ { type: "A", val: 2 },
{ type: "B", val: 3 },
{ type: "A", val: 1 },
{ type: "C", val: 5 } ];
var groups = _(data).groupBy('type');
var out = _(groups).map(function(g, key) {
return { type: key,
val: _(g).reduce(function(m,x) { return m + x.... |
14,730,311 | WPF borderless window with shadow VS2012 style | <p>I'm trying to create an application that looks like Visual Studio 2012. I have used <a href="http://msdn.microsoft.com/en-us/library/system.windows.shell.windowchrome.aspx" rel="noreferrer">WindowChrome</a> to remove the window borders, and changed the border color in my xaml.</p>
<p>What I don't know how to do is ... | 14,790,533 | 5 | 1 | null | 2013-02-06 13:29:41.813 UTC | 18 | 2020-10-21 17:42:05.38 UTC | 2013-03-10 14:47:51.047 UTC | null | 1,420,197 | null | 402,081 | null | 1 | 21 | c#|wpf|user-interface|visual-studio-2012 | 36,310 | <h1>Update (October '17)</h1>
<p>It has been four years now and I was interested in tackling this again and thus I have been messing around with <em>MahApps.Metro</em> once again and <a href="https://github.com/ChristianIvicevic/ModernChrome" rel="noreferrer">derived my own library based on it</a>. My <em>ModernChrome... |
14,712,223 | How to handle anchor hash linking in AngularJS | <p>Do any of you know how to nicely handle anchor hash linking in <strong>AngularJS</strong>?</p>
<p>I have the following markup for a simple FAQ-page</p>
<pre><code><a href="#faq-1">Question 1</a>
<a href="#faq-2">Question 2</a>
<a href="#faq-3">Question 3</a>
<h3 id="faq-1"&g... | 14,717,011 | 28 | 8 | null | 2013-02-05 16:29:38.017 UTC | 144 | 2021-07-08 14:42:02.867 UTC | 2018-02-13 07:24:36.583 UTC | null | 2,172,547 | null | 384,868 | null | 1 | 323 | javascript|angularjs|anchor|hashtag | 233,207 | <p>You're looking for <a href="https://docs.angularjs.org/api/ng/service/$anchorScroll" rel="noreferrer"><code>$anchorScroll()</code></a>.</p>
<p><a href="https://docs.angularjs.org/api/ng/service/$anchorScroll" rel="noreferrer">Here's the (crappy) documentation.</a></p>
<p><a href="https://github.com/angular/angular... |
14,770,829 | Grouping timestamps by day, not by time | <p>I've got a table storing user access/view logs for the webservice I run. It tracks the time as a timestamp though I'm finding when I do aggregate reporting I only care about the day, not the time.</p>
<p>I'm currently running the following query:</p>
<pre><code>SELECT
user_logs.timestamp
FROM
user_logs
WHE... | 14,771,089 | 1 | 0 | null | 2013-02-08 10:48:18.437 UTC | 15 | 2020-03-18 16:30:48.98 UTC | 2020-03-18 16:30:48.98 UTC | null | 631,348 | null | 1,384,652 | null | 1 | 80 | sql|postgresql | 72,979 | <pre><code>SELECT date_trunc('day', user_logs.timestamp) "day", count(*) views
FROM user_logs
WHERE user_logs.timestamp >= %(timestamp_1)s
AND user_logs.timestamp <= %(timestamp_2)s
group by 1
ORDER BY 1
</code></pre> |
19,331,606 | onclick add image to div | <p>I am trying to get image in a <code><div></code> using <code>onclick</code>. </p>
<p>Now I am getting the text on click. but I want to get the image in div on click...</p>
<p>How can i do this...?</p>
<p>Here is code I have implemented,,</p>
<p>Code:</p>
<pre><code><script>
function myFunction()
{
d... | 19,331,616 | 7 | 0 | null | 2013-10-12 07:16:29.917 UTC | 1 | 2019-03-26 10:04:18.883 UTC | 2013-10-12 07:39:44.927 UTC | user2672373 | null | null | 2,749,219 | null | 1 | 2 | javascript|html|onclick | 40,048 | <p>use </p>
<pre><code>document.getElementById("surprise").innerHTML="<img src='images/aftersurprise.png' />";
</code></pre> |
29,950,299 | Distributed Web crawling using Apache Spark - Is it Possible? | <p>An interesting question asked of me when I attended one interview regarding web mining. The question was, is it possible to crawl the Websites using Apache Spark?</p>
<p>I guessed that it was possible, because it supports distributed processing capacity of Spark. After the interview I searched for this, but couldn'... | 29,960,707 | 5 | 1 | null | 2015-04-29 17:13:20.16 UTC | 10 | 2021-02-11 12:56:10.507 UTC | 2016-12-29 18:28:06.037 UTC | user6022341 | 1,506,477 | null | 4,847,488 | null | 1 | 17 | web|apache-spark|web-crawler | 16,903 | <p>How about this way:</p>
<p>Your application would get a set of websites URLs as input for your crawler, if you are implementing just a normal app, you might do it as follows:</p>
<ol>
<li>split all the web pages to be crawled into a list of separate site, each site is small enough to fit in a single thread well:
... |
36,719,540 | How can I get an oauth2 access_token using Python | <p>For a project someone gave me this data that I have used in Postman for testing purposes:</p>
<p>In Postman this works perfectly.</p>
<p>Auth URL: <a href="https://api.example.com/oauth/access_token" rel="noreferrer">https://api.example.com/oauth/access_token</a><br>
Access Token URL: <a href="https://api.example.... | 36,737,820 | 3 | 0 | null | 2016-04-19 13:13:46.69 UTC | 15 | 2022-07-19 12:06:48.51 UTC | 2018-10-10 07:49:27.67 UTC | null | 9,928,700 | null | 5,039,579 | null | 1 | 17 | python|google-oauth | 81,268 | <p>I was finally able to get it done by using the <a href="https://rauth.readthedocs.io/en/latest/" rel="nofollow noreferrer">rauth</a> library (<code>pip install rauth</code>).</p>
<p>This is the code I used:</p>
<pre><code>from rauth import OAuth2Service
class ExampleOAuth2Client:
def __init__(self, client_id, c... |
36,076,924 | How can I display a loading control while a process is waiting for be finished? | <p>I decided to use this third-party component to make a simple loading control in my windows form.</p>
<p><a href="http://www.codeproject.com/Articles/14841/How-to-write-a-loading-circle-animation-in-NET" rel="noreferrer">http://www.codeproject.com/Articles/14841/How-to-write-a-loading-circle-animation-in-NET</a></p>... | 36,079,335 | 2 | 0 | null | 2016-03-18 05:39:30.13 UTC | 13 | 2018-11-24 14:28:31.153 UTC | 2018-11-24 14:28:31.153 UTC | null | 8,967,612 | null | 2,620,208 | null | 1 | 18 | c#|.net|winforms|loading | 61,390 | <p>You create a thread, which simply sets two properties and then ends. The <code>t.Abort</code> will probably do nothing, since the thread will have been exited by that time. Even worse, you import the excel file on the UI thread, which blocks any animation and freezes the complete UI.</p>
<p>This is how you should m... |
35,848,688 | What's the difference between replaceOne() and updateOne() in MongoDB? | <p>MongoDB bulk operations have two options:</p>
<ol>
<li><p><a href="https://docs.mongodb.org/manual/reference/method/Bulk.find.updateOne/" rel="noreferrer"><strong><code>Bulk.find.updateOne()</code></strong></a></p>
<blockquote>
<p>Adds a single document update operation to a bulk operations list. The operation c... | 35,848,817 | 3 | 0 | null | 2016-03-07 16:18:18.303 UTC | 8 | 2019-08-13 19:43:33.85 UTC | 2019-02-20 18:45:02.92 UTC | null | 462,347 | null | 462,347 | null | 1 | 74 | mongodb|mongodb-query|crud | 60,383 | <p>With <code>replaceOne()</code> you can only replace the entire document, while <code>updateOne()</code> allows for updating fields.</p>
<p>Since <code>replaceOne()</code> replaces the entire document - fields in the old document not contained in the new will be lost. With <code>updateOne()</code> new fields can be ... |
643,385 | adding items to listview at runtime | <p>When I add new values to a listview using :</p>
<pre><code> Set lstView = ListView(0).ListItems.Add(, , txtName)
lstView.ListSubItems.Add , , txtValue
lstView.Refresh
</code></pre>
<p>The only problem is that this only displays a blank new line in the listview, any idea how to update it correctly?</p>
... | 643,536 | 1 | 1 | null | 2009-03-13 15:56:45.25 UTC | null | 2009-03-13 16:54:56.793 UTC | null | null | null | Denvar | 74,751 | null | 1 | 2 | vb6|listview|listviewitem | 56,077 | <p>Assuming the .View property of your ListView is set to "Report", the following will add a couple of rows to the control and set the sub item text.</p>
<pre><code>Dim li As ListItem
With ListView1
.ColumnHeaders.Add , , "One"
.ColumnHeaders.Add , , "Two"
.ColumnHeaders.Add , , "Three"
Set li = .Lis... |
33,748,552 | Tensorflow: How to replace a node in a calculation graph? | <p>If you have two disjoint graphs, and want to link them, turning this:</p>
<pre><code>x = tf.placeholder('float')
y = f(x)
y = tf.placeholder('float')
z = f(y)
</code></pre>
<p>into this:</p>
<pre><code>x = tf.placeholder('float')
y = f(x)
z = g(y)
</code></pre>
<p>Is there a way to do that? It seems like it cou... | 33,770,771 | 4 | 0 | null | 2015-11-17 03:17:24.803 UTC | 17 | 2018-10-02 17:10:55.97 UTC | 2015-11-17 13:11:03.503 UTC | null | 997,378 | null | 997,378 | null | 1 | 38 | python|tensorflow | 20,818 | <p>TL;DR: If you can define the two computations as Python functions, you should do that. If you can't, there's more advanced functionality in TensorFlow to serialize and import graphs, which allows you to compose graphs from different sources.</p>
<p>One way to do this in TensorFlow is to build the disjoint computati... |
27,691,792 | Vim - Quit/Close Netrw without selecting any file | <p>My question is fairly simple, still I can't find the answer anywhere :
In Vim, how can I close Netrw explorer without actually selecting a file?
What keystroke should I hit to close the explorer and go back to the currently opened file? </p>
<p>So far, I have to select the currently opened file from within Netrw ... | 27,692,161 | 5 | 0 | null | 2014-12-29 15:39:56.48 UTC | 8 | 2020-06-18 14:04:27.077 UTC | 2014-12-29 15:47:29.687 UTC | null | 877,353 | null | 877,353 | null | 1 | 43 | vim|netrw | 18,215 | <p>Use <code><c-6></code>/<code><c-^></code> to go back to the previous buffer. See <code>:h CTRL-6</code>.</p>
<p>Pro-tip: use <code>:Rex</code> to <em>resume</em> exploring. See <code>:h :Rex</code></p> |
36,088,224 | What does userspace mode means in kube-proxy's proxy mode? | <p>kube-proxy has an option called --proxy-mode,and according to the help message, this option can be <strong>userspace</strong> or <strong>iptables</strong>.(See below)</p>
<pre><code># kube-proxy -h
Usage of kube-proxy:
...
--proxy-mode="": Which proxy mode to use: 'userspace' (older, stable) or 'iptables' (ex... | 36,088,688 | 1 | 0 | null | 2016-03-18 15:25:32.457 UTC | 12 | 2017-04-07 09:49:35.657 UTC | 2017-04-07 09:49:35.657 UTC | null | 1,925,083 | null | 615,674 | null | 1 | 19 | kubernetes|kube-proxy | 8,714 | <p>Userspace and iptables refer to what actually handles the connection forwarding. In both cases, local iptables rules are installed to intercept outbound TCP connections that have a destination IP address associated with a service. </p>
<p>In the userspace mode, the iptables rule forwards to a local port where a go ... |
45,263,064 | How can I fix this "ValueError: can't have unbuffered text I/O" in python 3? | <p>This is one of the MIT python project questions, but it's basically written for python 2.x users, so is there any way to fix the following code to operate in the latest python 3?</p>
<p>The current code is raising "ValueError: can't have unbuffered text I/O"</p>
<pre><code>WORDLIST_FILENAME = "words.txt"
def load... | 45,263,101 | 3 | 0 | null | 2017-07-23 08:29:48.947 UTC | 3 | 2021-09-30 11:47:36.183 UTC | 2019-11-10 13:27:55.743 UTC | null | 11,343 | null | 8,246,602 | null | 1 | 30 | python|python-3.x | 29,051 | <p>From <code>open</code>'s docstring:</p>
<blockquote>
<p>... buffering is an optional integer used to set the buffering policy.
Pass 0 to switch buffering off (<strong>only allowed in binary mode</strong>) ...</p>
</blockquote>
<p>So change <code>inFile = open(WORDLIST_FILENAME, 'r', 0)</code></p>
<p>to</p... |
22,724,921 | Do I need to do 'git init' before doing 'git clone' on a project | <p>I'm doing a <code>git clone</code> on a project following the instructions. But, do I need to do an <code>init</code> in the directory beforehand?</p> | 22,724,997 | 2 | 0 | null | 2014-03-28 23:28:01.717 UTC | 25 | 2015-10-14 20:03:18.427 UTC | 2015-10-14 20:03:18.427 UTC | null | 641,451 | null | 697,795 | null | 1 | 79 | git | 45,095 | <p><code>git clone</code> is basically a combination of:</p>
<ul>
<li><code>git init</code> (create the local repository)</li>
<li><code>git remote add</code> (add the URL to that repository)</li>
<li><code>git fetch</code> (fetch all branches from that URL to your local repository)</li>
<li><code>git checkout</code> ... |
27,162,552 | How to run ngrok in background? | <p>I tried running ngrok in the background with following command:</p>
<pre><code>./ngrok -subdomain test -config=ngrok.cfg 80 &
</code></pre>
<p>the process is running:</p>
<pre><code>[1] 3866
</code></pre>
<p>and the subdomain doesn't work.</p>
<p>It works with:</p>
<pre><code>./ngrok -subdomain test -config=ngro... | 27,163,717 | 21 | 0 | null | 2014-11-27 03:21:30.663 UTC | 14 | 2021-10-26 16:37:24.88 UTC | 2021-07-15 05:26:49.833 UTC | null | 5,918,539 | null | 4,040,776 | null | 1 | 35 | terminal|ngrok | 69,915 | <p>as explained <a href="https://github.com/inconshreveable/ngrok/issues/57">here</a></p>
<pre><code>ngrok -log=stdout 80 > /dev/null &
</code></pre> |
39,256,520 | Pyspark RDD .filter() with wildcard | <p>I have an Pyspark RDD with a text column that I want to use as a a filter, so I have the following code:</p>
<pre><code>table2 = table1.filter(lambda x: x[12] == "*TEXT*")
</code></pre>
<p>To problem is... As you see I'm using the <code>*</code> to try to tell him to interpret that as a wildcard, but no success.
... | 39,256,540 | 1 | 0 | null | 2016-08-31 18:23:31.093 UTC | null | 2018-03-14 13:59:47.907 UTC | null | null | null | null | 6,127,305 | null | 1 | 7 | python|apache-spark|rdd | 42,068 | <p>The lambda function is pure python, so something like below would work</p>
<pre><code>table2 = table1.filter(lambda x: "TEXT" in x[12])
</code></pre> |
21,188,239 | Spring transaction: rollback on Exception or Throwable | <p>I wonder whether it makes sense to use instead of </p>
<pre><code>@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
</code></pre>
<p>to use <code>Throwable</code></p>
<pre><code>@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
</code></pre>
<p>As I... | 21,188,820 | 4 | 0 | null | 2014-01-17 14:28:40.943 UTC | 12 | 2019-06-23 15:02:18.263 UTC | null | null | null | null | 71,420 | null | 1 | 29 | java|spring|transactions | 76,839 | <blockquote>
<p>As I understand catching Error will help us behave correctly even when something really bad happen. Or maybe it wouldn't help?</p>
</blockquote>
<p>You don't need to explicitly specify <code>rollbackFor = Throwable.class</code>, because spring will by default rollback the transaction if an <code>Erro... |
31,368,814 | Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' on a null object reference | <p><strong>MainActivity.java</strong> has following code:</p>
<pre><code>package com.softjourn.redmineclient.activities;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Base64;
import android.view.Menu;
import android.view.MenuItem;
import and... | 31,368,849 | 1 | 0 | null | 2015-07-12 14:26:02.613 UTC | 3 | 2019-02-07 10:07:36.907 UTC | null | null | null | null | 4,558,182 | null | 1 | 24 | java|android|list|android-studio|stack-trace | 71,414 | <p>You haven't initialised <code>List<Issue></code> in the IssuesResponse class. Try</p>
<pre><code>private List<Issue> issues = new ArrayList<>();
</code></pre> |
48,070,452 | Uncaught (in promise) Error: Request failed with status code 404 | <p>I am getting above error while fetching some data from the API. Following is the code of the <code>action creator</code> where I am trying <code>GET</code> the data: </p>
<pre><code>import { FETCH_USER } from './types';
import axios from 'axios';
export const fetchUser = () => async dispatch => {
c... | 56,900,591 | 3 | 0 | null | 2018-01-03 02:36:06.253 UTC | 1 | 2021-07-03 20:46:53.05 UTC | 2018-09-12 13:56:09.017 UTC | null | 472,495 | null | 8,936,320 | null | 1 | 4 | reactjs|react-redux|axios|dispatch-async | 43,849 | <p>Generally this error comes when the url/location provided inside GET method is not correct.
So check the url/location again and correct it.</p>
<p>So most probably there is some mistake here : '/api/current_user' </p> |
7,634,715 | Python decoding Unicode is not supported | <p>I am having a problem with my encoding in Python. I have tried different methods but I can't seem to find the best way to encode my output to UTF-8.</p>
<p>This is what I am trying to do:</p>
<pre><code>result = unicode(google.searchGoogle(param), "utf-8").encode("utf-8")
</code></pre>
<p><code>searchGoogle</code... | 7,634,778 | 1 | 0 | null | 2011-10-03 12:04:05.107 UTC | 17 | 2011-10-03 12:09:04.087 UTC | null | null | null | null | 486,845 | null | 1 | 81 | python|encoding|utf-8|character-encoding | 100,641 | <p>Looks like <code>google.searchGoogle(param)</code> already returns <code>unicode</code>:</p>
<pre><code>>>> unicode(u'foo', 'utf-8')
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
unicode(u'foo', 'utf-8')
TypeError: decoding Unicode is not supported
</code></p... |
50,283,857 | Using Cypress, how would I write a simple test to check that a logo image exists on a page | <p>specifically, I would like to test that the logo appears on the home page of the app. I guess I am not sure what I should use to look for the image.</p>
<p>I tried </p>
<pre><code>it('has a logo', function () {
cy.visit('http://localhost:3000')
cy.get('img').should('contains' , 'My-Logo.png')
})
</code>... | 50,284,329 | 2 | 0 | null | 2018-05-11 01:49:37.42 UTC | 2 | 2021-04-13 11:18:10.01 UTC | null | null | null | null | 5,692,673 | null | 1 | 29 | node.js|express|vue.js|cypress | 23,525 | <p>I figured out the solution on my own.</p>
<pre><code>cy.get('form').find('img').should('have.attr', 'src').should('include','My-Logo')
</code></pre>
<p>I inspected the element and found the <code><img src...</code> line was embedded within a <code><form></code>. I could do a <code>cy.get('form')</code> a... |
22,405,085 | Mocking $httpBackend - how to handle "Unexpected request, No more request expected"? | <p>I have a Jasmine test that is coded like this:</p>
<pre><code> it ("should send correct message to server to get data, and correctly set up scope when receiving it", function(){
$httpBackend.when('GET', 'https://localhost:44300/api/projectconfiguration/12').respond(fakedDtoBase);
$routeParams.projectId=fak... | 22,405,251 | 4 | 0 | null | 2014-03-14 12:32:28.573 UTC | 11 | 2021-10-27 06:20:30.857 UTC | 2014-03-30 16:51:26.607 UTC | null | 2,256,325 | null | 820,947 | null | 1 | 36 | angularjs|jasmine|karma-runner | 58,181 | <p>Your test fails because a request is made which you haven't specified.</p>
<p>Try to add:</p>
<pre><code>$httpBackend.when('GET', 'views/core/main/main.html').respond(fakedMainResponse);
</code></pre>
<p>Of course you should also define <code>fakedMainResponse</code>.</p>
<p>Please take a look also at the <a hre... |
3,136,453 | Immutable queue in Clojure | <p>What is the best way to obtain a simple, efficient immutable queue data type in Clojure?</p>
<p>It only needs two operations, enqueue and dequeue with the usual semantics.</p>
<p>I considered lists and vectors of course, but I understand that they have comparatively poor performance (i.e. O(n) or worse) for modif... | 3,136,693 | 3 | 5 | null | 2010-06-28 21:57:50.943 UTC | 7 | 2016-10-08 00:28:11.53 UTC | null | null | null | null | 214,010 | null | 1 | 35 | algorithm|data-structures|clojure|queue|immutability | 6,537 | <p>Problem solved - solution for others who may find it helpful.</p>
<p>I've found that Clojure has the clojure.lang.PersistentQueue class that does what is needed.</p>
<p>You can create an instance like this:</p>
<pre><code>(def x (atom clojure.lang.PersistentQueue/EMPTY))
</code></pre>
<p>As far as I can see, you... |
2,935,784 | What is the "Roster" in XMPP? | <p>I'm learning XMPP and I repeatedly see the word "Roster" but I have no idea what it is.</p> | 2,935,789 | 3 | 0 | null | 2010-05-29 16:28:33.153 UTC | 14 | 2017-04-11 09:24:57.01 UTC | 2017-04-11 09:24:57.01 UTC | null | 1,529,709 | null | 100,015 | null | 1 | 79 | xmpp | 29,676 | <blockquote>
<p>contact list (in XMPP this is called a "roster")</p>
</blockquote>
<p>Source: <a href="http://xmpp.org/rfcs/rfc6121.html#intro-requirements" rel="noreferrer">XMPP-IM - RFC 6121 § 1.3: Requirements</a></p> |
2,847,185 | How to programmatically trigger the click on a link using jQuery? | <p>How to programmatically trigger the click on a link using jQuery?</p> | 2,847,191 | 4 | 2 | null | 2010-05-17 07:06:51.08 UTC | 3 | 2019-03-12 15:45:27.217 UTC | 2019-03-12 15:45:27.217 UTC | null | 107,625 | null | 179,855 | null | 1 | 79 | jquery | 83,372 | <pre><code>$('#your_link_id').click()
</code></pre>
<p>See the excellent jquery <a href="http://api.jquery.com/click/" rel="noreferrer">docs</a> for more information</p> |
29,303,155 | How does Spring Batch transaction management work? | <p>I'm trying to understand how Spring Batch does transaction management. This is not a technical question but more of conceptual one: what approach does Spring Batch use and what are the consequences of that approach?</p>
<p>Let me try to clarify this question a bit. For instance, looking at the TaskletStep, I see th... | 29,304,822 | 1 | 0 | null | 2015-03-27 14:31:29.087 UTC | 10 | 2022-02-10 15:08:08.47 UTC | null | null | null | null | 1,688,586 | null | 1 | 17 | spring-batch | 28,667 | <p>There are two fundamental types of steps in Spring Batch, a Tasklet Step and a chunk based step. Each has it's own transaction details. Let's look at each:</p>
<p><strong>Tasklet Based Step</strong><br>
When a developer implements their own tasklet, the transactionality is pretty straight forward. Each call to t... |
36,292,620 | Elixir: When to use .ex and when .exs files | <p>Elixir's documentation <a href="https://elixir-lang.org/getting-started/modules-and-functions.html#scripted-mode" rel="noreferrer">states</a> that</p>
<blockquote>
<p>In addition to the Elixir file extension .ex, Elixir also supports
.exs files for scripting. Elixir treats both files exactly the same
way, the... | 36,293,239 | 4 | 0 | null | 2016-03-29 18:45:35.9 UTC | 13 | 2021-10-06 16:04:42.993 UTC | 2020-03-01 06:52:17.547 UTC | null | 1,417,451 | null | 69,349 | null | 1 | 93 | elixir | 22,770 | <p><code>.ex</code> is for compiled code, <code>.exs</code> is for interpreted code.</p>
<p>ExUnit tests, for example, are in <code>.exs</code> files so that you don't have to recompile every time you make a change to your tests. If you're writing scripts or tests, use <code>.exs</code> files. Otherwise, just use <cod... |
49,290,526 | Is there any straightforward way for Clap to display help when no command is provided? | <p>I'm using <a href="https://crates.io/crates/clap" rel="noreferrer">the Clap crate</a> for parsing command line parameters. I've defined a subcommand <code>ls</code> that should list files. Clap also defines a <code>help</code> subcommand that displays information about the application and its usage.</p>
<p>If no co... | 49,290,687 | 2 | 0 | null | 2018-03-15 02:16:41.493 UTC | 6 | 2022-03-16 12:42:08.04 UTC | 2021-07-15 01:40:02.123 UTC | null | 684,619 | null | 1,105,235 | null | 1 | 33 | rust|command-line-interface|clap | 5,863 | <p>Use <a href="https://docs.rs/clap/2.31.1/clap/enum.AppSettings.html#variant.ArgRequiredElseHelp" rel="noreferrer"><code>clap::AppSettings::ArgRequiredElseHelp</code></a>:</p>
<pre><code>App::new("myprog")
.setting(AppSettings::ArgRequiredElseHelp)
</code></pre>
<p>See also:</p>
<ul>
<li><a href="https://stack... |
49,087,643 | GraphQL Java client library | <p>I am looking for a java <em>client</em> library for GraphQL.
This is to use for server-to-server communication, both in java.
No android, not javascript... just java.
Apollo is the nearest answer, and it seems like it is for Android only, not for plain-java applications.
Lots of examples about build server in java,... | 49,273,780 | 1 | 0 | null | 2018-03-03 18:24:57.367 UTC | 4 | 2021-06-09 07:47:27.263 UTC | null | null | null | null | 9,439,222 | null | 1 | 32 | java|client|graphql | 12,520 | <p>There's a few clients available, all taking different approaches.</p>
<ol>
<li><a href="https://github.com/apollographql/apollo-android" rel="nofollow noreferrer">Apollo Android</a> - Originally intended for Android, but equally usable in any Java project. Someone also made a <a href="https://github.com/Sparow199/ap... |
179,510 | CSS - Is there a way to get rid of the selection rectangle after clicking a link? | <p>Is there a way to get rid of the selection rectangle when clicking a link which does not refresh the current page entirely?</p> | 179,532 | 2 | 0 | null | 2008-10-07 17:26:20.18 UTC | 9 | 2020-02-22 18:00:54.507 UTC | 2008-10-17 17:13:30.92 UTC | Mark Brady | null | Matthias | 16,440 | null | 1 | 47 | css|hyperlink | 26,680 | <p>Do you mean the dotted outline of a target?</p>
<p>Try:</p>
<pre><code>:focus {
outline: 0;
}
</code></pre>
<p>This would remove all focus outlines. IT's essentially the same as onclick in JavaScript terms. You might prefer to apply this to <code>a:focus</code>.</p> |
458,362 | How do I list all loaded assemblies? | <p>In .Net, I would like to enumerate all loaded assemblies over all AppDomains. Doing it for my program's AppDomain is easy enough <code>AppDomain.CurrentDomain.GetAssemblies()</code>. Do I need to somehow access every AppDomain? Or is there already a tool that does this?</p> | 458,390 | 2 | 3 | null | 2009-01-19 17:10:51.537 UTC | 18 | 2022-08-02 14:03:40.297 UTC | 2009-04-25 10:01:39.313 UTC | null | 49,246 | Abtin | 52,515 | null | 1 | 110 | c#|.net|assemblies | 112,431 | <p><strong>Using Visual Studio</strong></p>
<ol>
<li>Attach a debugger to the process (e.g. start with debugging or Debug > Attach to process)</li>
<li>While debugging, show the Modules window (Debug > Windows > Modules)</li>
</ol>
<p>This gives details about each assembly, app domain and has a few options to load sy... |
2,795,031 | synchronizing audio over a network | <p>I'm in startup of designing a client/server audio system which can stream audio arbitrarily over a network. One central server pumps out an audio stream and x number of clients receives the audio data and plays it. So far no magic needed and I have even got this scenario to work with VLC media player out of the box.... | 2,795,223 | 5 | 4 | null | 2010-05-08 17:44:29.71 UTC | 27 | 2019-02-23 03:15:27.39 UTC | 2017-05-23 10:29:52.607 UTC | null | -1 | null | 7,891 | null | 1 | 45 | algorithm|audio|synchronization|streaming | 23,833 | <p>Ryan Barrett wrote up his findings on <a href="http://snarfed.org/space/synchronizing_mp3_playback" rel="noreferrer">his blog</a>.</p>
<p>His solution involved using <a href="http://en.wikipedia.org/wiki/Network_Time_Protocol" rel="noreferrer">NTP</a> as a method to keep all the clocks in-sync:</p>
<blockquote>
... |
2,583,928 | Prefilling gmail compose screen with HTML text | <p>I found out that in order to open a Gmail compose screen you'd have to be logged in and open the following link:</p>
<p><a href="https://mail.google.com/a/domain/?view=cm&fs=1&tf=1&source=mailto&to=WHOEVER%40COMPANY.COM&su=SUBJECTHERE&cc=WHOEVER%40COMPANY.COM&bcc=WHOEVER%40COMPANY.COM&... | 2,585,630 | 6 | 4 | null | 2010-04-06 09:56:34.16 UTC | 12 | 2021-01-01 02:42:37.5 UTC | 2021-01-01 02:42:37.5 UTC | null | 1,783,163 | null | 89,752 | null | 1 | 12 | html|gmail|urlencode | 17,464 | <p>Check that your UrlEncode method really translates newlines into "%0a". Here's an example of a 2-line email body:</p>
<p><a href="https://mail.google.com/mail/?view=cm&ui=2&tf=0&fs=1&to=WHOEVER%40COMPANY.COM&su=SUBJECTHERE&body=LINE1%0aLINE2" rel="noreferrer">https://mail.google.com/mail/?vi... |
2,892,615 | How to remove auto focus/keyboard popup of a field when the screen shows up? | <p>I have a screen where the first field is an EditText, and it gains the focus at startup, also popups the numeric input type, which is very annoying</p>
<p>How can I make sure that when the activity is started the focus is not gained, and/or the input panel is not raised?</p> | 6,095,753 | 9 | 0 | null | 2010-05-23 16:58:58.48 UTC | 18 | 2020-07-22 08:51:23.733 UTC | 2018-04-13 09:20:18.537 UTC | null | 934,646 | null | 243,782 | null | 1 | 111 | android|keyboard|popup|android-softkeyboard | 83,183 | <pre><code>InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editTextField.getWindowToken(), 0);
</code></pre>
<p>or</p>
<p>set activity property in manifest file as below in the application tag</p>
<pre><code>android:windowSoftInputMode="stateHi... |
2,836,256 | Passing enum or object through an intent (the best solution) | <p>I have an activity that when started needs access to two different ArrayLists. Both Lists are different Objects I have created myself.</p>
<p>Basically I need a way to pass these objects to the activity from an Intent. I can use addExtras() but this requires a Parceable compatible class. I could make my classes t... | 9,753,178 | 15 | 1 | null | 2010-05-14 17:32:51.443 UTC | 47 | 2020-12-14 12:55:49.61 UTC | 2020-12-14 12:55:49.61 UTC | null | 1,306,012 | null | 248,521 | null | 1 | 246 | android | 120,628 | <p>This is an old question, but everybody fails to mention that Enums are actually <code>Serializable</code> and therefore can perfectly be added to an Intent as an extra. Like this:</p>
<pre><code>public enum AwesomeEnum {
SOMETHING, OTHER;
}
intent.putExtra("AwesomeEnum", AwesomeEnum.SOMETHING);
AwesomeEnum resu... |
25,058,007 | MongoDB difference between $orderby and Sort | <p>I want to fetch the latest document, which obviously is a single document, thus <code>findOne</code> should work fine. But <code>findOne</code> here returns the first document inserted. So I have two options now either use <code>$orderBy</code> with <code>findOne</code> or use <code>.sort()</code> function with <cod... | 37,954,176 | 2 | 0 | null | 2014-07-31 11:41:02.18 UTC | 7 | 2016-06-21 21:20:08.347 UTC | 2016-03-09 15:05:42.603 UTC | null | 324,381 | null | 3,045,515 | null | 1 | 19 | mongodb|mongoose | 41,108 | <p>As of Mongo 3.2, <code>$orderby</code> is <a href="https://docs.mongodb.com/manual/reference/operator/meta/orderby/" rel="noreferrer">deprecated</a>.</p>
<p>The <a href="https://docs.mongodb.com/manual/reference/operator/meta/orderby/" rel="noreferrer">docs explicitly say</a>:</p>
<blockquote>
<p>The $orderby op... |
25,107,774 | How do I send an HTTP GET request from a Chrome extension? | <p>I'm working on a chrome extension that sends a HTTP request using the method GET.</p>
<p>How do I send a GET to <code>www.example.com</code> with the parameter <code>par</code> with value <code>0</code>?</p>
<pre class="lang-none prettyprint-override"><code>https://www.example.com?par=0
</code></pre>
<p>(the server ... | 25,107,925 | 1 | 0 | null | 2014-08-03 18:28:58.107 UTC | 15 | 2022-01-11 21:19:49.953 UTC | 2022-01-11 21:19:49.953 UTC | null | 3,889,449 | null | 3,903,910 | null | 1 | 66 | javascript|google-chrome|google-chrome-extension|get|xmlhttprequest | 75,502 | <p>First, you'll need to edit your <code>manifest.json</code> and add the permission for <code>www.example.com</code>:</p>
<ul>
<li><p>For the new <a href="https://developer.chrome.com/docs/extensions/mv3/intro/" rel="noreferrer">Manifest V3</a>, use the <code>host_permissions</code> field:</p>
<pre class="lang-json pr... |
23,725,816 | Dispatch event with data | <p>I'd like to dispatch an event that will pass some data to any event listeners that listen on that event.</p>
<p>Considering a function that fires an event:</p>
<pre><code>function click() {
const x = 'foo'
document.dispatchEvent(new CustomEvent('clicked'))
}
click()
</code></pre>
<p>How can I pass custom dat... | 23,725,973 | 2 | 0 | null | 2014-05-18 19:10:21.047 UTC | 10 | 2021-05-19 16:35:54.223 UTC | 2021-05-19 16:35:54.223 UTC | null | 13,604,898 | null | 1,814,486 | null | 1 | 76 | javascript|events|custom-events | 71,589 | <p>Perhaps you are looking for <code>event.detail</code></p>
<pre><code>new CustomEvent('eventName', {'detail': data})
</code></pre>
<p>Instead of data use x and in event listener you can access x using event.detail</p>
<pre><code>function getSelectionBounds() {
var x = (bounds["x"].toFixed(2));
var y = "xyz";
... |
5,696,801 | IIS 7.5 applicationHost.config file is not being updated | <p>I'm currently playing around with the Microsoft.Web.Administration (MWA) namespace in order to adjust our application to configure IIS 7.5 with the new API.
I understood that all IIS level changes should be expressed in the following file (I'm on Win2K8-R2): </p>
<pre>%WINDIR%\System32\inetsrv\config\applicationHos... | 5,697,389 | 2 | 0 | null | 2011-04-17 22:10:47.403 UTC | 8 | 2016-03-14 13:10:49.593 UTC | 2011-04-18 00:02:17.183 UTC | null | 419 | null | 608,377 | null | 1 | 28 | iis-7.5|mime-types|applicationhost | 35,898 | <p>I just tried your code and it works fine. You are aware that this mime type is being added to the global mime type collection and not to a site?</p>
<p>It also gets added to the end of the <code><staticContent></code> list, this list isn't re-sorted when you do <code>ServerManager.CommitChanges()</code>.</p>
... |
5,790,965 | Return total records from SQL Server when using ROW_NUMBER | <p>I would like to return the total number of records in the database so I can set up pagination. How do I return the total number of records in the DB when using the following paging method in SQL Server 2008?</p>
<pre><code> ALTER PROCEDURE [dbo].[Nop_LoadAllOptimized]
(
@PageSize int = 20,
@P... | 5,791,178 | 2 | 4 | null | 2011-04-26 13:19:55.24 UTC | 16 | 2013-04-28 23:21:34.723 UTC | 2011-04-26 17:19:31.267 UTC | null | 21,234 | null | 520,712 | null | 1 | 30 | sql-server|paging|sql-server-2008-r2 | 32,351 | <p>I typically do it this way - never really checked whether it's very efficient from a performance point of view:</p>
<pre><code>WITH YourCTE AS
(
SELECT
(list of columns),
ROW_NUMBER() OVER (ORDER BY ......) AS 'RowNum'
FROM dbo.YourBaseTable
)
SELECT
*,
(SELECT MAX(RowNum) FROM YourC... |
33,336,396 | HTML/CSS close button overlapping right/upper corner | <p>Looking to place a button overlying, and partially outside parent div such as in this picture. MY attempts have it within the parent DIV. The picture below is what I am after.</p>
<p><a href="https://i.stack.imgur.com/0g4EA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0g4EA.png" alt="enter image descri... | 33,336,458 | 1 | 0 | null | 2015-10-25 23:43:05.97 UTC | 9 | 2020-02-17 21:17:35.327 UTC | null | null | null | null | 4,618,774 | null | 1 | 21 | html|css | 57,806 | <p>I guess this is what you looking for:</p>
<p>Just add <code>position:absolute;</code> instead <code>relative</code></p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>#container {
width: 80%;
/*border-radius... |
30,803,440 | Delayed rendering of React components | <p>I have a React component with a number of child components in it. I want to render the child components not at once but after some delay (uniform or different for each of the children).</p>
<p>I was wondering - is there a way how to do this?</p> | 30,807,560 | 10 | 0 | null | 2015-06-12 12:45:03.653 UTC | 26 | 2022-03-17 06:18:55.39 UTC | null | null | null | null | 1,213,844 | null | 1 | 75 | javascript|reactjs | 170,146 | <p>I think the most intuitive way to do this is by giving the children a "wait" <code>prop</code>, which hides the component for the duration that was passed down from the parent. By setting the default state to hidden, React will still render the component immediately, but it won't be visible until the state has chan... |
31,109,659 | How does collisionBitMask work? Swift/SpriteKit | <p>As far as I'm aware the default for Physics bodies is to bounce off each other when they hit each other until you set their collisionBitMask to an equal number.</p>
<p>However, I'm having a huge issue accomplishing what seems like it should be very simple because of collisionBitmasks I believe.</p>
<pre><code>let ... | 31,111,039 | 2 | 0 | null | 2015-06-29 07:04:48.177 UTC | 16 | 2020-05-20 18:14:14.67 UTC | 2020-05-20 18:14:14.67 UTC | null | 1,028,230 | null | 4,988,582 | null | 1 | 27 | swift|sprite-kit|skphysicsbody | 14,020 | <p>You can't get desired behaviour because you haven't set category, contact and collision bit masks properly. Here is an example on how you can set this to work:</p>
<pre><code>greenBall.physicsBody?.categoryBitMask = GreenBallCategory //Category is GreenBall
greenBall.physicsBody?.contactTestBitMask = RedBarCategory... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.