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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
26,126,853 | Verifying PEP8 in iPython notebook code | <p>Is there an easy way to check that iPython notebook code, while it's being written, is compliant with PEP8?</p> | 37,423,434 | 7 | 0 | null | 2014-09-30 17:41:27.587 UTC | 24 | 2021-12-13 14:03:28.29 UTC | 2014-10-06 18:53:39.163 UTC | null | 1,079,075 | null | 1,079,075 | null | 1 | 53 | python|ipython|ipython-notebook|pep8 | 27,887 | <p>In case this helps anyone, I'm using:</p>
<p><code>conttest "jupyter nbconvert notebook.ipynb --stdout --to script | flake8 - --ignore=W391"</code></p>
<ul>
<li><code>conttest</code> reruns when saving changes to the notebook</li>
<li><code>flake8 -</code> tells flake8 to take input from stdin</li>
<li><code>--ign... |
3,038,203 | Is there any point in using a volatile long? | <p>I occasionally use a <code>volatile</code> instance variable in cases where I have two threads reading from / writing to it and don't want the overhead (or potential deadlock risk) of taking out a lock; for example a timer thread periodically updating an int ID that is exposed as a getter on some class:</p>
<pre><c... | 3,038,233 | 3 | 3 | null | 2010-06-14 14:49:32.08 UTC | 19 | 2015-12-23 17:15:11.117 UTC | 2010-11-23 08:15:21.003 UTC | null | 276,052 | null | 127,479 | null | 1 | 58 | java|multithreading|concurrency|volatile | 17,318 | <p>Not sure if I understand your question correctly, but the <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.3.1.4" rel="noreferrer">JLS 8.3.1.4. volatile Fields</a> states:</p>
<blockquote>
<p>A field may be declared volatile, in which case the Java memory model ensures that all threads s... |
2,503,010 | Extracting columns from text file using PowerShell | <p>I have to extract columns from a text file explained in this post:</p>
<p><a href="https://stackoverflow.com/questions/2499746/extracting-columns-from-text-file-using-perl-similar-to-unix-cut">Extracting columns from text file using Perl one-liner: similar to Unix cut</a></p>
<p>but I have to do this also in a Win... | 2,503,038 | 4 | 0 | null | 2010-03-23 19:34:36.49 UTC | 3 | 2017-09-22 15:13:43.333 UTC | 2017-05-23 10:30:17.893 UTC | null | -1 | null | 255,564 | null | 1 | 13 | powershell|windows-server-2008 | 58,738 | <p>Try this:</p>
<pre><code>Get-Content test.txt | Foreach {($_ -split '\s+',4)[0..2]}
</code></pre>
<p>And if you want the data in those columns printed on the same line:</p>
<pre><code>Get-Content test.txt | Foreach {"$(($_ -split '\s+',4)[0..2])"}
</code></pre>
<p>Note that this requires PowerShell 2.0 for the <... |
2,888,422 | axis2 maven example | <p>I try to use axis2 (1.5.1) version to generate java codes from wsdl files, but I can't figure out what is the correct pom.xml</p>
<pre><code><build>
<plugins>
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-wsdl2code-maven-plugin... | 2,889,488 | 4 | 1 | null | 2010-05-22 14:22:41.373 UTC | 6 | 2015-07-30 02:29:22.38 UTC | 2010-05-26 06:56:28.12 UTC | null | 308,174 | null | 308,174 | null | 1 | 20 | maven-2|wsdl|axis2|xmlserializer|wsdl2code | 53,767 | <p>It's maybe not optimal but the following pom.xml seems to allow the generated code to be compiled:</p>
<pre><code><project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.stackoverflow</groupId>
<artifactId>Q2888422</artifactId>
<version>1.0-SNAPSHOT</vers... |
2,687,012 | Split string into sentences | <p>I have written this piece of code that splits a string and stores it in a string array:-</p>
<pre><code>String[] sSentence = sResult.split("[a-z]\\.\\s+");
</code></pre>
<p>However, I've added the [a-z] because I wanted to deal with some of the abbreviation problem. But then my result shows up as so:-</p>
<blockq... | 2,687,929 | 4 | 0 | null | 2010-04-21 22:29:34.107 UTC | 17 | 2021-01-22 15:07:07.643 UTC | 2016-01-22 18:48:44.563 UTC | null | 1,393,766 | null | 282,544 | null | 1 | 27 | java|regex|split|abbreviation | 35,965 | <p>Parsing sentences is far from being a trivial task, even for latin languages like English. A naive approach like the one you outline in your question will fail often enough that it will prove useless in practice.</p>
<p>A better approach is to use a <a href="http://icu-project.org/apiref/icu4j/com/ibm/icu/text/Brea... |
2,443,885 | graph library for scala | <p>Is there a good library (or wrapper to Java library) for graphs, and/or graph algorithms in scala?</p>
<p><a href="http://code.google.com/p/scala-graphs/" rel="noreferrer">This one</a> seems to be quite dead. <a href="http://en.literateprograms.org/Dijkstra's_algorithm_(Scala)" rel="noreferrer">This</a> is an e... | 2,445,951 | 4 | 2 | null | 2010-03-14 21:40:34.873 UTC | 10 | 2014-10-11 18:33:34.47 UTC | null | null | null | null | 55,094 | null | 1 | 33 | scala|graph | 14,370 | <p>We have developed a small graph library for the apparat project. You can take a look at it <a href="http://code.google.com/p/apparat/source/browse/#hg%2Fapparat-core%2Fsrc%2Fmain%2Fscala%2Fapparat%2Fgraph" rel="noreferrer">here</a>. It is not purely functional and not a zipper graph but does a good job for us. You g... |
2,419,650 | C/C++ macro/template blackmagic to generate unique name | <p>Macros are fine.
Templates are fine.
Pretty much whatever it works is fine.</p>
<p>The example is OpenGL; but the technique is C++ specific and relies on no knowledge of OpenGL.</p>
<p>Precise problem:</p>
<p>I want an expression E; where I do not have to specify a unique name; such that a constructor is called w... | 2,419,720 | 4 | 8 | null | 2010-03-10 18:53:08.383 UTC | 30 | 2019-06-09 07:57:34.417 UTC | 2015-09-19 16:29:31.557 UTC | null | 1,023,390 | null | 247,265 | null | 1 | 44 | c++|c-preprocessor|raii | 18,499 | <p>If your compiler supports <code>__COUNTER__</code> (it probably does), you could try:</p>
<pre><code>// boiler-plate
#define CONCATENATE_DETAIL(x, y) x##y
#define CONCATENATE(x, y) CONCATENATE_DETAIL(x, y)
#define MAKE_UNIQUE(x) CONCATENATE(x, __COUNTER__)
// per-transform type
#define GL_TRANSLATE_DETAIL(n, x, y,... |
2,970,361 | How to read the full stacktrace in Java where it says e.g. "... 23 more" | <p>I want to read the full stack trace of an exception that I capture.</p>
<p>For example:</p>
<pre><code>org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.ibm.db2.jcc.DB2Driver'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)
at org.apache... | 2,970,366 | 4 | 3 | null | 2010-06-03 22:53:16.863 UTC | 6 | 2021-01-10 14:21:41.17 UTC | 2021-01-10 14:21:41.17 UTC | null | 157,882 | null | 332,897 | null | 1 | 68 | java|stack-trace | 80,564 | <p>The answer is simple, those lines are already in the stacktrace :)</p>
<pre><code> at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at com.azurian.lce.usuarios.ConnectionManager.getConnection(ConnectionManager.java:65)
at com.azurian.lce.usuarios.db2.UsuarioDAOImpl.autenticar... |
2,634,073 | How do I animate View.setVisibility(GONE) | <p>I want to make an <code>Animation</code> for when a <code>View</code> gets it's visibility set to <code>GONE</code>. Instead of just dissapearing, the <code>View</code> should 'collapse'. I tried this with a <code>ScaleAnimation</code> but then the <code>View</code> is collapse, but the layout will only resize it's ... | 3,952,933 | 4 | 4 | null | 2010-04-14 00:10:59.607 UTC | 59 | 2014-08-13 18:16:42.14 UTC | 2010-04-14 21:49:56.777 UTC | null | 120,309 | null | 120,309 | null | 1 | 84 | android|animation | 65,471 | <p>There doesn't seem to be an easy way to do this through the API, because the animation just changes the rendering matrix of the view, not the actual size. But we can set a negative margin to fool LinearLayout into thinking that the view is getting smaller. </p>
<p>So I'd recommend creating your own Animation class,... |
52,882,119 | Create React App not installing, showing an error and aborting installation | <p>I Reinstalled Node.js and Yarn. Now I am getting this error.</p>
<p>My environment information is:</p>
<blockquote>
<p>Node: v8.12.0</p>
<p>NPM: 6.4.1</p>
<p>Yarn: 1.10.1</p>
<p>OS: Windows 10</p>
</blockquote>
<pre><code>PS C:\Users\mdbel\Desktop\Project\redux> npx create-react-app learnredux
Creating a new Rea... | 59,962,639 | 18 | 1 | null | 2018-10-18 20:33:05.02 UTC | 5 | 2022-02-21 20:10:49.153 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 2,114,949 | null | 1 | 14 | node.js|reactjs|npm|create-react-app|yarnpkg | 38,198 | <p>removing <code>.npmrc</code> from <code>C:\Users\you\.npmrc</code> can also solve the problem.</p> |
2,731,719 | How can "this" of the outer class be accessed from an inner class? | <p>Is it possible to get a reference to <code>this</code> from within a Java inner class?</p>
<p>i.e.</p>
<pre><code>class Outer {
void aMethod() {
NewClass newClass = new NewClass() {
void bMethod() {
// How to I get access to "this" (pointing to outer) from here?
}
};
}
}
</code></... | 2,731,729 | 5 | 0 | null | 2010-04-28 17:22:45.853 UTC | 21 | 2018-10-22 18:39:46.08 UTC | 2015-06-25 18:36:05.533 UTC | null | 18,103 | null | 317,778 | null | 1 | 74 | java|inner-classes | 24,774 | <p>You can access the instance of the outer class like this:</p>
<pre><code>Outer.this
</code></pre> |
2,726,993 | How to specify preference of library path? | <p>I'm compiling a c++ program using <code>g++</code> and <code>ld</code>. I have a <code>.so</code> library I want to be used during linking. However, a library of the same name exists in <code>/usr/local/lib</code>, and <code>ld</code> is choosing that library over the one I'm directly specifying. How can I fix this?... | 2,727,033 | 5 | 1 | null | 2010-04-28 05:17:06.657 UTC | 57 | 2018-10-15 06:30:06.17 UTC | 2017-01-03 06:29:39.94 UTC | null | 3,980,929 | null | 218,386 | null | 1 | 112 | c++|linker|g++ | 268,638 | <p><strong>Add the path to where your new library is to <code>LD_LIBRARY_PATH</code> (it has slightly different name on Mac ...)</strong></p>
<p>Your solution should work with using the <code>-L/my/dir -lfoo</code> options, at runtime use LD_LIBRARY_PATH to point to the location of your library.</p>
<p><a href="https... |
2,431,040 | java outOfMemoryError with stringbuilder | <p>I'm getting a java outOfMemoryError when I call this method - i'm using it in a loop to parse many large files in sequence. my guess is that <code>result.toString()</code> is not getting garbage collected properly during the loop. if so, how should i fix it?</p>
<pre><code>private String matchHelper(String buffer, ... | 2,431,094 | 6 | 3 | null | 2010-03-12 07:06:59.723 UTC | 6 | 2021-11-01 12:29:15.23 UTC | 2021-11-01 12:29:15.23 UTC | null | 5,459,839 | null | 276,712 | null | 1 | 8 | java|string|out-of-memory|heap-memory|stringbuilder | 38,227 | <p>Written this way, you'll need roughly <strong>6</strong> bytes of memory for every character in the file. </p>
<p>Each character is two bytes. You have the raw input, the substituted output (in the buffer), and you are asking for a third copy when you run out of memory.</p>
<p>If the file is encoded in something l... |
2,420,135 | Hide HTML element by id | <p>Hopefully there's a quick and dirty way to remove the "Ask Question" (or hide it) from a page where I can only add CSS and Javascript:</p>
<pre><code> <div class="nav" style="float: right;">
<ul>
<li style="margin-right: 0px;" >
<a id="nav-ask" href="/questions/as... | 2,420,166 | 6 | 2 | null | 2010-03-10 20:01:44.513 UTC | 6 | 2015-02-01 16:27:52.057 UTC | 2015-02-01 16:27:52.057 UTC | null | 3,204,551 | null | 2,915 | null | 1 | 31 | javascript|html|css | 151,313 | <pre><code><style type="text/css">
#nav-ask{ display:none; }
</style>
</code></pre> |
2,681,243 | How should I declare default values for instance variables in Python? | <p>Should I give my class members default values like this:</p>
<pre><code>class Foo:
num = 1
</code></pre>
<p>or like this?</p>
<pre><code>class Foo:
def __init__(self):
self.num = 1
</code></pre>
<p>In <a href="https://stackoverflow.com/questions/2424451/about-python-class-and-instance-variables">... | 2,681,507 | 6 | 0 | null | 2010-04-21 08:11:40.563 UTC | 38 | 2020-07-06 14:24:06.217 UTC | 2017-05-23 11:46:55.12 UTC | null | -1 | null | 149,330 | null | 1 | 116 | python|class|oop | 167,086 | <p>Extending bp's answer, I wanted to show you what he meant by immutable types.</p>
<p>First, this is okay:</p>
<pre><code>>>> class TestB():
... def __init__(self, attr=1):
... self.attr = attr
...
>>> a = TestB()
>>> b = TestB()
>>> a.attr = 2
>>> a.att... |
2,435,695 | Converting a md5 hash byte array to a string | <p>How can I convert the hashed result, which is a byte array, to a string?</p>
<pre><code>byte[] bytePassword = Encoding.UTF8.GetBytes(password);
using (MD5 md5 = MD5.Create())
{
byte[] byteHashedPassword = md5.ComputeHash(bytePassword);
}
</code></pre>
<p>I need to convert <code>byteHashedPassword</code> to a... | 2,435,734 | 7 | 1 | null | 2010-03-12 20:35:43.557 UTC | 11 | 2019-05-28 20:47:36.087 UTC | 2019-05-28 20:47:36.087 UTC | null | 2,224,584 | null | 39,677 | null | 1 | 88 | c#|hash|cryptography|md5|cryptographic-hash-function | 89,908 | <pre><code> public static string ToHex(this byte[] bytes, bool upperCase)
{
StringBuilder result = new StringBuilder(bytes.Length*2);
for (int i = 0; i < bytes.Length; i++)
result.Append(bytes[i].ToString(upperCase ? "X2" : "x2"));
return result.ToString();
}
</code></... |
3,038,302 | Why do ZeroMemory, etc. exist when there are memset, etc. already? | <p>Why does <code>ZeroMemory()</code>, and similar calls exist in the Windows API when there are memset and related calls in the C standard library already? Which ones should I call? I can guess the answer is "depends". On what?</p> | 3,038,539 | 8 | 0 | null | 2010-06-14 15:04:56.073 UTC | 3 | 2022-09-11 09:31:22.067 UTC | 2018-10-01 21:42:47.497 UTC | null | 3,204,551 | null | 113,748 | null | 1 | 32 | c++|c|windows|winapi|memset | 28,339 | <p>In C and C++, <code>ZeroMemory()</code> and <code>memset()</code> are the exact same thing.</p>
<pre><code>/* In winnt.h */
#define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length))
/* In winbase.h */
#define ZeroMemory RtlZeroMemory
</code></pre>
<p>Why use <code>ZeroMemory()</code> then? <a href=... |
2,579,734 | Get the type name | <p>How i can get full right name of generic type?</p>
<p>For example:
This code </p>
<pre><code>typeof(List<string>).Name
</code></pre>
<p>return </p>
<blockquote>
<p>List`1</p>
</blockquote>
<p>instead of </p>
<pre><code>List<string>
</code></pre>
<h2>How to get a right name?</h2>
<pre><code>typ... | 2,579,755 | 10 | 1 | null | 2010-04-05 17:09:53.513 UTC | 4 | 2019-09-07 13:20:26.777 UTC | 2010-04-05 17:16:35.093 UTC | null | 290,082 | null | 290,082 | null | 1 | 42 | c#|generics | 39,788 | <p>Use the <a href="http://msdn.microsoft.com/en-us/library/system.type.fullname.aspx" rel="noreferrer">FullName property</a>.</p>
<pre><code>typeof(List<string>).FullName
</code></pre>
<p>That will give you the namespace + class + type parameters.</p>
<p>What you are asking for is a C# specific syntax. As far... |
33,743,493 | Why Visual Studio 2015 can't run exe file (ucrtbased.dll)? | <p>I have installed the Visual Studio 2015 and created Win32 project with some code. I compiled it successfully, but I can't launch exe file, because I don't have some ucrtbased.dll...So how can I solve it? </p>
<p><a href="https://i.stack.imgur.com/g6vTC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/g6vTC... | 41,970,093 | 6 | 2 | null | 2015-11-16 19:55:03.54 UTC | 19 | 2021-07-15 13:48:19.467 UTC | 2017-01-04 09:43:31.237 UTC | null | 28,411 | null | 5,175,197 | null | 1 | 47 | visual-studio|visual-studio-2015|exe | 131,714 | <p>This problem is from VS 2015 silently failing to copy <code>ucrtbased.dll</code> (debug) and <code>ucrtbase.dll</code> (release) into the appropriate system folders during the installation of Visual Studio. (Or you did not select "Common Tools for Visual C++ 2015" during installation.) This is why reinstal... |
30,893,225 | IE Input type Date not appearing as Date Picker | <p>I am using the input type DATE in my HTML and everything works fine in Chrome and Firefox, but IE does not show the date picker.</p>
<p>When I use the JQuery Datepicker I get two date picker dialogs in Chrome and Firefox.</p>
<p>How can I fix the functionality where I can have the date input type and only have one... | 30,893,387 | 1 | 0 | null | 2015-06-17 13:34:47.367 UTC | 2 | 2019-04-15 00:46:21.513 UTC | 2017-02-09 14:28:16.43 UTC | null | 487,670 | null | 487,670 | null | 1 | 6 | internet-explorer|date|datepicker | 38,899 | <p>You need to use a <a href="https://en.wikipedia.org/wiki/Polyfill_(programming)" rel="nofollow noreferrer">polyfill</a> so that the input type DATE has a consistent behaviour in all browsers. You can use this <a href="http://afarkas.github.io/webshim/demos/index.html" rel="nofollow noreferrer">webshim</a> as a polyf... |
23,226,888 | Horizontal list items - fit to 100% with even spacing | <p>I have a simple list and i am trying to get the list items to be evenly spaced horizontally, but still fill 100% of the width of the container regardless of the width of the container.</p>
<p>I do not want each list item to be of equal width, but instead the spacing between each list item to be even:</p>
<p>jsfidd... | 23,226,961 | 1 | 0 | null | 2014-04-22 17:56:23.633 UTC | 20 | 2016-10-17 15:26:44.143 UTC | null | null | null | null | 1,189,880 | null | 1 | 39 | html|css|responsive-design | 83,338 | <p>The new CSS flexbox specification would be the solution to your problem :) </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>ul {
display: flex;
align-items: stret... |
32,190,881 | How to solve ERR_CONNECTION_REFUSED when trying to connect to localhost running IISExpress - Error 502 (Cannot debug from Visual Studio)? | <p>This is running on Windows Server 2008 and used to work several months ago. I am just now using this server again for some dev work with VS.</p>
<p>This is live web server used to serve up a few test sites as well.</p>
<p>This came up when running Visual Studio, then launching my projects for debugging.</p>
<p>T... | 35,418,904 | 23 | 1 | null | 2015-08-24 20:09:09.573 UTC | 17 | 2022-04-28 11:55:21.107 UTC | 2017-07-11 09:35:21.4 UTC | null | 1,842,261 | null | 172,359 | null | 1 | 112 | visual-studio|localhost|iis-express | 502,275 | <p>Try changing the port number in your project?</p>
<p>Project Properties → Web → Servers → Project Url:</p>
<p><a href="https://i.stack.imgur.com/cg3uW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/cg3uW.png" alt="enter image description here"></a></p>
<p>Don't forget to click <code>Create Virtual Dire... |
35,618,998 | How to implement Bottom Sheets using new design support library 23.2 | <p>Google release the new update to support library 23.2 in that they added bottom sheet feature. Can any one tell how to implement that bottom sheet using that library.</p> | 35,620,244 | 4 | 1 | null | 2016-02-25 05:21:19.483 UTC | 15 | 2017-03-17 09:57:08.513 UTC | null | null | null | null | 2,586,055 | null | 1 | 32 | android|android-support-library|android-support-design | 38,938 | <p><a href="https://i.stack.imgur.com/Mi8y6.png"><img src="https://i.stack.imgur.com/Mi8y6.png" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/FYdNb.png"><img src="https://i.stack.imgur.com/FYdNb.png" alt="enter image description here"></a></p>
<p>use layout like below</p>
<pre><co... |
36,816,788 | How do I call an Angular 2 pipe with multiple arguments? | <p>I know I can call a pipe like this:</p>
<pre><code>{{ myData | date:'fullDate' }}
</code></pre>
<p>Here the date pipe takes only one argument.
What is the syntax to call a pipe with more parameters, from component's template HTML and directly in code?</p> | 36,816,789 | 6 | 0 | null | 2016-04-23 21:41:45.09 UTC | 43 | 2022-04-04 14:05:59.063 UTC | 2016-12-21 19:44:13.767 UTC | null | 5,862,315 | null | 5,862,315 | null | 1 | 308 | javascript|angular|angular2-pipe | 277,684 | <p>In your component's template you can use multiple arguments by separating them with colons:</p>
<pre><code>{{ myData | myPipe: 'arg1':'arg2':'arg3'... }}
</code></pre>
<p>From your code it will look like this:</p>
<pre><code>new MyPipe().transform(myData, arg1, arg2, arg3)
</code></pre>
<p>And in your transform ... |
46,725,357 | Firestore - batch.add is not a function | <p>The <a href="https://firebase.google.com/docs/firestore/manage-data/transactions#batched-writes" rel="noreferrer">documentation</a> for Firestore batch writes lists only <code>set()</code>, <code>update()</code> and <code>delete()</code> as permitted operations.</p>
<p>Is there no way to add an <code>add()</code> o... | 46,739,496 | 9 | 0 | null | 2017-10-13 08:08:20.93 UTC | 10 | 2022-03-11 11:35:15.367 UTC | null | null | null | null | 2,131,598 | null | 1 | 80 | google-cloud-firestore | 24,249 | <p>You can do this in two steps:</p>
<pre><code>// Create a ref with auto-generated ID
var newCityRef = db.collection('cities').doc();
// ...
// Add it in the batch
batch.set(newCityRef, { name: 'New York City' });
</code></pre>
<p>The <code>.doc()</code> method does not write anything to the network or disk, it ju... |
8,813,265 | Why doesn't ignorecase flag (re.I) work in re.sub() | <p>From pydoc:</p>
<blockquote>
<p>re.sub = sub(pattern, repl, string, count=0, flags=0)<br>
Return the string obtained by replacing the leftmost
non-overlapping occurrences of the pattern in string by the
replacement repl. repl can be either a string or a callable;
if a string, backslash es... | 8,813,281 | 5 | 0 | null | 2012-01-11 02:04:45.513 UTC | 8 | 2019-11-26 12:34:43.007 UTC | null | null | null | null | 992,005 | null | 1 | 60 | python|regex | 35,096 | <p>Seems to me that you should be doing:</p>
<pre><code>import re
print(re.sub('class', 'function', 'Class object', flags=re.I))
</code></pre>
<p>Without this, the <code>re.I</code> argument is passed to the <code>count</code> argument.</p> |
38,862,101 | How do I share Protocol Buffer .proto files between multiple repositories | <p>We are considering using <a href="https://developers.google.com/protocol-buffers/" rel="noreferrer">Protocol Buffers</a> for communicating between a python & a node.js service that each live in their own repos. </p>
<p>Since the <code>.proto</code> files must be accessible to both repos, how should we share the... | 38,866,138 | 2 | 0 | null | 2016-08-09 23:41:03.533 UTC | 6 | 2016-08-10 19:30:06.503 UTC | 2016-08-10 00:04:36.057 UTC | null | 475,505 | null | 475,505 | null | 1 | 33 | python|node.js|git|protocol-buffers | 8,788 | <p>This depends on your development process.</p>
<p>A git subtree / submodule seems like a sensible solution for most purposes. If you had more downstream projects, publishing a ready-made module would make sense, as then the protobuf generator wouldn't be needed for every project.</p> |
27,568,265 | Neo4j super node issue - fanning out pattern | <p>I'm new to the Graph Database scene, looking into Neo4j and learning Cypher, we're trying to model a graph database, it's a fairly simple one, we got <em>users</em>, and we got <em>movies</em>, <em>users</em> can <strong>VIEW</strong> <em>movies</em>, <strong>RATE</strong> <em>movies</em>, create <em>playlists</em> ... | 27,569,672 | 3 | 0 | null | 2014-12-19 14:41:16.287 UTC | 14 | 2020-10-19 13:09:19.857 UTC | 2014-12-19 14:48:29.08 UTC | null | 991,683 | null | 991,683 | null | 1 | 26 | performance|neo4j|cypher|graph-databases|node-neo4j | 4,457 | <p><strong>UPDATE - October 2020</strong>. <a href="https://medium.com/neo4j/graph-modeling-all-about-super-nodes-d6ad7e11015b" rel="nofollow noreferrer">This article is the best source on this topic</a>, covering all aspects of super nodes</p>
<p>(my original answer below)</p>
<p>It's a good question. This isn't rea... |
34,803,565 | How to send a value from one component to another? | <p>I make a componenet in which I have one input field and button.On click of button I am diplaying the second component.I want to send data from one component to another component ?</p>
<p>how I will send data from one component to another ..I need to send input value (what ever user type in input field ) I need to s... | 34,807,178 | 3 | 0 | null | 2016-01-15 02:44:44.15 UTC | 10 | 2019-01-14 12:24:45.487 UTC | 2016-03-06 16:41:44.983 UTC | null | 217,408 | null | 3,701,974 | null | 1 | 10 | angular|angular2-routing|angular2-template|angular2-directives | 57,964 | <p>Oh!! may be I' m too late to answer the question!
But never mind.This might help you or other to share data between components using Router,Shared-Service and Shared-object used withing shared-service. I hope this will surely help.</p>
<p><a href="http://plnkr.co/edit/RRE6rGGVkHrgTIwzdXxc?p=preview">Answer</a></p>... |
35,013,383 | ItemDecoration based on viewtype in recyclerview | <p>I have multiple <em>view types</em> in my <code>RecyclerView</code> and I want to add an <code>ItemDecoration</code> based on the views type. Is there a way to do this?</p>
<p>This will add a decoration to every element:</p>
<pre><code>recyclerView.addItemDecoration(decoration);
</code></pre>
<p>I saw this <a hre... | 35,013,727 | 4 | 0 | null | 2016-01-26 11:59:43.873 UTC | 9 | 2020-09-21 23:01:00.087 UTC | 2016-01-26 18:22:45 UTC | null | 1,837,367 | null | 3,531,883 | null | 1 | 21 | java|android|android-recyclerview | 18,459 | <p>Yes, you can.</p>
<p>If you draw the decoration yourself, you can distinguish between different view types in <code>getItemOffsets</code> and <code>onDraw</code> by accessing the same method on the adapter like this:</p>
<pre><code>// get the position
int position = parent.getChildAdapterPosition(view);
// get th... |
28,989,605 | Add Metadata, headers (Expires, CacheControl) to a file uploaded to Amazon S3 using the Laravel 5.0 Storage facade | <p>I am trying to find out how to add in Metadata or headers (Expires, CacheControl etc.) to a file uploaded using the Laravel 5.0 Storage facade. I have use the page here as reference.</p>
<p><a href="http://laravel.com/docs/5.0/filesystem" rel="noreferrer">http://laravel.com/docs/5.0/filesystem</a></p>
<p>The follo... | 30,355,563 | 10 | 0 | null | 2015-03-11 14:41:32.187 UTC | 11 | 2022-08-18 11:44:36.303 UTC | 2015-03-13 18:00:44.37 UTC | null | 1,178,974 | null | 3,333,232 | null | 1 | 29 | php|amazon-s3|laravel-5|flysystem | 16,642 | <p>First, you need to call <code>getDriver</code> so you can send over an array of options. And then you need to send the options as an array.</p>
<p>So for your example:</p>
<pre><code>Storage::disk('s3')->getDriver()->put('/index4.txt', 'test', [ 'visibility' => 'public', 'Expires' => 'Expires, Fri, 30 Oc... |
29,192,579 | Fixed UISearchBar using UISearchController - Not using header view of UITableView | <p>Is it possible to put UISearchBar of UISearchController somewhere other than header view of UITableView?</p>
<p>In the <a href="https://developer.apple.com/library/ios/samplecode/TableSearch_UISearchController/Introduction/Intro.html" rel="noreferrer">apple's sample code for UISearchController</a>, following is use... | 29,193,911 | 3 | 0 | null | 2015-03-22 08:58:03.767 UTC | 8 | 2018-09-22 10:04:33.083 UTC | 2016-05-12 15:49:09.37 UTC | null | 750,510 | null | 2,541,555 | null | 1 | 14 | ios|uisearchbar|uisearchcontroller | 9,495 | <p>You can place the UISearchBar of UISearchController in the navigation bar so that it remains fixed</p>
<pre><code>self.searchController.hidesNavigationBarDuringPresentation = NO;
self.searchController.searchBar.searchBarStyle = UISearchBarStyleMinimal;
// Include the search bar within the navigation bar.
self.navi... |
27,129,169 | Android Studio - running a build collapses all the folders in the Project browser? | <p>I've been developing on Eclipse for years and have just started a new project on Android Studio.</p>
<p>I'm noticing that every time I run a build, Android Studio <strong>collapses ALL the folders</strong> in the Project Files browser, such that they need to be re-expanded to get back to where I want them.</p>
<p>Th... | 27,149,717 | 2 | 0 | null | 2014-11-25 14:22:20.64 UTC | 4 | 2014-11-26 12:50:42.997 UTC | 2020-06-20 09:12:55.06 UTC | null | -1 | null | 2,418,562 | null | 1 | 34 | android|android-studio | 4,131 | <p>I think you want to use the "Project" view, and not the "Project Files" view. I had this problem when I first switched from Eclipse to Android Studio and found it was because I'd set the file browser (top left) to look at Project files and not Project. The normal Project view does much the same thing and doesn't col... |
3,063,652 | What's the status of multicore programming in Haskell? | <p>What's the status of multicore programming in Haskell? What projects, tools, and libraries are available now? What experience reports have there been?</p> | 3,063,668 | 1 | 0 | 2010-06-17 18:26:18.407 UTC | 2010-06-17 16:39:24.857 UTC | 109 | 2015-06-13 18:40:24.857 UTC | null | null | null | null | 83,805 | null | 1 | 163 | haskell|concurrency|functional-programming|multicore|parallel-processing | 13,369 | <p>In the 2009-2012 period, the following things have happened:</p>
<p>2012:</p>
<ul>
<li>From 2012, the parallel Haskell status updates began appearing in the <a href="http://www.well-typed.com/blog/65" rel="noreferrer">Parallel Haskell Digest</a>.</li>
</ul>
<p>2011:</p>
<ul>
<li><a href="http://community.haskell... |
32,417,776 | You do not have permission to use the bulk load statement error | <p>I am trying to insert an image into a VARBINARY(MAX) column. I get this error: </p>
<blockquote>
<p>You do not have permission to use the bulk load statement.</p>
</blockquote>
<p>Here is my code:</p>
<pre><code>INSERT INTO Stickers (Name, Category, Gender, ImageData)
SELECT
'Red Dress',
... | 32,418,341 | 3 | 0 | null | 2015-09-05 21:19:14.31 UTC | 3 | 2021-01-20 07:05:30.73 UTC | 2017-05-23 11:52:04.293 UTC | null | -1 | null | 3,935,156 | null | 1 | 24 | sql-server|ssms | 99,596 | <p>To make sure you have the right permissions to use BULK commands follow the below</p>
<ul>
<li>Expand <strong>Security</strong></li>
<li>Expand <strong>Logins</strong></li>
<li>Right click on your username and choose <em>properties</em>
(A dialog window appears)</li>
<li>Choose <strong>Server Roles</strong></li>
<... |
6,051,145 | Using the repository pattern to support multiple providers | <p>Well, not sure if that's exactly the right title, but basically I have been having a lot of problems using repositories in MVC applications in such a way that you can substitute one set of repositories, implementing a different data storage technology, for another.</p>
<p>For example, suppose I want to use Entity F... | 6,051,328 | 1 | 2 | null | 2011-05-18 21:17:35.693 UTC | 12 | 2014-02-02 10:46:18.483 UTC | 2014-02-02 10:46:18.483 UTC | null | 727,208 | null | 244,346 | null | 1 | 14 | asp.net-mvc|entity-framework|design-patterns|repository-pattern | 3,914 | <p>What I can say? Welcome to the club ...</p>
<p>What you found is problem reached by many developers who followed "repository boom" with EFv4. Yes it is the problem and the problem is really complex. I discussed this several times:</p>
<ul>
<li><a href="https://stackoverflow.com/questions/5609508/asp-net-mvc3-and-e... |
5,607,774 | ack regex: Matching two words in order in the same line | <p>I would like to find lines in files that include two words, <code>word_1</code> and <code>word_2</code> in order, such as in <code>Line A</code> below, but not as in <code>Line B</code> or <code>Line C</code>:</p>
<pre><code>Line A: ... word_1 .... word_2 ....
Line B: ... word_1 ....
Line C: ... word_2 ....
</code... | 5,607,981 | 1 | 0 | null | 2011-04-09 20:42:18.313 UTC | 6 | 2011-04-09 21:18:50.01 UTC | 2011-04-09 20:59:00.66 UTC | null | 283,296 | null | 283,296 | null | 1 | 33 | regex|ack | 46,127 | <p>You want to find <code>word_1</code>, followed by anything, any number of times, followed by <code>word_2</code>. That should be </p>
<pre><code>word_1.*word_2
</code></pre>
<p>You seem to be using <code>*</code> as it is often used in command line searches, but in regexes is it a quantifier for the preceding cha... |
25,071,985 | Thymeleaf th:text - Put a text without removing HTML structures | <p>I'm new in thymeleaf and I try to create a template. My problem is this code:</p>
<pre><code><h1 th:text="${header.title}" >
title
<small th:text="${header.subtitle}" >Subtitle</small>
</h1>
</code></pre>
<p>I would like to get this output:</p>
<pre><code><h1> ... | 29,317,466 | 4 | 0 | null | 2014-08-01 02:29:25.163 UTC | 14 | 2022-08-31 00:54:25.81 UTC | 2022-08-31 00:54:25.81 UTC | null | 12,370,687 | null | 1,086,120 | null | 1 | 70 | templates|spring-mvc|thymeleaf | 125,463 | <p>I faced the same problem. <strong>The answer is <code>th:inline='text'</code></strong></p>
<p>This should solve your issue</p>
<pre><code><h1 th:inline="text" >
[[${header.title}]]
<small th:text="${header.subtitle}">Subtitle</small>
</h1>
</code></pre>
<hr/>
<p>or you can also use ... |
25,092,666 | text-decoration: none not working on ul | <p>I've seen a lot of questions relating to this subject but none of them answered my question. I am making a sidebar for a site and I'm trying to make the links in boxes that are the same width as the sidebar, have just a little padding, maybe 10-15px and a tiny bit of space between each. Maybe 3px. But I can't seem t... | 25,092,767 | 2 | 0 | null | 2014-08-02 07:13:56.123 UTC | 1 | 2014-08-02 07:29:52.793 UTC | 2014-08-02 07:22:45.523 UTC | null | 1,326,536 | null | 3,901,556 | null | 1 | 5 | html|css|text-decorations | 54,077 | <p>Removing the <code>text-decoration</code> and setting the colour is easy</p>
<pre><code>#sidelinks a {
color:black;
text-decoration:none;
}
</code></pre>
<p>So is removing the dots</p>
<pre><code>#sidelinks ul {
list-style:none;
padding:0;
margin:0;
}
</code></pre>
<p>If you look at the CSS ... |
351,954 | Accessing iPhone WiFi Information via SDK | <p>Is there a way using the iPhone SDK to get WiFi information? Things like Signal Strength, WiFi Channel and SSID are the main things I'm looking for.</p>
<p>Only interested in Wifi info, not cellular.</p> | 412,548 | 3 | 4 | null | 2008-12-09 06:29:30.883 UTC | 9 | 2017-04-27 09:22:31.497 UTC | 2009-01-13 23:43:20.213 UTC | MrValdez | 1,599 | KiwiBastard | 1,075 | null | 1 | 25 | iphone|cocoa-touch|wifi | 48,215 | <p>Based on <a href="http://openradar.appspot.com/radar?id=306" rel="nofollow noreferrer">this</a> bug report and <a href="https://stackoverflow.com/questions/339089/can-the-iphone-sdk-obtain-the-wi-fi-ssid-currently-connected-to">this</a> SO question, I'm guessing there's no supported way to do this atm.</p>
<p>EDIT:... |
1,206,884 | PHP GD: How to get imagedata as binary string? | <p>I'm using a solution for assembling image files to a zip and streaming it to browser/Flex application. (ZipStream by Paul Duncan, <a href="http://pablotron.org/software/zipstream-php/" rel="noreferrer">http://pablotron.org/software/zipstream-php/</a>).</p>
<p>Just loading the image files and compressing them works ... | 1,206,909 | 3 | 0 | null | 2009-07-30 14:17:23.803 UTC | 7 | 2019-12-30 02:36:37.667 UTC | null | null | null | null | 146,400 | null | 1 | 33 | php|zip|gd | 24,258 | <p>One way is to tell GD to output the image, then use PHP buffering to capture it to a string:</p>
<pre><code>$imagedata = imagecreatefrompng($imagefile);
ob_start();
imagepng($imagedata);
$stringdata = ob_get_contents(); // read from buffer
ob_end_clean(); // delete buffer
$zdata = gzdeflate($stringdata);
</code></p... |
6,358,066 | How to implement a dynamic list with a JSF 2.0 Composite Component? | <p>I asked <a href="https://stackoverflow.com/questions/6355543/pass-argument-to-a-composite-component-action-attribute">this</a> question and although the answer directly satisfied my needs I am left with a feeling that there has to a simpler solution for this specific problem.</p>
<p>I would like to have a composite... | 6,358,272 | 1 | 0 | null | 2011-06-15 13:02:51.09 UTC | 11 | 2015-07-16 15:28:45.4 UTC | 2017-05-23 11:45:34.29 UTC | null | -1 | null | 128,076 | null | 1 | 16 | jsf|jsf-2|facelets|dynamic-forms|composite-component | 15,701 | <p>I'd use a <code><h:dataTable></code> in a composite component with a backing <code>UIComponent</code> which you can bind by <code>componentType</code> attribute of the <code><composite:interface></code>. In the backing <code>UIComponent</code> you can then maintain the <code>DataModel</code> and define t... |
6,584,898 | How to set list of values as parameter into hibernate query? | <p>For example, I have this query </p>
<pre><code> select cat from Cat cat where cat.id in :ids
</code></pre>
<p>and I want to set ids to list (1,2,3,4,5,6,17,19).</p>
<p>This code doesn't work </p>
<pre><code>session.createQuery("select cat from Cat cat where cat.id in :ids")
.setParameter("ids", new Long[... | 6,584,995 | 1 | 0 | null | 2011-07-05 15:09:02.023 UTC | 6 | 2017-11-17 08:43:54.17 UTC | 2017-11-17 08:43:54.17 UTC | null | 100,297 | null | 426,377 | null | 1 | 32 | sql|hibernate|jpa | 47,641 | <p>Use <a href="https://docs.jboss.org/hibernate/orm/5.1/javadocs/org/hibernate/Query.html#setParameterList-java.lang.String-java.lang.Object:A-"><code>setParameterList()</code></a>. You'll also have to put parenthesis around the list param.</p>
<pre><code>session.createQuery("select cat from Cat cat where cat.id in (... |
20,479,794 | How do I properly git stash/pop in pre-commit hooks to get a clean working tree for tests? | <p>I'm trying to do a pre-commit hook with a bare run of unit tests and I want to make sure my working directory is clean. Compiling takes a long time so I want to take advantage of reusing compiled binaries whenever possible. My script follows examples I've seen online:</p>
<pre><code># Stash changes
git stash -q -... | 20,480,591 | 4 | 0 | null | 2013-12-09 20:13:09.017 UTC | 13 | 2021-12-10 20:12:21.693 UTC | null | null | null | null | 156,767 | null | 1 | 28 | git|githooks|git-stash | 10,379 | <p>There is—but let's get there in a slightly roundabout fashion. (Also, see warning below: there's a bug in the stash code which I thought was very rare, but apparently more people are running into. New warning, added in Dec 2021: <code>git stash</code> has been rewritten in C and has a whole new crop of bugs. I us... |
564,935 | No implicit conversion between 'lambda expression' and 'lambda expression'? | <blockquote>
<p>Type of conditional expression cannot be determined because there is no implicit conversion between 'lambda expression' and 'lambda expression'</p>
</blockquote>
<p>Say whaat? Could someone please explain this compile error to me? This is the code that produces it:</p>
<pre><code> protected overr... | 564,973 | 1 | 1 | null | 2009-02-19 11:50:13.273 UTC | 4 | 2020-06-26 14:53:36.463 UTC | 2020-06-26 14:53:36.463 UTC | null | 4,671,754 | Svish | 39,321 | null | 1 | 45 | c#|lambda | 9,261 | <p>The type of the conditional expression has to be inferred as a whole - and lambda expressions always have to be converted to a specific delegate or expression tree type.</p>
<p>In your latter two examples, the compiler knows what it's trying to convert the lambda expression to. In the first example, it tries to wor... |
2,699,584 | How to split (chunk) a Ruby array into parts of X elements? | <p>I have an array</p>
<pre><code>foo = %w(1 2 3 4 5 6 7 8 9 10)
</code></pre>
<p>How can I split or "chunk" this into smaller arrays?</p>
<pre><code>class Array
def chunk(size)
# return array of arrays
end
end
foo.chunk(3)
# => [[1,2,3],[4,5,6],[7,8,9],[10]]
</code></pre> | 2,699,615 | 2 | 0 | null | 2010-04-23 15:00:30.623 UTC | 33 | 2015-06-27 14:19:10.203 UTC | 2011-08-18 06:30:58.23 UTC | null | 184,600 | null | 184,600 | null | 1 | 200 | ruby|arrays | 139,107 | <p>Take a look at <a href="http://apidock.com/ruby/Enumerable/each_slice" rel="noreferrer">Enumerable#each_slice</a>:</p>
<pre><code>foo.each_slice(3).to_a
#=> [["1", "2", "3"], ["4", "5", "6"], ["7", "8", "9"], ["10"]]
</code></pre> |
32,843,213 | Operator does not exist: json = json | <p>when I try to select some record from a table</p>
<pre><code> SELECT * FROM movie_test WHERE tags = ('["dramatic","women", "political"]'::json)
</code></pre>
<p>The sql code cast a error</p>
<pre><code>LINE 1: SELECT * FROM movie_test WHERE tags = ('["dramatic","women",...
... | 32,843,380 | 1 | 0 | null | 2015-09-29 11:49:06.307 UTC | 10 | 2021-08-28 14:18:38.673 UTC | 2017-06-09 11:11:38.2 UTC | null | 1,995,738 | null | 4,482,493 | null | 1 | 40 | sql|json|postgresql|postgresql-9.4|jsonb | 61,464 | <p>In short - use JSONB instead of JSON or cast JSON to JSONB.</p>
<p>You cannot compare json values. You can compare text values instead:</p>
<pre><code>SELECT *
FROM movie_test
WHERE tags::text = '["dramatic","women","political"]'
</code></pre>
<p>Note however that values of type JSON ... |
33,207,164 | Spark Window Functions - rangeBetween dates | <p>I have a Spark SQL <code>DataFrame</code> with date column, and what I'm trying to get is all the rows preceding current row in a given date range. So for example I want to have all the rows from 7 days back preceding given row. I figured out, I need to use a <code>Window Function</code> like:</p>
<pre class="lang-... | 33,226,511 | 3 | 0 | null | 2015-10-19 05:24:07.907 UTC | 26 | 2022-08-09 03:33:36.337 UTC | 2022-07-04 09:56:38.06 UTC | null | 2,753,501 | null | 4,248,237 | null | 1 | 51 | apache-spark|date|pyspark|apache-spark-sql|window-functions | 69,702 | <p><strong>Spark >= 2.3</strong></p>
<p>Since Spark 2.3 it is possible to use interval objects using SQL API, but the <code>DataFrame</code> API support is <a href="https://issues.apache.org/jira/browse/SPARK-25841" rel="noreferrer">still work in progress</a>.</p>
<pre class="lang-py prettyprint-override"><code>df.cr... |
33,123,093 | Insert CSS into loaded HTML in UIWebView / WKWebView | <p>I am successfully able to get HTML content and display into my UIWebView. </p>
<p>But want to customize the content by adding an external CSS file. I can only change the size of text and font. I tried every possible solution to make changes but it does not work - it shows no changes. </p>
<p>Below is my code</p>... | 33,126,467 | 6 | 0 | null | 2015-10-14 10:37:03.217 UTC | 16 | 2020-07-09 12:18:38.207 UTC | 2017-04-20 01:04:12.947 UTC | null | 47,281 | null | 5,444,667 | null | 1 | 43 | ios|objective-c|uiwebview|wkwebview | 49,506 | <p>You can do it like this:</p>
<pre><code>- (void)webViewDidFinishLoad:(UIWebView *)webView {
NSString *cssString = @"body { font-family: Helvetica; font-size: 50px }"; // 1
NSString *javascriptString = @"var style = document.createElement('style'); style.innerHTML = '%@'; document.head.appendChild(style)"; /... |
23,353,009 | Vim spellcheck not always working in .tex file. Check region in Vim | <p>I use Vim to write my <code>.tex</code> files, but I am having trouble with the spell checker in Vim. Sometimes it does not check the words, and I think that it might be for the following reason.</p>
<p>Since Vim is clearly not supposed to check all of the words in the <code>.tex</code> document, for example, not ... | 23,357,364 | 3 | 0 | null | 2014-04-28 23:37:30.497 UTC | 13 | 2022-01-28 14:04:01.083 UTC | null | null | null | null | 1,529,157 | null | 1 | 38 | vim|latex|spell-checking|region | 9,264 | <p><code>syntax/tex.vim</code> already uses quite elaborate <em>sync patterns</em> to ensure that the syntax highlighting is accurate, but for long and complex documents, this may still fail.</p>
<p>Best you can do is trying to increase both values of</p>
<pre><code>syn sync maxlines=200
syn sync minlines=50
</code><... |
30,918,732 | How to determine which textfield is active swift | <p>I cant figure out which <code>UITextField</code> is currently active so i can clear its text if they hit cancel on a <code>UIBarButtonItem</code>. Here is my code. There is a view with a <code>UIPickerView</code>,<code>UIToolBar</code> and two bar button items. The cancel item has an action that will clear its text ... | 30,918,882 | 7 | 0 | null | 2015-06-18 14:49:41.127 UTC | 4 | 2018-11-24 20:29:58.113 UTC | 2015-06-18 15:25:03.457 UTC | null | 1,226,963 | null | 4,926,460 | null | 1 | 35 | ios|swift | 44,874 | <p>You can declare a <code>UITextField</code> property in your class, and assign the current text field to it in <code>textFieldDidBeginEditing</code>.
Then you can just call this text field whenever you need to.</p>
<pre><code>class ViewController : UIViewController, UITextFieldDelegate {
var activeTextField = UI... |
47,114,672 | What is difference between Barrier and Guideline in Constraint Layout? | <p><strong>Recently trying to implement <code>Constraint Layout</code> but I found <code>Barrier</code> and <code>Guideline</code> works same.</strong> Both works like divider. Is there any difference between them?</p> | 47,241,263 | 2 | 0 | null | 2017-11-04 19:21:44.32 UTC | 46 | 2021-10-01 07:26:32.347 UTC | null | null | null | null | 2,976,830 | null | 1 | 180 | android|android-constraintlayout | 72,736 | <h2>When to use barriers</h2>
<p>Assume you have two <code>TextView</code> widgets with dynamic heights and you want to place a <code>Button</code> just below the tallest <code>TextView</code>:</p>
<p><a href="https://i.stack.imgur.com/Vy0g6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Vy0g6.png" alt="Task... |
1,518,279 | JSON IPHONE: How to send a JSON request and pull the data from a server? | <p>I know barely nothing about JSON and I need to send a request to a server and read the data coming from it, using the iPhone only.</p>
<p>I have tried to use the <a href="https://github.com/stig/json-framework" rel="nofollow noreferrer">jason-framework</a>
to do that, but after readin the documentations I was not a... | 1,518,569 | 1 | 0 | null | 2009-10-05 04:37:58.44 UTC | 10 | 2012-09-02 16:35:59.527 UTC | 2012-09-02 16:35:59.527 UTC | null | 264,419 | null | 316,469 | null | 1 | 5 | iphone|objective-c|json|iphone-sdk-3.0 | 14,569 | <p>JSON framework supports converting Arrays, Dictionaries, Strings, Numbers, and Booleans. So what you want to do is convert your data to one of these formats. Since your data is NSData easiest way is to convert it with:</p>
<pre><code>NSString* stringData = [[NSString alloc] initWithData:yourData
... |
30,115,242 | Generating a Simple QR-Code with just HTML | <p>I came across this <code>APIserver</code> to generate the QRCode but I was wondering is it possible to just use HTML to generate the QRcode for example this is what I was thinking</p>
<pre class="lang-html prettyprint-override"><code><input id="text" type="text" value="Please Enter Your N... | 30,115,477 | 1 | 0 | null | 2015-05-08 03:24:50.303 UTC | 1 | 2021-08-23 04:15:46.883 UTC | 2020-07-15 09:29:58.407 UTC | null | 9,154,188 | null | 4,848,728 | null | 1 | 10 | qr-code | 83,846 | <p>Were you thinking of something like this? <a href="https://jsfiddle.net/v7d6d1ps/" rel="noreferrer">https://jsfiddle.net/v7d6d1ps/</a></p>
<p>Your HTML can be similar to what you have but with added onblur event. Only HTML cannot do this, so I have added jQuery/JavaScript combination.</p>
<pre><code><html>
... |
37,039,943 | Spark Scala: How to transform a column in a DF | <p>I have a dataframe in Spark with many columns and a udf that I defined. I want the same dataframe back, except with one column transformed. Furthermore, my udf takes in a string and returns a timestamp. Is there an easy way to do this? I tried</p>
<pre><code>val test = myDF.select("my_column").rdd.map(r => getTi... | 37,039,990 | 1 | 0 | null | 2016-05-04 23:44:46.117 UTC | 13 | 2022-09-13 14:24:14.973 UTC | 2016-05-05 00:32:37.663 UTC | null | 3,864,822 | null | 3,689,314 | null | 1 | 29 | scala|apache-spark | 42,800 | <p>If you really need to use your function, I can suggest two options:</p>
<ol>
<li><p>Using map / toDF:</p>
<pre><code>import org.apache.spark.sql.Row
import sqlContext.implicits._
def getTimestamp: (String => java.sql.Timestamp) = // your function here
val test = myDF.select("my_column").rdd.map {
ca... |
20,674,720 | Backup/Restore from different database causing Restore failed exclusive access could not be obtained | <p>I have a database A. I have taken a backup of database A called A.bak. I created a new database B. Now, I right click and Restore B from A.bak. In the Restore Dialog, I checked overwrite existing database and change the LogicalFileName from <code>C:\Program Files\Microsoft SQL Server\MSSQL11.SQLSERVER2012\MSSQL\DATA... | 22,363,859 | 3 | 0 | null | 2013-12-19 06:23:05.673 UTC | 3 | 2015-09-13 11:58:36.583 UTC | 2013-12-19 07:18:34.823 UTC | null | 960,567 | null | 960,567 | null | 1 | 26 | sql|sql-server|sql-server-2012 | 40,230 | <p>A cause for the attempt to get exclusive access comes from the options page of the restore dialog in SQL Server 2012 Management Studio. It will turn on tail-log and leave in restoring state options for the SOURCE database. So, it will try to gain exclusive access to the source database (in this case A) in order to... |
27,251,644 | How to get 1 hour ago from a date in iOS swift? | <p>I have been researching, but I couldnt find exact solution for my problem. I have been trying to get 1 hour ago from a date. How can I achieve this in swift?</p> | 27,251,855 | 14 | 0 | null | 2014-12-02 14:19:23.127 UTC | 18 | 2021-02-24 17:11:51.917 UTC | 2018-04-06 04:42:16.703 UTC | null | 7,576,100 | null | 4,300,689 | null | 1 | 52 | ios|iphone|swift|date | 42,983 | <p>For correct calculations involving NSDate that take into account all edge cases of different calendars (e.g. switching between day saving time) you should use NSCalendar class:</p>
<p><strong>Swift 3+</strong></p>
<pre><code>let earlyDate = Calendar.current.date(
byAdding: .hour,
value: -1,
to: Date())
</c... |
30,355,185 | How to read an integer input from the user in Rust 1.0? | <p>Existing answers I've found are all based on <code>from_str</code> (such as <a href="https://stackoverflow.com/q/25632070/155423">Reading in user input from console once efficiently</a>), but apparently <code>from_str(x)</code> has changed into <code>x.parse()</code> in Rust 1.0. As a newbie, it's not obvious how t... | 30,355,925 | 8 | 0 | null | 2015-05-20 16:17:27.2 UTC | 6 | 2021-11-27 18:52:31.87 UTC | 2017-09-27 16:26:04.093 UTC | null | 155,423 | null | 8,127 | null | 1 | 30 | input|integer|rust|user-input | 38,169 | <p>Here is a version with all optional type annotations and error handling which may be useful for beginners like me:</p>
<pre><code>use std::io;
fn main() {
let mut input_text = String::new();
io::stdin()
.read_line(&mut input_text)
.expect("failed to read from stdin");
let trimmed ... |
30,535,309 | Where should I define JS function to call in EJS template | <p>I am working on a template where I am trying to render template using express and ejs. As to the standard structure of node app, I have app.js file which which contains functions like following:</p>
<pre><code>app.locals.getFlag = function(country) {
var flag_img_name = "";
if (country.toLowerCase() == "us") {
... | 30,539,675 | 7 | 0 | null | 2015-05-29 17:07:35.217 UTC | 10 | 2020-01-31 07:06:16.21 UTC | null | null | null | null | 3,482,656 | null | 1 | 30 | node.js|express|ejs | 56,352 | <p>Just posting this answer here for someone who would might end up on this question while resolving same issue.</p>
<p>All you have to do is create new file (say <code>functions.ejs</code>) and include it in the .ejs file where you want to call that function. So, I have function like this in file named <code>function... |
30,590,243 | Using Laravel Socialite to login to facebook | <p>I am new to Laravel however and I am following the tutorial on <a href="http://www.codeanchor.net/blog/complete-laravel-socialite-tutorial/" rel="noreferrer">http://www.codeanchor.net/blog/complete-laravel-socialite-tutorial/</a>, to login a user through Facebook into my application. However, almost everywhere I fin... | 30,590,747 | 3 | 0 | null | 2015-06-02 07:45:00.03 UTC | 15 | 2018-07-26 11:44:03.397 UTC | 2017-05-23 12:34:41.687 UTC | null | -1 | null | 325,533 | null | 1 | 16 | php|facebook|facebook-graph-api|laravel|laravel-socialite | 38,460 | <p>In your composer.json add- <code>"laravel/socialite": "~2.0",</code></p>
<pre><code>"require": {
"laravel/framework": "5.0.*",
"laravel/socialite": "~2.0",
</code></pre>
<p>the run <code>composer update</code></p>
<p>In <strong>config/services.php</strong> add:</p>
<pre><code>//Socialite
'fac... |
26,561,604 | Create Named Pipe C++ Windows | <p>I am trying to create a simple comunication between 2 processes in C++ ( Windows ) like FIFO in linux.
This is my server:</p>
<pre><code>int main()
{
HANDLE pipe = CreateFile(TEXT("\\\\.\\pipe\\Pipe"), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
ConnectNamedPipe(pipe, NULL);
wh... | 26,561,999 | 1 | 0 | null | 2014-10-25 10:53:48.883 UTC | 32 | 2020-02-28 09:42:37.507 UTC | 2020-02-28 09:42:37.507 UTC | null | 995,714 | null | 3,052,078 | null | 1 | 27 | windows|c++11|ipc|named-pipes|fifo | 90,985 | <p>You cannot create a named pipe by calling <code>CreateFile(..)</code>.</p>
<p>Have a look at the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa365799%28v=vs.85%29.aspx" rel="noreferrer">pipe examples of the MSDN</a>. Since these examples are quite complex I've quickly written a <strong>VERY</st... |
27,652,686 | Python: What does for x in A[1:] mean? | <p>I was trying to understand Kadane's algorithm from Wikipedia, when I found this:</p>
<pre><code>def max_subarray(A):
max_ending_here = max_so_far = A[0]
for x in A[1:]:
max_ending_here = max(x, max_ending_here + x)
max_so_far = max(max_so_far, max_ending_here)
return max_so_far
</code></... | 27,652,711 | 6 | 0 | null | 2014-12-26 03:58:06.073 UTC | 13 | 2021-11-25 09:47:32.747 UTC | null | null | null | null | 4,383,783 | null | 1 | 17 | python | 89,547 | <p>This is <a href="https://docs.python.org/2/tutorial/introduction.html#lists" rel="noreferrer">array slice</a> syntax. See this SO question:
<a href="https://stackoverflow.com/questions/509211/explain-pythons-slice-notation">Explain Python's slice notation</a> .</p>
<p>For a list <code>my_list</code> of objects ... |
27,689,425 | How to make maven build of child module with parent module? | <p>I have multiple modules in my project and they are dependent on each other either directly or transitively.
When I maven build «Project A» some where «Project D» gets build automatically.</p>
<pre><code>Project A > Project B > Project C > Project D
where > means Project B depends on Project A
</code><... | 27,689,569 | 2 | 1 | null | 2014-12-29 13:00:37.14 UTC | 3 | 2016-03-04 10:12:42.04 UTC | 2016-03-04 10:12:42.04 UTC | null | 490,018 | null | 3,907,459 | null | 1 | 13 | java|maven|pom.xml | 50,981 | <p>You need to create an aggregator project. See <a href="http://maven.apache.org/pom.html#Aggregation" rel="noreferrer">the link for more information on the aggregation concept</a>.</p>
<p>Basically, you create a parent project containing several "modules". When building the parent, the modules automatically gets bui... |
44,383,601 | AWS elastic-search. FORBIDDEN/8/index write (api). Unable to write to index | <p>I am trying dump a list of docs to an AWS elastic-search instance. It was running fine. Then, all of sudden it started throwing this error:</p>
<pre><code>{ _index: '<my index name>',
_type: 'type',
_id: 'record id',
status: 403,
error:
{ type: 'cluster_block_exception',
reason: 'blocked by: [... | 47,745,128 | 5 | 0 | null | 2017-06-06 07:15:27.247 UTC | 8 | 2022-09-23 08:34:42.12 UTC | 2021-09-29 20:08:23.943 UTC | null | 321,731 | null | 5,453,496 | null | 1 | 48 | amazon-web-services|elasticsearch | 37,335 | <p>This error is the Amazon ES service actively blocking writes to protect the cluster from reaching red or yellow status. It does this using <a href="https://www.elastic.co/guide/en/elasticsearch/reference/6.0/index-modules.html#dynamic-index-settings" rel="noreferrer"><code>index.blocks.write</code></a>.</p>
<p>The t... |
34,440,604 | Whether to use invokeAll or submit - java Executor service | <p>I have a scenario where I have to execute 5 thread asynchronously for the same callable. As far as I understand, there are two options:</p>
<p>1) using submit(Callable)</p>
<pre><code>ExecutorService executorService = Executors.newFixedThreadPool(5);
List<Future<String>> futures = new ArrayList<>... | 34,798,567 | 3 | 0 | null | 2015-12-23 17:10:45.403 UTC | 10 | 2019-12-31 09:40:51.467 UTC | 2015-12-23 17:40:58.167 UTC | null | 810,176 | null | 810,176 | null | 1 | 25 | java|concurrency|executorservice|java.util.concurrent | 25,043 | <p><strong>Option 1</strong> : You are submitting the tasks to <code>ExecutorService</code> and you are not waiting for the completion of all tasks, which have been submitted to <code>ExecutorService</code></p>
<p><strong>Option 2</strong> : You are waiting for completion of all tasks, which have been submitted to <co... |
34,800,331 | r modify and rebuild package | <p>I'm trying to use the SemiMarkov package and I want to change one small line of code in there. I've done some digging via:</p>
<pre><code>getAnywhere("semiMarkov")
</code></pre>
<p>& I've identified that I want to change this line:</p>
<pre><code>hessian <- diag(ginv(hessian(V, solution)))
</code></pre>
<... | 34,800,599 | 2 | 0 | null | 2016-01-14 21:44:34.473 UTC | 13 | 2016-01-15 21:28:50.917 UTC | 2016-01-14 21:57:15.297 UTC | null | 5,730,082 | null | 5,730,082 | null | 1 | 24 | r|package|rebuild | 26,608 | <h1>Linux environment</h1>
<p>Starting with downloading the package source from CRAN. </p>
<ul>
<li>This is the landing page: <a href="https://cran.r-project.org/web/packages/SemiMarkov/index.html" rel="noreferrer">https://cran.r-project.org/web/packages/SemiMarkov/index.html</a> </li>
<li>This is the package source... |
26,389,952 | Powershell export-csv with no headers? | <p>So I'm trying to export a list of resources without the headers. Basically I need to omit line 1, "Name".</p>
<p>Here is my current code:</p>
<pre><code>Get-Mailbox -RecipientTypeDetails RoomMailbox,EquipmentMailbox | Select-Object Name | Export-Csv -Path "$(get-date -f MM-dd-yyyy)_Resources.csv" -NoTypeInformatio... | 26,390,115 | 2 | 0 | null | 2014-10-15 18:51:56.913 UTC | 2 | 2021-04-16 18:27:16.347 UTC | 2014-10-15 18:57:00.25 UTC | null | 3,861,838 | null | 3,861,838 | null | 1 | 21 | powershell|export|office365 | 81,104 | <p>It sounds like you basically want just text a file list of the names:</p>
<pre><code>Get-Mailbox -RecipientTypeDetails RoomMailbox,EquipmentMailbox |
Select-Object -ExpandProperty Name |
Set-Content -Path "$(get-date -f MM-dd-yyyy)_Resources.txt"
</code></pre>
<p>Edit: if you really want an export-csv without a... |
24,659,005 | Radar chart with multiple scales on multiple axes | <p>I want to plot a radar chart with multiple scales on multiple axes using <code>matplotlib</code>. <a href="http://matplotlib.org/examples/api/radar_chart.html" rel="noreferrer">The official API example</a> gives only one scale on one axis. (Scales are 0.2,0.4,0.6,0.8 in this example)</p>
<p>I want different scales ... | 24,669,479 | 1 | 0 | null | 2014-07-09 16:24:06.413 UTC | 9 | 2022-03-23 12:44:23.92 UTC | null | null | null | null | 547,820 | null | 1 | 14 | python|matplotlib|plot | 21,946 | <p>I think you can plot this with multiple axes, the lines are in the first axe, and other axes only shows ticklabels.</p>
<pre><code>import numpy as np
import pylab as pl
class Radar(object):
def __init__(self, fig, titles, labels, rect=None):
if rect is None:
rect = [0.05, 0.05, 0.95, 0.95]... |
6,048,661 | How to place a character below a function in Latex? | <p>Is it possible to place a character or a formula below an other part of a larger formula in Latex?</p>
<pre><code>foo f(x) = ...
x
</code></pre>
<p>In case that this example is not clear. I'd like to make one of my custom functions - just defined as <code>\text{foo}</code> in a math environment - look like one of... | 6,049,281 | 3 | 1 | null | 2011-05-18 17:28:10.883 UTC | 3 | 2015-08-30 21:58:15.437 UTC | 2013-12-07 21:30:03.593 UTC | null | 759,866 | null | 114,490 | null | 1 | 18 | math|latex | 82,750 | <p>The function you're looking for is <code>\underset</code> provided by the <code>amsmath</code> package. Here's an example:</p>
<pre><code>\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\underset{below}{above}$
\end{document}
</code></pre>
<p>Output:</p>
<p><img src="https://i.stack.imgur.com/dS9J7... |
5,865,069 | Why is this Java code in curly braces ({}) outside of a method? | <p>I am getting ready for a java certification exam and I have seen code LIKE this in one of the practice tests: </p>
<pre><code>class Foo {
int x = 1;
public static void main(String [] args) {
int x = 2;
Foo f = new Foo();
f.whatever();
}
{ x += x; } // <-- w... | 5,865,116 | 3 | 5 | null | 2011-05-03 04:38:39.68 UTC | 11 | 2021-12-27 17:24:52.42 UTC | 2014-11-25 12:19:21.577 UTC | user166390 | 1,681,681 | null | 126,077 | null | 1 | 31 | java|syntax|braces | 22,064 | <p>Borrowed from <a href="http://download.oracle.com/javase/tutorial/java/javaOO/initial.html" rel="noreferrer">here</a> -</p>
<blockquote>
<p>Normally, you would put code to initialize an instance variable in a
constructor. There are two alternatives to using a constructor to
initialize instance variables: init... |
5,606,915 | iOS download and save HTML file | <p>I am trying to download a webpage (html) then display the local html that has been download in a UIWebView. </p>
<p>This is what I have tried -</p>
<pre><code>NSString *stringURL = @"url to file";
NSURL *url = [NSURL URLWithString:stringURL];
NSData *urlData = [NSData dataWithContentsOfURL:url];
if ( urlData )
{
... | 5,607,132 | 4 | 1 | null | 2011-04-09 18:17:08.6 UTC | 10 | 2016-10-31 13:30:53.473 UTC | null | null | null | null | 443,859 | null | 1 | 17 | iphone|xcode|ios|ios4|uiwebview | 36,323 | <p>The path passed to the UIWebView is incorrect, like Freerunnering mentioned, try this instead:</p>
<pre><code>// Determile cache file path
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *filePath = [NSString stringWithFormat:@"%@/%@", [paths objectAtIndex:... |
1,945,722 | Selecting between two dates within a DateTime field - SQL Server | <p>How to select records between a date to another date given a DateTime field in a table.</p> | 1,945,744 | 2 | 2 | null | 2009-12-22 11:10:30.72 UTC | 6 | 2020-09-08 22:42:22.843 UTC | 2015-12-17 15:08:47.69 UTC | null | 2,451,726 | null | 207,556 | null | 1 | 18 | sql|sql-server-2005|datetime | 138,031 | <pre><code>SELECT *
FROM tbl
WHERE myDate BETWEEN #date one# AND #date two#;
</code></pre> |
1,449,370 | latex error: environment proof undefined | <p>hi i am using latex... wanted to use the following:</p>
<pre><code> \begin{proof}
...
\end{proof}
</code></pre>
<p>it gives me the following error:
!Latex error: Environment proof undefined. can you help me to solve this problem? thanks</p> | 1,449,403 | 2 | 0 | null | 2009-09-19 19:56:01.67 UTC | 1 | 2018-03-09 01:14:55.083 UTC | null | null | null | rikitak | null | null | 1 | 22 | latex|texmaker | 57,118 | <p>The <code>proof</code> environment is part of AMS-LaΤεχ, not plain LaΤεχ, so you need to:</p>
<pre><code>\usepackage{amsthm}
</code></pre>
<p>See this <a href="http://www.stat.umn.edu/~charlie/amslatex.html" rel="noreferrer">AMS-LaTeX page</a> for details. If you don't already have the packages installed, grab the... |
32,301,206 | How to fold table columns into rows on mobile devices? | <p>I'm developing a website featuring a restaurant's menu. Each item is available in different sizes, each at a different price. This is displayed on medium and large devices using a table, with a column for each price:</p>
<p><a href="https://i.stack.imgur.com/rXATK.png" rel="noreferrer"><img src="https://i.stack.img... | 32,314,671 | 2 | 1 | null | 2015-08-30 21:13:48.153 UTC | 10 | 2020-07-10 19:00:43.767 UTC | null | null | null | null | 759,866 | null | 1 | 12 | responsive-design|zurb-foundation|zurb-foundation-5 | 26,455 | <p>The solution involves making table cells <code>display: block</code> on mobile devices, and adding a <code>data-*</code> attribute to each cell, matching the column name.</p>
<p>This data attribute is injected in the cell's <code>::before</code> pseudo-element with <code>content: attr()</code>.</p>
<p>Example:</p>... |
5,978,108 | Open Vim from within a Bash shell script | <p>I want to write a Bash shell script that does the following:</p>
<ol>
<li>Opens a file using Vim;</li>
<li>Writes something into the file;</li>
<li>Saves the file and exits.</li>
</ol>
<pre><code>echo 'About to open a file'
vim file.txt # I need to use vim application to open a file
# Now write something into file.... | 5,978,288 | 5 | 5 | null | 2011-05-12 12:38:31.23 UTC | 9 | 2020-08-05 23:03:44.657 UTC | 2020-08-05 23:02:37.53 UTC | null | 254,635 | null | 246,365 | null | 1 | 16 | linux|bash|vim | 30,702 | <p>Vim has several options:</p>
<ul>
<li><code>-c</code> => pass ex commands. Example: <code>vim myfile.txt -c 'wq'</code> to force the last line of a file to be newline terminated (unless <code>binary</code> is set in some way by a script)</li>
<li><code>-s</code> => play a scriptout that was recorded with <code>-W</... |
5,724,455 | Can I make a user-specific gitignore file? | <p>I want to change the gitignore, but not everyone on the team wants these changes. How can a user have their own specific git ignore file?</p> | 5,724,499 | 5 | 1 | null | 2011-04-20 00:56:35.92 UTC | 25 | 2019-03-09 01:47:51.21 UTC | null | null | null | null | 702,928 | null | 1 | 157 | git|version-control|gitignore | 35,175 | <p>For user-specific and repo-specific file ignoring you should populate the following file: <pre>$GIT_DIR/info/exclude</pre></p>
<p>Usually $GIT_DIR stands for: <pre>your_repo_path/.git/</pre></p> |
5,874,558 | How to pass arguments to the __code__ of a function? | <p>The following works:</p>
<pre><code>def spam():
print "spam"
exec(spam.__code__)
</code></pre>
<blockquote>
<p>spam</p>
</blockquote>
<p>But what if <code>spam</code> takes arguments?</p>
<pre><code>def spam(eggs):
print "spam and", eggs
exec(spam.__code__)
</code></pre>
<blockquote>
<p>TypeError: s... | 5,874,844 | 6 | 12 | null | 2011-05-03 19:24:41.313 UTC | 10 | 2021-09-12 13:01:38.57 UTC | 2021-09-12 13:01:38.57 UTC | null | 355,230 | null | 562,583 | null | 1 | 32 | python|function|parameter-passing|exec|eval | 13,268 | <p>Can you change the function to <em>not</em> take any arguments? The variables is then looked up from the locals/globals where you can supply into <code>exec</code>:</p>
<pre><code>>>> def spam():
... print "spam and", eggs
...
>>> exec(spam.__code__, {'eggs':'pasta'})
spam and pasta
</code></pr... |
5,770,973 | Django: how to change the choices of AdminTimeWidget | <p>The <code>AdminTimeWidget</code> rendered in admin for a <code>DateTimeField</code> displays an icon of a clock and when you click you have the choice between: "Now Midnight 6:00 Noon".</p>
<p>How can I change these choices to "16h 17h 18h"?</p> | 5,987,580 | 7 | 0 | null | 2011-04-24 14:08:15.113 UTC | 9 | 2021-12-18 06:04:54.78 UTC | 2011-05-18 02:35:51.993 UTC | null | 260,365 | null | 395,239 | null | 1 | 11 | django|django-admin|django-forms | 4,490 | <p>Chris has a great answer. As an alternative you could do this using just javascript. Place the following javascript on the pages where you want the different time options. </p>
<pre><code>DateTimeShortcuts.overrideTimeOptions = function () {
// Find the first time element
timeElement = django.jQuery("ul.... |
6,265,995 | Flipboard’s layout algorithm | <p>I hope many of you would have heard about <a href="http://flipboard.com/" rel="nofollow noreferrer">Flipboard</a>. One of the most amazing things about this iPad app is the way it lays out the content which changes dynamically based on orientation of iPad & based on the streaming content.</p>
<p><img src="https... | 6,406,135 | 7 | 0 | null | 2011-06-07 13:34:59.813 UTC | 33 | 2012-12-17 16:59:22.567 UTC | 2012-08-30 20:02:54.403 UTC | null | 50,776 | null | 147,019 | null | 1 | 21 | algorithm|ipad|layout|flipboard | 9,406 | <p>Based on the screenshots and theories in <a href="http://corgitoergosum.net/2011/03/06/replicating-flipboard-part-iii-how-flipboard-lays-out-content/" rel="nofollow noreferrer">the blog post linked to by Jason Moore</a> in <a href="https://stackoverflow.com/questions/6265995/flipboards-layout-algorithm/6393263#63932... |
55,807,079 | I found invalid data while decoding error updating NuGet packages | <p>I have been trying to update NuGet packages in Visual Studio 2019 from both package manager consoles and the manage NuGet packages from the context options, but in both cases I get "Found invalid data while decoding." error.</p>
<p>I have to revert to Visual Studio 2017 to update. Is there a way to deal wi... | 59,122,631 | 2 | 4 | null | 2019-04-23 08:25:06.16 UTC | 4 | 2021-11-20 13:00:30.587 UTC | 2020-07-27 20:11:47.587 UTC | null | 63,550 | null | 767,781 | null | 1 | 28 | visual-studio-2019 | 11,880 | <p>Visual Studio 2019</p>
<ol>
<li>Go to menu <em>Tools</em> → <em>NuGet Package Manager</em> → <em>Package Manager Console</em>.</li>
<li>Type <code>dotnet nuget locals all --clear</code>.</li>
<li>Clean the solution.</li>
<li>Delete the <code>bin</code> and <code>obj</code> folders from the project folder.</li>
</ol>... |
17,941,054 | Android - Dynamically Updating a custom ListView after items in an ArrayList are added | <p>I have an activity that displays an initially populated custom ListView taken from an ArrayList, the user can then add to this list which I have no problem storing. I'm having problems displaying the added items. So far, the codes I see online use ArrayAdapter and they're only using the simple listView and not a cus... | 17,941,189 | 1 | 3 | null | 2013-07-30 07:41:31.937 UTC | 4 | 2013-07-30 09:46:46.033 UTC | 2013-07-30 09:46:46.033 UTC | null | 1,374,416 | null | 1,374,416 | null | 1 | 2 | android|listview|arraylist | 38,096 | <p>Your adapter does not get the new data, because you are initializing it with its own set of data.</p>
<p>One possibility would be to instantiate a new adapter and assign it to the ListView.</p>
<p>Add a field for your ListView in your activity:</p>
<pre><code>public TextView tv;
private int variantPosition;
Cust... |
5,536,532 | In-App Billing Security and Design questions | <p>I have a few questions connected to Android In-App Billing:</p>
<ol>
<li><p>Is it possible to make a purchase from non-Market app? I understand that it would be a vulnerability, but I have no opportunity to find out if it's possible or not.</p></li>
<li><p>How can I get purchase state for a particular product? As f... | 5,652,627 | 1 | 0 | null | 2011-04-04 09:10:59.89 UTC | 10 | 2011-04-22 05:27:26.727 UTC | 2011-04-22 05:27:26.727 UTC | null | 170,842 | null | 170,842 | null | 1 | 24 | android|security|in-app-purchase|google-play | 3,195 | <p>In order:</p>
<p>1- Nope. The in-app billing process is part of Market. If the app comes from elsewhere, there's no way for Market to verify the origin/authenticity of the application.</p>
<p>2- It's your responsibility to store the purchase state for a particular product. From the <a href="http://developer.an... |
4,940,259 | lambdas require capturing 'this' to call static member function? | <p>For the following code:</p>
<pre><code>struct B
{
void g()
{
[]() { B::f(); }();
}
static void f();
};
</code></pre>
<p>g++ 4.6 gives the error:</p>
<blockquote>
<p>test.cpp: In lambda function:<br>
test.cpp:44:21: error: 'this' was not captured for this lambda function</p>
</blockqu... | 4,941,046 | 1 | 3 | null | 2011-02-09 00:43:52.407 UTC | 10 | 2014-08-04 12:43:13.5 UTC | 2014-08-04 12:43:13.5 UTC | null | 2,642,204 | null | 141,719 | null | 1 | 65 | c++|lambda|c++11 | 38,272 | <p>I agree, it should compile just fine. For the fix (if you didn't know already), just add the reference capture and it will compile fine on gcc 4.6</p>
<pre><code>struct B
{
void g()
{
[&]() { B::f(); }();
}
static void f() { std::cout << "Hello World" << std::endl; };
};
</c... |
24,851,824 | How long does it take for GitHub page to show changes after changing index.html | <p>I am just wondering how long does it take for GitHub page to show the new items that I have added to the repository.</p>
<p>I changed <code>index.html</code> but after 10 minutes it still showed up the previous page...</p> | 24,871,850 | 4 | 2 | null | 2014-07-20 15:10:02.523 UTC | 19 | 2022-08-11 17:47:28.797 UTC | 2019-02-27 14:30:15.553 UTC | null | 680,068 | null | 3,394,937 | null | 1 | 124 | github|updates|github-pages | 95,805 | <p>The first time you generate your site it will take about 10 minutes for it to show up. Subsequent builds take only seconds from the time you push the changes to your GitHub repository.</p>
<p>However, depending on <a href="https://help.github.com/articles/setting-up-a-custom-domain-with-github-pages">how your have ... |
49,236,325 | Babel Preset does not provide support on IE11 for Object.assign - "Object doesn't support property or method 'assign'" | <p>I am using <strong>babel-preset-env version - 1.6.1</strong> for my react app, i am getting a error on IE :- <em>Object doesn't support property or method 'assign'</em>
<a href="https://i.stack.imgur.com/TmBJo.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TmBJo.png" alt="enter image description here"></a... | 49,236,446 | 2 | 1 | null | 2018-03-12 13:21:41.543 UTC | 8 | 2019-07-01 07:04:13.233 UTC | null | null | null | null | 5,006,144 | null | 1 | 30 | reactjs|internet-explorer|webpack|babeljs|babel-preset-env | 34,547 | <p>You need <a href="https://babeljs.io/docs/usage/polyfill/" rel="noreferrer">Babel Polyfill</a>.</p>
<p>Either import it in your entry JS file, or use Webpack.</p>
<pre><code>import "babel-polyfill";
</code></pre>
<p>or in <code>webpack.config.js</code></p>
<pre><code>module.exports = {
entry: ["babel-polyfill"... |
44,677,960 | How to use Material Design Icons In Angular 4? | <p>I want to use the icons from <a href="https://materialdesignicons.com/" rel="noreferrer">https://materialdesignicons.com/</a> in my angular 4 project.
The instructions on the website are only covering how to include it in <code>Angular 1.x</code> (<a href="https://materialdesignicons.com/getting-started" rel="noref... | 44,692,684 | 9 | 1 | null | 2017-06-21 13:46:05.123 UTC | 14 | 2020-11-01 18:21:21.513 UTC | null | null | null | null | 5,111,904 | null | 1 | 50 | angular|angular-material2 | 81,566 | <p>Instructions on how to include Material Design Icons into your Angular Material app can now be found on the <a href="https://dev.materialdesignicons.com/getting-started/angular#angular-material" rel="noreferrer">Material Design Icons - Angular</a> documentation page.</p>
<p>TL;DR: You can now leverage the <a href="h... |
21,522,493 | What was the difference between WSDL & Mex Endpoint in WCF | <p>I have couple of question on mex endpoint.</p>
<ol>
<li><p>In legacy web services, we create a proxy using wsdl. The WSDL exposes the web service's meta data. In wcf, another term comes that mex endpoint, which also exposes meta data, but wsdl is still alive in wcf. I am new to wcf, and I am confused regarding the ... | 21,522,849 | 2 | 1 | null | 2014-02-03 08:17:39.88 UTC | 14 | 2014-12-08 07:41:07.233 UTC | 2014-06-25 03:33:44.753 UTC | null | 299,327 | null | 508,127 | null | 1 | 43 | c#|wcf|wsdl|mex | 40,782 | <blockquote>
<p>1) in legacy web service we create proxy using wsdl. WSDL expose web
service meta data. in wcf another term comes that mex endpoint which
also expose meta data but wsdl is still live in wcf.i am new in wcf
hence i am confusing what is the difference between wsdl & mex
endpoint?</p>
</block... |
32,647,215 | Declaring static constants in ES6 classes? | <p>I want to implement constants in a <code>class</code>, because that's where it makes sense to locate them in the code.</p>
<p>So far, I have been implementing the following workaround with static methods:</p>
<pre><code>class MyClass {
static constant1() { return 33; }
static constant2() { return 2; }
... | 32,647,583 | 18 | 2 | null | 2015-09-18 08:22:19.12 UTC | 57 | 2022-09-22 14:24:46.583 UTC | 2015-09-18 16:59:54.13 UTC | null | 2,039,244 | null | 520,957 | null | 1 | 382 | javascript|class|constants|ecmascript-6 | 349,071 | <p>Here's a few things you could do:</p>
<p>Export a <code>const</code> from the <em>module</em>. Depending on your use case, you could just:</p>
<pre><code>export const constant1 = 33;
</code></pre>
<p>And import that from the module where necessary. Or, building on your static method idea, you could declare a <cod... |
9,067,993 | Upload to s3 with curl using pre-signed URL (getting 403) | <p>I'm using curl to call into a Java ReST API to retrieve a URL. Java then generates a pre-signed URL for S3 upload using my S3 credentials, and returns that in the ReST reply. Curl takes the URL and uses that for upload to S3, but S3 returns 403 "The request signature we calculated does not match the signature you pr... | 9,085,141 | 4 | 0 | null | 2012-01-30 17:24:43.123 UTC | 3 | 2015-03-28 09:47:58.867 UTC | 2012-01-30 19:14:22.41 UTC | null | 547,291 | null | 547,291 | null | 1 | 26 | java|bash|curl|amazon-s3 | 38,059 | <p>I've been able to generate a pre-signed URL via C# and upload it thereafter via <a href="http://curl.haxx.se/">curl</a> as expected. Given my tests I suspect you are indeed not using <em>curl</em> correctly - I've been able to upload a file like so:</p>
<pre><code>curl -v --upload-file ${fileName} ${location}
</cod... |
52,332,747 | What are the supported Swift String format specifiers? | <p>In Swift, I can format a String with format specifiers:</p>
<pre><code>// This will return "0.120"
String(format: "%.03f", 0.12)
</code></pre>
<p>But the official documentation is not giving any information or link regarding the supported format specifiers or how to build a template similar to <code>"%.03f"</code>... | 52,332,748 | 3 | 2 | null | 2018-09-14 13:11:00.487 UTC | 33 | 2022-06-22 09:29:29.853 UTC | 2019-03-07 14:58:18.587 UTC | null | 1,033,581 | null | 1,033,581 | null | 1 | 60 | swift|string|string-formatting | 44,196 | <p>The format specifiers for <code>String</code> formatting in Swift are the same as those in Objective-C <code>NSString</code> format, itself identical to those for <code>CFString</code> format and are buried deep in the archives of Apple Documentation (same content for both pages, both originally from year 2002 or ol... |
47,272,164 | No .bash_profile on my Mac | <p>I'm trying to develop using Eclipse/Maven on my Mac and while setting environment variables there is no .bash_profile. I do ls -a and still not there. I see a .bash_history and .bash_sessions. Where am I supposed to set my JAVA_HOME and PATH?</p>
<p>Thank you!</p> | 47,272,189 | 3 | 1 | null | 2017-11-13 19:35:44.813 UTC | null | 2021-06-12 02:59:21.883 UTC | null | null | null | null | 398,107 | null | 1 | 14 | eclipse|bash|macos|terminal | 58,224 | <p>In your terminal:</p>
<pre><code>touch ~/.bash_profile; open ~/.bash_profile
</code></pre>
<p>Then make your edits and save. This is generic so make sure your path is correct in the above example.</p> |
22,601,414 | How to set a frequency for the fm radio in android? | <p>In my android app I am using this intent to start fm radio</p>
<pre><code>Intent i = new Intent(Intent.ACTION_MAIN);
PackageManager manager = getPackageManager();
i = manager.getLaunchIntentForPackage("com.sec.android.app.fm");
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
</code></pre>
<p>Is it possi... | 22,652,799 | 2 | 1 | null | 2014-03-24 05:01:06.653 UTC | 8 | 2021-01-25 01:57:04.893 UTC | 2014-03-25 04:54:05.277 UTC | null | 2,219,371 | null | 2,219,371 | null | 1 | 10 | java|android | 5,753 | <p>There is currently no native Android API for playing FM radio.</p>
<p>You need to use 3rd party apps to play FM radio, and each phone vendor / app vendor has it's own API.</p>
<p>You best option is to contact them directly and ask for the relevant API to suit your needs.</p>
<p>Hope this helped!</p> |
7,068,388 | OAuth callbacks in iPhone web apps | <p>I'm building a full-screen iPhone optimized web app. It gets launched from the homepage like a native app and behaves like a standalone app via the following directive, but it's just plain HTML/CSS/JavaScript, no PhoneGap involved.</p>
<pre class="lang-html prettyprint-override"><code><meta name="apple-mobile we... | 7,262,955 | 2 | 3 | null | 2011-08-15 17:35:00.02 UTC | 11 | 2019-05-02 01:16:27.477 UTC | 2012-01-28 10:19:30.073 UTC | null | 918,414 | null | 20,476 | null | 1 | 14 | iphone|oauth|twitter-oauth|iphone-web-app|iphone-standalone-web-app | 4,078 | <p>I've had a similar problem recently, and found that if you set the URL in Javascript with a <code>window.location.href="http://example.com/whatever"</code> then iOS doesn't switch to Safari. I've managed to get PayPal checkout and Facebook login working in standalone web apps without switching to safari using this m... |
7,440,334 | How do Gravity values effect PopupWindow.showAtLocation() in Android | <p>How do the different Gravity values effect PopupWindow.showAtLocation() in Android?</p>
<p>I can't find good docs on PopupWindows showAtLocation and Gravity.</p> | 10,610,949 | 2 | 0 | null | 2011-09-16 05:00:09.333 UTC | 20 | 2018-05-07 03:56:10.907 UTC | 2013-02-26 23:56:13.19 UTC | null | 552,958 | null | 552,958 | null | 1 | 42 | android | 35,856 | <p>After hacking for a few hours trying some black magic maths to calculate centers and try to align the view using Gravity.TOP I found a post that used Gravity.CENTER. I'm collecting my findings here in the hopes it saves someone else some pain.</p>
<pre><code>popupWindow.showAtLocation(anyViewOnlyNeededForWindowTok... |
23,406,956 | What is percent of authorship in TortoiseSVN statistics? | <p>In statistics section of TortoiseSVN, there is something called percent of authorship. What is this? How is this calculated? and how can it be useful?</p> | 24,437,494 | 1 | 1 | null | 2014-05-01 10:34:30.667 UTC | 2 | 2014-06-26 18:20:55.947 UTC | 2014-06-26 18:20:55.947 UTC | null | 395,857 | danrah | 235,171 | null | 1 | 32 | svn|tortoisesvn | 6,704 | <p>The percent of authorship is a metric that aims at <a href="http://tigris-scm.10930.n7.nabble.com/Percent-of-authorship-td35688.html">quantifying the contribution of each committer</a>.</p>
<blockquote>
<p>In theory, it should be indeed lines-changes, but aggregated through
the entire history of the file, wit... |
31,948,189 | Material ripple effect hidden by other view in layout | <p>I added a ripple effect on a <code>ImageButton</code>, however it is hidden by an <code>ImageView</code> used as a background for the parent view <code>RelativeLayout</code>.</p>
<p>Here's the layout file:</p>
<pre><code><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
... | 37,757,154 | 5 | 2 | null | 2015-08-11 17:25:12.333 UTC | 10 | 2021-02-23 07:57:44.377 UTC | null | null | null | null | 352,876 | null | 1 | 18 | android|android-layout|material-design|rippledrawable | 11,941 | <p><em>I had exactly the same issue and solved it using this thread: <a href="https://code.google.com/p/android/issues/detail?id=155880" rel="noreferrer">https://code.google.com/p/android/issues/detail?id=155880</a></em></p>
<p><strong>Issue preview:</strong></p>
<p><em>Before solved:</em></p>
<p><a href="https://i.... |
31,587,770 | PowerMockito mocking static method fails when calling method on parameter | <p>I'm trying to test a class which uses a calculator class with a number of static methods. I've successfully mocked another class in a similar way, but this one is proving more stubborn.</p>
<p>It seems that if the mocked method contains a method call on one of the passed in arguments the static method is not mocke... | 31,588,929 | 4 | 3 | null | 2015-07-23 12:43:58.833 UTC | 5 | 2015-07-23 13:55:02.263 UTC | 2015-07-23 13:10:24.12 UTC | null | 872,206 | null | 872,206 | null | 1 | 10 | java|unit-testing|powermockito | 40,173 | <p>I've found the answer here <a href="https://blog.codecentric.de/en/2011/11/testing-and-mocking-of-static-methods-in-java/">https://blog.codecentric.de/en/2011/11/testing-and-mocking-of-static-methods-in-java/</a></p>
<p>Here's the final code which works. I've tested this approach in the original code (as well as t... |
18,833,649 | Error using nuget in VS2012 "missing packages" | <p>When I build my project from within VS2012 I get the following error message</p>
<pre><code>This project references NuGet package(s) that are missing on this computer.
Enable NuGet Package Restore to download them.
</code></pre>
<p>I have the nuget options set for NuGet to download missing packages.</p>
<p><img... | 18,995,655 | 8 | 1 | null | 2013-09-16 17:11:43.75 UTC | 4 | 2017-11-24 13:17:16.693 UTC | 2013-09-16 17:26:08.19 UTC | null | 61,623 | null | 61,623 | null | 1 | 30 | visual-studio|nuget|nuget-package-restore | 44,583 | <p>As Dan was alluding to, if your solution has a .nuget folder (from enabling package restore), then nuget 2.7's automatic package restore feature is disabled, as per <a href="http://docs.nuget.org/docs/workflows/migrating-to-automatic-package-restore">http://docs.nuget.org/docs/workflows/migrating-to-automatic-packag... |
37,785,154 | How to enable maven artifact caching for GitLab CI runner? | <p>We use GitLab CI with shared runners to do our continuous integration. For each build, the runner downloads tons of maven artifacts.</p>
<p>Is there a way to configure GitLab CI to cache those artifacts so we can speed up the building process by preventing downloading the same artifact over and over again?</p> | 40,024,602 | 8 | 1 | null | 2016-06-13 08:37:17.87 UTC | 24 | 2021-07-01 16:02:03.947 UTC | 2021-07-01 16:02:03.947 UTC | null | 557,091 | null | 978,392 | null | 1 | 85 | maven|gitlab-ci|gitlab-ci-runner | 69,034 | <p>Gitlab CI allows you to define certain paths, which contain data that should be cached between builds, on a per job or build basis (see <a href="https://docs.gitlab.com/ce/ci/yaml/README.html#cache" rel="noreferrer">here</a> for more details). In combination with khmarbaise's recommendation, this can be used to cach... |
21,262,309 | RSpec: how to test if a method was called? | <p>When writing RSpec tests, I find myself writing a lot of code that looks like this in order to ensure that a method was called during the execution of a test (for the sake of argument, let's just say I can't really interrogate the state of the object after the call because the operation the method performs is not ea... | 21,263,118 | 4 | 2 | null | 2014-01-21 15:27:45.103 UTC | 16 | 2020-04-26 10:36:11.51 UTC | 2017-02-24 14:15:22.75 UTC | null | 3,257,186 | null | 705,589 | null | 1 | 134 | ruby-on-rails|ruby|rspec | 153,549 | <pre><code>it "should call 'bar' with appropriate arguments" do
expect(subject).to receive(:bar).with("an argument I want")
subject.foo
end
</code></pre> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.