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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
46,710,747 | Type 'string' is not assignable to type '"inherit" | "initial" | "unset" | "fixed" | "absolute" | "static" | "relative" | "sticky"' | <p>I get the following error in my application (npm 5.4.2, react 15.4, typescript 2.5.3, webpack 2.2.1, webpack-dev-server 2.4.1).</p>
<p>This will work:</p>
<pre><code><div style={{position: 'absolute'}}>working</div>
</code></pre>
<p>This will not compile:</p>
<pre><code>const mystyle = {
position... | 46,711,592 | 5 | 1 | null | 2017-10-12 13:21:15.597 UTC | 11 | 2022-01-17 17:16:25.347 UTC | null | null | null | null | 1,472,223 | null | 1 | 76 | reactjs|typescript|webpack | 46,937 | <p>This is a workaround, but it is alright.
Some other solution is:</p>
<pre><code>const mystyles = {
position: 'absolute',
} as React.CSSProperties;
</code></pre>
<p>You can check back when this <a href="https://github.com/Microsoft/TypeScript/issues/16457" rel="noreferrer">issue</a> will be solved. Around TS 2.6... |
8,874,987 | Symfony2/Doctrine QueryBuilder using andwhere() | <p>I am using following method in a repository class to look for certain tags in my database:</p>
<pre><code>public function getItemsByTag($tag, $limit = null)
{
$tag = '%'.$tag.'%';
$qb = $this->createQueryBuilder('c');
$qb->select('c')
->where($qb->expr()->like('c.tags', '?1'))
... | 8,876,905 | 2 | 0 | null | 2012-01-16 01:42:14.153 UTC | 5 | 2013-09-26 14:26:31.573 UTC | null | null | null | null | 804,670 | null | 1 | 12 | doctrine|symfony | 47,647 | <p>I would write it like this:</p>
<pre class="lang-php prettyprint-override"><code>$qb = $this
->createQueryBuilder('c')
->where('c.tags LIKE :tag')
->andWhere('c.reviewed = 1')
->andWhere('c.enabled = 1')
->setParameter('tag', "%{$tag}%")
->orderBy('c.clicks', 'DESC')
-&... |
9,010,734 | Why do I need to nest a component with rendered="#{some}" in another component when I want to ajax-update it? | <p>So I've found a few answers close to this, and I've found enough to fix the problem I had. But even so, I'm curious as to understand the workings around this. Let me illustrate with an example :</p>
<p>I have a facelet <code>.xhtml</code> page that looks like this (shortned).</p>
<pre class="lang-xml prettyprint... | 9,010,771 | 1 | 0 | null | 2012-01-25 21:41:30.763 UTC | 27 | 2016-02-10 08:58:01.893 UTC | 2016-02-10 08:58:01.893 UTC | null | 157,882 | null | 686,036 | null | 1 | 35 | jsf|jsf-2|facelets|conditional-rendering|ajax-update | 22,012 | <p>Ajax updating is performed by JavaScript language in the client side. All which JavaScript has access to is the HTML DOM tree. If JSF does not render any component to the HTML output, then there's nothing in the HTML DOM tree which can be obtained by JavaScript upon Ajax update. JavaScript cannot get the desired ele... |
27,244,132 | What benefits does dictionary initializers add over collection initializers? | <p>In a recent past there has been a lot of talk about whats new in C# 6.0<br>
One of the most talked about feature is using <code>Dictionary</code> initializers in C# 6.0<br>
But wait we have been using collection initializers to initialize the collections and can very well initialize a <code>Dictionary</code> also in... | 27,244,282 | 3 | 1 | null | 2014-12-02 07:37:24.837 UTC | 1 | 2020-03-06 13:06:50.867 UTC | 2017-09-15 09:24:29.697 UTC | null | 158,074 | null | 2,568,925 | null | 1 | 51 | c#|dictionary|collections|c#-6.0|collection-initializer | 17,702 | <p>While you <em>could</em> initialize a dictionary with collection initializers, it's quite cumbersome. Especially for something that's supposed to be syntactic sugar.</p>
<p>Dictionary initializers are much cleaner:</p>
<pre><code>var myDict = new Dictionary<int, string>
{
[1] = "Pankaj",
[2] = "Panka... |
749,209 | How do I Display Code Samples On Web Pages With Nice Syntax Styling Like Stack Overflow Does? | <p>I would like to be able to pull some code samples out of a database and/or have the text embedded into the website and then have the sample formatted in a code like fashion on the screen. While the text alone on the screen is great, the format will make it more user friendly. How is this done?</p>
<p><strong>I wa... | 749,229 | 3 | 0 | null | 2009-04-14 20:21:49.083 UTC | 17 | 2015-01-05 23:48:14.787 UTC | 2017-05-23 12:07:10.757 UTC | null | -1 | null | 55,747 | null | 1 | 11 | asp.net|javascript|html|css | 1,923 | <p>Stack Overflow uses <a href="http://code.google.com/p/google-code-prettify/" rel="noreferrer">prettify.js</a> from Google.</p> |
588,918 | ImageMagick/Imagick convert PDF to JPG using native PHP API | <p>I’m attempting to convert PDF files into PNGs. It works great from the command line (I do have GhostScript 8.64 installed). But from PHP I’m having a problem:</p>
<p>code:</p>
<pre><code>$im = new Imagick($pdf_file); // this is where it throws the exception below
</code></pre>
<p>output:</p>
<pre><code>Fatal err... | 591,466 | 3 | 0 | null | 2009-02-26 02:54:10.23 UTC | 9 | 2016-12-21 22:46:32.323 UTC | 2009-02-26 03:29:49.753 UTC | Norman Ramsey | 41,661 | matt | 63,567 | null | 1 | 12 | php|image|pdf|pdf-generation|ghostscript | 25,760 | <p>Finally figured this out. The GhostScript executable (<code>gs</code>) wasn't in Apache's environment path. It was in <code>/usr/local/bin</code>. Though I tried several ways to add <code>/usr/local/bin</code> to the path, I did not succeed. I ended up putting a symlink for <code>gs</code> in the <code>/usr/bin dire... |
538,435 | AES interoperability between .Net and iPhone? | <p>I need to encrypt a string on the iPhone and send it to a .Net web service for decryption. I am able to encrypt/decrypt on the iPhone and with .Net, but the encrypted strings from the iPhone cannot be decrypted by .Net. The error I get is "Padding is invalid and cannot be removed."</p>
<p>The .Net code is from:
<... | 539,928 | 3 | 3 | null | 2009-02-11 19:40:33.643 UTC | 27 | 2016-02-03 14:01:44.647 UTC | 2009-02-12 20:28:19.807 UTC | HeroicLife | 65,244 | HeroicLife | 65,244 | null | 1 | 23 | .net|iphone|encryption|aes | 16,296 | <p>At the very least, you are using differing initialization vectors (IV).</p>
<ul>
<li><p>The .Net code uses the key for IV.</p>
<pre><code>private static AesCryptoServiceProvider GetProvider(byte[] key)
{
//Set up the encryption objects
AesCryptoServiceProvider result = new AesCryptoServiceProvider();
b... |
22,348,705 | Best way to store DB config in Node.Js / Express app | <p>What would be the best way to store DB config (username, password) in an open source app that runs on node.js / Express? Two specific questions:</p>
<ol>
<li><p>Shall I put it into a separate config.js file in <code>/lib</code> folder, for example, and never include it into the master repository that is publicly av... | 22,348,862 | 7 | 0 | null | 2014-03-12 10:33:14.77 UTC | 35 | 2022-04-19 06:29:44.577 UTC | 2017-02-24 12:23:37.203 UTC | null | 2,360,798 | null | 712,347 | null | 1 | 77 | javascript|node.js|express|config | 70,082 | <p>Not sure whether this is the best practice, but personally I have a <code>config.json</code> file where I store my db connection information. Then I do the following:</p>
<pre><code>// options.js
var fs = require('fs'),
configPath = './config.json';
var parsed = JSON.parse(fs.readFileSync(configPath, 'UTF-8'));
exp... |
20,383,647 | Pandas selecting by label sometimes return Series, sometimes returns DataFrame | <p>In Pandas, when I select a label that only has one entry in the index I get back a Series, but when I select an entry that has more then one entry I get back a data frame.</p>
<p>Why is that? Is there a way to ensure I always get back a data frame?</p>
<pre><code>In [1]: import pandas as pd
In [2]: df = pd.DataF... | 20,384,317 | 8 | 0 | null | 2013-12-04 19:01:40.187 UTC | 36 | 2022-05-06 18:44:56.377 UTC | 2019-07-20 23:26:07.897 UTC | null | 202,229 | null | 2,752,242 | null | 1 | 129 | python|pandas|dataframe|slice|series | 56,764 | <p>Granted that the behavior is inconsistent, but I think it's easy to imagine cases where this is convenient. Anyway, to get a DataFrame every time, just pass a list to <code>loc</code>. There are other ways, but in my opinion this is the cleanest.</p>
<pre><code>In [2]: type(df.loc[[3]])
Out[2]: pandas.core.frame.Da... |
24,041,220 | Sending message to a specific ID in Socket.IO 1.0 | <p>I want to sent data to one specific socket ID. </p>
<p>We used to be able to do this in the older versions:</p>
<pre><code>io.sockets.socket(socketid).emit('message', 'for your eyes only');
</code></pre>
<p>How would I go about doing something similar in Socket.IO 1.0?</p> | 24,224,146 | 7 | 0 | null | 2014-06-04 15:12:50.31 UTC | 38 | 2021-10-15 13:48:28.93 UTC | null | null | null | user2283026 | null | null | 1 | 89 | socket.io|socket.io-1.0 | 93,078 | <p>In socket.io 1.0 they provide a better way for this. Each socket automatically joins a default room by self id. Check documents: <a href="http://socket.io/docs/rooms-and-namespaces/#default-room">http://socket.io/docs/rooms-and-namespaces/#default-room</a></p>
<p>So you can emit to a socket by id with following cod... |
41,606,853 | Error in commiting to git saying stCommitMsg file not found | <p>While I am trying to make a commit to my local git branch I got this error</p>
<blockquote>
<p>fatal: could not read '/Users/<username>/.stCommitMsg': No such
file or directory</p>
</blockquote>
<p>I am able to commit using</p>
<pre><code>git commit -m "commit message"
</code></pre>
<p>but I am unable ... | 41,607,044 | 2 | 0 | null | 2017-01-12 06:53:16.893 UTC | 4 | 2021-07-22 10:10:11.22 UTC | 2017-01-12 07:28:28.123 UTC | null | 7,256,199 | null | 5,077,507 | null | 1 | 30 | git | 9,678 | <p>When run <code>git commit</code>, git will read from configure variable commit.template to find commit message template and load it to editor for you to write commit message.</p>
<p>For your error, it seems that it try to find a template file of <code>'/Users/<username>/.stCommitMsg</code>. please create it f... |
20,190,668 | Multiprocessing a for loop? | <p>I have an array (called <code>data_inputs</code>) containing the names of hundreds of astronomy images files. These images are then manipulated. My code works and takes a few seconds to process each image. However, it can only do one image at a time because I'm running the array through a <code>for</code> loop:</p>
... | 20,192,251 | 4 | 0 | null | 2013-11-25 11:09:12.46 UTC | 48 | 2022-04-17 02:44:32.877 UTC | 2018-05-13 16:24:19.063 UTC | null | 355,230 | null | 2,952,205 | null | 1 | 120 | python|multiprocessing | 191,859 | <p>You can simply use <a href="https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.Pool" rel="noreferrer"><code>multiprocessing.Pool</code></a>:</p>
<pre><code>from multiprocessing import Pool
def process_image(name):
sci=fits.open('{}.fits'.format(name))
<process>
if __name__ =... |
20,011,138 | PHPStorm - Run Filewatcher on existing files? | <p>I've installed the nodejs plugin in PHPStorm and setup the yuicompressor npm for minifying css/js. </p>
<p>I got the file watcher working so that .min.css files are produced automatically whenever i make changes to .css/.js files in the project, but notice the file watcher only kicks in on existing files if I make... | 20,012,655 | 1 | 0 | null | 2013-11-15 21:44:48.753 UTC | 13 | 2014-04-02 16:19:51.103 UTC | null | null | null | null | 1,930,687 | null | 1 | 21 | phpstorm | 9,619 | <ol>
<li>Select such file(s)/folder(s) in Project View panel</li>
<li><strong>"Help | Find Action"</strong> (<kbd>Ctrl + Shift + A</kbd>), activate check box for better results</li>
<li>Search for "<code>run file w</code>" (without quotes, obviously) and choose <strong>Run File Watchers</strong> entry</li>
</ol>
<hr>
... |
5,683,793 | Emoji (Emoticons) on Blackberry and Android App. How to support? | <p>I wonder how whatsapp gives support for that. I could use emojis on iPhone because it is natively supported. I'm not developing for bb neither android but I need to help a coder with this stuff. <br><br>
The bb guy told me that he can add a font as a project resource (ttf), but since emojis are colored graphics, I'm... | 5,698,761 | 3 | 3 | null | 2011-04-16 01:10:21.427 UTC | 8 | 2013-10-08 13:39:35.54 UTC | 2011-10-22 17:55:24.467 UTC | null | 67,407 | null | 463,675 | null | 1 | 9 | android|blackberry|fonts|emoticons|emoji | 68,652 | <p>On <strong>Android</strong> you can make a <a href="http://en.wikipedia.org/wiki/Computer_font#Bitmap_fonts" rel="noreferrer">BitMap font</a> with the tutorial i <a href="http://obviam.net/index.php/using-bitmap-fonts-in-android/" rel="noreferrer">found here</a>. Then you can embed all your Emoji into that font.</p>... |
5,694,923 | In Clojure how to choose a value if nil | <p>In Clojure what is the idiomatic way to test for nil and if something is nil then to substitute a value? </p>
<p>For example I do this a lot:</p>
<pre><code> let [ val (if input-argument input-argument "use default argument")]
</code></pre>
<p>: but I find it repetitive having to use "input-argument" twice.</p... | 5,695,731 | 3 | 1 | null | 2011-04-17 16:56:28.967 UTC | 8 | 2018-08-10 11:06:55.187 UTC | 2018-08-10 11:06:55.187 UTC | null | 2,311,567 | null | 190,822 | null | 1 | 29 | clojure | 16,629 | <p>Alex's suggestion of "or" is indeed the idiomatic way to rewrite your example code, but note that it will not <em>only</em> replace <code>nil</code> values, but also those which are <code>false</code>.</p>
<p>If you want to keep the value <code>false</code> but discard <code>nil</code>, you need:</p>
<pre><code>(l... |
5,893,349 | Java, How to add library files in netbeans? | <p>I am new to the Netbeans IDE and Java. I have a java project that shows lot of compilation errors: </p>
<pre><code>can not import "org.apache.commons.logging.Log"
</code></pre>
<p>Can somebody please help me with these errors, How do I add library files in Netbeans IDE?</p> | 5,893,518 | 4 | 0 | null | 2011-05-05 06:09:03.62 UTC | 5 | 2020-11-09 03:36:30.39 UTC | 2015-07-27 13:03:22.093 UTC | null | 660,143 | null | 199,675 | null | 1 | 23 | java|include-path|netbeans-6.9 | 167,716 | <p>Quick solution in NetBeans 6.8.</p>
<p>In the Projects window right-click on the name of the project that lacks library -> Properties -> The Project Properties window opens. In Categories tree select "Libraries" node -> On the right side of the Project Properties window press button "Add JAR/Folder" -> Select jars ... |
6,209,903 | How to exclude dependencies from maven assembly plugin : jar-with-dependencies? | <p>Maven's assembly plugin enables the creation of a big jar including all dependencies with descriptorRef <code>jar-with-dependencies</code>.</p>
<p>How can one exclude some of these dependencies? It seems like it does not have such a configuration? Is there another solution?</p> | 6,210,532 | 4 | 1 | null | 2011-06-02 02:51:37.153 UTC | 9 | 2022-04-12 22:00:16.337 UTC | 2015-08-28 12:27:41.393 UTC | null | 1,743,880 | null | 520,957 | null | 1 | 40 | java|maven|jar|maven-assembly-plugin | 42,241 | <p>This <a href="http://maven.apache.org/plugins/maven-assembly-plugin/examples/single/including-and-excluding-artifacts.html" rel="nofollow noreferrer">example</a> indicates one way to do this:</p>
<pre><code> <dependencySets>
<dependencySet>
....
<excludes>
<exclude>co... |
1,783,540 | Spring JTA configuration - how to set TransactionManager? | <p>We configure our Spring transaction in Spring config as:</p>
<pre><code><tx:jta-transaction-manager/>
</code></pre>
<p>I gather this means that Spring will automatically discover the underlying JTA implementation. So when we start up JBoss we see these messages while Spring searches:</p>
<pre><code>[JtaTra... | 1,784,044 | 2 | 1 | null | 2009-11-23 14:41:42.433 UTC | 10 | 2015-08-12 19:38:47.843 UTC | 2009-11-23 16:06:00.783 UTC | null | 7,034 | null | 47,281 | null | 1 | 13 | java|spring|jboss|jta|spring-transactions | 47,358 | <p>Yes, that's alright. The stack trace you were seeing was also alright: <code><tx:jta-transaction-manager/></code> tries to acquire the transaction manager from a number of different standard locations; for every failed JNDI lookup, you'll see the <code>javax.naming.NameNotFoundException</code>.</p>
<p><code>j... |
6,016,000 | How to open phones gallery through code | <p>I wanna to open phones gallery through a button click.<br>
In my activity I have a button, I want to open the gallery through that button click.</p> | 6,016,352 | 5 | 1 | null | 2011-05-16 10:24:58.77 UTC | 8 | 2021-03-31 15:01:11.89 UTC | 2011-05-16 10:37:07.633 UTC | null | 246,342 | null | 1,147,007 | null | 1 | 22 | android | 90,661 | <p>Here is sample code for open gallery from app.</p>
<pre><code>Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select Picture"),SELECT_IMAGE);
</code></pre>
<p>OnActivityResult for get image.</p>
<pre><code>p... |
6,069,368 | Aggregate Function on Uniqueidentifier (GUID) | <p>Let's say I have the following table:</p>
<pre><code>category | guid
---------+-----------------------
A | 5BC2...
A | 6A1C...
B | 92A2...
</code></pre>
<p>Basically, I want to do the following SQL:</p>
<pre><code>SELECT category, MIN(guid)
FROM myTable
GROUP BY category
</code></pre>
<p>... | 6,069,422 | 5 | 2 | null | 2011-05-20 08:33:15.603 UTC | 7 | 2015-03-03 11:10:42.123 UTC | null | null | null | null | 87,698 | null | 1 | 48 | sql|sql-server|guid|aggregate|uniqueidentifier | 29,987 | <p>Assuming you're using SQL Server 2005 or later:</p>
<pre><code>;with Numbered as (
select category,guid,ROW_NUMBER() OVER (PARTITION BY category ORDER BY guid) rn
from myTable
)
select * from Numbered where rn=1
</code></pre> |
6,039,050 | difference between text file and binary file | <p>Why should we distinguish between text file and binary files when transmitting them? Why there are some channels designed only for textual data? At the bottom level, they are all bits.</p> | 6,039,058 | 5 | 0 | null | 2011-05-18 01:49:24.393 UTC | 20 | 2019-12-29 22:16:41.887 UTC | null | null | null | null | 660,496 | null | 1 | 51 | text-files|binaryfiles|file-type | 31,826 | <p>At the bottom level, they are all bits... true. However, some transmission channels have seven bits per byte, and other transmission channels have eight bits per byte. If you transmit ASCII text over a seven-bit channel, then all is fine. Binary data gets mangled.</p>
<p>Additionally, different systems use diffe... |
5,816,960 | How to check is timezone identifier valid from code? | <p>I'll try to explain what's the problem here.</p>
<p>According to <a href="http://php.net/manual/en/timezones.php">list of supported timezones</a> from PHP manual, I can see all valid TZ identifiers in PHP.</p>
<p>My first question is how to get that list from code but that's not what I really need.</p>
<p>My fina... | 5,878,722 | 8 | 0 | null | 2011-04-28 10:09:57.39 UTC | 9 | 2020-10-05 09:52:12.403 UTC | 2011-05-03 14:03:11.113 UTC | null | 679,733 | null | 679,733 | null | 1 | 39 | php|validation|datetime|time|timezone | 18,455 | <p>You solution works fine, so if it's speed you're looking for I would look more closely at what you're doing with your arrays. I've timed a few thousand trials to get reasonable average times, and these are the results:</p>
<pre><code>createTZlist : 20,713 microseconds per run
createTZlist2 : 13,848 microseconds per... |
5,731,234 | How to get the start time of a long-running Linux process? | <p>Is it possible to get the start time of an old running process? It seems that <code>ps</code> will report the date (not the time) if it wasn't started today, and only the year if it wasn't started this year. Is the precision lost forever for old processes?</p> | 5,731,337 | 8 | 12 | null | 2011-04-20 13:38:27.93 UTC | 84 | 2021-10-18 16:16:21.33 UTC | null | null | null | null | 512,652 | null | 1 | 333 | linux|bash|process | 273,554 | <p>You can specify a formatter and use <code>lstart</code>, like this command:</p>
<pre><code>ps -eo pid,lstart,cmd
</code></pre>
<p>The above command will output all processes, with formatters to get PID, command run, and date+time started.</p>
<p>Example (from Debian/Jessie command line)</p>
<pre><code>$ ps -eo p... |
5,742,543 | An invalid XML character (Unicode: 0xc) was found | <p>Parsing an XML file using the Java DOM parser results in:</p>
<pre><code>[Fatal Error] os__flag_8c.xml:103:135: An invalid XML character (Unicode: 0xc) was found in the element content of the document.
org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0xc) was found in the element content of the doc... | 5,742,563 | 10 | 0 | null | 2011-04-21 10:05:44.45 UTC | 18 | 2021-11-29 16:47:54.997 UTC | 2015-05-06 16:47:42.527 UTC | null | 2,777,965 | null | 644,474 | null | 1 | 45 | java|xml|dom|xml-parsing | 189,666 | <p>There are a few characters that are dissallowed in XML documents, even when you encapsulate data in CDATA-blocks.</p>
<p>If you generated the document you will need to <strike>entity encode it or</strike> strip it out. If you have an errorneous document, you should strip away these characters before trying to parse... |
55,606,800 | Create Pull Request Button is disabled | <p>I would like to make a pull request from my fork repo to the upstream repository.</p>
<p>As always I was following these steps <a href="https://help.github.com/en/articles/creating-a-pull-request-from-a-fork" rel="noreferrer">here</a> from <strong>the guidance from Github.</strong></p>
<p>But this time I can not m... | 55,633,299 | 9 | 6 | null | 2019-04-10 07:17:16.773 UTC | 4 | 2022-07-21 14:39:55.893 UTC | 2021-11-10 13:43:58.957 UTC | null | 1,201,863 | null | 11,257,110 | null | 1 | 46 | github|pull-request | 27,029 | <p>From Github Developer Support:</p>
<blockquote>
<p>Also, I know this might seem strange, but could you try selecting the
base repo/branch from the drop down list (even if this already seems
selected), and give this another go. It could that, for whatever
reason, the pull request creation flow isn't picking ... |
46,257,633 | iOS 11 - Is in app purchase testing using a sandbox user keeps asking to sign in for anyone else too? Forever loop? | <p>I am testing a non-consumable IAP on an iPhone 6s running iOS 11 GM.
Whenever I tap my "Buy" button, it asks me to sign in. I tap "Sign in with existing apple ID" and enter my sandbox user details (which worked fine as of a few days ago on iOS 10).</p>
<p>After entering, it just goes back to the same "Sign in" scre... | 46,364,900 | 5 | 2 | null | 2017-09-16 19:22:16.667 UTC | 8 | 2020-03-17 11:28:48.387 UTC | 2017-10-13 16:45:14.85 UTC | null | 7,506,896 | null | 1,634,905 | null | 1 | 38 | ios|iphone|in-app-purchase|app-store-connect|ios11 | 8,202 | <p>The same thing happens for me, for three separate sandbox users which were created before iOS 11 release. (The problem seems prevalent on iOS 11, there are posts on reddit and apple forums reporting this issue) </p>
<p>It seems creating new fresh sandbox user is the way to go. Sandbox users created after iOS 11 re... |
19,779,483 | PL/SQL ORA-01422: exact fetch returns more than requested number of rows | <p>I get keep getting this error I can't figure out what is wrong.</p>
<blockquote>
<p>DECLARE<br>
*<br>
ERROR at line 1:<br>
ORA-01422: exact fetch returns more than requested number of rows<br>
ORA-06512: at line 11</p>
</blockquote>
<p>Here is my code.</p>
<pre><code>DECLARE
rec_ENAME EMPLOYEE.ENAME... | 19,779,546 | 1 | 0 | null | 2013-11-04 23:46:08.427 UTC | 10 | 2021-02-08 19:28:06.357 UTC | 2017-08-20 18:11:51.077 UTC | null | 146,325 | null | 2,954,433 | null | 1 | 30 | oracle|plsql|oracle11g|sqlplus | 199,977 | <p>A <code>SELECT INTO</code> statement will throw an error if it returns anything other than 1 row. If it returns 0 rows, you'll get a <code>no_data_found</code> exception. If it returns more than 1 row, you'll get a <code>too_many_rows</code> exception. Unless you know that there will always be exactly 1 employee ... |
39,690,094 | Spring-boot default profile for integration tests | <p>Spring-boot utilizes <a href="http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html" rel="noreferrer">Spring profiles</a> which allow for instance to have separate config for different environments.
One way I use this feature is to configure test database to be used by integration... | 39,690,595 | 14 | 0 | null | 2016-09-25 18:05:54.963 UTC | 29 | 2022-08-12 20:10:48.203 UTC | 2021-04-30 20:30:56.73 UTC | null | 254,477 | null | 854,603 | null | 1 | 133 | java|spring|spring-boot | 178,213 | <p>As far as I know there is nothing directly addressing your request - but I can suggest a proposal that could help:</p>
<p>You could use your own test annotation that is a <a href="http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#beans-meta-annotations" rel="noreferrer">meta annotatio... |
33,355,444 | R - when trying to install package: InternetOpenUrl failed | <p>Since I've updated both R (to 3.2.2) and RStudio (to 0.99.486) in Win 7, I'm experiencing problems downloading packages.</p>
<p>I'm aware of the questions asked <a href="https://stackoverflow.com/questions/25599943/unable-to-install-packages-in-latest-version-of-rstudio-and-r-version-3-1-1">here</a> but neither</p>... | 33,372,798 | 4 | 0 | null | 2015-10-26 20:55:22.503 UTC | 9 | 2018-10-06 12:31:37.22 UTC | 2017-05-23 12:10:24.4 UTC | null | -1 | null | 4,126,224 | null | 1 | 22 | r|installation|package|install.packages | 28,203 | <p>The problem might be a failure to handle <code>https</code> properly by the underlying method used by R for downloading files. This can be verified by trying</p>
<pre><code>fname <- tempfile()
download.file("https://cran.uni-muenster.de/", destfile=fname)
file.remove(fname)
</code></pre>
<p>If that does not wor... |
69,207,368 | Constant FILTER_SANITIZE_STRING is deprecated | <p>I have installed PHP 8.1 and I started testing my old project. I have used the filter <code>FILTER_SANITIZE_STRING</code> like so:</p>
<pre><code>$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
</code></pre>
<p>Now I get this error:</p>
<blockquote>
<p>Deprecated: Constant FILTER_SANITIZE_S... | 69,207,369 | 5 | 0 | null | 2021-09-16 11:10:25.95 UTC | 5 | 2022-09-02 16:05:12.643 UTC | 2021-09-24 19:59:38.917 UTC | null | 1,839,439 | null | 1,839,439 | null | 1 | 34 | php|filter|sanitization|php-8.1 | 23,693 | <p>This filter had an unclear purpose. It's difficult to say what exactly it was meant to accomplish or when it should be used. It was also confused with the default string filter, due to its name, when in reality the default string filter is called <code>FILTER_UNSAFE_RAW</code>. The PHP community decided that the usa... |
20,327,937 | ValueError: unconverted data remains: 02:05 | <p>I have some dates in a json files, and I am searching for those who corresponds to today's date :</p>
<pre><code>import os
import time
from datetime import datetime
from pytz import timezone
input_file = file(FILE, "r")
j = json.loads(input_file.read().decode("utf-8-sig"))
os.environ['TZ'] = 'CET'
for item in ... | 20,328,136 | 6 | 0 | null | 2013-12-02 12:07:31.577 UTC | 8 | 2022-09-06 12:38:19.153 UTC | null | null | null | null | 2,899,642 | null | 1 | 46 | python|date|datetime|python-2.7 | 189,756 | <p>The value of <code>st</code> at <code>st = datetime.strptime(st, '%A %d %B')</code> line something like <code>01 01 2013 02:05</code> and the <code>strptime</code> can't parse this. Indeed, you get an hour in addition of the date... You need to add <code>%H:%M</code> at your strptime.</p> |
30,033,096 | What is `lr_policy` in Caffe? | <p>I just try to find out how I can use <a href="http://caffe.berkeleyvision.org/">Caffe</a>. To do so, I just took a look at the different <code>.prototxt</code> files in the examples folder. There is one option I don't understand:</p>
<pre><code># The learning rate policy
lr_policy: "inv"
</code></pre>
<p>Possible ... | 33,711,600 | 2 | 0 | null | 2015-05-04 14:47:04.15 UTC | 18 | 2018-03-22 06:46:36.26 UTC | 2018-03-22 06:46:36.26 UTC | null | 1,714,410 | null | 562,769 | null | 1 | 37 | machine-learning|neural-network|deep-learning|caffe|gradient-descent | 33,958 | <p>If you look inside the <code>/caffe-master/src/caffe/proto/caffe.proto</code> file (you can find it online <a href="https://github.com/BVLC/caffe/blob/master/src/caffe/proto/caffe.proto#L157-L172">here</a>) you will see the following descriptions:</p>
<pre><code>// The learning rate decay policy. The currently impl... |
36,840,396 | fetch gives an empty response body | <p>I have a react/redux application and I'm trying to do a simple GET request to a sever: </p>
<pre><code>fetch('http://example.com/api/node', {
mode: "no-cors",
method: "GET",
headers: {
"Accept": "application/json"
}
}).then((response) => {
console.log(response.body); // null
return dispatch({
... | 40,427,882 | 9 | 0 | null | 2016-04-25 12:20:01.607 UTC | 23 | 2022-06-03 15:33:38.223 UTC | 2019-08-24 03:42:59.02 UTC | null | 3,578,997 | null | 2,828,229 | null | 1 | 109 | javascript|fetch-api | 176,977 | <p>I just ran into this. As mentioned in this <a href="https://stackoverflow.com/a/35291777/2800482">answer</a>, using <code>mode: "no-cors"</code> will give you an <code>opaque response</code>, which doesn't seem to return data in the body.</p>
<blockquote>
<p>opaque: Response for “no-cors” request to cross-origin ... |
18,955,397 | Update the selected dates of date range picker for Twitter Bootstrap | <p>I'm using the <a href="https://github.com/dangrossman/bootstrap-daterangepicker" rel="noreferrer">date range picker</a> for Twitter Bootstrap, by <a href="http://www.dangrossman.info/2012/08/20/a-date-range-picker-for-twitter-bootstrap/" rel="noreferrer">Dan Grossman</a>.</p>
<p>When initialized, it's possible to s... | 21,391,074 | 5 | 0 | null | 2013-09-23 09:02:42.523 UTC | 1 | 2019-12-21 10:22:50.05 UTC | 2017-01-14 12:02:28.677 UTC | null | 6,106,614 | null | 2,417,844 | null | 1 | 11 | javascript|jquery|twitter-bootstrap|daterangepicker | 47,888 | <p>The latest version of this component provides methods for updating the start/end date:</p>
<pre><code>$("#reportrange").data('daterangepicker').setStartDate(startDate);
$("#reportrange").data('daterangepicker').setEndDate(endDate);
</code></pre>
<p>You don't have to call the update methods yourself as these will h... |
19,177,732 | What is the difference between ng-if and ng-show/ng-hide | <p>I'm trying to understand the difference between <code>ng-if</code> and <code>ng-show</code>/<code>ng-hide</code>, but they look the same to me.</p>
<p>Is there a difference that I should keep in mind choosing to use one or the other?</p> | 19,177,773 | 12 | 0 | null | 2013-10-04 09:26:14.98 UTC | 115 | 2019-05-07 06:48:50 UTC | 2019-05-07 06:48:50 UTC | null | 1,033,581 | null | 356,440 | null | 1 | 429 | angularjs|angularjs-ng-show|angularjs-ng-if | 320,805 | <h2>ngIf</h2>
<p>The <code>ngIf</code> directive <strong>removes or recreates</strong> a portion of the DOM tree based on an expression. If the expression assigned to <code>ngIf</code> evaluates to a false value then the element is removed from the DOM, otherwise a clone of the element is reinserted into the DOM.</p>
... |
26,893,792 | How to change an endpoint address with XML Transformation in web.config? | <p>I need change the address of this configuration in a web.config:</p>
<pre><code><client>
<endpoint address="OLD_ADDRESS"
binding="basicHttpBinding"
contract="Service.IService" name="BasicHttpBinding_IService" />
</client>
</code></pre>
<p>to this:</p>
<pre><code><client>
<en... | 26,894,625 | 1 | 0 | null | 2014-11-12 18:19:09.427 UTC | 5 | 2014-11-12 19:07:12.02 UTC | 2014-11-12 18:32:38.887 UTC | null | 888,472 | null | 888,472 | null | 1 | 30 | c#|xml|wcf|xslt | 13,320 | <p>Does the structure of your transformation file match your web.config? Specifically, are you missing a systems.serviceModel element? </p>
<pre><code><configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.serviceModel>
<client>
<endpoint name="Ba... |
51,527,489 | Change the default width of a VuetifyJS DataTable cell | <p>I'm using the <a href="https://vuetifyjs.com/en/components/data-tables#introduction" rel="nofollow noreferrer">VuetifyJS Data Table</a> and I need to move the entries of each header cell as close as possible to each other.
I tried to add a <em>width</em> to each header but that didn't work - it seems there is a pred... | 51,569,928 | 5 | 1 | null | 2018-07-25 20:53:55.907 UTC | 2 | 2022-09-10 05:07:20.673 UTC | 2022-05-27 14:51:40.443 UTC | null | 6,000,966 | null | 974,925 | null | 1 | 32 | javascript|vue.js|datatable|vuetify.js | 84,698 | <p>You can add another empty header and set <code>width</code> of every column to min value(1%), except empty to make it fill all free space. Also you need to add empty <code>td</code> to table body template to make grey row dividers visible.</p>
<p>See codepen: <a href="https://codepen.io/anon/pen/WKXwOR" rel="norefe... |
33,308,121 | Can you bind 'this' in an arrow function? | <p>I've been experimenting with ES6 for a while now, and I've just come to a slight problem.</p>
<p>I really like using arrow functions, and whenever I can, I use them.</p>
<p>However, it would appear that you can't bind them!</p>
<p>Here is the function:</p>
<pre><code>var f = () => console.log(this);
</code></... | 33,308,151 | 14 | 1 | null | 2015-10-23 17:22:36.373 UTC | 36 | 2022-08-15 21:40:48.773 UTC | 2019-11-23 16:01:50.883 UTC | null | 2,051,454 | null | 4,633,828 | null | 1 | 178 | javascript|function|ecmascript-6 | 100,471 | <p>You cannot <em>rebind</em> <code>this</code> in an arrow function. It will always be defined as the context in which it was defined. If you require <code>this</code> to be meaningful you should use a normal function.</p>
<p>From the <a href="http://www.ecma-international.org/ecma-262/6.0/#sec-arrow-function-definit... |
9,174,966 | Example of ´instanceof´ | <pre><code>public class TableModel2 extends TableModel1 { ... }
TableModel2 tableModel = new TableModel2();
boolean t1 = tableModel instanceof TableModel1;
boolean t2 = tableModel instanceof TableModel2;
</code></pre>
<p>In the above example, <code>t1</code> and <code>t2</code> are <code>true</code>. So, how could I... | 9,175,054 | 7 | 0 | null | 2012-02-07 10:54:15.18 UTC | 6 | 2012-02-07 11:23:10.453 UTC | 2012-02-07 10:58:48.147 UTC | null | 1,122,645 | null | 1,089,623 | null | 1 | 21 | java|instanceof | 66,453 | <pre><code>boolean t2 = tableModel.getClass().equals(TableModel1.class); //False
boolean t2 = tableModel.getClass().equals(TableModel2.class); //True
</code></pre> |
9,522,897 | Groovy, how to iterate a list with an index | <p>With all the shorthand ways of doing things in Groovy, there's got to be an easier way to iterate a list while having access to an iteration index.</p>
<pre><code>for(i in 0 .. list.size()-1) {
println list.get(i)
}
</code></pre>
<p>Is there no implicit index in a basic <code>for</code> loop?</p>
<pre><code>fo... | 9,522,992 | 2 | 0 | null | 2012-03-01 19:46:38.547 UTC | 4 | 2016-01-07 20:54:46.897 UTC | 2013-03-12 20:59:26.453 UTC | null | 791,406 | null | 791,406 | null | 1 | 55 | arrays|list|groovy|loops | 102,352 | <p>You can use <a href="http://docs.groovy-lang.org/latest/html/groovy-jdk/java/lang/Object.html#eachWithIndex(groovy.lang.Closure)" rel="noreferrer"><code>eachWithIndex</code></a>:</p>
<pre><code>list.eachWithIndex { item, index ->
println item
println index
}
</code></pre>
<p>With Groovy 2.4 and newer, y... |
30,149,493 | Redis AUTH command in Python | <p>I'm using <a href="https://github.com/andymccurdy/redis-py" rel="noreferrer">redis-py</a> binding in Python 2 to connect to my Redis server. The server requires a password. I don't know how to <code>AUTH</code> after making the connection in Python.</p>
<p>The following code does not work:</p>
<pre><code>import re... | 30,153,367 | 4 | 3 | null | 2015-05-10 08:51:50.403 UTC | 10 | 2022-03-24 15:38:59.963 UTC | null | null | null | null | 1,595,430 | null | 1 | 29 | python|redis | 38,874 | <p>Thanks to the hints from the comments. I found the answer from <a href="https://redis-py.readthedocs.org/en/latest/" rel="noreferrer">https://redis-py.readthedocs.org/en/latest/</a>.</p>
<p>It says</p>
<pre><code>class redis.StrictRedis(host='localhost', port=6379, db=0, password=None, socket_timeout=None, connect... |
30,818,694 | Test if dict contained in dict | <p>Testing for equality works fine like this for python dicts:</p>
<pre><code>first = {"one":"un", "two":"deux", "three":"trois"}
second = {"one":"un", "two":"deux", "three":"trois"}
print(first == second) # Result: True
</code></pre>
<p>But now my second dict contains some additional keys I want to ignore:</p>
<p... | 30,818,799 | 4 | 2 | null | 2015-06-13 12:30:35.833 UTC | 11 | 2015-06-14 18:47:17.867 UTC | 2017-05-23 12:10:47.363 UTC | null | -1 | null | 4,099,181 | null | 1 | 42 | python|dictionary | 24,722 | <p>You can use a <a href="https://docs.python.org/2/library/stdtypes.html#dictionary-view-objects">dictionary view</a>:</p>
<pre><code># Python 2
if first.viewitems() <= second.viewitems():
# true only if `first` is a subset of `second`
# Python 3
if first.items() <= second.items():
# true only if `firs... |
10,620,131 | Running liquibase within Java code | <p>For some reason there's no documentation on running liquibase inside Java code. I want to generate tables for Unit tests.</p>
<p>How would I run it directly in Java?</p>
<p>e.g.</p>
<pre><code>Liquibase liquibase = new Liquibase()
liquibase.runUpdates() ?
</code></pre> | 10,626,847 | 4 | 1 | null | 2012-05-16 13:57:11.42 UTC | 17 | 2022-05-14 19:26:51.517 UTC | null | null | null | null | 53,069 | null | 1 | 38 | java|liquibase | 35,466 | <p>It should be something like (taken from liquibase.integration.spring.SpringLiquibase source):</p>
<pre><code>java.sql.Connection c = YOUR_CONNECTION;
Liquibase liquibase = null;
try {
Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(c))
liquibase = new L... |
22,673,111 | Required XML attribute "adSize" was missing | <p>I get a "Required XML attribute "adSize" was missing" when I launch my app. This is written on the screen of my smartphone instead of my banner. </p>
<p>I tried the different solutions founded on stack (like <code>xmlns:ads="http://schemas.android.com/apk/res-auto"</code> instead of <code>xmlns:ads="http://schemas... | 34,531,612 | 18 | 2 | null | 2014-03-26 21:09:51.563 UTC | 3 | 2021-11-16 13:32:42.993 UTC | 2017-10-20 09:50:27.34 UTC | null | 4,720,935 | null | 3,464,273 | null | 1 | 22 | android|admob | 43,044 | <p>Here is a weird answer. I just restarted my eclipse and it stared working. This might help some one.</p>
<p>Just restart eclipse, android studio or IntelliJ IDE</p> |
7,540,329 | NSPredicate compare with Integer | <p>How can I compare two NSNumbers or a NSNumber and an Integer in an NSPredicate?</p>
<p>I tried:</p>
<pre><code>NSNumber *stdUserNumber = [NSNumber numberWithInteger:[[NSUserDefaults standardUserDefaults] integerForKey:@"standardUser"]];
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"userI... | 7,540,395 | 2 | 0 | null | 2011-09-24 16:37:32.4 UTC | 9 | 2020-09-25 11:52:38.453 UTC | 2020-09-25 11:52:38.453 UTC | null | 8,642,838 | null | 265,551 | null | 1 | 44 | ios|objective-c|core-data|nspredicate | 39,677 | <p><code>NSNumber</code> is an object type. Unlike <code>NSString</code>, the actual value of <em>NSNumber</em> is not substitued when used with <code>%@</code> format. You have to get the actual value using the predefined methods, like <code>intValue</code> which returns the integer value. And use the format substitue... |
18,866,745 | remove all options from select jquery but only one | <p>I have a select that contain this values: </p>
<pre><code><select id="lstCities" class="valid" name="City">
<option value="OSNY">OSNY</option>
<option value="dd">dd</option>
<option value="OSffNY">OSffNY</option>
<option value="ANTONY">ANTONY</option>
<opt... | 18,866,808 | 5 | 1 | null | 2013-09-18 07:56:57.35 UTC | 3 | 2017-10-17 03:30:25.86 UTC | null | null | null | null | 1,428,798 | null | 1 | 14 | javascript|jquery|removeall | 55,537 | <p>select all options, then exclude the one with that value :</p>
<pre><code>$('#lstCities option[value!="0"]').remove();
</code></pre>
<p><a href="http://jsfiddle.net/9dgV5/2/"><strong>FIDDLE</strong></a></p> |
17,736,967 | Python: how to add text inside a canvas? | <p>I have tried many times to add text to my canvas but it only adds it with a click of a button or on the outside of my canvas. Or it pops up in a separate box. Using the code below-</p>
<pre><code>def text():
canvas.create_text(100,10,fill="darkblue",font="Times 20 italic bold",text="Click the bubbles that are m... | 17,737,103 | 2 | 0 | null | 2013-07-19 01:58:18.293 UTC | 4 | 2020-02-12 12:39:51.823 UTC | 2013-07-22 03:35:44.157 UTC | null | 2,589,457 | null | 2,589,457 | null | 1 | 16 | text|python-3.x|tkinter | 85,823 | <p>For one, the first snippet of code doesn't work because you don't have a variable named <code>canvas</code>. You have one called <code>self.canvas</code>, however. And when I use <code>self.canvas</code> in the first bit of code and add it to the working program, the text shows up just fine.</p>
<p>Also, in that fi... |
18,128,895 | Replace spaces, tabs and carriage returns | <p>I am working with SQL developer with Oracle 11g. I have a query that looks something along the lines of this;</p>
<pre><code>SELECT [column], [column], [column],...... rs.notes
FROM [table], [table], [table]............ return_sku rs
WHERE [conditions] AND [conditions] AND [conditions]
</code></pre>
<p>In the <cod... | 18,129,100 | 2 | 1 | null | 2013-08-08 14:38:26.017 UTC | 1 | 2013-08-08 15:07:33.963 UTC | 2013-08-08 14:48:30.493 UTC | null | 1,464,444 | null | 2,664,815 | null | 1 | 3 | sql|oracle|select|replace | 59,728 | <p>In Oracle if you just want to remove a character you can omit the third argument of the replace call and the function for character codes is chr(), not char().</p>
<p>So your line would be <code>SELECT ... replace(rs.notes,chr(10)) ...</code></p> |
3,589,573 | PHP function flags, how? | <p>I'm attempting to create a function with flags as its arguments but the output is always different with what's expected :</p>
<pre><code>define("FLAG_A", 1);
define("FLAG_B", 4);
define("FLAG_C", 7);
function test_flags($flags) {
if($flags & FLAG_A) echo "A";
if($flags & FLAG_B) echo "B";
if(... | 3,589,579 | 1 | 0 | null | 2010-08-28 05:16:09.957 UTC | 10 | 2015-06-15 00:04:22.027 UTC | 2011-06-30 18:23:24.54 UTC | null | 236,247 | null | 433,531 | null | 1 | 21 | php|function|bit-manipulation|flags | 15,244 | <p>Flags must be powers of 2 in order to bitwise-or together properly.</p>
<pre><code>define("FLAG_A", 0x1);
define("FLAG_B", 0x2);
define("FLAG_C", 0x4);
function test_flags($flags) {
if ($flags & FLAG_A) echo "A";
if ($flags & FLAG_B) echo "B";
if ($flags & FLAG_C) echo "C";
}
test_flags(FLAG_B | F... |
28,354,217 | how can you record your screen in a gif? | <p><img src="https://i.stack.imgur.com/lfdUs.gif" alt="enter image description here"></p>
<p>This is the example i am talking about, how can you do this?</p> | 28,354,334 | 2 | 2 | null | 2015-02-05 21:20:13.62 UTC | 12 | 2018-03-27 21:26:42.12 UTC | 2015-02-06 00:43:26.51 UTC | null | 2,166,798 | null | 97,893 | null | 1 | 25 | macos|gif | 41,316 | <p>I usually, on Mac, do this task with <a href="https://www.cockos.com/licecap/" rel="noreferrer">https://www.cockos.com/licecap/</a> (source: <a href="https://github.com/justinfrankel/licecap" rel="noreferrer">https://github.com/justinfrankel/licecap</a>). It also runs on Windows. </p>
<blockquote>
<p>LICEcap can ... |
8,955,332 | What is signing ClickOnce manifests for? | <p>According to <a href="http://msdn.microsoft.com/en-us/library/zfz60ccf%28v=vs.90%29.aspx" rel="noreferrer">Microsoft</a>, you <em>must</em> sign your ClickOnce application. But it seems to me that it works just fine when I publish it without signing it (by turning off the 'Sign the ClickOnce manifests' option).</p>
... | 9,053,248 | 1 | 1 | null | 2012-01-21 18:08:22.45 UTC | 3 | 2012-01-29 16:33:52.893 UTC | 2012-01-28 05:39:27.4 UTC | null | 1,336 | null | 1,219,414 | null | 1 | 39 | .net|clickonce|manifest|code-signing | 22,675 | <p>It's a security feature that allows your users to verify that any updates really originated from the publisher of the version you installed before. This is a basic property of Public Key encryption.
On top of that you can have your certificate authorized by a trusted peer so that the details of the publisher supplie... |
26,993,853 | ViewPager inside fragment, how to retain state? | <p>In my application the fragment activity holds two fragments, Fragment A and Fragment B. Fragment B is a view pager that contains 3 fragments.</p>
<p><img src="https://i.stack.imgur.com/1zKEm.png" alt="enter image description here"></p>
<p>In my activity, to prevent that the fragment is recreated on config changes:... | 27,316,052 | 2 | 3 | null | 2014-11-18 12:00:04.4 UTC | 12 | 2017-09-27 11:58:54.537 UTC | 2014-11-18 12:50:24.843 UTC | null | 401,025 | null | 401,025 | null | 1 | 12 | android|android-fragments|fragmentpageradapter | 18,224 | <p>You will need to do 2 things to resolve the issue:</p>
<p>1) You should use <code>onCreate</code> method instead of <code>onViewCreated</code> to instantiate <code>LfPagerAdapter</code>;</p>
<p>i.e.:</p>
<pre><code> public class MainTabFragment extends Fragment {
private PagerSlidingTabStrip mSlidingTabLa... |
19,800,939 | How to initialize a constructor with that takes Strings as parameters? | <p>I am not sure that I am using the right terminology, but question is how do I properly make a constructor that takes a string in as a parameter?</p>
<p>I am used to having a <code>const char *</code> in the constructor instead of strings.</p>
<p>Normally I would do something like this:</p>
<pre><code>Name(const c... | 19,800,969 | 4 | 0 | null | 2013-11-05 23:11:16.403 UTC | 2 | 2019-06-02 08:36:26.74 UTC | 2013-11-05 23:13:47.797 UTC | null | 1,404,311 | null | 1,819,427 | null | 1 | 16 | c++|string|constructor | 52,461 | <p>Use <a href="http://en.cppreference.com/w/cpp/string/basic_string" rel="noreferrer"><code>std::string</code></a> and initializer lists:</p>
<pre><code>std::string fName, lName;
Name(string fName, string lName):fName(std::move(fName)), lName(std::move(lName))
{
}
</code></pre>
<p>In this case, you don't need to us... |
368,766 | How to pass parameters to SSRS report programmatically | <p>I'm looking for a little help on programmatically passing parameters to a SSRS report via VB.NET and ASP.NET. This seems like it should be a relatively simple thing to do, but I haven't had much luck finding help on this.</p>
<p>Does anyone have any suggestions on where to go to get help with this, or perhaps even... | 368,851 | 4 | 0 | null | 2008-12-15 15:47:31.93 UTC | 8 | 2015-02-24 15:21:25.08 UTC | null | null | null | null | 6,602 | null | 1 | 15 | asp.net|vb.net|reporting-services | 55,660 | <p>You can do the following,: (it works both on local reports as in Full Blown SSRS reports. but in full mode, use the appropriate class, the parameter part remains the same)</p>
<pre><code>LocalReport myReport = new LocalReport();
myReport.ReportPath = Server.MapPath("~/Path/To/Report.rdlc");
ReportParameter myParam... |
399,971 | Sharing a folder and setting permissions in PowerShell | <p>I need a script to run on Vista Ultimate to share an external drive and assign full control to Everyone. I've got a batch file to create the share using <code>net share</code>, but there doesn't seem to be a way to change the permissions. I reckon this must be possible in PowerShell, but I have no idea where to star... | 400,459 | 4 | 0 | null | 2008-12-30 10:45:30.323 UTC | 3 | 2017-12-07 20:37:32.453 UTC | null | null | null | harriyott | 5,744 | null | 1 | 17 | powershell|permissions|directory|share | 55,586 | <p>Two answers.</p>
<p>In PowerShell, the Get-ACL cmdlet will retrieve the existing permissions. You then modify those using .NET commands, and run Set-ACL to apply it back to the folder - the help for these two cmdlets includes examples, and you can download the book examples from www.sapienpress.com for "Windows Pow... |
695,303 | Building Amazon Affiliates links | <p>How can I generate an Amazon affiliates link (with my Tracking ID) from a regular link without using Amazon online tools ?</p> | 695,912 | 4 | 1 | null | 2009-03-29 20:21:12.84 UTC | 15 | 2018-11-22 17:38:44.927 UTC | null | null | null | null | 41,767 | null | 1 | 19 | amazon | 8,510 | <p>Here's an <a href="http://www.askdavetaylor.com/how_do_i_quickly_build_amazon_affiliate_links_on_my_pages.html" rel="noreferrer">easy tutorial</a> that should get you started. And <a href="https://affiliate-program.amazon.com/gp/associates/help/t5/a16" rel="noreferrer">this page</a> at Amazon should fill in some gap... |
390,578 | Creating instance of type without default constructor in C# using reflection | <p>Take the following class as an example:</p>
<pre><code>class Sometype
{
int someValue;
public Sometype(int someValue)
{
this.someValue = someValue;
}
}
</code></pre>
<p>I then want to create an instance of this type using reflection:</p>
<pre><code>Type t = typeof(Sometype);
object o = Ac... | 390,596 | 4 | 2 | null | 2008-12-24 01:34:32.407 UTC | 48 | 2018-06-25 12:14:10.23 UTC | 2013-09-27 15:57:55.463 UTC | null | 661,933 | Aistina | 37,472 | null | 1 | 105 | c#|reflection|instantiation|default-constructor | 95,187 | <p>I originally posted this answer <a href="https://stackoverflow.com/questions/178645/how-does-wcf-deserialization-instantiate-objects-without-calling-a-constructor#179486">here</a>, but here is a reprint since this isn't the exact same question but has the same answer:</p>
<p><code>FormatterServices.GetUninitialized... |
1,243,614 | How do I calculate the normal vector of a line segment? | <p>Suppose I have a line segment going from (x1,y1) to (x2,y2). How do I calculate the normal vector perpendicular to the line?</p>
<p>I can find lots of stuff about doing this for planes in 3D, but no 2D stuff.</p>
<p>Please go easy on the maths (links to worked examples, diagrams or algorithms are welcome), I'm a p... | 1,243,676 | 4 | 3 | null | 2009-08-07 08:35:36.627 UTC | 71 | 2022-01-13 19:29:33.827 UTC | null | null | null | null | 18,854 | null | 1 | 205 | math|geometry|vector | 236,536 | <p>If we define <code>dx = x2 - x1</code> and <code>dy = y2 - y1</code>, then the normals are <code>(-dy, dx)</code> and <code>(dy, -dx)</code>.</p>
<p>Note that no division is required, and so you're not risking dividing by zero.</p> |
22,404,641 | Using Sqoop to import data from MySQL to Hive | <p>I am using Sqoop (version 1.4.4) to import data from MySQL to Hive. The data will be a subset of one of tables, i.e. few columns from a table. Is it necessary to create table in Hive before hand. Or importing the data will create the name specified in the command if it is not in the Hive?</p> | 22,407,835 | 6 | 1 | null | 2014-03-14 12:10:36.403 UTC | 5 | 2022-01-25 15:39:18.187 UTC | 2014-03-14 12:11:29.567 UTC | null | 13,302 | null | 2,526,951 | null | 1 | 7 | mysql|hadoop|hive|sqoop | 63,119 | <p>As mentioned in the <a href="http://sqoop.apache.org/docs/1.4.4/SqoopUserGuide.html#_importing_data_into_hive" rel="nofollow noreferrer">sqoop documentation</a>, you will not have to create any hive tables if you use the <em><code>--hive-import</code></em> argument in your command</p>
<p>example:</p>
<pre><code>sqoo... |
23,522,130 | JavaBean wrapping with JavaFX Properties | <p>I want to use JavaFX properties for UI binding, but I don't want them in my model classes (see <a href="https://stackoverflow.com/questions/23187989/using-javafx-beans-properties-in-model-classes">Using javafx.beans properties in model classes</a>). My model classes have getters and setters, and I want to create pro... | 23,524,537 | 1 | 1 | null | 2014-05-07 15:32:38.213 UTC | 8 | 2017-02-11 22:25:15.413 UTC | 2017-05-23 12:34:45.273 UTC | null | -1 | null | 1,829,158 | null | 1 | 22 | java|model-view-controller|javafx|model|javabeans | 10,341 | <p>The <code>Simple*Property</code> classes are full, standalone implementations of their corresponding <code>Property</code> abstract classes, and do not rely on any other object. So, for example, <code>SimpleStringProperty</code> contains a (private) <code>String</code> field itself which holds the current value of t... |
48,218,065 | ProgrammingError: SQLite objects created in a thread can only be used in that same thread | <p>i'm fairly new to programming. I've tried MySQL before, but now it's my first time using SQLite in a python flask website.
So maybe I'm using MySQL syntax instead of SQLite, but I can't seem to find the problem.</p>
<pre><code>Piece of my code:
@app.route('/register', methods=['GET', 'POST'])
def register():... | 48,218,213 | 9 | 1 | null | 2018-01-12 00:52:17.887 UTC | 21 | 2022-05-14 03:22:34.567 UTC | null | null | null | null | 9,136,764 | null | 1 | 105 | python|mysql|sqlite|flask | 111,715 | <p>Your cursor 'c' is not created in the same thread; it was probably initialized when the Flask app was run.</p>
<p>You probably want to generate SQLite objects (the conneciton, and the cursor) in the same method, such as:</p>
<pre><code> @app.route('/')
def dostuff():
with sql.connect("database.db") as con:
... |
29,477,393 | Is middleware neeeded to redirect to HTTPS in ASP.net and C#? | <p>What is the recommend way to redirect to HTTPS all incoming requests that are not secure. Do I need to write a middleware component? If so, I couldn't figure out how to get the server name.</p>
<pre><code>public class RedirectHttpMiddleware
{
RequestDelegate _next;
public RedirectHttpMiddleware(RequestDe... | 29,477,556 | 12 | 2 | null | 2015-04-06 18:39:07.053 UTC | 17 | 2021-12-14 16:48:18.843 UTC | 2021-12-14 16:48:18.843 UTC | null | 1,145,388 | null | 3,151,470 | null | 1 | 36 | c#|redirect|https|asp.net-core|middleware | 21,533 | <p>You can use your own middleware class, but typically I just do something like this in my Startup configuration:</p>
<pre><code>app.Use(async (context, next) =>
{
if (context.Request.IsHttps)
{
await next();
}
else
{
var withHttps = Uri.UriSchemeHttps + Uri.SchemeDelimiter + co... |
29,576,063 | How to attach navbar only on certain pages using ui-router? | <p>How to display a navbar on every page except landingpage, so that not have to attach a navbar file on each of needed pages? Now I have enclosed navbar on main app layout, how it should be handled to keep it DRY?</p>
<p>Demo (with navbar on each page):</p>
<p><div class="snippet" data-lang="js" data-hide="false">
<... | 29,577,344 | 1 | 2 | null | 2015-04-11 09:06:53.103 UTC | 12 | 2015-04-11 11:28:08.973 UTC | 2015-04-11 10:47:29.97 UTC | null | 171,456 | null | 707,729 | null | 1 | 15 | javascript|angularjs|twitter-bootstrap|angular-ui-router|angularjs-ng-include | 9,094 | <p>Created named views like <code><div ui-view name="nav"></div></code> and set the templateUrl by view by state. For the <code>landingpage</code> state, just don't provide a templateUrl for the <code>nav</code> view and it won't render the navbar.</p>
<p><strong>Update</strong>: hide on <code>landingpage<... |
36,580,963 | Can you, or should you use localStorage in Redux's initial state? | <p>For example... </p>
<pre><code>export const user = (state = {
id: localStorage.getItem('id'),
name: localStorage.getItem('name'),
loggedInAt: null
}, action) => {
case types.LOGIN:
localStorage.setItem('name', action.payload.user.name);
localStorage.setItem('id', action.payload.user.id);
... | 36,581,186 | 1 | 3 | null | 2016-04-12 18:10:07.013 UTC | 8 | 2019-02-28 22:20:33.843 UTC | null | null | null | null | 1,541,609 | null | 1 | 30 | javascript|reactjs|ecmascript-6|redux|flux | 16,271 | <p>Redux <a href="http://redux.js.org/docs/api/createStore.html" rel="noreferrer"><code>createStore</code></a> 2nd param is intended for store initialization:</p>
<pre><code>createStore(reducer, [initialState], [enhancer])
</code></pre>
<p>So you can do something like this:</p>
<pre><code>const initialState = {
id... |
4,366,177 | Static block on home page in Magento | <p>I am trying to add a static block to the home page of a Magento site using the layout XML file.</p>
<p>I can see how to add and remove block inside a reference, but I am struggling to see how to add it for a specific page, i.e. the home page.</p>
<pre><code><block type="cms/block" name="home-page-block">
... | 4,366,398 | 1 | 0 | null | 2010-12-06 12:02:40.57 UTC | 9 | 2017-03-29 05:34:38.727 UTC | 2012-07-07 06:14:39.42 UTC | null | 635,608 | null | 347,180 | null | 1 | 15 | xml|magento | 37,225 | <p>In any layout file used by your theme add the following.</p>
<pre><code><cms_index_index>
<reference name="content">
<block type="cms/block" name="home-page-block">
<action method="setBlockId"><block_id>home-page-block</block_id></action>
</block>
&l... |
39,526,595 | EntityFramework Core automatic migrations | <p>Is there any code to perform automatic migration in <code>Entity Framework core</code> <code>code first</code> in asp.net core project?</p>
<p>I do it simply in MVC4/5 by adding</p>
<pre><code>Database.SetInitializer(new MigrateDatabaseToLatestVersion<AppDbContext, MyProject.Migrations.Configuration>());
pub... | 39,526,807 | 10 | 1 | null | 2016-09-16 08:07:57.807 UTC | 9 | 2022-04-12 14:26:03.987 UTC | 2016-09-16 10:41:26.773 UTC | null | 1,077,309 | null | 4,404,269 | null | 1 | 50 | entity-framework|asp.net-core|entity-framework-core | 72,631 | <p>You can call <code>context.Database.Migrate()</code>in your <code>Startup.cs</code></p>
<p>eg:</p>
<pre><code>using (var context = new MyContext(...))
{
context.Database.Migrate();
}
</code></pre> |
39,414,692 | A javascript 'let' global variable is not a property of 'window' unlike a global 'var' | <p>I used to check if a global <code>var</code> has been defined with:</p>
<pre><code>if (window['myvar']==null) ...
</code></pre>
<p>or</p>
<pre><code>if (window.myvar==null) ...
</code></pre>
<p>It works with <code>var myvar</code></p>
<p>Now that I am trying to switch to let, this does not work anymore.</p>
<p... | 39,414,995 | 1 | 6 | null | 2016-09-09 15:10:39.147 UTC | 12 | 2018-07-12 15:03:20.74 UTC | null | null | null | null | 1,413,206 | null | 1 | 16 | javascript|var|let | 16,207 | <blockquote>
<p>I hear people say that at the global level, let and var are/behave the
same, but this is not what I am seeing.</p>
</blockquote>
<p>Eh, yes and no. To answer your question, in the large majority of cases <code>let</code> and <code>var</code> are the same when declared globally, but there are some d... |
19,965,197 | Change column values in an R dataframe | <p>I have a data frame formatted like this in R:</p>
<p><img src="https://i.stack.imgur.com/FSQvT.png" alt="dataframe"></p>
<p>How could I call up all the HEIGHT values where GROUP is equal to B and change them? I.e. from cm to mm. </p> | 19,965,337 | 2 | 1 | null | 2013-11-13 21:55:39.54 UTC | null | 2021-06-11 16:40:14.66 UTC | 2015-12-02 23:59:13.223 UTC | null | 4,370,109 | null | 1,658,170 | null | 1 | 2 | r|dataframe | 54,086 | <pre><code>data = data.frame(
group = rep(c("A", "B", "C"), each = 4),
height = c(259, 243, 253, 235, 23.5, 23.6, 23.5, 24.1, 235, 234, 235, 220)
)
data #shows your data
#from cm to mm
data$height[data$group == "B"] <- data$height[data$group == "B"] * 10
</cod... |
7,511,353 | Change iPhone splash screen time | <p>How would I make the splash screen stay for longer, 5 seconds, for example?</p> | 7,511,511 | 4 | 7 | null | 2011-09-22 07:48:53.537 UTC | 10 | 2016-11-24 11:50:23.983 UTC | null | null | null | null | 948,163 | null | 1 | 7 | iphone|ios|xcode|splash-screen | 33,968 | <p>You need to create a view controller for displaying the splash screen as done below. </p>
<pre><code> - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[self generateRandomSplashScreen];
[self performSelector:@selector(removeSplashS... |
7,397,988 | Android GridView with categories? | <p>Is it possible to use categories or some sort of headers with a <code>GridView</code> in Android?</p>
<p>I put together a quick illustration of what I was thinking about:</p>
<p><img src="https://i.stack.imgur.com/09tNQ.jpg" alt="enter image description here"></p>
<p>Thanks a lot.</p> | 15,547,863 | 4 | 8 | null | 2011-09-13 07:01:59.43 UTC | 7 | 2016-08-30 12:42:03.82 UTC | null | null | null | null | 762,442 | null | 1 | 33 | android|gridview|android-3.0-honeycomb | 21,097 | <p>You can use <a href="http://tonicartos.github.com/StickyGridHeaders/">Stickygridheaders</a> library directly or as a model to create your own widget.</p> |
7,335,920 | What specifically are wall-clock-time, user-cpu-time, and system-cpu-time in UNIX? | <p>I can take a guess based on the names, but what specifically are wall-clock-time, user-cpu-time, and system-cpu-time in UNIX?</p>
<p>Is user-cpu time the amount of time spent executing user-code while kernel-cpu time the amount of time spent in the kernel due to the need of privileged operations (like IO to disk)?</... | 7,335,965 | 4 | 1 | null | 2011-09-07 14:50:01.247 UTC | 69 | 2021-03-09 13:33:10.81 UTC | 2021-03-09 13:33:10.81 UTC | null | 3,924,118 | null | 857,994 | null | 1 | 190 | unix|operating-system | 105,516 | <p>Wall-clock time is the time that a clock on the wall (or a stopwatch in hand) would measure as having elapsed between the start of the process and 'now'.</p>
<p>The user-cpu time and system-cpu time are pretty much as you said - the amount of time spent in user code and the amount of time spent in kernel code.</p>
... |
24,441,178 | Recommended Minimum Android App SDK | <p>I am making an android app, and am wondering what the industry's thoughts are on supporting older android versions like GingerBread and FroYo. Should a developer like me take the extra step to make my app compatible with those older versions, or are they obsolete? I am speaking in terms of the market in 2014.</p>
<... | 24,441,258 | 8 | 1 | null | 2014-06-26 22:21:58.777 UTC | 8 | 2022-08-02 08:51:51.733 UTC | null | null | null | null | 2,518,263 | null | 1 | 47 | android|sdk | 65,019 | <p>Most of the Android devices are above the Gingerbread level. But there are still a decent number of those devices out there. You, as a developer, must decide if the number of users who would potentially download your app for those versions of Android is worth the level of effort in developing the app for those vers... |
1,435,012 | switch statement in Jquery and List | <p>I would like to know if my approach is efficient and correct. my code is not working though, I don't know why.</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>... | 1,435,074 | 4 | 0 | null | 2009-09-16 19:30:24.003 UTC | 3 | 2012-12-20 14:22:37.48 UTC | 2009-09-16 19:34:08.08 UTC | null | 1,831 | null | 173,072 | null | 1 | 8 | javascript|jquery|switch-statement|conditional-statements | 74,256 | <p>You code doesn't work because the variables are scoped to the function <code>HotelQuery</code>. I think what you might want to do is return an object with properties from the function, and also use the unobtrusive JavaScript approach to bind an click event handler to the <code><a></code> element.</p>
<p>Somet... |
42,593,975 | Make front- and backend (Angular 2 and Spring) Maven Multimodule Project | <p>How do I create a Maven multimodule project with a Spring backend and Angular2 front-end? Using spring initializr (<a href="https://start.spring.io" rel="noreferrer">https://start.spring.io</a>) and angular cli separately seems to be straightforward, but how do I organize that as a multi-module Maven project with li... | 43,032,863 | 1 | 9 | null | 2017-03-04 08:44:44.347 UTC | 12 | 2018-06-13 13:09:31.453 UTC | 2018-06-13 13:09:31.453 UTC | null | 4,125,622 | null | 4,125,622 | null | 1 | 15 | spring|maven|angular|spring-boot|angular-cli | 16,079 | <p>The recommended way to build an Angular 2 application is to make use of Angular CLI tool. Similarly when you work with Java EE projects you typically use Maven as the build tool.</p>
<p>To get the best of both worlds you can develop a multi module project as you already figured.</p>
<p>If you would like then just ... |
49,530,465 | Lombok plugin incompatible with 2018.1 Intellij Idea | <p>Right now I have seen Intellij Idea update window with the notion: </p>
<blockquote>
<p>Plugin incompatible with new build found: Lombok Plugin</p>
</blockquote>
<p><a href="https://i.stack.imgur.com/8u7Pi.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8u7Pi.png" alt="enter image description here"></a... | 49,531,561 | 4 | 3 | null | 2018-03-28 09:11:51.747 UTC | 2 | 2018-03-28 10:06:33.383 UTC | null | null | null | null | 723,845 | null | 1 | 59 | intellij-idea|lombok|intellij-lombok-plugin | 19,964 | <p>The following is a solution works for me:</p>
<ol>
<li>Update intellij idea (I use the community release zip package)</li>
<li>Run Idea and open settings</li>
<li>Select lombok plugin and reload list of plugins
<a href="https://i.stack.imgur.com/dyitm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dyitm.... |
10,299,811 | Creating new database from a backup of another Database on the same server? | <p>I am trying to create a new database from an old backup of database on the same server.
When using <em>SQL server management studio</em> and trying to restore to the new DB from the backup I get this error</p>
<pre><code>System.Data.SqlClient.SqlError: The backup set holds a backup of a database
other than the exi... | 10,300,030 | 5 | 2 | null | 2012-04-24 14:16:29.38 UTC | 16 | 2021-10-16 17:25:21.043 UTC | 2013-09-11 07:52:36.373 UTC | null | 1,989,820 | null | 1,353,886 | null | 1 | 85 | sql|database|sql-server-2008 | 151,139 | <h1>What I should to do:</h1>
<ul>
<li>Click on 'Restore Database ...' float menu that appears right clicking the "Databases" node on SQL Server Management Studio.</li>
<li>Fill wizard with the database to restore and the new name.</li>
<li><strong>Important</strong> If database still exists change the "... |
7,621,373 | How do I change the date format of a DataBinder.Eval in asp.net? | <p>I'm trying to figure out how to change the datetime format so just the date will show up.</p>
<pre><code> <asp:Repeater ID="RepeaterActions" runat="server">
<ItemTemplate>
<li>
<span class="historyDate"><%#DataBinder.Eval(Containe... | 7,621,648 | 5 | 0 | null | 2011-10-01 16:09:09.767 UTC | 5 | 2019-01-03 08:52:55.867 UTC | 2011-10-01 17:20:17.52 UTC | null | 957,627 | null | 957,627 | null | 1 | 40 | c#|asp.net|sql-server | 82,896 | <p>give the format e.g: </p>
<pre><code><%# DataBinder.Eval(Container.DataItem, "ActionListDate", "{0:d/M/yyyy hh:mm:ss tt}") %>
</code></pre> |
13,903,257 | HTML5 canvas, scale image after drawing it | <p>I'm trying to scale an image that has already been draw into canvas.
This is the code:</p>
<pre><code> var canvas = document.getElementById('splash-container');
var context = canvas.getContext('2d');
var imageObj = new Image();
imageObj.onload = function() {
// draw image at its orig... | 13,903,654 | 2 | 0 | null | 2012-12-16 16:32:17.617 UTC | 1 | 2014-03-18 01:46:07.81 UTC | null | null | null | null | 1,200,252 | null | 1 | 13 | image|html|canvas|scale | 40,934 | <p>You're thinking about it wrong. Once you've drawn the image onto the <code>canvas</code> it has no relationship to the <code>imageObj</code> object. Nothing you do to <code>imageObj</code> will affect what's already drawn. If you want to scale the image, do in the <a href="https://developer.mozilla.org/docs/Web/G... |
13,933,077 | Android AlertDialog setOnDismissListener for API lower than 17 | <p>I created an AlertDialog:</p>
<pre><code>private CharSequence[] _items = { "item1", "item2", "item3", "item4",
"item5", "item6", "item7" };
AlertDialog.Builder daysBuilder = new AlertDialog.Builder(this);
daysBuilder.setTitle("SomeCaption");
daysBuilder.setMultiChoiceItems(_items,new Boolean[] { false, tr... | 13,935,676 | 1 | 2 | null | 2012-12-18 12:31:29.64 UTC | 3 | 2017-07-16 06:23:26.383 UTC | 2017-07-16 06:23:26.383 UTC | null | 5,250,273 | null | 1,900,916 | null | 1 | 30 | java|android|dialog | 6,105 | <p>The problem is you are using <code>setOnDismissListener</code> of <code>AlertDialog.Builder</code>. This was introduced in Api level 17, <code>setOnDismissListener</code> of <code>AlertDialog</code> itself has been since api level 1.</p>
<pre><code>AlertDialog alert = daysBuilder.create();
alert.setOndismissListene... |
13,881,292 | What information does GCC Profile Guided Optimization (PGO) collect and which optimizations use it? | <p>Which information does GCC collect when I enable <code>-fprofile-generate</code> and which optimization does in fact uses the collected information (when setting the <code>-fprofile-use</code> flag) ?</p>
<p>I need citations here. I've searched for a while but didn't found anything documented.</p>
<p>Information r... | 13,881,504 | 2 | 0 | null | 2012-12-14 15:10:25.5 UTC | 12 | 2017-10-29 01:09:36.897 UTC | 2017-10-29 01:09:36.897 UTC | null | 895,245 | null | 973,795 | null | 1 | 48 | c++|gcc|pgo|lto | 26,256 | <p><code>-fprofile-generate</code> enables <code>-fprofile-arcs</code>, <code>-fprofile-values</code> and <code>-fvpt</code>.</p>
<p><code>-fprofile-use</code> enables <code>-fbranch-probabilities</code>, <code>-fvpt</code>, <code>-funroll-loops</code>, <code>-fpeel-loops</code> and <code>-ftracer</code></p>
<p>Sourc... |
13,793,060 | `respond_to?` vs. `respond_to_missing?` | <p>What is the point of defining <code>respond_to_missing?</code> as opposed to defining <code>respond_to?</code>? What goes wrong if you redefine <code>respond_to?</code> for some class?</p> | 13,793,573 | 2 | 0 | null | 2012-12-09 23:37:53.233 UTC | 14 | 2019-11-06 14:28:49.813 UTC | null | null | null | null | 314,166 | null | 1 | 54 | ruby|metaprogramming | 12,745 | <p>Without <a href="http://ruby-doc.org/core/Object.html#method-i-respond_to_missing-3F" rel="noreferrer"><code>respond_to_missing?</code></a> defined, trying to get the method via <a href="http://ruby-doc.org/core/Object.html#method-i-method" rel="noreferrer"><code>method</code></a> will fail:</p>
<pre><code>class Fo... |
14,178,264 | C++11: Correct std::array initialization? | <p>If I initialize a std::array as follows, the compiler gives me a warning about missing braces </p>
<pre><code>std::array<int, 4> a = {1, 2, 3, 4};
</code></pre>
<p>This fixes the problem:</p>
<pre><code>std::array<int, 4> a = {{1, 2, 3, 4}};
</code></pre>
<p>This is the warning message:</p>
<pre><co... | 14,178,283 | 5 | 8 | null | 2013-01-06 01:10:32.19 UTC | 12 | 2022-07-21 21:22:56.453 UTC | 2018-07-30 08:25:20.913 UTC | null | 706,055 | null | 1,392,142 | null | 1 | 82 | c++|arrays|c++11|initialization|c++14 | 103,767 | <p>This is the bare implementation of <code>std::array</code>: </p>
<pre><code>template<typename T, std::size_t N>
struct array {
T __array_impl[N];
};
</code></pre>
<p>It's an aggregate struct whose only data member is a traditional array, such that the inner <code>{}</code> is used to initialize the inner... |
29,203,312 | How can I retain the scroll position of a scrollable area when pressing back button? | <p>I have a long list of links inside a big scrollable div. Each time when a user click on a link then click the back button, it starts at the very top of the div. It is not user friendly to our users. Any ways to let the browser scroll to the previous position when pressing the back button? </p>
<p>Thank you very muc... | 29,203,427 | 8 | 2 | null | 2015-03-23 04:33:07.527 UTC | 17 | 2022-04-21 05:31:07.74 UTC | null | null | null | null | 2,335,065 | null | 1 | 29 | javascript|jquery|html|google-chrome|browser | 50,813 | <p>During page unload, get the scroll position and store it in local storage. Then during page load, check local storage and set that scroll position. Assuming you have a div element with id <code>element</code>. In case it's for the page, please change the selector :)</p>
<pre><code>$(function() {
$(window).unload... |
43,291,165 | How to append multi dimensional array using for loop in python | <p>I am trying to <code>append</code> to a multi-dimensional array.</p>
<p>This is what I have done so far:</p>
<pre><code>arr=[[]]
for i in range(10):
for j in range(5):
arr[i].append(i*j)
print i,i*j
print arr
</code></pre>
<p>This is my expected output:</p>
<blockquote>
<p><code>[[0,0,0,0... | 43,291,200 | 4 | 1 | null | 2017-04-08 06:59:23.53 UTC | 2 | 2020-12-14 17:53:22.7 UTC | 2017-04-08 07:11:47.427 UTC | null | 7,256,039 | null | 996,366 | null | 1 | 6 | python|arrays | 46,565 | <p>You're forgetting to append the empty list beforehand. Thus why you get a, <code>IndexError</code> when you try to do <code>arr[i]</code>.</p>
<pre><code>arr = []
for i in range(10):
arr.append([])
for j in range(5):
arr[i].append(i*j)
</code></pre> |
9,095,748 | Method Area and PermGen | <p>I was trying to understand the memory structure of HotSpot JVM and got confused with the two terms <strong>"Method Area"</strong> and <strong>"PermGen"</strong> space. The docs I referred to say that Method Area contains the definition of classes and methods including the byte code. Some other docs say that they are... | 9,095,858 | 4 | 1 | null | 2012-02-01 12:24:14.017 UTC | 12 | 2020-10-18 07:52:51.47 UTC | 2019-03-14 10:02:54.11 UTC | null | 2,361,308 | null | 830,753 | null | 1 | 20 | java|memory-management|jvm|jvm-hotspot|permgen | 19,246 | <p>You should take a look at <a href="http://javapapers.com/core-java/java-jvm-memory-types/" rel="noreferrer">Java Memory Types</a> and optionally at this doc about the <a href="http://www.oracle.com/technetwork/java/gc-tuning-5-138395.html" rel="noreferrer">Garbage Collection</a> in Java. The latter is very verbose a... |
19,696,153 | Difference between qt qml and qt quick | <p>I'm confused with QML, QtQuick 1.0 and QtQuick 2.0. What's the difference between them?</p>
<p>I use QtCreator 2.8.1 based on Qt 5.1.1. I want to develop a desktop program, which technology should I use?</p> | 19,706,567 | 2 | 2 | null | 2013-10-31 00:06:48.703 UTC | 23 | 2019-04-03 09:15:21.55 UTC | 2019-04-03 09:15:21.55 UTC | null | 10,239,789 | null | 1,424,014 | null | 1 | 77 | qt|qml|qt-quick|qtquick2 | 34,761 | <p><strong>EDIT: Please refer to @TheBootroo for a better answer</strong></p>
<p>Although my answer was accepted by the OP, I want to revise (or even) remove my answer.</p>
<p>My answer was based on personal experiences with respect to Qt 5.2 in 2013 some of which is no longer valid today:</p>
<ul>
<li>QML is Qt Met... |
45,086,480 | .Net Core Model Binding JSON Post To Web API | <p>Just started a new project using .NET Core. Added my Web API controller and related method. Using Postman I created a JSON object and posted it to my controller method. Bear in mind the JSON object matches the Object param in the controller method exactly.</p>
<p>In debug mode I can see the object, it is not null, ... | 45,086,673 | 6 | 1 | null | 2017-07-13 16:35:06.217 UTC | 2 | 2021-10-25 21:36:16.2 UTC | 2017-10-24 14:26:26.917 UTC | null | 1,548,895 | null | 2,237,982 | null | 1 | 18 | c#|asp.net-core|asp.net-web-api2|model-binding|asp.net-core-webapi | 45,219 | <p><strong>NOTE: If you are using aspnet core 3.0, the solution can be found <a href="https://docs.microsoft.com/en-us/aspnet/core/web-api/jsonpatch?view=aspnetcore-3.1" rel="noreferrer">here</a>. For other versions, keep reading.</strong></p>
<p>You need to mark your parameter as coming from the body with the <code>F... |
711,884 | Python naming conventions for modules | <p>I have a module whose purpose is to define a class called "nib". (and a few related classes too.) How should I call the module itself? "nib"? "nibmodule"? Anything else?</p> | 711,892 | 5 | 0 | null | 2009-04-02 22:31:35.687 UTC | 14 | 2019-08-13 07:09:29.003 UTC | null | null | null | cool-RR | 76,701 | null | 1 | 125 | python|naming-conventions | 126,639 | <p>Just nib. Name the class Nib, with a capital N. For more on naming conventions and other style advice, see <a href="https://www.python.org/dev/peps/pep-0008/#package-and-module-names" rel="noreferrer">PEP 8</a>, the Python style guide.</p> |
224,689 | Transactions in .net | <p>What are the best practices to do transactions in C# .Net 2.0. What are the classes that should be used? What are the pitfalls to look out for etc. All that commit and rollback stuff. I'm just starting a project where I might need to do some transactions while inserting data into the DB. Any responses or links for e... | 224,702 | 5 | 2 | null | 2008-10-22 06:41:02.257 UTC | 90 | 2016-09-13 13:29:03.043 UTC | 2008-10-22 07:23:40.343 UTC | Xardas | 1,688,440 | Xardas | 1,688,440 | null | 1 | 150 | c#|.net|transactions | 192,274 | <p>There are 2 main kinds of transactions; connection transactions and ambient transactions. A connection transaction (such as SqlTransaction) is tied directly to the db connection (such as SqlConnection), which means that you have to keep passing the connection around - OK in some cases, but doesn't allow "create/use/... |
104,953 | Position an element relative to its container | <p>I'm trying to create a horizontal 100% stacked bar graph using HTML and CSS. I'd like to create the bars using <code>DIVs</code> with background colors and percentage widths depending on the values I want to graph. I also want to have a grid lines to mark an arbitrary position along the graph.</p>
<p>In my experime... | 105,035 | 5 | 1 | null | 2008-09-19 19:48:22.937 UTC | 80 | 2020-03-30 22:38:30.827 UTC | 2020-03-30 22:38:30.827 UTC | null | 3,488 | Kanook | 3,488 | null | 1 | 196 | html|css|positioning | 246,220 | <p>You are right that CSS positioning is the way to go. Here's a quick run down:</p>
<p><code>position: relative</code> will layout an element relative to <em>itself.</em> In other words, the elements is laid out in normal flow, then it is removed from normal flow and offset by whatever values you have specified (top,... |
940,707 | How do I programmatically get the version of a DLL or EXE file? | <p>I need to get the product version and file version for a DLL or EXE file using Win32 native APIs in C or C++. I'm <em>not</em> looking for the Windows version, but the version numbers that you see by right-clicking on a DLL file, selecting "Properties", then looking at the "Details" tab. This is usually a four-part ... | 940,743 | 6 | 4 | null | 2009-06-02 17:04:57.13 UTC | 19 | 2017-06-13 21:15:04 UTC | 2017-03-23 16:00:38.48 UTC | null | 1,033,581 | null | 8,078 | null | 1 | 83 | c++|winapi|dll|version|exe | 96,826 | <p>You would use the <a href="http://msdn.microsoft.com/en-us/library/ms647003.aspx" rel="noreferrer">GetFileVersionInfo</a> API.</p>
<p>See <a href="http://msdn.microsoft.com/en-us/library/ms646985(VS.85).aspx" rel="noreferrer">Using Version Information</a> on the MSDN site.</p>
<p>Sample:</p>
<pre><code>DWORD ver... |
17,483,726 | Hide and show div when page load | <p>i have a div :</p>
<pre><code><div id="postreply">
<asp:Label ID="lbStatus" CssClass="input-large1" runat="server" Text="Close" Width="600px"></asp:Label>
</div>
</code></pre>
<p>i try to hide div when page load :</p>
<pre><code><script type="text/javascript">
window.onload = fun... | 17,483,867 | 5 | 7 | null | 2013-07-05 07:47:59.47 UTC | 1 | 2013-07-05 08:15:20.027 UTC | 2013-07-05 07:50:31.68 UTC | null | 1,563,422 | null | 2,514,731 | null | 1 | 2 | javascript|jquery | 51,434 | <p>Try this, once with <code>$(document).ready</code>, it executes when HTML-Document is loaded and DOM is ready where as <code>window.onload</code> executes when complete page is fully loaded, including all frames, objects and images</p>
<pre><code>$(document).ready(function() {
if($("#lbStatus").val() == "Close"... |
38,017,016 | "async Task then await Task" vs "Task then return task" | <p>Quick question..</p>
<p>In order to get some solid base understanding about Asynchronous Programming and the <code>await</code> I would like to know what the difference is between these two code snippets when it comes to multi threading and the execution sequence and time:</p>
<p><strong>This</strong>:</p>
<pre><... | 38,017,167 | 2 | 4 | null | 2016-06-24 15:30:53.113 UTC | 16 | 2019-12-10 10:07:39.97 UTC | 2019-12-10 10:07:39.97 UTC | null | 2,063,755 | null | 5,890,227 | null | 1 | 95 | c#|multithreading|asynchronous | 28,193 | <p>It is almost the same (in terms of threads etc.). But for the second one (using <code>await</code>) a lot more overhead will be created by the compiler.</p>
<p>Methods declared as <code>async</code> and using <code>await</code> are converted into a <em>state machine</em> by the compiler. So when you hit the <code>a... |
21,359,130 | Should 3.4 enums use UPPER_CASE_WITH_UNDERSCORES? | <p>As the documentation says, an enumeration is a set of symbolic names (members) bound to unique, <strong>constant</strong> values. The <a href="http://www.python.org/dev/peps/pep-0008/#constants">PEP8</a> says that constants are usually named as <code>UPPER_CASE</code>, should I use this notation in Python 3.4 <a hre... | 21,359,677 | 3 | 4 | null | 2014-01-26 03:04:13.773 UTC | 5 | 2019-06-12 14:01:03.86 UTC | 2014-01-26 03:09:12.293 UTC | null | 1,212,596 | null | 2,116,607 | null | 1 | 41 | python|python-3.x|enums|python-3.4 | 13,956 | <p><strong>Update</strong></p>
<p>The BDFL (Benevolent Dictator For Life) <a href="https://mail.python.org/pipermail/python-ideas/2016-September/042340.html" rel="noreferrer">has spoken</a>, and the <a href="https://docs.python.org/3/library/enum.html#creating-an-enum" rel="noreferrer"><code>Enum documentation</code><... |
20,968,562 | how to convert a bs4.element.ResultSet to strings? Python | <p>I have a simple code like: </p>
<pre><code> p = soup.find_all("p")
paragraphs = []
for x in p:
paragraphs.append(str(x))
</code></pre>
<p>I am trying to convert a list I obtained from xml and convert it to string. I want to keep it with it's original tag so I can reuse some text, thus the reaso... | 20,969,389 | 2 | 6 | null | 2014-01-07 09:54:36.587 UTC | 4 | 2017-02-05 00:36:39.517 UTC | null | null | null | null | 2,774,210 | null | 1 | 17 | python|beautifulsoup|runtime-error | 83,479 | <p>The problem here is probably that some of the binary graphic data at the bottom of <a href="http://www.sec.gov/Archives/edgar/data/1547063/000119312513465948/0001193125-13-465948.txt" rel="noreferrer">the document</a> contains the sequence of characters <code><P</code>, which Beautiful Soup is trying to repair in... |
17,973,357 | What are the valid characters in PHP variable, method, class, etc names? | <p>What are the valid characters you can use in PHP names for variables, constants, functions, methods, classes, ...?</p>
<p>The manual has <a href="http://php.net/manual/en/language.oop5.basic.php">some</a> <a href="http://www.php.net/manual/en/language.variables.basics.php">mentions</a> of the regular expression <co... | 17,973,365 | 2 | 0 | null | 2013-07-31 14:36:03.67 UTC | 15 | 2022-01-31 14:48:52.05 UTC | null | null | null | null | 385,378 | null | 1 | 36 | php | 14,847 | <p>The <code>[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*</code> regex only applies when the name is used directly in some special syntactical element. Some examples:</p>
<pre><code>$varName // <-- varName needs to satisfy the regex
$foo->propertyName // <-- propertyName needs to satisfy the regex
class... |
17,804,674 | How to check whether a text box is empty or not? | <p>I want to check whether a text box contains a name or not. If not then an alert should be popped up displaying a message after pressing a submit button and the page should not submit the blank value. If it contains value then the value should be submitted.</p>
<p>I am using the below code. When I leave the text box... | 17,804,700 | 3 | 1 | null | 2013-07-23 08:06:24.04 UTC | 1 | 2013-07-23 08:30:47.673 UTC | 2013-07-23 08:17:25.457 UTC | null | 218,196 | null | 2,122,220 | null | 1 | 2 | javascript|javascript-events | 65,047 | <p>You need to do <code>onclick="return check();"</code></p> |
46,705,101 | mat-form-field must contain a MatFormFieldControl | <p>We are trying to build our own form-field-Components at our Company. We are trying to wrap material design's Components like this:</p>
<p>field:</p>
<pre class="lang-html prettyprint-override"><code><mat-form-field>
<ng-content></ng-content>
<mat-hint align="start"><strong>{{h... | 49,658,335 | 41 | 8 | null | 2017-10-12 08:42:28.923 UTC | 34 | 2022-08-27 06:54:35.467 UTC | 2022-06-02 11:49:33.94 UTC | null | 1,791,913 | null | 479,045 | null | 1 | 418 | angular|typescript|angular-material | 550,408 | <p>Import MatInputModule in your module.ts file and it will solve the problem.</p>
<pre><code>import { MatInputModule } from '@angular/material/input';
</code></pre>
<p>The statement after it is the old answer.</p>
<p>Unfortunately content projection into <code>mat-form-field</code> is not supported yet.
Please track t... |
1,625,158 | iphone SDK detect Wifi and Carrier network | <p>my app accesses the internet and i just want to detect whether there is a connection either via wifi or via carrier data network or not</p>
<p>apple has made an example for that "Reachability"</p>
<p><a href="https://developer.apple.com/iphone/library/samplecode/Reachability/" rel="nofollow noreferrer">https://dev... | 1,625,206 | 5 | 1 | null | 2009-10-26 14:32:12.65 UTC | 15 | 2015-11-20 20:37:50.65 UTC | 2015-11-20 20:37:50.65 UTC | null | 1,505,120 | null | 169,656 | null | 1 | 11 | iphone|networking|wifi|detect | 24,198 | <p>That sample is exactly what you need.</p>
<p>Look at Reachability.m. it'll tell you whether you have any connection, and then tell you what kind of connection you have.</p> |
1,526,409 | Dynamically create text in dialog box | <p>How can I dynamically set the text of the dialog box that I'm opening? I've tried a few different things but they all respond with an empty dialog box.</p>
<p>Here is my current try:</p>
<pre>
$('#dialog').text('Click on the link to download the file:<br />'.data);
$('#dialog').dialog("open");
</pre> | 1,526,821 | 5 | 1 | null | 2009-10-06 15:37:48.06 UTC | 2 | 2015-12-02 23:18:28.937 UTC | 2015-06-09 12:28:34.397 UTC | null | 319,741 | null | 183,231 | null | 1 | 14 | jquery|jquery-ui|dialog | 58,642 | <p>For best practice, try putting a div inside your dialog div and appending text to that instead. </p>
<pre><code><div id="myDialog"><div id="myDialogText"></div></div>
</code></pre>
<p>and then setting the text of the internal Div. This make for better separation, so you have</p>
<ul>
<li>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.