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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
17,868,232 | How to use Tomcat 8 in Eclipse? | <p><strong>EDIT 2014-02-07: Eclipse Luna is here, and support for Tomcat 8 is included in the bundled WTP : ) Happy days!</strong></p>
<p>Tomcat 8 is still in development, but you can get it <a href="https://repository.apache.org/content/repositories/snapshots/org/apache/tomcat/tomcat/8.0-SNAPSHOT/">here</a>. Now ther... | 21,912,109 | 11 | 1 | null | 2013-07-25 20:33:22.233 UTC | 17 | 2017-07-12 06:51:13.667 UTC | 2014-08-03 14:12:53.573 UTC | null | 589,259 | null | 2,620,121 | null | 1 | 51 | eclipse|tomcat|websocket|eclipse-kepler | 173,296 | <p><strong><em>UPDATE</em>: Eclipse Mars EE and later have native support for Tomcat8. Use this only if you have an earlier version of eclipse.</strong></p>
<hr>
<p>The latest version of Eclipse still does not support Tomcat 8, but you can add the new version of WTP and Tomcat 8 support will be added natively. To do ... |
6,909,314 | Is it possible to replace values in SQL query? | <p>I would like to know if it is possible in an SQL query to replace some values by something else, or if I need to do that in post-processing.</p>
<p>Let me explain. I have this table:</p>
<pre><code>|username| accepted |
|--------|----------|
| toto | NULL |
|--------|----------|
| foo | 0 |
|------... | 6,909,390 | 4 | 1 | null | 2011-08-02 08:39:15.153 UTC | 1 | 2011-08-02 14:14:39.133 UTC | 2011-08-02 09:03:26.263 UTC | null | 67,392 | null | 29,568 | null | 1 | 5 | sql|sql-server|tsql | 39,249 | <p>If you have a few values:</p>
<pre><code>SELECT CASE [accepted]
WHEN 0 THEN 'not_accepted'
WHEN 1 THEN 'accepted '
ELSE 'not_available' END AS accepted
, count(*)
FROM my_table
GROUP BY CASE [accepted]
WHEN 0 THEN 'not_accepted'
WHEN 1 THEN 'accepted '
ELSE 'not_available' END
</code></pre> |
23,742,626 | What exactly does '__weak typeof(self)weakSelf = self;' mean | <p>This is used in the weakify pattern of Objective-C</p>
<p>My guess is that it means: assign a weak reference to self with the name 'weakSelf' and the typeof self (e.g. MyViewController)</p>
<p>If it's correct and looks obvious to you: I want to be absolutely sure to get this right. Thanks.</p> | 23,742,765 | 4 | 4 | null | 2014-05-19 16:18:26.027 UTC | 12 | 2022-08-16 07:29:55.583 UTC | 2022-08-16 07:29:55.583 UTC | null | 624,459 | null | 624,459 | null | 1 | 30 | objective-c|typeof|weak | 21,842 | <blockquote>
<p>My guess is that it means: assign a weak reference to self with the name <code>weakSelf</code> and the <code>typeof</code> self (e.g. <code>MyViewController</code>)</p>
</blockquote>
<p>Yes, that is almost exactly what it means. The type of <code>self</code> would be <code>MyViewController*</code> (w... |
18,701,984 | Displaying the hex value of a string from a oracle varchar2? | <p>We are having problems with text that is encoded in some different ways but kept in a single column in a table. Long story. On MySQL, I can do "select hex(str) from table where" and I see the bytes of the string exactly as I set them.</p>
<p>On Oracle, I have a string which starts with the Turkish character İ, whic... | 18,702,627 | 2 | 0 | null | 2013-09-09 15:39:37.3 UTC | 4 | 2016-03-23 16:02:42.24 UTC | null | null | null | null | 869,809 | null | 1 | 21 | oracle|unicode|utf-8|turkish|ojdbc | 109,154 | <p>Use the <a href="http://docs.oracle.com/cd/E11882_01/server.112/e41084/functions055.htm" rel="noreferrer"><code>dump</code></a> function to see how Oracle stores data internally.</p>
<p>You seem to have a misunderstanding on how Oracle treats <code>VARCHAR2</code> characters set conversions: you can't influence how... |
41,196,027 | What is the difference between void and static void function in C? | <p>I have a two <strong>C</strong> files.</p>
<p>file1.c</p>
<pre><code>int main()
{
func();
return 0;
}
</code></pre>
<p>file2.c</p>
<pre><code>static void func(void)
{
puts("func called");
}
</code></pre>
<p>But, if I compile the above code with command <code>cc file2.c file1.c</code>, I got the below, ... | 41,196,173 | 1 | 4 | null | 2016-12-17 06:35:44.607 UTC | 13 | 2016-12-17 10:05:39.59 UTC | 2016-12-17 10:05:39.59 UTC | null | 5,612,562 | null | 5,612,562 | null | 1 | 27 | c|static | 58,961 | <blockquote>
<p>What is the difference between void and static void function in C?</p>
</blockquote>
<p>The real question should be what is the difference between <code>static</code> and <code>non-static</code> function? (the return type <code>void</code> is irrelevant, it can be <code>int</code> or anything else).<... |
877,943 | how to configure a rails app (redmine) to run as a service on windows? | <p>I'm using redmine as a ticket manager, and I'd like to configure it to be run automatically when windows starts up.</p>
<p>How can I configure it to be run as a service?</p>
<p>--</p>
<p>Just asked the question to document it, I hope somebody may find it useful...</p> | 878,049 | 7 | 0 | null | 2009-05-18 14:10:37.41 UTC | 14 | 2018-08-23 13:04:57.927 UTC | 2009-05-18 14:31:00.3 UTC | null | 47,633 | null | 47,633 | null | 1 | 16 | ruby-on-rails|windows|service|redmine | 19,129 | <p><strong>1. using webrick:</strong></p>
<p>ref: <a href="http://www.redmine.org/boards/1/topics/4123" rel="nofollow noreferrer">http://www.redmine.org/boards/1/topics/4123</a></p>
<ul>
<li><p>Download and install the Windows NT Resource Kit from
<a href="http://www.microsoft.com/downloads/details.aspx?familyid=9d46... |
185,444 | Why is MPI considered harder than shared memory and Erlang considered easier, when they are both message-passing? | <p>There's a lot of interest these days in Erlang as a language for writing parallel programs on multicore. I've heard people argue that Erlang's message-passing model is easier to program than the dominant shared-memory models such as threads. </p>
<p>Conversely, in the high-performance computing community the domina... | 256,120 | 7 | 1 | null | 2008-10-09 00:10:25.713 UTC | 17 | 2012-06-19 10:39:04.937 UTC | null | null | null | lorin | 742 | null | 1 | 34 | erlang|multicore|parallel-processing|mpi | 10,560 | <p>I agree with all previous answers, but I think a key point that is not made totally clear is that one reason that MPI might be considered hard and Erlang easy is the match of model to the domain. </p>
<p>Erlang is based on a concept of local memory, asynchronous message passing, and shared state solved by using som... |
152,834 | Default port for SQL Server | <p>I need to know the default port settings for the following services</p>
<ol>
<li>SQL Server</li>
<li>SQL Browser</li>
<li>SQL Reporting services</li>
<li>SQL Analysis services</li>
</ol>
<p>I need to know the port settings for these services for different versions of SQL Server (2000,2005,2008)</p>
<p>Also let me k... | 152,892 | 7 | 2 | null | 2008-09-30 12:32:40.463 UTC | 9 | 2022-06-03 03:22:59.217 UTC | 2022-06-03 03:22:59.217 UTC | balaweblog | 19,123,103 | balaweblog | 22,162 | null | 1 | 64 | asp.net|sql|sql-server | 121,995 | <ol>
<li><p>The default SQL Server port is 1433 but only if it's a default install. Named instances get a random port number.</p></li>
<li><p>The browser service runs on port UDP 1434.</p></li>
<li><p>Reporting services is a web service - so it's port 80, or 443 if it's SSL enabled.</p></li>
<li><p>Analysis services i... |
1,065,168 | Does disposing streamreader close the stream? | <p>I am sending a stream to methods to write on, and in those methods I am using a binary reader/wrtier. When the reader/writer gets disposed, either by <code>using</code> or just when it is not referenced, is the stream closed as well??</p>
<p>I would send a BinaryReader/Writer, but I am using a StreamReader too (may... | 1,065,196 | 7 | 0 | null | 2009-06-30 18:17:55.253 UTC | 33 | 2021-08-16 20:56:05.713 UTC | 2009-06-30 18:34:05.49 UTC | null | 18,907 | null | 112,830 | null | 1 | 178 | c#|stream|streamreader | 78,235 | <p>Yes, <code>StreamReader</code>, <code>StreamWriter</code>, <code>BinaryReader</code> and <code>BinaryWriter</code> all close/dispose their underlying streams when you call <code>Dispose</code> on them. They <em>don't</em> dispose of the stream if the reader/writer is just garbage collected though - you should always... |
1,070,974 | yield return works only for IEnumerable<T>? | <p>Can I use <code>yield return</code> when the return type is an <code>IGrouping<TKey, TElement></code> or an <code>IDictionary<TKey, TValue></code>?</p> | 1,071,008 | 8 | 1 | null | 2009-07-01 19:46:34.23 UTC | 2 | 2022-05-22 22:24:29.17 UTC | 2015-10-02 07:27:25.84 UTC | null | 1,087,135 | null | 48,465 | null | 1 | 36 | c#|.net|ienumerable | 18,140 | <p><code>yield return</code> works for exactly 4 cases:</p>
<ul>
<li><code>IEnumerable</code></li>
<li><code>IEnumerable<T></code></li>
<li><code>IEnumerator</code></li>
<li><code>IEnumerator<T></code></li>
</ul>
<p>This is because it has to build a state machine internally; a dictionary (etc) wouldn't be... |
1,159,087 | Inlining in Java | <p>In C++ I can declare a method "inline" and the compiler is likely to inline it. As far as I understand there is no such keyword in Java.</p>
<p>Inlining is done if the JVM decides to do so? Can I influence this decision somehow?</p> | 1,159,118 | 8 | 0 | null | 2009-07-21 13:11:55.047 UTC | 6 | 2015-02-18 21:48:05.227 UTC | 2015-02-18 21:48:05.227 UTC | null | 3,001,761 | null | 141,456 | null | 1 | 40 | java|jvm|inlining|inline-method | 13,186 | <p>A couple of the other answers have suggested that only final methods can be inlined - this is not true, as HotSpot is smart enough to be able to inline non-final methods so long as they haven't been overridden <em>yet</em>. When a class is loaded which overrides the method, it can undo its optimisation. Obviously ma... |
12,702 | Returning DataTables in WCF/.NET | <p>I have a WCF service from which I want to return a DataTable. I know that this is often a highly-debated topic, as far as whether or not returning DataTables is a good practice. Let's put that aside for a moment.</p>
<p>When I create a DataTable from scratch, as below, there are no problems whatsoever. The table is... | 42,332 | 8 | 0 | null | 2008-08-15 20:26:01.447 UTC | 12 | 2016-12-19 04:49:58.767 UTC | 2015-07-25 21:48:51.883 UTC | Chris Fournier | 63,550 | theprise | 940 | null | 1 | 51 | c#|.net|wcf|web-services|datatable | 56,529 | <p>For anyone having similar problems, I have solved my issue. It was several-fold.</p>
<ul>
<li>As Darren suggested and Paul backed up, the Max..Size properties in the configuration needed to be enlarged. The SvcTraceViewer utility helped in determining this, but it still does not always give the most helpful error... |
699,468 | Remove HTML tags not on an allowed list from a Python string | <p>I have a string containing text and HTML. I want to remove or otherwise disable some HTML tags, such as <code><script></code>, while allowing others, so that I can render it on a web page safely. I have a list of allowed tags, how can I process the string to remove any other tags?</p> | 699,483 | 9 | 3 | null | 2009-03-30 23:25:29.423 UTC | 67 | 2021-04-06 13:08:03.08 UTC | 2019-02-04 20:34:24.57 UTC | user212218 | 400,617 | null | 25,991 | null | 1 | 77 | python|html | 44,120 | <p>Here's a simple solution using <a href="http://www.crummy.com/software/BeautifulSoup/" rel="noreferrer">BeautifulSoup</a>:</p>
<pre><code>from bs4 import BeautifulSoup
VALID_TAGS = ['strong', 'em', 'p', 'ul', 'li', 'br']
def sanitize_html(value):
soup = BeautifulSoup(value)
for tag in soup.findAll(True)... |
920,646 | Uncaught SoapFault exception: [HTTP] Error Fetching http headers | <p>I'm trying to create a soap connection to Magento's web services, however I'm getting an error when I try and create an instance of the soap client class. I can view the wsdl file in firefox without problems and I can watch php make the request for the wsdl in apaches logs but it still fails. Nusoap can connect. <... | 1,152,603 | 10 | 1 | null | 2009-05-28 12:44:52.833 UTC | 6 | 2018-05-26 10:21:01.19 UTC | 2011-01-07 16:54:44.107 UTC | null | 1,288 | null | 113,721 | null | 1 | 26 | php|soap|magento|wsdl | 103,366 | <p>Try to set :</p>
<pre><code>default_socket_timeout = 120
</code></pre>
<p>in your <code>php.ini</code> file.</p> |
55,342 | How can I kill all sessions connecting to my oracle database? | <p>I need to quickly (and forcibly) kill off all external sessions connecting to my oracle database without the supervision of and administrator.</p>
<p>I don't want to just lock the database and let the users quit gracefully.</p>
<p>How would I script this?</p> | 55,359 | 10 | 0 | null | 2008-09-10 21:16:10.613 UTC | 16 | 2016-03-30 04:47:34.46 UTC | 2016-02-29 14:52:09.66 UTC | CodeSlave | 685 | CodeSlave | 685 | null | 1 | 29 | oracle|session|sqlplus|kill|database-administration | 133,723 | <p>This answer is heavily influenced by a conversation here: <a href="http://www.tek-tips.com/viewthread.cfm?qid=1395151&page=3" rel="noreferrer">http://www.tek-tips.com/viewthread.cfm?qid=1395151&page=3</a></p>
<pre><code>ALTER SYSTEM ENABLE RESTRICTED SESSION;
begin
for x in (
select... |
1,125,226 | Styling checkboxes, radio buttons and dropdowns | <p>How can I style HTML checkboxes, radio buttons and dropdowns? Or can I?</p>
<p>I'd like to use an image for checkboxes or radiobuttons, and the same for lists - the dropdown arrow doesn't look nice most of the time.</p> | 1,125,320 | 11 | 0 | null | 2009-07-14 13:01:09.113 UTC | 7 | 2020-01-08 21:19:07.72 UTC | 2012-05-05 15:51:54.507 UTC | null | 707,111 | null | 119,032 | null | 1 | 16 | css | 47,146 | <p>see this 2 links for jQuery Plugins for Styling Checkbox & Radio Buttons:</p>
<p><a href="http://line25.com/articles/jquery-plugins-for-styling-checkbox-radio-buttons" rel="noreferrer">http://line25.com/articles/jquery-plugins-for-styling-checkbox-radio-buttons</a></p>
<p><a href="http://www.queness.com/post/2... |
232,435 | How do I restrict foreign keys choices to related objects only in django | <p>I have a two way foreign relation similar to the following</p>
<pre><code>class Parent(models.Model):
name = models.CharField(max_length=255)
favoritechild = models.ForeignKey("Child", blank=True, null=True)
class Child(models.Model):
name = models.CharField(max_length=255)
myparent = models.ForeignKey(Par... | 252,087 | 11 | 2 | null | 2008-10-24 03:52:50.317 UTC | 27 | 2020-10-28 21:42:50.427 UTC | null | null | null | Jeff Mc | 25,521 | null | 1 | 72 | python|django|django-models | 66,085 | <p>I just came across <a href="http://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.limit_choices_to" rel="noreferrer">ForeignKey.limit_choices_to</a> in the Django docs.
Not sure yet how this works, but it might just be the right thing here.</p>
<p><strong>Update:</strong> ForeignKey.li... |
342,181 | What's the best way to validate currency input in UITextField? | <p>My application allows the user to enter a numeric value (currency) in a <code>UITextField</code> control, but the keyboard layout that I wish was available is unfortunately not one of the built-in options, so I had to choose the "Numbers & Punctuation" option in Interface Builder. Here's the corresponding dialog... | 342,231 | 13 | 0 | null | 2008-12-04 21:40:08.773 UTC | 13 | 2018-09-28 13:03:00.727 UTC | 2018-09-28 13:03:00.727 UTC | Chris Hanson | 123,632 | jpm | 35,478 | null | 1 | 18 | iphone|cocoa-touch | 21,111 | <p>Perhaps you could attach a <strong><code>UITextFieldDelegate</code></strong> on the control and have it implement <strong><code>textField:shouldChangeCharactersInRange:replacementString:</code></strong> That way, if it sees any characters that you don't want in the field, it can reject them.</p> |
355,650 | C++ HTML template framework, templatizing library, HTML generator library | <p>I am looking for template/generator libraries for C++ that are similar to eg. Ruby's Erb, Haml, PHP's Smarty, etc.</p>
<p>It would be great if I it would sport some basic features like loops, if/else, int conversion to strings, etc.</p>
<p>Parameter passing to template rendering engine is also important if I could... | 412,985 | 13 | 2 | null | 2008-12-10 10:41:54.027 UTC | 49 | 2019-12-29 22:07:12.627 UTC | 2016-06-03 06:31:39.297 UTC | null | 264,325 | Marcin Gil | 5,731 | null | 1 | 64 | c++|template-engine | 42,342 | <p>A quick review of the mentioned project.</p>
<p><a href="http://rgrz.tumblr.com/post/13808947359/review-of-html-template-engines-in-c-language" rel="nofollow noreferrer">http://rgrz.tumblr.com/post/13808947359/review-of-html-template-engines-in-c-language</a></p>
<h2>ClearSilver</h2>
<ul>
<li>Site: <a href="http:... |
1,119,289 | How to show the "Are you sure you want to navigate away from this page?" when changes committed? | <p>Here in stackoverflow, if you started to make changes then you attempt to navigate away from the page, a javascript confirm button shows up and asks: "Are you sure you want to navigate away from this page?" blee blah bloo...</p>
<p>Has anyone implemented this before, how do I track that changes were committed?
I be... | 1,119,324 | 18 | 2 | null | 2009-07-13 12:57:09.073 UTC | 127 | 2021-04-01 06:22:17.937 UTC | 2014-04-30 13:29:10.753 UTC | null | 90,674 | null | 75,500 | null | 1 | 304 | javascript|html|message|onbeforeunload|confirm | 262,187 | <h2>Update (2017)</h2>
<p>Modern browsers now consider displaying a custom message to be a security hazard and it has therefore been <a href="https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload#Browser_compatibility" rel="noreferrer">removed</a> from all of them. Browsers now only displ... |
624,926 | How do I detect whether a Python variable is a function? | <p>I have a variable, <code>x</code>, and I want to know whether it is pointing to a function or not.</p>
<p>I had hoped I could do something like:</p>
<pre><code>>>> isinstance(x, function)
</code></pre>
<p>But that gives me:</p>
<pre class="lang-none prettyprint-override"><code>Traceback (most recent cal... | 624,939 | 28 | 8 | null | 2009-03-09 03:31:30.623 UTC | 135 | 2022-01-15 07:35:40.63 UTC | 2018-02-24 11:38:54.78 UTC | null | 63,550 | Daniel H | 14,799 | null | 1 | 911 | python | 357,291 | <p>If this is for Python 2.x or for Python 3.2+, you can use <a href="https://docs.python.org/3/library/functions.html#callable" rel="noreferrer"><code>callable()</code></a>. It used to be deprecated, but is now undeprecated, so you can use it again. You can read the discussion here: <a href="http://bugs.python.org/iss... |
34,545,354 | "Internal error in the expression evaluator" | <p>I've encountered a problem in expression evaluator of visual studio 2015 that says "Internal error in the expression evaluator", after some investigations I found that this is caused by an assembly that is loaded using reflection. This assembly wouldn't throw any exceptions but after that, vs exp evaluator will fail... | 34,550,540 | 11 | 5 | null | 2015-12-31 10:55:14.98 UTC | 16 | 2022-04-20 08:04:20.703 UTC | 2017-03-16 12:18:46.833 UTC | null | 6,357,360 | null | 5,733,707 | null | 1 | 66 | c#|debugging|visual-studio-2015 | 44,542 | <p>That sounds like a bug in the expression evaluator. For a better workaround, instead of checking "Use Managed Compatibility Mode", check "Use the legacy C# and VB expression evaluators". This should enable you to continue using Edit and Continue as well as other features added within the last few releases.</p>
<p... |
6,692,706 | Reading DataSet in C# | <p>If we have filled a DataSet using a select query in C#, how can we read the column values?</p>
<p>I want to do something like this:</p>
<pre><code>string name = DataSetObj.rows[0].columns["name"]
</code></pre>
<p>What would the correct syntax look like to achieve my goal?</p> | 6,692,720 | 5 | 0 | null | 2011-07-14 11:52:50.47 UTC | 4 | 2018-03-12 12:36:56.37 UTC | 2018-03-12 12:34:34.69 UTC | null | 397,817 | null | 277,581 | null | 1 | 5 | c#|dataset | 47,710 | <pre><code>foreach(var row in DataSetObj.Tables[0].Rows)
{
Console.WriteLine(row["column_name"]);
}
</code></pre> |
6,334,592 | One DbContext per request in ASP.NET MVC (without IOC container) | <p>Apologies if this has already been answered, but how do you guarantee one Entity Framework DbContext per request if you are not using an IOC container? (The answers I've come across so far deal with IOC container solutions.)</p>
<p>It seems like most solutions hook into the <code>HttpContext.Current.Items</code> di... | 6,334,865 | 6 | 1 | null | 2011-06-13 18:29:36.9 UTC | 44 | 2013-12-23 14:30:37.237 UTC | 2011-06-13 20:11:01.353 UTC | null | 129,164 | null | 129,164 | null | 1 | 51 | asp.net-mvc|entity-framework|asp.net-mvc-3|entity-framework-4.1|ef-code-first | 25,634 | <p>I would use the BeginRequest/EndRequest method, this helps ensure that your context is disposed of properly when the request is over with.</p>
<pre><code>protected virtual void Application_BeginRequest()
{
HttpContext.Current.Items["_EntityContext"] = new EntityContext();
}
protected virtual void Application_E... |
6,497,685 | How do I detect non-ASCII characters in a string? | <p>If I have a PHP string, how can I determine if it contains at least one non-ASCII character or not, in an efficient way? And by non-ASCII character, I mean any character that is not part of this table, <a href="http://www.asciitable.com/" rel="noreferrer">http://www.asciitable.com/</a>, positions 32 - 126 inclusive.... | 6,497,946 | 9 | 4 | null | 2011-06-27 19:09:31.233 UTC | 10 | 2020-08-18 12:07:56.973 UTC | 2011-06-27 19:23:09.407 UTC | null | 732,284 | null | 732,284 | null | 1 | 42 | php|string | 51,516 | <p>I found it more useful to detect if any character falls out of the list</p>
<pre><code>if(preg_match('/[^\x20-\x7e]/', $string))
</code></pre> |
6,453,640 | How to include external font in WPF application without installing it | <p>How to include external font in WPF application without installing it</p>
<p>I tried this code </p>
<pre><code> System.Drawing.Text.PrivateFontCollection privateFonts = new System.Drawing.Text.PrivateFontCollection();
privateFonts.AddFontFile("C:\\Documents and Settings\\somefont.ttf");
System.Drawing.Fon... | 6,856,459 | 13 | 0 | null | 2011-06-23 12:00:48.897 UTC | 46 | 2021-05-07 14:27:06.687 UTC | null | null | null | null | 606,144 | null | 1 | 75 | c#|wpf|fonts | 90,746 | <p>I use such XAML code:</p>
<pre><code><Style x:Key="Hatten">
<Setter Property="TextElement.FontFamily" Value="Resources/#HATTEN" />
</Style>
</code></pre>
<p>#HATTEN - reference to hatten.tft in Resources.</p>
<p>Using the Style:</p>
<pre><code> <TextBlock x:Name="lblTitle" Style="{Dy... |
42,324,317 | You must pass a component to the function returned by connect. Instead received undefined | <p>The code below gives </p>
<blockquote>
<p>Uncaught Error: You must pass a component to the function returned by connect. Instead received undefined</p>
</blockquote>
<p><strong>List.js</strong></p>
<pre><code>import React from 'react';
import { connect, bindActionCreators } from 'react-redux';
import PostList f... | 42,329,949 | 5 | 7 | null | 2017-02-19 06:24:39.843 UTC | 3 | 2020-11-23 10:36:14.813 UTC | 2017-02-19 06:32:25.62 UTC | null | 295,783 | null | 7,584,211 | null | 1 | 24 | javascript|reactjs|redux|react-redux | 45,154 | <p>You are doing <code>import PostList from '../components/PostList';</code> so you need to use <code>export default</code> in your PostList.js file.</p>
<p>Otherwise you need to do <code>import { PostList } from '../components/PostList';</code>.</p>
<p>To whoever is interested, here is a nice article about es6 impor... |
15,678,467 | how to add padding between menu items in android? | <p><img src="https://i.stack.imgur.com/wi9CI.png" alt="enter image description here"></p>
<p>I'm having menu items being inflated from res/menu/menu.xml on to ActionBar, how do I add padding between menu items using android?</p>
<p></p>
<pre><code><item
android:id="@+id/home"
android:showAsAction="always... | 15,679,629 | 3 | 0 | null | 2013-03-28 09:40:40.557 UTC | 3 | 2014-09-09 13:22:44.107 UTC | 2013-03-28 10:11:28.517 UTC | null | 1,716,809 | null | 1,716,809 | null | 1 | 15 | android|android-layout|android-actionbar | 47,739 | <p>Found solution, added following lines in styles.xml file and it worked!!</p>
<pre><code><style name="AppTheme" parent="AppBaseTheme">
<item name="android:actionButtonStyle">@style/MyActionButtonStyle</item>
</style>
<style name="MyActionButtonStyle" parent="AppBaseTheme">
<... |
15,624,236 | Is there a way in sbt to convert compiler warnings to errors so the build fails? | <p>I want to "ban" some or all compiler warnings. </p> | 15,624,502 | 3 | 1 | null | 2013-03-25 20:34:49.837 UTC | 1 | 2021-04-07 12:40:17.683 UTC | null | null | null | null | 945,819 | null | 1 | 29 | scala|sbt | 5,886 | <p>You can pass options from sbt to the scala compiler, including the one that turns warnings into errors.</p>
<p>I usually add these:</p>
<pre><code>scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-Xfatal-warnings"),
</code></pre> |
15,968,911 | How to clear text area with a button in html using javascript? | <p>I have button in html</p>
<pre><code><input type="button" value="Clear">
<textarea id='output' rows=20 cols=90></textarea>
</code></pre>
<p>If I have an external javascript (.js) function, what should I write?</p> | 15,968,947 | 5 | 1 | null | 2013-04-12 10:24:01.423 UTC | 9 | 2022-02-14 14:29:05.173 UTC | 2020-06-27 04:41:08.853 UTC | null | 8,422,953 | null | 2,270,858 | null | 1 | 35 | javascript|html|button|textarea | 169,809 | <p>Change in your html with adding the function on the button click</p>
<pre><code> <input type="button" value="Clear" onclick="javascript:eraseText();">
<textarea id='output' rows=20 cols=90></textarea>
</code></pre>
<p>Try this in your js file:</p>
<pre><code>function eraseText() {
docum... |
15,994,603 | How to sleep in the Linux kernel? | <p>Can I use the msleep() function to sleep for a specified amount of time in kernel space? If so, which header files do I need to include? <code>#include <linux/time.h></code> doesn't seem to be the right one. Is there perhaps a better function for this purpose?</p> | 15,994,682 | 2 | 0 | null | 2013-04-14 00:58:12.227 UTC | 6 | 2021-03-02 16:18:18.433 UTC | 2017-05-24 06:15:51.177 UTC | null | 895,245 | null | 850,271 | null | 1 | 36 | c|linux|linux-kernel|sleep | 69,395 | <p>I needed to include <code><linux/delay.h></code> to use msleep in kernel space.</p> |
15,490,658 | How to handle XML services in AngularJS? | <p>My company has thousands of existing xml web services and is starting to adopt AngularJs for new projects.</p>
<p>The tutorial over at <a href="http://angularjs.org/">http://angularjs.org/</a> uses json services exclusively. It looks like they make a service call in the controller, parse the resulting JSON, and pas... | 15,492,222 | 5 | 0 | null | 2013-03-19 02:45:44.253 UTC | 13 | 2016-11-08 11:24:15.29 UTC | 2016-05-24 14:33:17.48 UTC | null | 2,333,214 | null | 1,267,413 | null | 1 | 53 | xml|service|angularjs|backend | 83,907 | <p>If option 2 is relatively easy for you (like adding one-line JSON conversions in your back-end controllers, for example), then it's probably a good investment, as the JSON is leaner over the wire, far less work on the client side and generally preferred by RESTful API consumers (in case there are other consumers).</... |
56,577,201 | Why is --isolatedModules error fixed by any import? | <p>In a create-react-app typescript project, I tried to write this just to test some stuff quickly:</p>
<pre class="lang-js prettyprint-override"><code>// experiment.test.ts
it('experiment', () => {
console.log('test');
});
</code></pre>
<p>But it gives me the following error, with a red squiggly beneath <code>i... | 56,577,324 | 7 | 3 | null | 2019-06-13 09:15:42.71 UTC | 22 | 2022-01-19 17:47:42.483 UTC | 2019-06-13 09:19:36.747 UTC | null | 184,201 | null | 39,321 | null | 1 | 231 | typescript | 190,098 | <p>Typescript treats files without import/exports as legacy script files. As such files are not modules and any definitions they have get merged in the global namespace. <code>isolatedModules</code> forbids such files.</p>
<p>Adding any import or export to a file makes it a module and the error disappears.</p>
<p><stro... |
33,773,296 | Is there or isn't there an integer type in JavaScript? | <p>I am just starting to learn Javascript and I immediately got confused by seemingly contradictory statements in Mozilla's <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript" rel="noreferrer">A re-introduction to JavaScript (JS tutorial)</a>.</p>
<p>One one hand:</p>
<bl... | 33,774,009 | 4 | 10 | null | 2015-11-18 06:35:24.953 UTC | 9 | 2022-09-23 05:50:50.853 UTC | 2015-11-24 15:03:48.42 UTC | null | 2,200,659 | null | 5,556,250 | null | 1 | 59 | javascript|integer | 38,933 | <p><strong>UPDATE</strong>: with a new ES2020 standard released this answer is not entirely correct anymore, see <a href="https://stackoverflow.com/a/51149434/251311">the other answer</a> (from <a href="https://stackoverflow.com/users/553609/mathias-lykkegaard-lorenzen">@Mathias Lykkegaard Lorenzen</a>) about <code>Big... |
22,798,934 | Pandas long to wide reshape, by two variables | <p>I have data in long format and am trying to reshape to wide, but there doesn't seem to be a straightforward way to do this using melt/stack/unstack:</p>
<pre><code>Salesman Height product price
Knut 6 bat 5
Knut 6 ball 1
Knut 6 wand 3
Stev... | 22,799,916 | 6 | 3 | null | 2014-04-01 23:37:44.7 UTC | 36 | 2022-02-01 19:14:19.62 UTC | 2021-10-12 16:25:26.213 UTC | null | 10,714,156 | null | 2,985,049 | null | 1 | 94 | python|pandas|stata|reshape | 152,291 | <p>A simple pivot might be sufficient for your needs but this is what I did to reproduce your desired output:</p>
<pre><code>df['idx'] = df.groupby('Salesman').cumcount()
</code></pre>
<p>Just adding a within group counter/index will get you most of the way there but the column labels will not be as you desired:</p>
... |
13,560,001 | Length of an object array | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/5950155/java-arrays-length">Java Arrays - length</a> </p>
</blockquote>
<p>How do you determine the length of an array that is not an String array or an integer array? It won't let me use <code>.length()</code>... | 13,560,125 | 4 | 2 | null | 2012-11-26 06:54:10.777 UTC | 1 | 2022-09-13 03:30:55.977 UTC | 2017-05-23 12:01:42.21 UTC | null | -1 | null | 1,852,563 | null | 1 | 7 | java|arrays | 48,317 | <p>Arrays in Java are not resizable. Once an array is instantiated, its length cannot change. That's why the <code>length</code> attribute (<code>myArray.length</code>) can always be trusted to contain the array's length.</p> |
13,577,473 | BETWEEN Versus >= and <= in DB2 SQL Query - Performance | <p>I have the following querys: </p>
<pre><code>SELECT ID, ADDRESS
FROM EMPLOYEE A
WHERE ID=12345
AND CURRENT DATE BETWEEN A.EFF_DT AND A.EXP_DT
SELECT ID, ADDRESS
FROM EMPLOYEE A
WHERE ID=12345
AND CURRENT DATE >= A.EFF_DT AND CURRENT DATE <= A.EXP_DT
</code></pre>
<p>Out of these two queries which qu... | 13,577,573 | 2 | 1 | null | 2012-11-27 04:37:41.423 UTC | 2 | 2012-11-27 04:55:08.937 UTC | 2012-11-27 04:42:44.7 UTC | null | 1,164,885 | null | 1,164,885 | null | 1 | 8 | db2|query-optimization | 52,179 | <p>Both those should give you exactly the same execution profile, based on my knowledge of DB2/z (the LUW product may be different but I doubt it).</p>
<p>If you're really concerned, you should run an <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0000952.ht... |
13,329,445 | How to read image from in memory buffer (StringIO) or from url with opencv python library | <p>Just share a way to create opencv image object from in memory buffer or from url to improve performance.</p>
<p>Sometimes we get image binary from url, to avoid additional file IO, we want to <strong>imread</strong> this image from in memory buffer or from url, but imread only supports read image from file system w... | 13,329,446 | 2 | 0 | null | 2012-11-11 07:42:46.31 UTC | 7 | 2019-03-26 15:40:20.83 UTC | null | null | null | null | 1,401,309 | null | 1 | 28 | image|opencv|numpy|urllib2|stringio | 33,131 | <p>To create an OpenCV image object with in memory buffer(StringIO), we can use OpenCV API imdecode, see code below:</p>
<pre><code>import cv2
import numpy as np
from urllib2 import urlopen
from cStringIO import StringIO
def create_opencv_image_from_stringio(img_stream, cv2_img_flag=0):
img_stream.seek(0)
img... |
13,642,381 | C/C++ Why to use unsigned char for binary data? | <p>Is it really necessary to use <code>unsigned char</code> to hold binary data as in some libraries which work on character encoding or binary buffers? To make sense of my question, have a look at the code below -</p>
<pre><code>char c[5], d[5];
c[0] = 0xF0;
c[1] = 0xA4;
c[2] = 0xAD;
c[3] = 0xA2;
c[4] = '\0';
printf... | 13,642,984 | 8 | 10 | null | 2012-11-30 09:33:40.083 UTC | 32 | 2020-02-04 23:16:49.257 UTC | 2017-05-23 12:32:01.897 UTC | null | -1 | null | 1,363,471 | null | 1 | 56 | c++|c|character-encoding|bytebuffer|rawbytestring | 30,585 | <p>In C the <code>unsigned char</code> data type is the only data type that has all the following three properties simultaneously </p>
<ul>
<li>it has no padding bits, that it where all storage bits contribute to the value of the data</li>
<li>no bitwise operation starting from a value of that type, when converted bac... |
13,239,325 | How to find the reason for a failed Build without any error or warning | <p>I have a WebApplication which contains reference to WCF services.</p>
<p>While building using Visual Studio 2010, Build fails without any error or warning. However building the <code>.csproj</code> using <code>MsBuild</code> is successful.</p>
<p>Can't figure out what should I try in Visual Studio, to resolve / diag... | 27,425,455 | 10 | 6 | null | 2012-11-05 19:53:04.27 UTC | 27 | 2022-09-05 15:51:36.443 UTC | 2022-09-05 15:51:36.443 UTC | null | 2,756,409 | null | 1,431,250 | null | 1 | 215 | c#|asp.net|.net|visual-studio | 175,450 | <p>I just ran into a similar situation. In my case, a custom action (from the MSBuildVersioning package available on Nuget.org - <a href="http://www.nuget.org/packages/MSBuildVersioning/" rel="noreferrer">http://www.nuget.org/packages/MSBuildVersioning/</a>) which appeared in the csproj file's BeforeBuild target was fa... |
39,550,732 | Is there a way to have conditional markdown chunk execution in Rmarkdown? | <p>I am an instructor looking to make a homework assignment and homework solution guide from the same Rmarkdown file by changing a document parameter I created called <code>soln</code>. When <code>soln=FALSE</code> the assignment document is generated, and when <code>soln=TRUE</code> the homework solution guide is gene... | 39,552,048 | 2 | 4 | null | 2016-09-17 19:12:17.35 UTC | 14 | 2018-04-23 20:14:55.387 UTC | 2016-09-17 21:22:46.033 UTC | null | 4,418,571 | null | 4,418,571 | null | 1 | 29 | r|markdown|knitr|r-markdown|pandoc | 11,295 | <p>Instead of using <code>cat</code> to print the solution from within an R code chunk, you could write the solution as you usually would in <code>rmarkdown</code> (i.e., with the usual combination of text, <code>latex</code>, and R code chunks), and use the parameter <code>soln</code> to comment out that section when ... |
20,762,662 | What's the correct way to sort Python `import x` and `from x import y` statements? | <p>The <a href="http://www.python.org/dev/peps/pep-0008/#imports">python style guide</a> suggests to group imports like this:</p>
<blockquote>
<p>Imports should be grouped in the following order:</p>
<ol>
<li>standard library imports</li>
<li>related third party imports</li>
<li>local application/library ... | 20,763,446 | 6 | 2 | null | 2013-12-24 14:37:57.05 UTC | 55 | 2021-05-29 02:21:40.81 UTC | 2013-12-25 00:59:03.353 UTC | null | 216,074 | null | 298,479 | null | 1 | 239 | python|coding-style|python-import|pep8 | 105,777 | <p>Imports are generally sorted alphabetically and described in various places besides PEP 8.</p>
<p><strong>Alphabetically sorted modules are quicker to read and searchable</strong>. After all, Python is all about readability.
Also, it is easier to verify that something is imported, and avoids duplicate imports.</p>
<... |
20,586,525 | getMeasuredWidth returns totally wrong value | <p>I have to measure a <code>View</code> for spacing others. I use this code for that:</p>
<pre><code>ViewGroup view = ...;
view.setPadding(10, 0, 10, 0);
int wrapContent = RelativeLayout.LayoutParams.WRAP_CONTENT;
int specWidth = MeasureSpec.makeMeasureSpec(wrapContent, MeasureSpec.AT_MOST);
view.measure(specWidth, s... | 21,761,151 | 1 | 3 | null | 2013-12-14 18:05:37.21 UTC | 14 | 2015-10-20 19:47:18.583 UTC | 2014-04-03 20:37:32.913 UTC | null | 375,929 | null | 747,412 | null | 1 | 28 | android|android-layout|view|measure | 11,084 | <p>Passing <code>WRAP_CONTENT</code> instead of an actual value to <code>makeMeasureSpec()</code> won't do any good, I don't think those were meant to be used together.</p>
<p>Use actual constraint value as first parameter (e.g. size of the parent view or dimensions of the screen) with the <code>MeasureSpec.AT_MOST</c... |
24,314,687 | Slide down animation from display:none to display:block? | <p>Is there a way to animate display:none to display:block using CSS so that the hidden div slides down instead of abruptly appearing, or should I go about this a different way?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="sn... | 24,314,932 | 7 | 2 | null | 2014-06-19 19:21:58.003 UTC | 9 | 2022-01-28 14:55:50.797 UTC | 2021-09-27 19:55:48.787 UTC | null | 16,444,630 | null | 2,827,407 | null | 1 | 31 | javascript|jquery|html|css|css-transitions | 119,278 | <p>Yes, there is a way:
<a href="http://jsfiddle.net/6C42Q/12/" rel="noreferrer">http://jsfiddle.net/6C42Q/12/</a></p>
<p>By using CSS3 transitions, and manipulate height, rather than display property:</p>
<pre><code>.hidden {
height: 0px;
-webkit-transition: height 0.5s linear;
-moz-transition: height... |
3,938,278 | Close Window for button click | <p>I have been trying to close the window on button click but am unable to do so.</p>
<p>I have added javascript <code>window.close()</code></p>
<p>added on the code behind page on button click event all in vain. Language <code>c#</code> or <code>vb.net</code> </p> | 3,938,297 | 2 | 1 | null | 2010-10-14 23:05:25.13 UTC | 1 | 2016-02-09 13:48:46.69 UTC | 2016-02-09 13:48:46.69 UTC | null | 4,946,896 | null | 428,747 | null | 1 | 5 | javascript|asp.net | 67,128 | <p>That needs to be on the client side, try something like this:</p>
<pre><code><input type="button" id="close" onclick="window.close()" />
</code></pre>
<p>If you want an asp.net button you can do:</p>
<pre><code><asp:Button ID="close" runat="server" OnClientClick="javascript:window.close()" />
</code><... |
9,146,651 | Trigger an event on `click` and `enter` | <p>I have a searchbox on my site that. Currently, users must click the submit button next to the box to search via jquery's post. I would like to let users also press enter to search. How can i do this?</p>
<p>JQUERY:</p>
<pre><code>$('document').ready(function(){
$('#searchButton').click(function(){
v... | 9,146,661 | 7 | 2 | null | 2012-02-05 03:19:53.613 UTC | 24 | 2018-03-12 06:24:24.53 UTC | 2012-02-05 03:26:17.61 UTC | null | 1,113,246 | null | 802,370 | null | 1 | 77 | jquery|jquery-selectors | 134,254 | <p>Use <code>keypress</code> event on <code>usersSearch</code> textbox and look for <kbd>Enter</kbd> button. If enter button is pressed then trigger the search button click event which will do the rest of work. Try this.</p>
<pre><code>$('document').ready(function(){
$('#searchButton').click(function(){
va... |
29,502,052 | Template specialization and enable_if problems | <p>I am running into a problem regarding the appropriate usage of enable_if and template specialization.</p>
<p>After modifying the example (for confidentiality reasons), here's a comparable example:</p>
<blockquote>
<p>I have function called "less" that checks if 1st arg is less than 2nd
arg. Let's say I want to... | 29,502,338 | 1 | 3 | null | 2015-04-07 21:54:35.873 UTC | 8 | 2015-11-04 16:39:24.487 UTC | 2015-11-04 16:39:24.487 UTC | null | 241,631 | null | 211,528 | null | 1 | 23 | c++|templates|c++11|sfinae|enable-if | 12,914 | <p>Default template arguments are not part of the signature of a function template. So in your example you have two identical overloads of <code>less</code>, which is illegal. clang complains about the redefinition of the default argument (which is also illegal according to §14.1/12 [temp.param]), while gcc produces th... |
16,419,144 | get picture object from facebook post with graph api | <p>I'm able to get a picture-url from a specific facebook-post through the facebook graph-api (ie <a href="https://developers.facebook.com/tools/explorer?method=GET&path=196118303833398_362048290573731" rel="noreferrer">https://developers.facebook.com/tools/explorer?method=GET&path=196118303833398_3620482905737... | 16,419,450 | 5 | 1 | null | 2013-05-07 12:32:34.663 UTC | 5 | 2017-01-22 07:44:26.023 UTC | 2013-05-07 12:42:28.527 UTC | null | 2,358,298 | null | 2,358,298 | null | 1 | 15 | facebook-graph-api | 54,399 | <p>Only users and pages have a <code>picture</code> <em>connection</em> – posts don’t. (A <code>field</code> is something different.)</p>
<p>But I guess the <code>full_picture</code> field is what you want: <a href="https://developers.facebook.com/tools/explorer?method=GET&path=196118303833398_362048290573731%3Ffi... |
16,208,121 | java create date object using a value string | <p>I am using this to get the current time :</p>
<pre><code>java.util.Calendar cal = java.util.Calendar.getInstance();
System.out.println(new java.text.SimpleDateFormat("EEEE, dd/MM/yyyy/hh:mm:ss")
.format(cal.getTime()));
</code></pre>
<p>I want to put the value (which I print it) into a date object,... | 16,208,179 | 9 | 6 | null | 2013-04-25 06:45:41.787 UTC | 7 | 2021-02-09 11:14:42.683 UTC | 2016-05-10 21:14:43.23 UTC | null | 1,718,174 | null | 2,038,257 | null | 1 | 27 | java|date | 167,033 | <p>Whenever you want to convert a String to Date object then use <code>SimpleDateFormat#parse</code><br>
Try to use <br></p>
<pre><code>String dateInString = new java.text.SimpleDateFormat("EEEE, dd/MM/yyyy/hh:mm:ss")
.format(cal.getTime())
SimpleDateFormat formatter = new SimpleDateFormat("EEEE, dd/MM/yyyy/hh... |
16,174,469 | Unprotect VBProject from VB code | <p>How can i unprotect my VB project from a vb macro ?
i have found this code:</p>
<pre><code> Sub UnprotectVBProject(ByRef WB As Workbook, ByVal Password As String)
Dim VBProj As Object
Set VBProj = WB.VBProject
Application.ScreenUpdating = False
'Ne peut procéder si le projet est non-protégé.
If VBProj... | 16,176,557 | 3 | 3 | null | 2013-04-23 16:24:22.96 UTC | 24 | 2022-01-07 07:01:08.5 UTC | 2013-04-24 09:36:44.367 UTC | null | 1,140,579 | null | 1,591,681 | null | 1 | 29 | vba|excel|excel-2007 | 72,710 | <p><strong>EDIT</strong>:</p>
<p>Converted this to a <a href="http://www.siddharthrout.com/index.php/2019/01/20/unprotect-vbproject-from-vb-code/" rel="nofollow noreferrer">BLOG post</a> for VBA and VB.Net.</p>
<p>I have never been in favor of <code>Sendkeys</code>. They are reliable in some case but not always. I have... |
16,471,636 | Bean injection inside a JPA @Entity | <p>Is it possible to inject beans to a JPA <code>@Entity</code> using Spring's dependency injection?</p>
<p>I attempted to @Autowire ServletContext but, while the server did start successfully, I received a NullPointerException when trying to access the bean property.</p>
<pre><code>@Autowired
@Transient
ServletConte... | 17,688,178 | 3 | 1 | null | 2013-05-09 21:43:37.57 UTC | 9 | 2017-11-17 08:49:49.533 UTC | 2017-11-17 08:49:49.533 UTC | null | 100,297 | null | 1,747,491 | null | 1 | 41 | spring|spring-mvc|jpa | 41,745 | <p>You can inject dependencies into objects not managed by the Spring container using <code>@Configurable</code> as explained here: <a href="http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/aop.html#aop-atconfigurable" rel="noreferrer">http://static.springsource.org/spring/docs/3.2.x/spr... |
16,287,963 | Navigation bar disappeared from my storyboard items | <p>From one day to another the navigation bar disappeared from my storyboard items in XCode 4.6.2. I can't restore them (cleaning, rebuilding, closing, reopening etc)</p>
<p>When running my app on my device or in simulator, everything works ok, the navigation bar is there. But I need them on my storyboard during desig... | 16,288,036 | 7 | 0 | null | 2013-04-29 20:48:46.993 UTC | 11 | 2022-01-22 17:26:02.087 UTC | null | null | null | null | 582,211 | null | 1 | 44 | ios|xcode|uinavigationcontroller|storyboard | 32,895 | <p>Try this:</p>
<p>Select the view controller with the missing navigation bar and view the attributes inspector (This is the fourth tab over in the right side window). Under the simulated metrics section, change the "Top Bar" from the default "inferred" to "Navigation Bar".</p>
<p>Hopefully that solves your problem... |
16,202,348 | numpy divide row by row sum | <p>How can I divide a numpy array row by the sum of all values in this row?</p>
<p>This is one example. But I'm pretty sure there is a fancy and much more efficient way of doing this:</p>
<pre><code>import numpy as np
e = np.array([[0., 1.],[2., 4.],[1., 5.]])
for row in xrange(e.shape[0]):
e[row] /= np.sum(e[row... | 16,202,486 | 3 | 0 | null | 2013-04-24 21:16:31.543 UTC | 17 | 2020-07-15 17:38:34.577 UTC | null | null | null | null | 869,402 | null | 1 | 67 | python|multidimensional-array|numpy | 51,634 | <p>Method #1: use <code>None</code> (or <code>np.newaxis</code>) to add an extra dimension so that broadcasting will behave:</p>
<pre><code>>>> e
array([[ 0., 1.],
[ 2., 4.],
[ 1., 5.]])
>>> e/e.sum(axis=1)[:,None]
array([[ 0. , 1. ],
[ 0.33333333, 0.66666667],... |
41,791,413 | Indexes with included columns, what's the difference? | <p>I've never really understood the difference between these two indexes, can someone please explain what the difference is (performance-wise, how the index structure will look like in db, storage-wise etc)?</p>
<p><strong>Included index</strong></p>
<pre><code>CREATE NONCLUSTERED INDEX IX_Address_PostalCode
ON Perso... | 41,791,921 | 3 | 6 | null | 2017-01-22 13:22:29.61 UTC | 9 | 2020-11-13 15:20:39.893 UTC | 2020-11-13 15:20:39.893 UTC | null | 62,600 | null | 2,808,645 | null | 1 | 23 | sql|sql-server|tsql|database-indexes|sql-server-performance | 18,065 | <p>The internal storage of indexes uses a B-Tree structure and consists of "index pages" (the root and all intermediate pages) and "index data pages" (the leaf pages only).</p>
<blockquote>
<p>Note do not confuse "index data pages" with the "data pages" (leaf pages of clustered indexes) which store most of the colum... |
17,496,175 | Reading XML from Stream | <p>I'm working with ASP.NET, and am importing an XML file from a form. Right now I convert that into a <code>Stream</code>: </p>
<pre><code>Stream inputStream = XmlFileUploadControl.PostedFile.InputStream;
</code></pre>
<p>because I may need this version later.</p>
<p>I'd like to first check to make make sure that ... | 17,496,240 | 2 | 1 | null | 2013-07-05 20:06:04.157 UTC | null | 2016-02-28 14:19:23.353 UTC | 2013-08-21 00:30:16.37 UTC | null | 41,071 | null | 823,859 | null | 1 | 9 | c#|xml|stream|xmlreader | 43,537 | <p>The first time you create an <code>XmlReader</code> around the stream, it is at position 0. But the second time you create an <code>XmlReader</code>, the stream has already been partially read, so it is no longer at position 0, so the <code>XmlReader</code> can't read the XML document.</p>
<p>Instead, you should cr... |
17,232,714 | Add a custom attribute to a Laravel / Eloquent model on load? | <p>I'd like to be able to add a custom attribute/property to an Laravel/Eloquent model when it is loaded, similar to how that might be achieved with <a href="http://redbeanphp.com/manual/models_and_fuse">RedBean's</a> <code>$model->open()</code> method.</p>
<p>For instance, at the moment, in my controller I have:</... | 17,250,429 | 9 | 2 | null | 2013-06-21 10:13:20.887 UTC | 75 | 2020-03-27 03:35:16.353 UTC | 2014-05-02 10:12:20.437 UTC | null | 248,567 | null | 921,476 | null | 1 | 273 | php|orm|laravel|eloquent | 295,519 | <p>The problem is caused by the fact that the <code>Model</code>'s <code>toArray()</code> method ignores any accessors which do not directly relate to a column in the underlying table.</p>
<p>As Taylor Otwell mentioned <a href="https://github.com/laravel/framework/issues/112#issuecomment-12530987">here</a>, "This is i... |
11,942,083 | Using OpenQuery With INSERT INTO Statement | <p>I currently use the following to data warehouse a table everday:</p>
<pre><code>DROP TABLE mytable
SELECT firstcolumn, secondcolumn INTO mytable
FROM OPENQUERY (mylinkedserver, 'SELECT firstcolumn, secondcolumn FROM linkedtable')
</code></pre>
<p>I would like to start using TRUNCATE going forward (to perserve sy... | 11,942,165 | 2 | 0 | null | 2012-08-13 20:49:02.427 UTC | null | 2012-08-13 20:55:26.783 UTC | null | null | null | null | 1,423,787 | null | 1 | 3 | sql|sql-server|sql-server-2008|tsql | 45,748 | <p>I believe the syntax is:</p>
<pre><code>TRUNCATE TABLE mytable
INSERT INTO mytable (firstcolumn, secondcolumn)
SELECT firstcolumn, secondcolumn
FROM OPENQUERY (mylinkedserver, 'SELECT firstcolumn, secondcolumn FROM linkedtable')
</code></pre> |
22,121,056 | How to make a website run the index.html file? | <p>I just hosted a website. But, when i want to run the website it opens the index of the website (list of files what i added using FTP and not the Index.html page). How to fix that?</p>
<p>Please help...</p> | 22,121,740 | 5 | 2 | null | 2014-03-01 22:11:03.473 UTC | 8 | 2019-08-13 19:25:09.917 UTC | 2017-12-08 11:28:20.11 UTC | null | 2,682,835 | null | 2,682,835 | null | 1 | 12 | html|ftp | 88,259 | <p>If you want to display the contents of an index.html file when a request is made to your website domain, let's say it is domain.com, then all you have to do is to upload the index.html file to the correct <strong>document root directory</strong> on your server.</p>
<p>The <strong>document root</strong> is the folde... |
22,257,726 | EACCES Error with Bower install? | <p>I've read a few answers on StackOverflow & some other sites but none seem to fix the issue I'm having.</p>
<p>I'm installing AppGyver Add-ons, via terminal. Getting the following error:</p>
<pre><code>BradMacBookPro:SparksInSpain breadadams$ bower install https://##MY-DOWNLOAD-CODE##@addons.appgyver.com/steroi... | 26,104,460 | 8 | 2 | null | 2014-03-07 18:19:59.017 UTC | 13 | 2017-08-18 11:34:14.433 UTC | 2017-08-18 11:34:14.433 UTC | null | 2,553,600 | null | 2,553,600 | null | 1 | 47 | terminal|bower|steroids | 41,160 | <p>I had a similar issue that I couldn't resolve using these suggestions. I was successful when I ran Bower with root privileges, like so:</p>
<pre><code>sudo bower install --allow-root
</code></pre> |
37,565,793 | How to let the user select an input from a finite list? | <p>Is it possible to ask for selection between multiple choices in Python, without an if loop?</p>
<p>Example:</p>
<pre><code>print "Do you want to enter the door"
raw_input ("Yes or not")
</code></pre>
<p>And the user can only choose between the selections.</p> | 37,567,304 | 6 | 4 | null | 2016-06-01 10:16:02.02 UTC | 12 | 2022-04-11 15:58:47.457 UTC | 2021-10-18 21:28:23.38 UTC | null | -1 | null | 2,980,075 | null | 1 | 16 | python|user-input | 75,457 | <p>If you need to do this on a regular basis, there is a convenient library for this purpose that may help you achieve better user experience easily : <a href="https://pypi.python.org/pypi/inquirer" rel="noreferrer">inquirer</a></p>
<p><strong>Disclaimer : As far as i know, it won't work on Windows without some hacks.... |
37,392,166 | Firebase "Run firebase use default to activate project APP_NAME" | <p>It was successfully when deployed first time, now im trying to deploy again, shows an error:</p>
<pre><code>Run firebase use default to activate project MY_APP_NAME
</code></pre>
<p><strong>Error:</strong></p>
<blockquote>
<p>No project active, but a project alias is available.</p>
</blockquote> | 37,464,231 | 9 | 5 | null | 2016-05-23 13:20:55.813 UTC | 1 | 2020-12-24 03:42:14.737 UTC | 2016-05-23 14:08:19.813 UTC | null | 2,873,538 | null | 1,468,908 | null | 1 | 29 | firebase | 26,504 | <p>At first should <code>firebase use</code> to make default alias. </p>
<p>After <code>firebase use default</code> to use default. </p>
<p>Then <code>firebase deploy</code> yahoo.. you can deploy</p> |
19,663,704 | Understanding how .Internal C functions are handled in R | <p>I wonder if anyone can illustrate to me how R executes a <code>C</code> call from an R command typed at the console prompt. I am particularly confused by <code>R</code>'s treatment of a) function arguments and b) the function call itself. </p>
<p>Let's take an example, in this case <code>set.seed()</code>. Wonderi... | 19,664,351 | 2 | 4 | null | 2013-10-29 16:16:33.103 UTC | 16 | 2013-10-29 23:11:01.9 UTC | 2017-05-23 11:47:21.377 UTC | null | -1 | null | 1,478,381 | null | 1 | 39 | c|r|syntax|internals | 1,618 | <p><code>CAR</code> and <code>CDR</code> are how you access pairlist objects, as explained in <a href="http://cran.r-project.org/doc/manuals/R-lang.html#Pairlist-objects">section 2.1.11 of <em>R Language Definition</em></a>. <code>CAR</code> contains the first element, and <code>CDR</code> contains the remaining eleme... |
19,720,711 | Git warning: push.default is unset; its implicit value is changing | <p>When I push to remote in Git, I get this warning:</p>
<pre><code>warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch t... | 19,723,478 | 4 | 5 | null | 2013-11-01 04:17:39.537 UTC | 22 | 2021-07-17 16:39:15.473 UTC | 2016-10-23 11:23:17.55 UTC | null | 492,336 | null | 2,215,537 | null | 1 | 70 | git|push | 64,075 | <p>This warning was introduced in Git 1.7.11 along with the <code>simple</code> style of pushing. The issue is that the current default, <code>matching</code>, can result in inexperienced users force pushing when some branches are behind their remote equivalent because the branches simply aren't up-to-date. The end r... |
19,376,735 | How to return a specific element of an array? | <p>I want to return odd numbers of an array yet Eclipse doesn't seem to accept my return <code>array[i];</code> code. I think it requires returning a whole array since I set an array as a parameter to my method.
As I said before, I need to pass an array and get a specific element of that array in return. Even if I make... | 19,376,865 | 4 | 6 | null | 2013-10-15 08:41:40.72 UTC | 1 | 2013-10-15 10:34:11.57 UTC | 2013-10-15 09:11:05.397 UTC | null | 2,858,004 | null | 2,858,004 | null | 1 | 2 | java|arrays|parameters|elements | 159,145 | <p>You code should look like this:</p>
<pre><code>public int getElement(int[] arrayOfInts, int index) {
return arrayOfInts[index];
}
</code></pre>
<p>Main points here are method return type, it should match with array elements type and if you are working from <code>main()</code> - this method must be static also.... |
21,865,041 | In C, what exactly happens when you pass a NULL pointer to strcmp()? | <p>I have read that the following results in undefined behavior. </p>
<pre><code>strcmp(foo, NULL);
</code></pre>
<p>But what exactly happens "underneath the hood," so to speak? Is <code>foo</code> compared to garbage data? Is <code>NULL</code> dereferenced? What are the details that cause "undefined behavior"?</p> | 21,865,119 | 4 | 9 | null | 2014-02-18 20:51:58.44 UTC | 1 | 2016-02-22 19:13:11.237 UTC | 2016-02-22 19:13:11.237 UTC | null | 754,842 | null | 754,842 | null | 1 | 29 | c | 40,827 | <p>It depends on the implementation, which is free to assume your parameters are valid (i.e. not null in this case). The behaviour may or may not be reproducible from execution to execution, or from one implementation/platform to another.</p> |
17,658,216 | Extract last word in string in R | <p>What's the most elegant way to extract the last word in a sentence string?</p>
<p>The sentence does not end with a "."
Words are seperated by blanks.</p>
<pre><code>sentence <- "The quick brown fox"
TheFunction(sentence)
</code></pre>
<p>should return: "fox"</p>
<p>I do not want to use a package if a simple s... | 17,658,506 | 5 | 3 | null | 2013-07-15 15:41:33.267 UTC | 8 | 2020-03-08 13:45:44.31 UTC | 2013-07-15 15:59:14.577 UTC | null | 906,490 | null | 2,030,503 | null | 1 | 35 | r | 42,976 | <pre><code>tail(strsplit('this is a sentence',split=" ")[[1]],1)
</code></pre>
<p>Basically as suggested by @Señor O.</p> |
17,223,851 | sort list by date in descending order - groovy madness | <p>I'm not able to sort a list of Objects by a Date in descending order</p>
<p>Let's say this is my class <code>Thing</code></p>
<pre><code>class Thing {
Profil profil
String status = 'ready'
Date dtCreated = new Date()
}
</code></pre>
<p>Inside the method I'm creating the <code>List things</code></p>
<pre><code> ... | 17,224,150 | 3 | 1 | null | 2013-06-20 21:10:22.933 UTC | 5 | 2021-04-14 16:08:20.903 UTC | 2021-04-14 16:08:20.903 UTC | null | 3,964,927 | null | 1,712,905 | null | 1 | 44 | java|date|sorting|grails|groovy | 85,659 | <p>Instead of</p>
<pre><code>things.sort{-it.dtCreated}
</code></pre>
<p>you might try </p>
<pre><code>things.sort{a,b-> b.dtCreated<=>a.dtCreated}
</code></pre>
<p>reverse() does nothing because it creates a new list instead of mutating the existing one.</p>
<pre><code>things.sort{it.dtCreated}
things.re... |
17,456,671 | To what level does MongoDB lock on writes? (or: what does it mean by "per connection" | <p>In the mongodb documentation, it says:</p>
<blockquote>
<p>Beginning with version 2.2, MongoDB implements locks on a per-database basis for most read and write operations. Some global operations, typically short lived operations involving multiple databases, still require a global “instance” wide lock. Before 2.2... | 17,456,923 | 4 | 2 | null | 2013-07-03 19:35:24.333 UTC | 65 | 2021-07-03 09:20:41.783 UTC | 2013-12-17 09:19:53.69 UTC | null | 2,096,752 | null | 570,259 | null | 1 | 65 | mongodb|concurrency|locking | 63,191 | <p>It is not per connection, it is per <code>mongod</code>. In other words the lock will exist across all connections to the <code>test</code> database on that server.</p>
<p>It is also a read/write lock so if a write is occuring then a read must wait, otherwise how can MongoDB know it is a consistent read?</p>
<p>Ho... |
26,037,744 | Efficiency of findViewById | <p>Probably most Android devs know that <code>findViewById</code> is not a cheap operation. Another thing that most of us know, is that you can boost the performance by using the smallest sub-tree of the view hierarchy to find views by their id, example:</p>
<pre><code><LinearLayout
android:id="@+id/some_id_0"&... | 26,118,335 | 2 | 4 | null | 2014-09-25 11:41:59.28 UTC | 8 | 2016-06-11 00:23:17.243 UTC | 2014-09-30 09:35:03.167 UTC | null | 954,474 | null | 954,474 | null | 1 | 14 | android|performance|android-layout|findviewbyid | 8,997 | <p>It makes absolutely no difference if you look for the <code>View</code> directly or if you look for a parent first and then the child. But if you for example want to retrieve the three <code>TextViews</code> in the <code>LinearLayout</code> with the id <code>some_id_8</code> then it would be better for performance i... |
22,989,500 | Is RestTemplate thread safe? | <p>Is a Spring <code>RestTemplate</code> thread-safe? That is</p>
<ul>
<li>Is a <code>RestTemplate</code> a Strategy object that multiple connections can safely share. <strong>or</strong></li>
<li>Is a <code>RestTemplate</code> a connection object (like a data-base connection), which can not be shared while in use, an... | 22,989,501 | 4 | 4 | null | 2014-04-10 13:30:02.903 UTC | 19 | 2019-09-05 15:47:48.753 UTC | null | null | null | null | 545,127 | null | 1 | 77 | java|spring|rest|thread-safety | 49,881 | <p><code>RestTemplate</code> <a href="https://spring.io/blog/2009/03/27/rest-in-spring-3-resttemplate" rel="noreferrer">is thread safe</a> (emphasis added):</p>
<blockquote>
<p>Conceptually, it is very similar to the <code>JdbcTemplate</code>, <code>JmsTemplate</code>, and the various other templates found in the Sp... |
43,089,058 | Entity Framework Core jsonb column type | <p>I am using Entity Framework Core with npgsql postgresql for Entity Framework Core.</p>
<p>My question is, using migrations, how do I mark a class property to generate a JSONB column type?</p>
<p>For example:</p>
<pre><code>public class MyTableClass
{
public int Id { get; set; }
// My JSONB column
pub... | 43,115,883 | 2 | 3 | null | 2017-03-29 09:05:58.29 UTC | 7 | 2021-04-09 02:32:33.817 UTC | 2017-04-04 16:02:05.577 UTC | null | 13,302 | null | 1,582,065 | null | 1 | 30 | c#|postgresql|entity-framework-core|npgsql | 27,248 | <p>Based on H. Herzl comment:</p>
<p>My final solution was something like this:</p>
<pre><code>public class MyTableClass
{
public int Id { get; set; }
[Column(TypeName = "jsonb")]
public string Data { get; set; }
}
</code></pre>
<p>Migrations generated this:</p>
<pre><code>Data = table.Column<string... |
9,260,159 | Java 7 Automatic Resource Management JDBC (try-with-resources statement) | <p>How to integrate the common JDBC idiom of creating/receiving a connection, querying the database and possibly processing the results with Java 7's automatic resource management, the try-with-resources statement? (<a href="http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html">Tutorial</a>... | 9,260,565 | 3 | 3 | null | 2012-02-13 12:01:31.783 UTC | 17 | 2019-12-17 12:39:01.297 UTC | 2015-07-31 00:18:15.413 UTC | null | 642,706 | null | 1,070,957 | null | 1 | 37 | java|jdbc|java-7|try-with-resources | 18,986 | <pre><code>try(Connection con = getConnection()) {
try (PreparedStatement prep = con.prepareConnection("Update ...")) {
//prep.doSomething();
//...
//etc
con.commit();
} catch (SQLException e) {
//any other actions necessary on failure
con.rollback();
//consider a ... |
9,596,652 | How to escape apostrophe (') in MySql? | <p>The <a href="http://dev.mysql.com/doc/refman/5.0/en/string-literals.html#character-escape-sequences">MySQL documentation</a> says that it should be <code>\'</code>. However, both scite and mysql shows that <code>''</code> works. I saw that and it works. What should I do?</p> | 9,596,819 | 10 | 3 | null | 2012-03-07 06:09:41.213 UTC | 22 | 2021-02-03 16:37:15.113 UTC | 2012-03-07 06:11:03.313 UTC | null | 23,897 | null | 700,663 | null | 1 | 185 | mysql|escaping | 328,804 | <p>The MySQL documentation you cite actually says a little bit more than you mention. It also says, </p>
<blockquote>
<p>A “<code>'</code>” inside a string quoted with “<code>'</code>” may be written as “<code>''</code>”. </p>
</blockquote>
<p>(Also, you linked to the <a href="http://dev.mysql.com/doc/refman/5.0/e... |
18,371,351 | Python - Pymongo Insert and Update Documents | <p>Using PyMongo, I have a set of dict's in a list that I'd like to submit to my MongoDB. Some of the items in the list are new entries, and some are to update.</p>
<p>Example:</p>
<p><strong>On Server Database:</strong></p>
<pre><code>[{"_id" : 1, "foo" : "bar}]
</code></pre>
<p><strong>To send to database:</stron... | 18,372,494 | 4 | 0 | null | 2013-08-22 03:48:45.967 UTC | 4 | 2020-01-31 03:05:02.1 UTC | null | null | null | null | 721,386 | null | 1 | 19 | python|mongodb|pymongo | 57,008 | <p>Use <a href="https://docs.mongodb.com/manual/reference/method/db.collection.update/#update-upsert" rel="noreferrer"><code>upsert</code></a> option:</p>
<pre><code>from pymongo import MongoClient
cl = MongoClient()
coll = cl["local"]["test2"]
data = [{"_id" : 1, "foo" : "HELLO"}, {"_id" : 2, "Blah" : "Bloh"}]
for d... |
18,693,639 | Change background color of edittext in android | <p>If I change the background color of my <code>EditText</code> using the below code, it looks like the box is shrunken and it doesn't maintain the ICS theme of a blue bottom border that exists for a default <code>EditText</code>.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:and... | 18,694,067 | 10 | 0 | null | 2013-09-09 07:47:08.323 UTC | 9 | 2019-08-23 23:37:14.56 UTC | 2014-12-22 17:18:30.603 UTC | null | 4,015,623 | null | 164,683 | null | 1 | 31 | android|android-layout|android-edittext | 139,096 | <p>What you should do is to create a 9 patch image for edittext and set that image as edit text background. You can create 9 patches using <a href="http://romannurik.github.io/AndroidAssetStudio/nine-patches.html" rel="nofollow noreferrer">this</a> website</p>
<p>I am attaching a sample 9 patch image for your referenc... |
15,027,280 | Prevent submit button with onclick event from submitting | <p>I want to prevent a submit button with onclick event from submitting:</p>
<pre><code>$j('form#userForm .button').click(function(e) {
if ($j("#zip_field").val() > 1000){
$j('form#userForm .button').attr('onclick','').unbind('click');
alert('Sorry we leveren alleen inomstreken hijen!');
... | 15,027,290 | 5 | 1 | null | 2013-02-22 15:16:10.243 UTC | 2 | 2017-09-12 20:35:49.037 UTC | 2017-09-12 20:35:49.037 UTC | null | 3,995,261 | user1054080 | null | null | 1 | 19 | jquery|submit|preventdefault | 83,204 | <p>You'll need to add the event as a parameter:</p>
<pre><code>$j('form#userForm .button').click(function(event) { // <- goes here !
if ( parseInt($j("#zip_field").val(), 10) > 1000){
event.preventDefault();
$j('form#userForm .button').attr('onclick','').unbind('click');
alert('Sorry ... |
15,203,534 | Convert.ToDateTime: how to set format | <p>I use convert like:</p>
<pre><code>Convert.ToDateTime(value)
</code></pre>
<p>but i need convert date to format like "mm/yy".<br>
I'm looking for something like this:</p>
<pre><code>var format = "mm/yy";
Convert.ToDateTime(value, format)
</code></pre> | 15,203,567 | 5 | 1 | null | 2013-03-04 14:13:45.217 UTC | 1 | 2019-01-21 12:41:22.67 UTC | 2013-03-04 14:15:59.487 UTC | null | 15,541 | null | 1,916,002 | null | 1 | 20 | c#|.net|datetime | 160,084 | <p>You should probably use either <a href="http://msdn.microsoft.com/en-us/library/7ee1y0t7.aspx"><code>DateTime.ParseExact</code></a> or <a href="http://msdn.microsoft.com/en-us/library/system.datetime.tryparseexact.aspx"><code>DateTime.TryParseExact</code></a> instead. They allow you to specify specific formats. I pe... |
15,018,372 | How to take partial screenshot with Selenium WebDriver in python? | <p>I have searched a lot for this but couldn't find a solution. Here's <a href="https://stackoverflow.com/questions/10848900/how-to-take-partial-screenshot-frame-with-selenium-webdriver">a similar question</a> with a possible solution in java.</p>
<p>Is there a similar solution in Python?</p> | 15,870,708 | 8 | 0 | null | 2013-02-22 06:41:47.24 UTC | 50 | 2021-02-27 19:16:19.797 UTC | 2017-05-23 10:31:02.473 UTC | null | -1 | null | 2,098,273 | null | 1 | 86 | python|selenium | 79,898 | <p>Other than Selenium, this example also requires the PIL Imaging library. Sometimes this is put in as one of the standard libraries and sometimes it's not, but if you don't have it you can install it with <code>pip install Pillow</code></p>
<pre><code>from selenium import webdriver
from PIL import Image
from io impo... |
38,168,973 | How to programmatically get the list of registered users in Firebase | <p>I am working on an android app based on <a href="https://firebase.google.com/" rel="noreferrer">Firebase</a> and I am creating registration using authentication of users with their email addresses and passwords with method <code>signInWithEmailAndPassword</code>, I am able register multiple users and also able to se... | 38,170,753 | 1 | 4 | null | 2016-07-03 10:24:23.213 UTC | 4 | 2016-12-27 08:25:17.753 UTC | 2016-12-27 08:25:17.753 UTC | null | 2,058,547 | null | 726,863 | null | 1 | 23 | android|firebase|firebase-authentication | 45,748 | <p>You can't</p>
<p>The explanation is here <a href="https://stackoverflow.com/questions/14673708/how-do-i-return-a-list-of-users-if-i-use-the-firebase-simple-username-password">How do I return a list of users if I use the Firebase simple username & password authentication</a></p>
<p>You can instead set the user'... |
28,306,288 | RemovedInDjango18Warning: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is deprecated | <p>I am doing a Django project and when I tried to access 127.0.0.1:8000/articles/create, I got the following error in my Ubuntu terminal: </p>
<pre><code>/home/(my name)/django_test/article/forms.py:4: RemovedInDjango18Warning: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is ... | 28,306,347 | 4 | 4 | null | 2015-02-03 18:36:42.253 UTC | 18 | 2015-04-04 22:19:20.643 UTC | 2015-02-03 18:48:36.927 UTC | null | 3,849,798 | null | 3,849,798 | null | 1 | 40 | python|django | 54,022 | <p>For your form, it's a warning, not an error, telling you that in django 1.8, you will need to change your form to </p>
<pre><code>from django import forms
from models import Article
class ArticleForm(forms.ModelForm):
class Meta:
model = Article
fields = '__all__' # Or a list of the fields th... |
7,729,905 | What is local/remote and no-interface view in EJB? | <p>I am trying to understand what the purpose and why we need the different client views in EJB. Could someone try to explain? </p> | 7,729,969 | 2 | 0 | null | 2011-10-11 17:18:16.077 UTC | 39 | 2017-06-20 10:55:34.193 UTC | 2013-09-24 09:05:40.287 UTC | null | 2,390,083 | null | 454,049 | null | 1 | 84 | java|jakarta-ee|ejb | 44,799 | <p><strong>Remote client view</strong></p>
<p>When your EJB and its clients will be in a distributed environment - meaning EJBs and clients will reside on separate Java virtual machines. Example : EJBs hosted on a WebSphere Application Server and Servlets that consume EJB APIs hosted on a Tomcat server.</p>
<p><stron... |
9,371,658 | Convert DateTime to a specified Format | <p>I have this date format <code>yy/MM/dd HH:mm:ss</code> ex: <code>12/02/21 10:56:09</code>. The problem is, when i try to convert it to different format using this code:</p>
<pre><code>CDate("12/02/21 10:56:09").ToString("MMM. dd, yyyy HH:mm:ss")
</code></pre>
<p>It displays <code>Dec. 12, 2021 10:56:09</code>.</p... | 9,371,683 | 5 | 6 | null | 2012-02-21 03:18:13.007 UTC | 5 | 2017-01-24 15:19:15.307 UTC | 2012-02-21 06:10:30.163 UTC | null | 787,016 | null | 491,243 | null | 1 | 20 | c#|.net|vb.net|datetime-format | 174,086 | <p>Use <a href="http://msdn.microsoft.com/en-us/library/w2sa9yss.aspx"><code>DateTime.ParseExact</code></a>, e.g.:</p>
<pre><code>DateTime.ParseExact("12/02/21 10:56:09", "yy/MM/dd HH:mm:ss",
CultureInfo.InvariantCulture
).ToString("MMM. dd, yyyy HH:mm:ss")
</code></pre> |
23,516,958 | ON DUPLICATE KEY + AUTO INCREMENT issue mysql | <p>I have table structure like this</p>
<p><img src="https://i.stack.imgur.com/jSr9u.png" alt="enter image description here"></p>
<p>when I insert row to the table I'm using this query:</p>
<p><code>INSERT INTO table_blah ( material_item, ... hidden ) VALUES ( data, ... data ) ON DUPLICATE KEY UPDATE id = id, materi... | 23,517,191 | 10 | 8 | null | 2014-05-07 11:46:49.36 UTC | 8 | 2021-12-07 02:58:53.373 UTC | 2014-05-07 11:50:36.763 UTC | null | 2,202,702 | null | 2,761,390 | null | 1 | 40 | mysql | 54,340 | <p>This behavior <a href="https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html" rel="noreferrer">is documented</a> (paragraph in parentheses):</p>
<blockquote>
<p>If you specify ON DUPLICATE KEY UPDATE, and a row is inserted that
would cause a duplicate value in a UNIQUE index or PRIMARY KEY, MySQL
performs... |
8,648,369 | How to change the time in apache server so it matches the computer's time (PHP)? | <p>In my particular case, both the server and the client are the same computer, I'm on localhost. When i echo out the date from the date() function, it displays a totally wrong value, a 11 hours earlier time. I also tried gmdate(), but it displays the date in AM not PM. Is there any way to change the apache server time... | 8,648,408 | 4 | 4 | null | 2011-12-27 19:18:08.847 UTC | 3 | 2019-07-04 15:49:38.61 UTC | 2011-12-27 19:40:32.587 UTC | null | 924,233 | null | 924,233 | null | 1 | 19 | php|apache | 105,266 | <p>I believe you are looking for: <code>date_default_timezone_set ( string $timezone_identifier )</code></p>
<p><a href="http://php.net/manual/en/function.date-default-timezone-set.php" rel="noreferrer">Link</a></p>
<p>You can also set this in your php.ini config.</p> |
8,395,269 | what do <form action="#"> and <form method="post" action="#"> do? | <p>I'm reading a book on html development (which I'm fairly new at) and despite the fact that the book just had its 1st publishing one month ago (Nov. 2011), the author is an experienced coder and maybe using <code>#</code> for the action in a form is old school? </p>
<p>Because I'm trying to get the gist of the samp... | 8,395,283 | 4 | 5 | null | 2011-12-06 04:14:59.45 UTC | 35 | 2020-01-30 01:09:07.097 UTC | 2019-09-19 11:49:39.447 UTC | null | 1,587,329 | null | 1,082,520 | null | 1 | 77 | html | 264,887 | <p>Action normally specifies the file/page that the form is submitted to (using the method described in the method paramater (post, get etc.))</p>
<p>An action of <code>#</code> indicates that the form stays on the same page, simply suffixing the url with a <code>#</code>. Similar use occurs in anchors. <code><a hr... |
5,508,033 | SPAN next to each other WITHOUT float | <p>How would you get three span's to sit side by side instead of going to the next line without using float in CSS? So I need all three of these to appear next to each other..or if there is another method without using float.
Thanks!</p>
<pre class="lang-html prettyprint-override"><code><span style="display:blo... | 5,508,047 | 4 | 3 | null | 2011-04-01 00:39:08.703 UTC | 1 | 2022-08-23 05:26:38.067 UTC | 2022-08-23 05:26:38.067 UTC | null | 872,328 | null | 676,028 | null | 1 | 15 | css|html | 40,715 | <p><code>display: inline-block;</code> or their natural (default) display of inline.. though you can give the inline-block a width and height</p> |
4,956,346 | How can I add remote repositories in Mercurial? | <p>I am working with Git repositories in the following way:</p>
<ul>
<li>I have the master repository and several remotes on the different production machines. </li>
<li>I am pushing the production code to the remotes and restart the services for the changes to take effect. </li>
</ul>
<p>I am about to switch from Gi... | 4,959,205 | 4 | 0 | null | 2011-02-10 11:13:14 UTC | 18 | 2022-02-12 13:34:47.377 UTC | 2018-10-09 19:58:59.467 UTC | null | 1,429,387 | null | 226,394 | null | 1 | 105 | mercurial|repository|hg-paths | 38,403 | <p>You add entries to the <code>[paths]</code> section of your local clone's <code>.hg/hgrc</code> file. Here's an example of a section that would go in the <code>.hg/hgrc</code> file:</p>
<pre><code>[paths]
remote1 = http://path/to/remote1
remote2 = http://path/to/remote2
</code></pre>
<p>You can then use commands ... |
5,017,582 | PHP Looping Template Engine - From Scratch | <p>For a group project I am trying to create a template engine for PHP for the people less experienced with the language can use tags like {name} in their HTML and the PHP will replace that tag with a predefined variable from an array. As well as supporting loops.</p>
<p>This is well beyond the expectations of the pro... | 5,018,400 | 6 | 0 | null | 2011-02-16 14:24:21.033 UTC | 11 | 2011-02-16 16:36:48.953 UTC | 2011-02-16 16:36:48.953 UTC | null | 193,376 | null | 193,376 | null | 1 | 16 | php|parsing|templates|nested-loops | 15,045 | <p>A simple approach is to convert the template into PHP and run it.</p>
<pre><code>$template = preg_replace('~\{(\w+)\}~', '<?php $this->showVariable(\'$1\'); ?>', $template);
$template = preg_replace('~\{LOOP:(\w+)\}~', '<?php foreach ($this->data[\'$1\'] as $ELEMENT): $this->wrap($ELEMENT); ?>'... |
5,329,472 | Conversion between absolute and relative paths in Delphi | <p>Are there standard functions to perform absolute <--> relative path conversion in Delphi?</p>
<p>For example:</p>
<ul>
<li>'Base' path is <code>'C:\Projects\Project1\'</code></li>
<li>Relative path is <code>'..\Shared\somefile.pas'</code></li>
<li>Absolute path is <code>'C:\Projects\Shared\somefile.pas'</code><... | 5,329,520 | 10 | 2 | null | 2011-03-16 17:47:08.05 UTC | 14 | 2022-05-01 09:28:54.647 UTC | 2011-12-11 00:18:55.957 UTC | null | 988,445 | null | 246,408 | null | 1 | 39 | delphi|path | 20,913 | <p>I would use <a href="http://msdn.microsoft.com/en-us/library/bb773740(VS.85).aspx" rel="noreferrer"><code>PathRelativePathTo</code></a> as the first function and <a href="http://msdn.microsoft.com/en-us/library/bb773569(VS.85).aspx" rel="noreferrer"><code>PathCanonicalize</code></a> as the second. In the latter case... |
29,347,790 | Difference between IOError and OSError? | <p>I am always getting confused on whether a function would raise an IOError or OSError (or both?). What is the principle rule behind these exception types, what is the difference between them and when is which raised?</p>
<p>I've initially thought OSError is for things like permission denial, but opening a file witho... | 29,347,946 | 2 | 6 | null | 2015-03-30 13:42:14.41 UTC | 7 | 2020-09-13 20:58:36.56 UTC | 2015-03-30 13:44:23.87 UTC | null | 791,713 | null | 791,713 | null | 1 | 46 | python|exception|python-2.x | 40,903 | <p>There is very little difference between the two types. In fact, even the core Python developers agreed that there is no real difference and removed <code>IOError</code> in Python 3 (it is now an alias for <code>OSError</code>). See <a href="https://www.python.org/dev/peps/pep-3151/#confusing-set-of-os-related-except... |
41,577,597 | sequelize "findbyid" is not a function but apparently "findAll" is | <p>I am getting a very strange problem with sequelize, When I try to call the function findAll it works fine (same for create and destroy), but when I try to call function "findById", it throws "findById is not a function" (same for "FindOne").</p>
<pre><code>//works fine
var gammes = models.gamme.findAll().then(funct... | 53,252,755 | 3 | 3 | null | 2017-01-10 20:16:54.373 UTC | 4 | 2020-07-10 06:40:44.59 UTC | null | null | null | null | 5,085,426 | null | 1 | 53 | node.js|orm|sequelize.js | 29,200 | <p>With Sequelize v5, findById() was replaced by findByPk(). Replace findById using findByPk and everything should work fine. You can find query doc <a href="https://sequelize.org/master/manual/model-querying-finders.html" rel="noreferrer">here</a></p> |
12,382,771 | mysql pivot/crosstab query | <p><strong>Question 1:</strong> I have a table with the below structure and data:</p>
<pre><code>app_id transaction_id mobile_no node_id customer_attribute entered_value
100 111 9999999999 1 Q1 2
100 111 9999999999 2 Q... | 12,386,127 | 3 | 0 | null | 2012-09-12 07:02:39.013 UTC | 9 | 2017-03-06 16:23:23.903 UTC | 2013-05-03 11:28:12.643 UTC | null | 573,261 | null | 1,586,706 | null | 1 | 13 | mysql|sql|pivot | 28,048 | <p>While @John's static answer works great, if you have an unknown number of columns that you want to transform, I would consider using prepared statements to get the results:</p>
<pre><code>SET @sql = NULL;
SELECT
GROUP_CONCAT(DISTINCT
CONCAT(
'GROUP_CONCAT((CASE node_id when ',
node_id,
' the... |
12,177,801 | What's the difference in Qt between setVisible, setShown and show/hide | <p>Please excuse this potentially noobish question but when trying to hide a QWidget what is the difference between calling setVisible(False), setShown(False) and hide()?</p> | 12,178,039 | 2 | 1 | null | 2012-08-29 12:19:36.623 UTC | 4 | 2015-12-07 06:43:33.403 UTC | null | null | null | null | 779,135 | null | 1 | 31 | qt|pyqt|hide|show|visible | 28,252 | <p><code>show()</code> is just a convenience function for <code>setVisible(true)</code>.</p>
<p>Similarly <code>hide()</code> is equivalent to <code>setVisible(false)</code></p>
<p>Internally, the same code is used to render your view.</p>
<p>See <a href="http://doc.qt.io/archives/qt-4.7/qwidget.html#show">http://do... |
12,519,074 | scrape websites with infinite scrolling | <p>I have written many scrapers but I am not really sure how to handle infinite scrollers. These days most website etc, Facebook, Pinterest has infinite scrollers.</p> | 26,814,351 | 3 | 2 | null | 2012-09-20 18:56:22.697 UTC | 20 | 2019-09-17 11:06:39.673 UTC | null | null | null | null | 200,317 | null | 1 | 31 | python|screen-scraping|scraper | 30,056 | <p>You can use selenium to scrap the infinite scrolling website like twitter or facebook. </p>
<p>Step 1 : Install Selenium using pip </p>
<pre><code>pip install selenium
</code></pre>
<p>Step 2 : use the code below to automate infinite scroll and extract the source code</p>
<pre><code>from selenium import webdriv... |
12,393,231 | Break statement inside two while loops | <p>Let's say I have this:</p>
<pre class="lang-java prettyprint-override"><code>while (a) {
while (b) {
if (b == 10) {
break;
}
}
}
</code></pre>
<p><strong>Question:</strong> Will the break statement take me out of both loops or only from the inner one? Thank you.</p> | 12,393,289 | 11 | 1 | null | 2012-09-12 17:12:25.697 UTC | 7 | 2021-06-01 18:28:00.37 UTC | 2021-06-01 18:28:00.37 UTC | null | 8,976 | null | 778,076 | null | 1 | 31 | java|while-loop|break | 100,501 | <p>In your example break statement will take you out of while(b) loop </p>
<pre><code>while(a) {
while(b) {
if(b == 10) {
break;
}
}
// break will take you here.
}
</code></pre> |
12,179,633 | Make shopt change local to function | <p>I'm trying to write a bash function that uses <code>nocasematch</code> without changing the callers setting of the option. The function definition is:</p>
<pre><code>is_hello_world() {
shopt -s nocasematch
[[ "$1" =~ "hello world" ]]
}
</code></pre>
<p>Before I call it:</p>
<pre><code>$ shopt nocasematch
noc... | 12,179,705 | 4 | 0 | null | 2012-08-29 13:56:17.483 UTC | 6 | 2021-02-07 23:40:39.927 UTC | 2018-10-25 05:16:11.867 UTC | null | 6,862,601 | null | 1,331,399 | null | 1 | 31 | bash|shopt | 4,558 | <p>The function body can be any compound command, not just a group command ( <code>{}</code> ). Use a sub-shell:</p>
<pre><code>is_hello_world() (
shopt -s nocasematch
[[ "$1" =~ "hello world" ]]
)
</code></pre> |
12,618,321 | What pool of characters do MD5 and SHA have? | <p>Does MD5 and SHA only contain alphanumeric characters? (i.e., from A to Z and 0 to 9, or do they exclude some characters?)</p> | 12,618,366 | 1 | 0 | null | 2012-09-27 09:34:16.5 UTC | 5 | 2015-05-04 11:15:53.42 UTC | null | null | null | null | 748,789 | null | 1 | 45 | hash|cryptography|md5|sha | 34,291 | <p>MD5 and SHA hashes in raw form are binary, however their common representation is a hex-encoded string, which contains characters <code>[a-fA-F0-9]</code>.</p>
<p>So if this is what you meant, then characters G-Z, g-z are "excluded".</p>
<p>Another, less common, representation is Base64 encoding [0-9a-zA-Z+/].</p> |
12,606,196 | What is the alternative to using the Deprecated Hamcrest method is()? | <p>I use the following code at the moment to assert on a <code>boolean</code> value, however the method <code>org.hamcrest.Matchers.is()</code> is deprecated.</p>
<pre><code>assertThat(someValue, is(false));
</code></pre>
<p>Is there a simple alternative syntax to test for boolean values without resorting to <code>as... | 12,606,235 | 5 | 6 | null | 2012-09-26 16:23:19.783 UTC | 7 | 2022-03-06 23:14:17.637 UTC | 2012-09-27 08:01:18.147 UTC | null | 713,106 | null | 713,106 | null | 1 | 57 | java|unit-testing|hamcrest | 41,989 | <p>Have you tried <code>equalTo(T)</code>?</p>
<pre><code>assertThat(someValue, equalTo(false));
</code></pre>
<p>I don't see that <a href="http://hamcrest.org/JavaHamcrest/javadoc/1.3/org/hamcrest/Matchers.html#is%28T%29" rel="noreferrer"><code>is(T)</code></a> is deprecated - <a href="http://hamcrest.org/JavaHamcre... |
12,140,844 | java.lang.RuntimeException: WakeLock under-locked C2DM_LIB | <p>I have uploaded my application on google play but users have reported the following exception</p>
<p><strong>java.lang.RuntimeException: WakeLock under-locked C2DM_LIB</strong>. This exception occurs when I try to release the <code>WakeLock</code>. Can anyone tell what could be the problem.</p> | 12,142,013 | 4 | 0 | null | 2012-08-27 11:08:44.91 UTC | 10 | 2014-07-12 19:17:30.397 UTC | 2012-11-15 08:04:14.983 UTC | null | 810,368 | null | 944,457 | null | 1 | 63 | android|android-service|android-c2dm|google-cloud-messaging | 42,013 | <p>I have traced same exception in new GCM Library too. Actually old C2DM Android library have same error, same crash, and Google hasn't fixed it yet. As I can see by our statistics, about 0.1% of users experiencing this crash.</p>
<p>My investigations shows that problem is in incorrect releasing of network <code>Wake... |
12,540,282 | Is Joda-Time DateTimeFormatter class thread safe? | <p>Is the <a href="http://www.joda.org/joda-time/">Joda-Time</a> <code>DateTimeFormatter</code> class <a href="https://en.wikipedia.org/wiki/Thread_safety">thread safe</a>? Once I get an instance from <code>DateTimeFormat.forPattern</code>, can its various parse methods be called by multiple threads? DateTimeFormatter'... | 12,540,298 | 3 | 0 | null | 2012-09-22 02:49:11.5 UTC | 7 | 2017-08-15 13:44:57.223 UTC | 2014-02-28 21:58:28.11 UTC | null | 642,706 | null | 24,396 | null | 1 | 64 | java|thread-safety|jodatime|date-format | 26,200 | <p><a href="http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html" rel="noreferrer">Yes, it is</a>:</p>
<blockquote>
<p>DateTimeFormat is thread-safe and immutable, and the <strong>formatters</strong> it
returns are as well.</p>
</blockquote>
<p>and so is the <a href="http://docs.oracle.c... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.