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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
18,789,973 | Sortable table columns with AngularJs | <p>I'm trying to sort a table of data which is populated from a JSON source. The code I have is as follows:</p>
<p>HTML:</p>
<pre><code><div ng-app="myApp">
<div ng-controller="PurchasesCtrl">
<table cellspacing="0">
<tr class="first">
<th class="fir... | 18,790,499 | 5 | 2 | null | 2013-09-13 15:26:06.56 UTC | 6 | 2019-10-08 16:23:23.28 UTC | null | null | null | null | 405,781 | null | 1 | 11 | angularjs|angularjs-ng-repeat | 40,165 | <p>Updated jsfiddle: <a href="http://jsfiddle.net/gweur/">http://jsfiddle.net/gweur/</a></p>
<p>sza is right, you did forget the $scope.sort object, but you are also missing the orderBy filter in your ng-repeat</p>
<pre><code>|orderBy:sort.column:sort.descending
</code></pre>
<p>Additionally, you'll need to explicit... |
19,205,547 | Implementing Simple SeekBar in android | <p><strong>Filters.java</strong></p>
<pre><code>public class Filters extends Activity implements OnSeekBarChangeListener{
private SeekBar PRICEbar,DISTANCEbar, RATINGbar; // declare seekbar object variable
// declare text label objects
private TextView PRICEtextProgress,DISTANCEtextProgress, RATINGtextProgr... | 19,205,579 | 5 | 2 | null | 2013-10-06 04:50:23.433 UTC | 3 | 2021-03-25 05:12:07.34 UTC | 2021-03-25 05:10:50.347 UTC | null | 874,188 | null | 1,083,093 | null | 1 | 14 | android|xml|seekbar | 54,770 | <p>You have already defined max value of seekbar </p>
<pre><code>android:max="100"
</code></pre>
<p>Now you need to add <strong>two textviews on left and right of seekbar</strong>. Use <strong>Relative layout</strong> and align both <strong>textviews Left and Right</strong> to the parent.</p> |
27,711,184 | Why is PIP raising an AssertionError on pip freeze? | <p>My console:</p>
<pre><code>desarrollador@desarrollador-HP-14-Notebook-PC1:~$ pip freeze
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/freeze.py"... | 27,948,576 | 7 | 4 | null | 2014-12-30 19:15:29.453 UTC | 6 | 2019-12-02 05:09:08.793 UTC | 2019-12-02 05:09:08.793 UTC | null | 498,256 | null | 1,105,249 | null | 1 | 39 | pip | 14,924 | <p>Reason: The python-pip package in Ubuntu 12.04 is seriously outdated and has some bugs with certain package names (as I can see) and cannot parse them correctly.</p>
<p>Solution: install a newer version of pip, via easy_install.</p> |
1,104,599 | Convert byte array to short array in C# | <p>I'm currently reading a file and wanted to be able to convert the array of bytes obtained from the file into a short array.</p>
<p>How would I go about doing this?</p> | 1,104,615 | 7 | 1 | null | 2009-07-09 15:23:28.097 UTC | 4 | 2016-11-15 09:59:24.383 UTC | null | null | null | null | 47,013 | null | 1 | 15 | c#|bytearray | 40,587 | <p>One possibility is using <a href="http://msdn.microsoft.com/en-us/library/bb548891.aspx" rel="noreferrer"><code>Enumerable.Select</code></a>:</p>
<pre><code>byte[] bytes;
var shorts = bytes.Select(b => (short)b).ToArray();
</code></pre>
<p>Another is to use <a href="http://msdn.microsoft.com/en-us/library/exc45... |
748,965 | What is a multibyte character set? | <p>Does the term multibyte refer to a charset whose characters can - but don't have to be - wider than 1 byte, (e.g. UTF-8) or does it refer to character sets which are in any case wider than 1 byte (e.g. UTF-16) ? In other words: What is meant if anybody talks about multibyte character sets?</p> | 749,028 | 9 | 0 | null | 2009-04-14 19:17:46.103 UTC | 8 | 2021-09-09 07:48:57.857 UTC | null | null | null | null | 49,628 | null | 1 | 45 | utf-8|terminology|multibyte | 92,935 | <p>The term is ambiguous, but in my internationalization work, we typically avoided the term "multibyte character sets" to refer to Unicode-based encodings. Generally, we used the term only for legacy encoding schemes that had one or more bytes to define each character (excluding encodings that require only one byte pe... |
455,061 | how do I check that two folders are the same in linux | <p>I have moved a web site from one server to another and I copied the files using SCP </p>
<p>I now wish to check that all the files have been copied OK.</p>
<p>How do I compare the sites?</p>
<p>Count files for a folder?</p>
<p>Get the total files size for folder tree?</p>
<p>or is there a better way to compare ... | 455,085 | 10 | 1 | null | 2009-01-18 12:36:32.797 UTC | 12 | 2016-03-14 10:05:07.88 UTC | 2009-01-18 13:27:52.577 UTC | Rob Wells | 2,974 | null | 3,582 | null | 1 | 30 | linux|web | 26,828 | <p>If you were using scp, you could probably have used <a href="http://samba.anu.edu.au/rsync/" rel="noreferrer">rsync</a>. </p>
<p>rsync won't transfer files that are already up to date, so you can use it to verify a copy is current by simply running rsync again.</p>
<p>If you were doing something like this on the o... |
124,143 | Why are Exceptions not Checked in .NET? | <p>I know Googling I can find an appropriate answer, but I prefer listening to your personal (and maybe technical) opinions.<br/>
<strong>What is the main reason of the difference between Java and C# in throwing exceptions?</strong><br/>
In Java the signature of a method that throws an exception has to use the "throws"... | 124,175 | 10 | 0 | null | 2008-09-23 21:52:24.603 UTC | 17 | 2016-03-11 21:47:50.383 UTC | 2008-09-26 20:06:31.53 UTC | Dima | 13,313 | Scuffia | 68,336 | null | 1 | 42 | java|.net|exception | 9,997 | <p>Because the response to checked exceptions is almost always:</p>
<pre><code>try {
// exception throwing code
} catch(Exception e) {
// either
log.error("Error fooing bar",e);
// OR
throw new RuntimeException(e);
}
</code></pre>
<p>If you actually know that there is something you can do if a particula... |
248,760 | VB6 Editor changing case of variable names | <p>I'm not much of a Visual Basic person, but I am tasked with maintaining an old VB6 app. Whenever I check out a file, the editor will replace a bunch of the uppercase variable names with lowercase automatically. How can I make this stop!? I don't want to have to change them all back, and it's a pain to have these ... | 248,853 | 10 | 1 | null | 2008-10-29 23:11:37.143 UTC | 11 | 2021-03-17 20:36:16.273 UTC | 2019-12-17 09:16:22.187 UTC | Mike Spross | 12,258,312 | Laure | 32,613 | null | 1 | 42 | ide|vb6 | 19,057 | <p>Continuing from <a href="https://stackoverflow.com/questions/248760/vb6-editor-changing-case-of-variable-names#248773">DJ's answer</a>...</p>
<p>And it won't only change the case of variables in the same scope either.</p>
<p>It will change the case of all variables with the same name in your entire project. So eve... |
270,138 | How do I draw lines using XNA? | <p>I've read a bunch of tutorials involving XNA (and it's various versions) and I still am a little confused on drawing primitives. Everything seems to be really convoluted.</p>
<p>Can someone show me, using code, the simplest XNA implementation of drawing one or two lines on to the screen? Perhaps with a brief expl... | 270,179 | 10 | 0 | null | 2008-11-06 20:32:02.497 UTC | 10 | 2020-04-25 18:34:42.12 UTC | 2008-11-06 20:37:38.6 UTC | Simucal | 2,635 | Simucal | 2,635 | null | 1 | 46 | drawing|xna|lines|primitive|shapes | 63,927 | <p>When working with XNA, everything (even 2d primitives) have to be expressed in a way that a 3d card can understand, which means that a line is just a set of vertices.</p>
<p>MSDN has a pretty good walkthrough here:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb196414.aspx#ID2EEF" rel="noreferrer">http:... |
322,470 | Can I invoke an instance method on a Ruby module without including it? | <h3>Background:</h3>
<p>I have a module which declares a number of instance methods</p>
<pre><code>module UsefulThings
def get_file; ...
def delete_file; ...
def format_text(x); ...
end
</code></pre>
<p>And I want to call some of these methods from within a class. How you normally do this in ruby is like this... | 322,526 | 10 | 2 | null | 2008-11-26 23:03:37.793 UTC | 52 | 2019-10-01 23:48:14.28 UTC | 2014-09-11 16:06:09.63 UTC | Orion Edwards | 322,020 | Orion Edwards | 234 | null | 1 | 206 | ruby|module|methods | 155,639 | <p>If a method on a module is turned into a module function you can simply call it off of Mods as if it had been declared as</p>
<pre><code>module Mods
def self.foo
puts "Mods.foo(self)"
end
end
</code></pre>
<p>The module_function approach below will avoid breaking any classes which include all of Mods.</p>... |
708,352 | How do I reinitialize or reset the properties of a class? | <p>I've created a class with properties that have default values. At some point in the object's lifetime, I'd like to "reset" the object's properties back to what they were when the object was instantiated. For example, let's say this was the class:</p>
<pre><code>public class Truck {
public string Name = "Super Tr... | 708,363 | 11 | 0 | null | 2009-04-02 04:56:26.79 UTC | 1 | 2022-05-18 20:32:38.503 UTC | null | null | null | Dylan | 551 | null | 1 | 15 | c#|class|properties|instantiation | 59,586 | <p>You can have the initialization in a method instead of inlining with the declaration. Then have the constructor and reset method call the initialization method:</p>
<pre><code>public class Truck {
public string Name;
public int Tires;
public Truck() {
Init();
}
public void ResetTruck() {
... |
1,341,847 | Apostrophe (') in XPath query | <p>I use the following <code>XPATH Query</code> to list the object under a site. <code>ListObject[@Title='SomeValue']</code>. SomeValue is dynamic. This query works as long as SomeValue does not have an apostrophe ('). Tried using escape sequence also. Didn't work. </p>
<p>What am I doing wrong?</p> | 1,352,556 | 11 | 2 | null | 2009-08-27 15:31:12.493 UTC | 12 | 2022-06-09 05:31:17.26 UTC | 2021-10-10 13:42:44.827 UTC | null | 290,085 | null | 141,282 | null | 1 | 42 | c#|java|xml|xpath | 44,283 | <p>This is surprisingly difficult to do.</p>
<p>Take a look at the <a href="http://www.w3.org/TR/xpath" rel="noreferrer">XPath Recommendation</a>, and you'll see that it defines a literal as:</p>
<pre><code>Literal ::= '"' [^"]* '"'
| "'" [^']* "'"
</code></pre>
<p>Which is to say, string literals in ... |
447,456 | What the typical viewport size on a 1024x768 screen? | <p>I am designing a web application, and I wish to know the largest size (x and y) that I can design for.</p>
<p><a href="http://www.w3schools.com/browsers/browsers_display.asp" rel="nofollow noreferrer">As of January 2008</a>, about half of users are using 1024x278 screens, and probably less than 10% are using smalle... | 1,921,958 | 13 | 0 | null | 2009-01-15 16:28:01.26 UTC | 8 | 2015-04-15 22:56:04.003 UTC | 2017-05-23 12:17:05.463 UTC | null | -1 | mcherm | 14,570 | null | 1 | 25 | html|browser|cross-browser | 69,763 | <p>Today I just came across a site which is HIGHLY relevant to this old question of mine. Apparently Google is willing to share their knowledge about browser window sizes. Their new service is at <a href="http://browsersize.googlelabs.com/" rel="nofollow noreferrer">http://browsersize.googlelabs.com/</a> and it basical... |
226,689 | Unique element ID, even if element doesn't have one | <p>I'm writing a GreaseMonkey script where I'm iterating through a bunch of elements. For each element, I need a string ID that I can use to reference that element later. The element itself doesn't have an <code>id</code> attribute, and I can't modify the original document to give it one (although I can make DOM change... | 230,114 | 13 | 4 | null | 2008-10-22 16:58:56.097 UTC | 8 | 2017-07-07 07:36:52.02 UTC | 2008-10-23 15:04:27.76 UTC | Robert J. Walker | 4,287 | Robert J. Walker | 4,287 | null | 1 | 42 | javascript|firefox|dom|greasemonkey | 43,020 | <p><strong>UPDATE:</strong> Closures are indeed the answer. So after fiddling with it some more, I figured out why closures were initially problematic and how to fix it. The tricky thing with a closure is you have to be careful when iterating through the elements not to end up with all of your closures referencing the ... |
334,708 | GET parameters in the URL with CodeIgniter | <p>I know that codeIgniter turns off GET parameters by default. </p>
<p>But by having everything done in POST, don't you get annoyed by the re-send data requests if ever you press back after a form submission?</p>
<p>It annoys me, but I'm not sure if I want to allow GET purely for this reason.</p>
<p>Is it such a b... | 334,787 | 17 | 1 | null | 2008-12-02 17:05:36.66 UTC | 22 | 2021-02-02 23:40:45.673 UTC | 2011-11-09 11:40:40.303 UTC | null | 42,106 | null | 42,106 | null | 1 | 49 | html|codeigniter|post|get | 205,596 | <p>When I first started working with CodeIgniter, not using GET really threw me off as well. But then I realized that you can simulate GET parameters by manipulating the URI using the built-in <a href="http://codeigniter.com/user_guide/libraries/uri.html" rel="noreferrer">URI Class</a>. It's fantastic and it makes your... |
6,935,006 | Making curl send errors to stderr and everything else to stdout | <p>Is there a way to tell curl to output errors to stderr, and everything else to stdout?</p>
<p>The reason is that I am using curl from the command line (actually a cronjob) to upload a file to an FTP site every evening. Unfortunately because curl outputs status information on stderr, I receive an e-mail about an er... | 6,935,338 | 4 | 0 | null | 2011-08-04 00:49:35.463 UTC | 3 | 2022-03-08 09:54:15.87 UTC | 2016-12-22 08:16:57.887 UTC | null | 308,237 | null | 308,237 | null | 1 | 43 | curl|stdout|stderr | 46,103 | <p>After some more experimentation I have come up with the following workaround, but I'm still open to better alternatives.</p>
<p>It works by temporarily storing all output (stdout and stderr) in a temporary file, and then sending the contents of that file to stderr or stdout depending on curl's exit code. If curl f... |
6,374,874 | How to change the default time zone in R? | <p>How can I change the default timezone in R?
I'm working with time series. All my time series are defined in UTC time zone, but if I print a date it is always done in CET/CEST time zone. </p> | 6,408,072 | 4 | 2 | null | 2011-06-16 15:55:52.107 UTC | 21 | 2018-05-25 09:25:54.893 UTC | 2018-05-25 09:25:54.893 UTC | null | 202,229 | Paul PUGET | 802,890 | null | 1 | 69 | r|timezone|date-arithmetic | 59,375 | <p>Another way to do it, without changing the whole computer time is using the setenv command like this : <code>Sys.setenv(TZ='GMT')</code></p> |
6,873,973 | How to find Control in TemplateField of GridView? | <p>How does <code>FindControl</code> method works if I need to find any <code>Control</code> which is inside <code>GridView</code> <code>Template</code>, more specifically <code>ItemTemplate</code>?</p>
<p>I have a <code>hyperlink</code> but it is not able to find the same.</p>
<p><strong>Question updated with code</... | 6,874,083 | 7 | 0 | null | 2011-07-29 13:34:57.077 UTC | 5 | 2019-02-18 13:00:34.183 UTC | 2017-07-01 11:39:14.99 UTC | null | 1,305,969 | null | 224,636 | null | 1 | 29 | c#|asp.net|gridview|findcontrol|templatefield | 212,320 | <p>Try this:</p>
<pre><code>foreach(GridViewRow row in GridView1.Rows) {
if(row.RowType == DataControlRowType.DataRow) {
HyperLink myHyperLink = row.FindControl("myHyperLinkID") as HyperLink;
}
}
</code></pre>
<p>If you are handling RowDataBound event, it's like this:</p>
<pre><code>protected void Gr... |
6,549,149 | Extending the defaults of a Model superclass in Backbone.js | <p>I would like to pose this as a question to <a href="https://stackoverflow.com/questions/6505873/in-backbone-js-how-can-i-get-model-superclass-defaults-to-act-as-defaults-for-sub/6508530#6508530">this</a> answer but I can't seem to do so, I apologize.</p>
<p>Extending the defaults for the subclass are reflected in t... | 6,550,191 | 7 | 0 | null | 2011-07-01 14:15:48.157 UTC | 8 | 2015-10-25 23:33:15.307 UTC | 2017-05-23 12:16:50.12 UTC | null | -1 | null | 307,827 | null | 1 | 37 | javascript|backbone.js|prototypal-inheritance | 17,867 | <p>The problem is that <code>Inventory.prototype.defaults</code> and <code>Extended.prototype.defaults</code> has the same reference, because you have not override the reference.</p>
<p>So you can do this in 2 ways, maybe more but i only found this 2:</p>
<p><strong>Edit:</strong> The first example is incorrect (see ... |
6,340,664 | Delete a particular local notification | <p>I am developing an iPhone alarm app based on local notifications.</p>
<p>On deleting an alarm, the related local notification should get cancelled. But how can I determine exactly which object from the array of local notifications is to be cancelled?</p>
<p>I am aware of <code>[[UIApplication sharedApplication] ca... | 6,341,476 | 13 | 0 | null | 2011-06-14 07:57:36.77 UTC | 47 | 2019-08-29 21:58:54.603 UTC | 2017-11-06 04:58:21.453 UTC | null | 2,303,865 | null | 770,817 | null | 1 | 92 | objective-c|iphone|uilocalnotification|usernotifications | 71,817 | <p>You can save a unique value for key in your local notification's userinfo.
Get all local notification, loop through the array and delete the particular notification.</p>
<p>Code as follows,</p>
<p><strong>OBJ-C:</strong></p>
<pre><code>UIApplication *app = [UIApplication sharedApplication];
NSArray *eventArray = ... |
45,500,836 | Close multiple goroutine if an error occurs in one in go | <p>consider this function :</p>
<pre><code>func doAllWork() error {
var wg sync.WaitGroup
for i := 0; i < 2; i++ {
wg.add(1)
go func() {
defer wg.Done()
for j := 0; j < 10; j++ {
result, err := work(j)
if err != nil {
... | 45,502,591 | 3 | 4 | null | 2017-08-04 07:37:37.303 UTC | 9 | 2020-09-30 17:01:11.623 UTC | 2020-07-02 22:52:28.45 UTC | null | 6,858,274 | null | 6,858,274 | null | 1 | 22 | go|error-handling|synchronization|exit|goroutine | 16,536 | <p>You may use the <a href="https://golang.org/pkg/context/" rel="noreferrer"><code>context</code></a> package which was created for things like this (<em>"carries deadlines, cancelation signals..."</em>).</p>
<p>You create a context capable of publishing cancelation signals with <a href="https://golang.org/pkg/contex... |
41,495,658 | Use custom build output folder when using create-react-app | <p>Facebook provides a <code>create-react-app</code> <a href="https://github.com/facebookincubator/create-react-app" rel="noreferrer">command</a> to build react apps. When we run <code>npm run build</code>, we see output in <code>/build</code> folder. </p>
<blockquote>
<p>npm run build</p>
<p>Builds the app for... | 41,495,859 | 17 | 2 | null | 2017-01-05 22:13:16.807 UTC | 35 | 2022-01-10 23:07:52.497 UTC | null | null | null | null | 4,130,867 | null | 1 | 142 | reactjs|create-react-app | 222,039 | <p>Edit: Support for a configurable <code>BUILD_PATH</code> just landed into v4.0.2. See <a href="https://stackoverflow.com/a/66036117/1333836">t_dom93's answer</a>.</p>
<p>You can't change the build output folder name with the current configuration options.</p>
<p>Moreover, you shouldn't. This is a part of <a href="ht... |
15,751,723 | How to train a neural network to supervised data set using pybrain black-box optimization? | <p>I have played around a bit with pybrain and understand how to generate neural networks with custom architectures and train them to supervised data sets using backpropagation algorithm. </p>
<p>However I am confused by the optimization algorithms and the concepts of tasks, learning agents and environments. </p>
<p>... | 15,868,489 | 1 | 1 | null | 2013-04-01 20:55:20.637 UTC | 12 | 2015-08-05 00:39:35.81 UTC | 2013-04-13 13:19:47.567 UTC | null | 1,376,627 | null | 1,376,627 | null | 1 | 20 | python|artificial-intelligence|neural-network|pybrain | 10,815 | <p>I finally worked it out!! Its always easy once you know how! </p>
<p>Essentially the first arg to the GA is the fitness function (called evaluator in docs) which must take the second argument (an individual, called evaluable in docs) as its only arg. </p>
<p>In this example will train to XOR</p>
<pre><code>from p... |
15,814,346 | Is it possible to use css to make a background image "fade" or gradient the bottom portion to transparent so that a background color shows? | <p>I know that this can easily be done in any image editing program, I was just curious if there was a way just using css.</p>
<p>Example:</p>
<pre><code>body {background-color: #837960; background-image: url("Images/background.jpg") background-repeat: no-repeat;}
</code></pre>
<p>Could you use css to fade the backg... | 15,814,561 | 3 | 7 | null | 2013-04-04 14:39:28.387 UTC | 3 | 2019-02-23 14:27:05.74 UTC | null | null | null | null | 1,839,715 | null | 1 | 23 | css | 67,623 | <p>It is possible - in CSS3 you can set multiple values for background</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>body {
background: #837960 url("https://i.stack.im... |
15,641,898 | Python: timezone.localize() not working | <p>I am having some issues getting <code>timezone.localize()</code> to work correctly. My goal is to grab today's date and convert it from CST to EST. Then finally format the datetime before spitting it out. I am able to format the date correctly, but the datetime is not changing from CST to EST. Additionally when I fo... | 15,642,065 | 2 | 2 | null | 2013-03-26 16:09:21.183 UTC | 2 | 2013-03-26 16:29:54.82 UTC | 2013-03-26 16:29:54.82 UTC | null | 1,086,571 | null | 1,086,571 | null | 1 | 27 | python|datetime|timezone | 41,632 | <p><code>.localize()</code> takes a naive datetime object and interprets it <em>as if</em> it is in that timezone. It does <em>not</em> move the time to another timezone. A naive datetime object has <em>no</em> timezone information to be able to make that move possible.</p>
<p>You want to interpret <code>now()</code> ... |
15,576,009 | How to make HashMap work with Arrays as key? | <p>I am using boolean arrays as keys for a HashMap. But the problem is HashMap fails to get the keys when a different array is passed as key, although the elements are same. (As they are different objects). </p>
<p>How can I make it work with arrays as keys ?
Here is the code :</p>
<pre><code>public class main {
pub... | 15,576,112 | 9 | 2 | null | 2013-03-22 17:02:20.137 UTC | 11 | 2020-02-21 19:28:35.923 UTC | null | null | null | null | 564,503 | null | 1 | 35 | java|arrays|hashmap | 44,088 | <p>You cannot do it this way. Both <code>t</code> and <code>a</code> will have different <code>hashCode()</code> values because the the <code>java.lang.Array.hashCode()</code> method is inherited from <code>Object</code>, which uses the reference to compute the hash-code (default implementation). Hence the hash code fo... |
15,872,254 | Android NDK: WARNING: APP_PLATFORM android-9 is larger than android:minSdkVersion 8 | <p>I am getting the following warning when compiling my cocos2d-x project with cygwin.</p>
<pre><code>`/cygdrive/e/project/MyGame/proj.android `
/cygdrive/e/android-ndk-r8e/build/core/add-application.mk:128: Android NDK: WARNING:APP_PLATFORM android-9 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
</c... | 15,887,984 | 3 | 3 | null | 2013-04-08 06:01:19.777 UTC | 7 | 2016-12-10 20:28:01.723 UTC | null | null | null | null | 1,495,342 | null | 1 | 42 | android|android-ndk|cygwin|cocos2d-x | 36,002 | <p>It seems that you are using Android-9 as runtime. You can put <code>APP_PLATFORM := android-8</code> in your <code>Application.mk</code> file and the warning will disappear.</p> |
15,750,535 | Using mysqldump to format one insert per line? | <p>This has been asked a few times but I cannot find a resolution to my problem. Basically when using mysqldump, which is the built in tool for the MySQL Workbench administration tool, when I dump a database using extended inserts, I get massive long lines of data. I understand why it does this, as it speeds inserts by... | 19,961,480 | 9 | 2 | null | 2013-04-01 19:43:09.16 UTC | 11 | 2020-05-22 09:19:04.483 UTC | null | null | null | null | 443,943 | null | 1 | 61 | mysql|mysqldump|mysql-workbench|mysqladministrator | 27,512 | <p>With the default mysqldump format, each record dumped will generate an individual INSERT command in the dump file (i.e., the sql file), each on its own line. This is perfect for source control (e.g., svn, git, etc.) as it makes the diff and delta resolution much finer, and ultimately results in a more efficient sour... |
15,734,031 | Why does the preflight OPTIONS request of an authenticated CORS request work in Chrome but not Firefox? | <p>I am writing a JavaScript client to be included on 3rd party sites (think Facebook Like button). It needs to retrieve information from an API that requires basic HTTP authentication. The simplified setup looks like this:</p>
<p>A 3rd party site includes this snippet on their page:</p>
<pre><code><script
async=... | 15,734,032 | 3 | 1 | null | 2013-03-31 20:14:42.697 UTC | 19 | 2020-06-26 12:54:29.03 UTC | 2017-05-23 12:18:11.943 UTC | null | -1 | null | 613,588 | null | 1 | 70 | javascript|ajax|cors | 114,088 | <p><strong>Why <em>does</em> it work in Chrome and not Firefox?</strong></p>
<p>The <a href="https://fetch.spec.whatwg.org/#cors-protocol-and-credentials" rel="noreferrer">W3 spec for CORS preflight requests</a> clearly states that user credentials should be excluded. There is a bug in <a href="https://code.google.com/... |
15,821,532 | Get current AUTO_INCREMENT value for any table | <p>How do I get the current AUTO_INCREMENT value for a table in MySQL?</p> | 15,821,543 | 9 | 1 | null | 2013-04-04 20:55:27.94 UTC | 81 | 2021-12-25 03:09:55.113 UTC | 2014-05-05 18:47:56.21 UTC | null | 19,405 | null | 2,246,727 | null | 1 | 357 | mysql|auto-increment | 375,131 | <p>You can get all of the table data by using this query:</p>
<pre><code>SHOW TABLE STATUS FROM `DatabaseName` WHERE `name` LIKE 'TableName' ;
</code></pre>
<p>You can get exactly this information by using this query:</p>
<pre><code>SELECT `AUTO_INCREMENT`
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'Databa... |
10,415,653 | Run Batch file as administrator - Windows 7 - Command "Run As" from network file system | <p>I need to set up the delivery of a program installer.</p>
<p>This program has a program_installer.exe and a folder that i cannot include in the installer at the time in which i create the installer.</p>
<p>therefore, when a user needs to install the program i send him a BATCH file via MAIL</p>
<pre><code>@echo of... | 10,415,764 | 3 | 4 | null | 2012-05-02 14:19:56.487 UTC | 1 | 2014-09-17 09:53:48.773 UTC | 2012-05-02 14:31:17.433 UTC | null | 1,207,195 | null | 958,744 | null | 1 | 7 | shell|batch-file|cmd|dos|administration | 50,014 | <p>It's a little bit tricky but it can be done.</p>
<p>First you have to know (from the batch file) if the user is an administrator. If it is then you can simply go on with installation. If it's not you can run another cmd.exe instance to run the batch file as administrator (using the <code>runas</code> command).</p>
... |
10,717,249 | Get current domain | <p>I have my site on the server <code>http://www.myserver.uk.com</code>.</p>
<p>On this server I have two domains:</p>
<pre class="lang-none prettyprint-override"><code>one.com and two.com
</code></pre>
<p>I would like to get the current domain using PHP, but if I use <code>$_SERVER['HTTP_HOST']</code> then it is showi... | 10,717,309 | 8 | 7 | null | 2012-05-23 09:36:29.727 UTC | 37 | 2021-08-21 18:11:11.337 UTC | 2021-08-21 17:50:25.993 UTC | null | 63,550 | null | 1,381,903 | null | 1 | 182 | php|url|php-5.2 | 443,353 | <p>Try using this:</p>
<pre><code>$_SERVER['SERVER_NAME']
</code></pre>
<p>Or parse:</p>
<pre><code>$_SERVER['REQUEST_URI']
</code></pre>
<p>Reference: <em><a href="http://php.net/manual/en/function.apache-request-headers.php" rel="noreferrer">apache_request_headers()</a></em></p> |
67,798,798 | Unhandled Exception: Null check operator used on a null value shared preference | <p>so I tried Shared preference to make user still logged in until they log out but when i tried to restart the app this appears</p>
<pre><code>[VERBOSE-2:ui_dart_state.cc(199)] Unhandled Exception: Null check operator used on a null value
#0 MethodChannel.binaryMessenger (package:flutter/src/services/platform_cha... | 68,178,721 | 4 | 9 | null | 2021-06-02 04:08:59.21 UTC | 3 | 2021-06-29 12:30:42.837 UTC | null | null | null | null | 15,957,792 | null | 1 | 29 | flutter|dart | 9,333 | <p>Make sure to call <code>WidgetsFlutterBinding.ensureInitialized();</code> before <code>await SharedPreferences.getInstance();</code></p>
<p>For example in your main.dart:</p>
<pre><code>void main() async {
await runZonedGuarded(
() async {
WidgetsFlutterBinding.ensureInitialized();
final prefs = a... |
25,081,757 | What's NSLocalizedString equivalent in Swift? | <p>Is there an Swift equivalent of <code>NSLocalizedString(...)</code>?
In <code>Objective-C</code>, we usually use:</p>
<pre><code>NSString *string = NSLocalizedString(@"key", @"comment");
</code></pre>
<p>How can I achieve the same in Swift? I found a function:</p>
<pre><code>func NSLocalizedString(
key: Strin... | 25,081,758 | 16 | 4 | null | 2014-08-01 13:48:47.663 UTC | 63 | 2021-04-14 13:30:38.18 UTC | 2016-01-18 20:12:12.293 UTC | null | 1,634,890 | null | 348,796 | null | 1 | 239 | ios|swift|localization|nslocalizedstring | 124,119 | <p>The <code>NSLocalizedString</code> exists also in the Swift's world.</p>
<pre><code>func NSLocalizedString(
key: String,
tableName: String? = default,
bundle: NSBundle = default,
value: String = default,
#comment: String) -> String
</code></pre>
<p>The <code>tableName</code>, <code>bundle</c... |
31,978,324 | What exactly is std::atomic? | <p>I understand that <code>std::atomic<></code> is an atomic object. But atomic to what extent? To my understanding an operation can be atomic. What exactly is meant by making an object atomic? For example if there are two threads concurrently executing the following code:</p>
<pre><code>a = a + 12;
</code></pre... | 31,978,762 | 3 | 4 | null | 2015-08-13 02:00:06.16 UTC | 137 | 2021-05-24 11:48:00.55 UTC | 2019-06-02 04:01:21.827 UTC | user4386938 | 963,864 | user4386938 | null | null | 1 | 246 | c++|multithreading|c++11|atomic | 212,735 | <p>Each instantiation and full specialization of <a href="http://en.cppreference.com/w/cpp/atomic/atomic" rel="noreferrer">std::atomic<></a> represents a type that different threads can simultaneously operate on (their instances), without raising undefined behavior:</p>
<blockquote>
<p>Objects of atomic types are... |
10,408,740 | Why does in_array() wrongly return true with these (large numeric) strings? | <p>I am not getting what is wrong with this code. It's returning "Found", which it should not.</p>
<pre><code>$lead = "418176000000069007";
$diff = array("418176000000069003","418176000000057001");
if (in_array($lead,$diff))
echo "Found";
else
echo "Not found";
</code></pre> | 10,408,802 | 9 | 10 | null | 2012-05-02 06:27:13.65 UTC | 13 | 2020-05-18 11:46:31.857 UTC | 2012-05-31 13:15:17.807 UTC | null | 367,456 | null | 929,265 | null | 1 | 43 | php|arrays | 8,189 | <p><strong>Note: <em>This was a bug in PHP old versions and is corrected in <code>PHP 5.4</code> and newer versions.</em></strong> </p>
<p>It is because of the limitations of the number storage in <code>PHP</code></p>
<p>The real problem here is because of the <code>PHP_INT_MAX</code> - the value exceeded in our case... |
41,102,299 | Pip Error : 'module' object has no attribute 'Cryptography_HAS_SSL_ST' | <p>I tried to install from pip and keep on getting similar type of errors.</p>
<pre><code>$ pip install quandl
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
File "/usr/lib/python2.7/dist-packages/pkg_resources/__init... | 45,853,179 | 9 | 7 | null | 2016-12-12 13:45:05.68 UTC | 8 | 2019-01-20 20:58:30.053 UTC | 2018-06-16 20:20:16.207 UTC | null | 5,908,241 | null | 5,908,241 | null | 1 | 17 | python|linux|ubuntu|openssl|pip | 29,262 | <p>Ubuntu 16.04.3 here:</p>
<p>I think I have fixed this by removing the python-openssl package (and it's dependencies) with:</p>
<pre><code>apt-get --auto-remove remove python-openssl
</code></pre>
<p>Then installing the latest version with pip:</p>
<pre><code>pip install pyOpenSSL
</code></pre>
<p>Of course, if ... |
51,911,368 | What restriction is perf_event_paranoid == 1 actually putting on x86 perf? | <p>Newer Linux kernels have a sysfs tunable <code>/proc/sys/kernel/perf_event_paranoid</code> which allows the user to adjust the available functionality of <code>perf_events</code> for non-root users, with higher numbers being more secure (offering correspondingly less functionality):</p>
<p>From the <a href="https:/... | 51,919,744 | 1 | 5 | null | 2018-08-18 18:08:54.447 UTC | 9 | 2018-08-19 16:36:25.46 UTC | null | null | null | null | 149,138 | null | 1 | 27 | linux-kernel|x86|profiling|perf|intel-pmu | 23,689 | <p>In this case <em>CPU event</em> refers to monitoring events per CPU rather than per task. For <code>perf</code> tools this restricts the usage of</p>
<pre><code>-C, --cpu=
Count only on the list of CPUs provided. Multiple CPUs can be provided as a comma-separated list with no space: 0,1.
Ranges of CPUs are ... |
51,891,415 | NullPointerException on Meizu devices in Editor.updateCursorPositionMz | <p>Lately, there have been crashes on my Android app, on Meizu devices <strong>only</strong> (M5c, M5s, M5 Note). Android version: 6.0.</p>
<p>Here is the full stack trace:</p>
<pre><code>Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getLineForOffset(int)' ... | 52,001,305 | 9 | 6 | null | 2018-08-17 08:34:49.783 UTC | 16 | 2019-08-06 12:47:08.957 UTC | null | null | null | null | 4,561,039 | null | 1 | 73 | android|textview|meizu | 10,715 | <h2>Update (Aug. 8, 2019)</h2>
<p>As @andreas-wenger, @waseefakhtar and @vadim-kotov mentioned, the fix is now included from <a href="https://github.com/material-components/material-components-android/releases" rel="noreferrer">com.google.android.material:material:1.1.0-alpha08</a> onwards.</p>
<h2>Old answer</h2>
<... |
28,795,975 | iOS App Rejection due to 2.23 - iOS Data Storage Guidelines | <p>Here's message from Apple about rejection : </p>
<blockquote>
<p>2.23 - Apps must follow the iOS Data Storage Guidelines or they will be rejected
2.23 Details</p>
<p>On launch and content download, your app stores 6.5 MB, which does not
comply with the iOS Data Storage Guidelines.</p>
<p>Next Steps<... | 29,182,488 | 3 | 11 | null | 2015-03-01 16:28:19.877 UTC | 10 | 2016-07-15 03:17:59.737 UTC | 2015-03-02 20:54:42.04 UTC | null | 1,011,777 | null | 1,011,777 | null | 1 | 20 | ios|objective-c|app-store|appstore-approval | 7,006 | <p>I just got the same rejection message yesterday.</p>
<p>I use the following code in <code>application:didFinishLaunchingWithOptions:</code> to see what my application has inside the documents folder and what is the permission of each item about iCloud backup:</p>
<pre><code>NSArray *paths = NSSearchPathForDirector... |
28,521,583 | UIPopoverPresentationController on iPhone doesn't produce popover | <p>I'm trying to implement the new <code>UIPopoverPresentationController</code> in my iPhone app (using Objective C). What I want is a simple popover with a tableview that emanates from the initiating button.</p>
<p><strong>--Edit--</strong></p>
<p>Here's my <strong>REVISED</strong> code, adapted from research in the... | 28,521,768 | 5 | 13 | null | 2015-02-14 23:50:18.46 UTC | 17 | 2022-05-25 12:22:21.257 UTC | 2015-02-15 04:36:59.87 UTC | null | 2,671,035 | null | 2,671,035 | null | 1 | 33 | ios|objective-c|iphone|popover | 37,356 | <p>Steps:</p>
<p>A) Link your <code>UIButton</code> to the popover's view controller using the <code>Present As Popover</code> segue type. I actually had to create a new project to get this to appear but it's probably something to do with the base SDK.</p>
<p>B) Make the View Controller containing the <code>UIButton<... |
9,440,380 | Using an instance of an object as a key in hashmap, and then access it with exactly new object? | <p>I have a hasmap with a key object, </p>
<pre><code>HashMap<Key, Object> test;
</code></pre>
<p>and make new Key("the same") as key..</p>
<p>so its like..:</p>
<pre><code>test.put(new Key("the same"), someObject);
</code></pre>
<p>(without storing that key in a variable)</p>
<p>so.. after a while... i wan... | 9,440,411 | 3 | 2 | null | 2012-02-25 01:44:37.703 UTC | 18 | 2015-12-16 14:56:58.923 UTC | null | null | null | null | 448,451 | null | 1 | 51 | java|hashmap | 138,678 | <p>You need to implement <code>hashCode</code> and <code>equals</code> on <code>Key</code>. The <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals%28java.lang.Object%29">default implementation</a> of these methods simply checks for <em>instance</em> equality (in other words, two <code>Objec... |
16,062,893 | Why does @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) fix Hibernate Lazy Loading Exceptions? | <p>I switched an app I am working on from using AspectJ load time weaving to using Spring CGlib proxies and right after I did that there were many parts of the code where I started to get hibernate lazy loading exceptions where in the past there were no exceptions being thrown.</p>
<p>I have been able to resolve these... | 16,555,359 | 2 | 0 | null | 2013-04-17 14:33:03.803 UTC | 9 | 2013-05-21 15:07:39.477 UTC | 2013-05-21 15:07:39.477 UTC | null | 438,319 | null | 438,319 | null | 1 | 18 | java|spring|hibernate | 9,392 | <p>I assume your code is not using <code>OpenSessionInViewFilter</code> or anything similar.</p>
<p>Without the <code>@Transactional</code> annotation, the Hibernate session is closed after leaving the <code>BarRepository.findSomeEntity()</code> method.</p>
<p>When a <code>@Transactional</code> method is called and t... |
16,455,777 | Python Count Elements in a List of Objects with Matching Attributes | <p>I am trying to find a simple and fast way of counting the number of Objects in a list that match a criteria.
e.g.</p>
<pre><code>class Person:
def __init__(self, Name, Age, Gender):
self.Name = Name
self.Age = Age
self.Gender = Gender
# List of People
PeopleList = [Person("Joan", 15, "F... | 16,455,812 | 5 | 0 | null | 2013-05-09 06:30:01.227 UTC | 8 | 2016-11-24 15:24:22.57 UTC | null | null | null | null | 1,148,991 | null | 1 | 60 | python|list|object|attributes|count | 72,620 | <pre><code>class Person:
def __init__(self, Name, Age, Gender):
self.Name = Name
self.Age = Age
self.Gender = Gender
>>> PeopleList = [Person("Joan", 15, "F"),
Person("Henry", 18, "M"),
Person("Marg", 21, "F")]
>>> sum(p.Gender == "F" for p i... |
16,132,759 | Is there auto type inferring in Java? | <p>Is there an <code>auto</code> variable type in Java like you have in C++?</p>
<p>An example:</p>
<pre><code>for ( auto var : object_array)
std::cout << var << std::endl;
for( auto var : object_array)
var.do_something_that_only_this_particular_obj_can_do();
</code></pre>
<p>I know that there i... | 16,132,818 | 6 | 5 | null | 2013-04-21 15:23:15.607 UTC | 17 | 2020-11-29 13:11:27.103 UTC | 2017-06-18 16:17:30.07 UTC | null | 1,033,581 | null | 1,624,921 | null | 1 | 155 | java|c++|auto | 115,105 | <p>Java 10 introduced a <code>var</code> identifier which is like C++ <code>auto</code>; see <a href="https://stackoverflow.com/a/47037550/">sorrymissjackson's answer</a>.</p>
<p>Prior to Java 10, there was no equivalent to the <code>auto</code> keyword. The same loop can be achieved as:</p>
<pre><code>for ( Object var... |
12,844,687 | Code 128 Barcode generation in vb.net | <p>I am attempting to take a string and convert it into a code 128 barcode in vb.net. I am a novice programmer and was wondering what some people thought would be the best design practices for accomplishing this. </p>
<p>A simple google search has yielded a few seemingly free solutions to this.
<a href="http://www.onb... | 13,234,682 | 5 | 1 | null | 2012-10-11 16:54:21.927 UTC | null | 2019-03-26 18:32:46.053 UTC | null | null | null | null | 1,665,657 | null | 1 | 3 | vb.net|visual-studio-2010|barcode|code128 | 44,989 | <p>If you don't want to write any code for string conversion in barcode and don't want to buy an external component, you can use the ItextSharp library ( <a href="http://sourceforge.net/projects/itextsharp/" rel="nofollow">http://sourceforge.net/projects/itextsharp/</a> ) which is in my opinion the simplest way to achi... |
37,578,362 | How to add "colSpan" attribute in ReactJS | <p>I'm getting the error "<strong>Type string is not assignable to type number</strong>" when I try to add a <strong>colSpan="2"</strong> attribute to the below ReactJS TypeScript code. How can I fix this?</p>
<pre><code>class ProductCategoryRow extends React.Component<MyProps, MyState> {
constructor(props: ... | 37,579,218 | 1 | 4 | null | 2016-06-01 20:39:05.067 UTC | 3 | 2017-11-10 08:01:40.46 UTC | 2017-09-09 06:48:55.73 UTC | null | 28,324 | null | 2,304,788 | null | 1 | 46 | reactjs|typescript | 36,613 | <p>Have you tried <code><th colSpan={2}>{ this.props.category}</th></code>?</p> |
24,665,649 | Why does C# not allow me to call a void method as part of the return statement? | <p>I am curious if there is a legitimate reason as to why C# does not support calling a void method as part of the return statement when the calling method's return type is also void.</p>
<pre><code>public void MethodA()
{
return;
}
public void MethodB()
{
return MethodA();
}
</code></pre>
<p>So we would... | 24,665,814 | 9 | 18 | null | 2014-07-10 00:15:54.937 UTC | 4 | 2014-07-24 16:24:29.03 UTC | 2014-07-11 18:38:56.1 UTC | null | 302,939 | null | 302,939 | null | 1 | 38 | c#|void | 13,647 | <p>Because it's simply the way <a href="http://msdn.microsoft.com/en-us/library/ms228593.aspx">the language is defined</a>.</p>
<blockquote>
<p>A method can use <code>return</code> statements to return control to its caller.
<strong>In a method returning <code>void</code>, <code>return</code> statements cannot spe... |
21,512,678 | Check at compile-time is a template type a vector | <p>I can imagine the following code:</p>
<pre><code>template <typename T> class X
{
public:
T container;
void foo()
{
if(is_vector(T))
container.push_back(Z);
else
container.insert(Z);
}
}
// somewhere else...
X<std::vector<sth>> abc;
abc.foo();
</code><... | 21,512,908 | 6 | 5 | null | 2014-02-02 15:59:41.03 UTC | 11 | 2022-01-31 07:57:09.853 UTC | 2014-02-02 16:14:32.13 UTC | null | 515,203 | null | 3,127,595 | null | 1 | 19 | c++|templates | 6,496 | <p>It is named tag dispatching :</p>
<pre><code>#include <vector>
#include <set>
#include <type_traits>
template<typename T> struct is_vector : public std::false_type {};
template<typename T, typename A>
struct is_vector<std::vector<T, A>> : public std::true_type {};
templa... |
19,691,920 | Collision resolution in Java HashMap | <p>Java <code>HashMap</code> uses <code>put</code> method to insert the K/V pair in <code>HashMap</code>.
Lets say I have used <code>put</code> method and now <code>HashMap<Integer, Integer></code> has one entry with <code>key</code> as 10 and <code>value</code> as 17.</p>
<p>If I insert 10,20 in this <code>Has... | 19,691,998 | 9 | 4 | null | 2013-10-30 19:17:25.21 UTC | 34 | 2021-12-22 14:58:45.577 UTC | 2018-05-01 21:00:25.69 UTC | null | 2,938,723 | null | 2,938,723 | null | 1 | 89 | java|hashmap | 150,050 | <p>When you insert the pair <code>(10, 17)</code> and then <code>(10, 20)</code>, there is technically no collision involved. You are just replacing the old value with the new value for a given key <code>10</code> (since in both cases, 10 is equal to 10 and also the hash code for 10 is always 10).</p>
<p>Collision hap... |
19,794,739 | What is the difference between iteration and recursion? | <p>What is the difference between <code>iteration</code> and <code>recursion</code> and why/when is one better:</p>
<pre><code>while (true) {
// Iterating
}
</code></pre>
<p>And</p>
<pre><code>private void recursion() {
if (true)
recursion(); // Recursing
return;
}
</code></pre>
<p>I see a lot ... | 19,794,926 | 8 | 4 | null | 2013-11-05 17:10:04.88 UTC | 16 | 2016-02-19 17:19:59.993 UTC | 2014-03-12 12:40:01.48 UTC | user2742371 | null | user2742371 | null | null | 1 | 24 | c++|recursion|iteration | 40,327 | <p>There are two main differences between Recursion and an Iterative Version of the same algorithm. </p>
<p>First of all, some times it is almost better to understand a recursive algorithm than an iterative one (At least if you are experienced programmer) So it does increase expressivity and in some cases readability ... |
21,716,527 | In Windows: How do you programatically launch a process in administrator mode under another user context? | <p><strong>Scenario</strong></p>
<p>I have a remote computer that I want to run installers (arbitrary executables) on programatically. These installers require two things:</p>
<ul>
<li>They must run in Administrator mode.</li>
<li>They must run under a specific user context (Specifically, a local user who is a member... | 21,718,198 | 1 | 12 | null | 2014-02-12 00:58:09.337 UTC | 9 | 2017-03-29 01:35:50.09 UTC | 2017-05-23 12:10:18.85 UTC | null | -1 | null | 3,044,940 | null | 1 | 2 | windows|batch-file | 5,335 | <p>OK, so it turns out that <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms682431%28v=vs.85%29.aspx" rel="noreferrer"><code>CreateProcessWithLogonW</code></a> function filters the user token, and so does <a href="http://msdn.microsoft.com/en-us/library/aa378184%28v=vs.85%29.aspx" rel="noreferrer"><c... |
44,830,663 | Docker Container Networking with Docker-in-Docker | <p>I would like to network with a child docker container from a parent docker container, with a docker-in-docker setup.</p>
<p>Let's say I'm trying to connect to a simple Apache httpd server. When I run the httpd container on my host machine, everything works fine:</p>
<pre><code>asnyder:~$ docker run -d -p 8080:80 h... | 44,996,703 | 3 | 4 | null | 2017-06-29 16:34:57.97 UTC | 8 | 2019-08-26 12:39:11.7 UTC | 2017-08-06 03:12:02.41 UTC | null | 5,091,191 | null | 5,091,191 | null | 1 | 31 | networking|docker|docker-in-docker | 8,884 | <p>There are pros and cons for both DinD and bind mounting the Docker socket and there are certainly use cases for both. As an example, check out <a href="https://applatix.com/case-docker-docker-kubernetes-part/" rel="noreferrer">this set of blog posts</a>, which does a good job of explaining one of the use cases. </p>... |
45,028,246 | Android Studio 3.0 : canary 6 : android.content.res.Resources$NotFoundException inside Launching activity | <p>I update android-studio 3.0 from canary 5 to canary 6 and suddenly My app gives crash on KitKat(API 19) with below stacktrace.</p>
<p>The Main2Activity.java:10 line is the first line in my activity onCreate() method. </p>
<pre><code>07-11 13:00:39.523 8913-8913/dcpl.com.myapplication E/AndroidRuntime: FATAL EXCEP... | 45,031,035 | 4 | 5 | null | 2017-07-11 07:37:36.113 UTC | 7 | 2017-07-20 09:08:46.38 UTC | 2017-07-17 02:48:14.133 UTC | null | 1,402,846 | null | 5,144,038 | null | 1 | 29 | android|android-4.4-kitkat|android-studio-3.0 | 3,757 | <p>Seems like the issue is related to Aapt 2.</p>
<p>Put </p>
<p><code>android.enableAapt2=false
</code></p>
<p>In your <code>gradle.properties</code> file and it fixes the issue for me.</p> |
17,193,825 | Loading PictureBox Image from resource file with path (Part 3) | <p>I understand that this question has been asked (and answered) before. However, none of the solutions are working for me.</p>
<p>Below is a screen capture of all the relevant pieces of the puzzle:</p>
<p><a href="http://dinosaur-island.com/PlantPictureBoxScreenCap.jpg" rel="noreferrer">Screen capture http://dinosau... | 17,194,695 | 5 | 0 | null | 2013-06-19 14:23:41.483 UTC | 5 | 2020-03-13 05:30:29.217 UTC | 2019-09-09 19:59:31.817 UTC | null | 472,495 | null | 918,489 | null | 1 | 28 | c#|picturebox | 217,053 | <p>The path should be something like: <code>"Images\a.bmp"</code>. (Note the lack of a leading slash, and the slashes being <strong>back</strong> slashes.)</p>
<p>And then:</p>
<pre><code>pictureBox1.Image = Image.FromFile(@"Images\a.bmp");
</code></pre>
<p>I just tried it to make sure, and it works. This is besides... |
17,225,088 | $http get parameters does not work | <p>Does anyone know why this does not work?</p>
<pre><code>$http
.get('accept.php', {
source: link,
category_id: category
})
.success(function (data, status) {
$scope.info_show = data
});
</code></pre>
<p>and this does work:</p>
<pre><code>$http
.get('accept.php?source=' +... | 17,225,186 | 2 | 0 | null | 2013-06-20 22:45:17.753 UTC | 18 | 2017-05-23 09:58:57.147 UTC | 2017-04-24 12:45:00.85 UTC | null | 4,927,984 | null | 1,835,545 | null | 1 | 93 | javascript|angularjs|http|angular-http | 114,018 | <p>The 2nd parameter in the <code>get</code> call is a config object. You want something like this:</p>
<pre><code>$http
.get('accept.php', {
params: {
source: link,
category_id: category
}
})
.success(function (data,status) {
$scope.info_show = data
... |
17,202,548 | Wavy shape with css | <p>I'm trying to recreate this image with CSS:</p>
<p><img src="https://i.stack.imgur.com/Jq0kf.png" alt="wayvy shape"></p>
<p>I would not need it to repeat. This is what I started but it just has a straight line:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<... | 17,202,736 | 7 | 6 | null | 2013-06-19 22:38:16.367 UTC | 51 | 2022-09-02 06:23:58 UTC | 2018-07-29 20:12:55.68 UTC | null | 8,620,333 | null | 1,411,004 | null | 1 | 107 | css|css-shapes | 282,790 | <p>I'm not sure it's your shape but it's close - you can play with the values:</p>
<p><a href="https://jsfiddle.net/7fjSc/9/" rel="noreferrer">https://jsfiddle.net/7fjSc/9/</a></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="... |
17,385,916 | IntelliJ how to zoom in / out | <p>The IntelliJ keymap says:</p>
<pre><code>Zoom in: Keypad + =
Zoom out Keypad - -
</code></pre>
<p>But they have no effect. Anyone have this working?</p>
<p>New info: Now I have added more key-bindings:</p>
<pre><code>Zoom in: Alt-Shift-=
Zoom out: Alt-Shift-minus
</code></pre>
<p>But these still have no effect.... | 65,592,795 | 12 | 7 | null | 2013-06-30 00:20:02.053 UTC | 24 | 2022-08-09 21:05:29.487 UTC | 2020-12-22 15:40:31.033 UTC | null | 1,056,563 | null | 1,056,563 | null | 1 | 138 | intellij-idea|zooming | 181,653 | <p>Double click <code>Shift</code> to open the quick actions. Then search for "Decrease Font Size" or "Increase Font Size" and hit <code>Enter</code>. To repeat the action you can doubleclick <code>Shift</code> and <code>Enter</code></p>
<p>I prefer that way because it works even when you're using n... |
17,139,501 | Using $_POST to get select option value from HTML | <p>I use <code>select</code> as below:</p>
<pre><code><select name="taskOption">
<option>First</option>
<option>Second</option>
<option>Third</option>
</select>
</code></pre>
<p>How do I get the value from the <code>select</code> option and store it into a v... | 17,139,538 | 8 | 0 | null | 2013-06-17 02:04:11.707 UTC | 31 | 2022-09-20 13:17:06.927 UTC | 2016-09-24 21:39:13.413 UTC | null | 462,627 | null | 2,473,385 | null | 1 | 148 | php|html|arrays | 827,090 | <p>Use this way:</p>
<pre><code>$selectOption = $_POST['taskOption'];
</code></pre>
<p>But it is always better to give values to your <code><option></code> tags.</p>
<pre><code><select name="taskOption">
<option value="1">First</option>
<option value="2">Second</option>
<... |
17,162,308 | Node.js Error: Cannot find module express | <p>I wrote my first node.js app, but it can't find express library:</p>
<pre><code>C:\ChatServer\Server>node server.js
module.js:340
throw err;
^
Error: Cannot find module 'express'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Modul... | 17,162,384 | 15 | 3 | null | 2013-06-18 06:52:23.453 UTC | 33 | 2021-01-29 01:37:14.483 UTC | null | null | null | null | 966,972 | null | 1 | 168 | node.js|express|npm | 393,647 | <p>You need to install Express locally into the context of your application (<code>node_modules</code> folder):</p>
<pre><code>$ npm install express
</code></pre>
<p>The reason for this is that applications always look in their local context for any dependencies. The global installation is only for setting up system-... |
31,868,639 | How to ping an IP Address in golang | <p>How can you ping an IP address from a golang application? The ultimate goal is to check if a server is online.</p>
<p>Does go have a way in the standard library to implement a network ping?</p> | 35,194,144 | 6 | 9 | null | 2015-08-07 02:09:18.937 UTC | 3 | 2020-06-14 06:04:50.603 UTC | 2017-12-16 07:07:35.703 UTC | null | 1,033,581 | null | 4,798,893 | null | 1 | 25 | go | 43,121 | <p>As @desaipath mentions, there is no way to do this in the standard library. However, you do not need to write the code for yourself - it has already been done:</p>
<blockquote>
<p><a href="https://github.com/tatsushid/go-fastping" rel="noreferrer">https://github.com/tatsushid/go-fastping</a></p>
</blockquote>
<p... |
5,256,516 | MATLAB: print a figure to pdf as the figure shown in the MATLAB | <p>I am trying to export (save as, print) a figure into .pdf format. However, no matter how I configure the setting, there are large margins around the figure.</p>
<p>When I export the figure into .eps format, there is no such problem --- i.e. the figure just looks like it is displayed in the MATLAB.</p>
<p>How could... | 5,256,555 | 3 | 2 | null | 2011-03-10 07:05:43.47 UTC | 4 | 2019-06-05 08:48:36.957 UTC | null | null | null | null | 468,841 | null | 1 | 7 | matlab|figure|export-to-pdf | 40,535 | <p>You can try the following:</p>
<p>1) After you plot the figure in <a href="http://en.wikipedia.org/wiki/MATLAB" rel="nofollow">MATLAB</a>, go to 'File->Export Setup', and input the size of the output you want. For example, Width: 6 inches, Height: 5 inches. Then click 'Apply to Figure' button.</p>
<p>2) Don't clos... |
5,282,099 | Signal handling in pthreads | <p>I have created a pthread, and installed a signal handler inside that, same way as we do in <code>main( )</code> function. The thread's signal handler is a separate function. Surprisingly, it is not working, that is the thread's signal handler is not able to catch signals.</p>
<p>Here is the code:</p>
<pre><code>#inc... | 5,282,181 | 3 | 3 | null | 2011-03-12 11:03:21.48 UTC | 16 | 2021-12-07 11:07:07.743 UTC | 2021-12-07 11:06:12.537 UTC | null | 6,594,576 | null | 575,281 | null | 1 | 28 | c|pthreads|signals | 94,217 | <p>There are several problems with your code:</p>
<ul>
<li><code>ptr</code> is not initialised, so all the <code>ptr-></code> parts will crash the program</li>
<li>you are calling <code>pthread_kill()</code> immediately, very likely before the signal handler has been installed, and in a thread (which has unspecified... |
5,042,379 | In VB6 what is the difference between Property Set and Property Let? | <p>I have just created several <code>Property Set</code> methods, and they didn't compile. When I changed them to <code>Property Let</code>, everything was fine.</p>
<p>I have since studied the documentation to find the difference between <code>Property Set</code> and <code>Property Let</code>, but must admit to being... | 5,042,718 | 3 | 1 | null | 2011-02-18 14:21:10.373 UTC | 7 | 2016-10-24 14:36:01.977 UTC | 2015-11-11 19:11:47.483 UTC | null | 4,865,599 | null | 326,900 | null | 1 | 40 | oop|properties|vb6|setter|letter | 54,646 | <p><code>Property Set</code> is for objects (e.g., class instances) </p>
<p><code>Property Let</code> is for "normal" datatypes (e.g., string, boolean, long, etc.)</p> |
5,201,965 | Objective-C (cocoa) equivalent to python's endswith/beginswith | <p>Python has <code>string.startswith()</code> and <code>string.endswith()</code> functions which are pretty useful.
What NSString methods can I use to have the same function?</p> | 5,202,006 | 3 | 0 | null | 2011-03-05 05:44:01.957 UTC | null | 2011-12-05 19:04:42.473 UTC | 2011-03-05 06:33:21.637 UTC | null | 308,903 | null | 260,127 | null | 1 | 46 | python|objective-c|cocoa | 7,820 | <p>Use <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/hasPrefix%3a"><code>-hasPrefix:</code></a> and <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/... |
5,027,808 | How to avoid DIVIDE BY ZERO error in an SQL query | <pre><code>SELECT YEAR, period, round((1- sum(rej_qty) / sum(recd_qty))*100, 0)
FROM TAB_A
WHERE sid = '200'
AND sdid IN ('4750')
AND
(
(
YEAR ='2011'
AND period IN('01_JAN')
)
OR
(
YEAR = '2010'
AND period IN('02_FEB','03_MAR','04_APR','05_MAY'... | 5,027,850 | 4 | 0 | null | 2011-02-17 10:38:55.767 UTC | 7 | 2019-10-17 14:37:26.7 UTC | 2012-10-01 08:16:21.307 UTC | null | 309,086 | null | 157,705 | null | 1 | 10 | sql|oracle9i|divide-by-zero | 64,075 | <p>If you want to ignore such records you can use a subquery</p>
<pre><code>SELECT YEAR, period, round((1- rej_sum / recd_sum)*100, 0) FROM
(
SELECT YEAR, sum(rej_qty) rej_sum, sum(recd_qty) recd_sum
FROM TAB_A
WHERE sid = '200'
AND sdid IN ('4750')
AND
(
(
YEAR ='2011'
AND ... |
25,741,027 | Default username and password for Oracle database | <p>I forgot to feed sys, system and hr password while Oracle DB installation and hit OK but now for SQ*Plus it needs those credentials for login in command prompt.How to get default user name and password?</p> | 25,743,716 | 2 | 2 | null | 2014-09-09 09:24:12.897 UTC | 3 | 2020-05-01 18:46:35.507 UTC | null | null | null | null | 2,596,551 | null | 1 | 6 | database|oracle | 64,104 | <p>You can simply login as :</p>
<pre><code>sqlplus / as sysdba
</code></pre>
<p>Then give password to the respective users :</p>
<pre><code>ALTER USER <username> IDENTIFIED BY <password>;
</code></pre>
<p>You can do that for all the three users.</p>
<p>I hope you are not on 12c. Else, you need to ment... |
25,616,382 | how to set cornerRadius for only bottom-left,bottom-right and top-left corner of a UIView? | <p>Is there a way to set cornerRadius for only bottom-left,bottom-right and top-left corner of a UIView?</p>
<p>I tried the following, but it ended up making the view disappear. Is there anything wrong with the code below?</p>
<pre><code> UIBezierPath *maskPath;
maskPath = [UIBezierPath bezierPathWithRoundedRe... | 25,616,833 | 10 | 3 | null | 2014-09-02 05:22:43.66 UTC | 35 | 2018-05-29 08:43:55.113 UTC | 2014-09-02 06:31:27.087 UTC | null | 3,830,876 | null | 1,595,141 | null | 1 | 37 | ios|objective-c|iphone|xcode|ipad | 47,242 | <p>You can do it like this:</p>
<pre><code>UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.viewOutlet.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerBottomLeft | UIRectCornerBottomRight) cornerRadii:CGSizeMake(10.0, 10.0)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
mask... |
9,410,401 | Adding Custom header to the excel file | <p>Is it possible to add a custom header to the Excel while exporting a <code>DataSet</code> to Excel in ASP.NET?
I have one requirement like this. I can export the <code>DataSet</code> to the Excel successfully. But I can't add the custom header. Please help me if anybody have the solution. Thanks in advance.</p> | 9,653,194 | 3 | 4 | null | 2012-02-23 09:38:19.19 UTC | 2 | 2012-09-13 05:07:03.963 UTC | 2012-02-23 09:43:02.317 UTC | null | 26,396 | null | 124,875 | null | 1 | 6 | c#|asp.net|header|export-to-excel | 51,554 | <p>IF you are using <code>Response.Write</code> to Export the Excel.
You can use the following code with minimal effort and the <code>Header</code> can be customized as you want, just like HTML headers.</p>
<pre><code>Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachm... |
9,522,631 | How to put a line comment for a multi-line command | <p>I know how to write a multi-line command in a Bash script, but how can I add a comment for each line in a multiline command?</p>
<pre><code>CommandName InputFiles \ # This is the comment for the 1st line
--option1 arg1 \ # This is the comment for the 2nd line
--option2 arg2 # This i... | 9,525,753 | 4 | 4 | null | 2012-03-01 19:27:09.25 UTC | 97 | 2021-02-17 17:11:58.897 UTC | 2018-04-01 17:14:21.547 UTC | null | 42,223 | null | 301,336 | null | 1 | 440 | bash|shell|comments | 88,099 | <p>I'm afraid that, in general, you can't do what you're asking for. The best you can do is a comment on the lines before the command, or one single comment at the end of the command line, or a comment after the command.</p>
<p>You can't manage to intersperse comments inside a command this way. The <code>\</code>s exp... |
18,330,917 | How to alert inline of button | <p>I know already how to alert by use javascript or Jquery. But just onclick button I apply javascript external or internal. What I need is we alert inline of button
Example: </p>
<pre><code><button name="my_btn" id="my_btn" onClick="alert('Hello I am alert')">Alert</button>
</code></pre>
<p>If it is pos... | 18,330,969 | 4 | 1 | null | 2013-08-20 08:57:33.02 UTC | 0 | 2018-02-12 18:10:58.643 UTC | 2013-08-20 09:04:46.343 UTC | null | 2,572,353 | null | 2,605,515 | null | 1 | 7 | javascript | 40,624 | <p>I never really understand why someone wants to do it this way, but here is an inline alert on a button.</p>
<pre><code><button type="button" onclick="alert('Hello World')">Show Alert</button>
</code></pre>
<p><a href="http://jsfiddle.net/pfQPT/" rel="noreferrer">Here is the fiddle</a></p>
<p><a href="... |
18,413,014 | Run a JAR file from the command line and specify classpath | <p>I've compiled a <a href="http://en.wikipedia.org/wiki/JAR_%28file_format%29" rel="noreferrer">JAR</a> file and specified the Main-Class in the manifest (I used the Eclipse <em>Export</em> function). My dependencies are all in a directory labeled <code>lib</code>. I can't seem to get a straight answer on how to execu... | 18,413,058 | 5 | 1 | null | 2013-08-23 22:50:19.597 UTC | 32 | 2019-12-17 21:20:55.363 UTC | 2016-04-04 18:11:49.383 UTC | null | 63,550 | null | 2,161,954 | null | 1 | 143 | java|shell|command-line|classpath | 274,827 | <p>When you specify <code>-jar</code> then the <code>-cp</code> parameter will be ignored. </p>
<p>From <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/solaris/java.html#jar">the documentation</a>:</p>
<blockquote>
<p><i>When you use this option, the JAR file is the source of all user classes, and oth... |
20,257,266 | How to access localhost from a Genymotion android emulator? | <p>I can not figure out how to access localhost from a Genymotion android emulator. By the way, Im using MAMP.</p> | 20,257,547 | 10 | 2 | null | 2013-11-28 03:36:27.763 UTC | 20 | 2022-08-17 12:57:42.323 UTC | null | null | null | null | 2,940,948 | null | 1 | 73 | android|emulation|mamp|genymotion | 83,191 | <p><Strong>Update</strong></p>
<p>After genymotion update to 2.2 you can use <code>10.0.3.2</code>, <a href="https://stackoverflow.com/a/18940022/1729802">ref</a></p>
<p><Strong>Another approach</Strong></p>
<p>To access your localhost through Genymotion is using your PC IP address. to get your IP address go to:</p>... |
15,204,470 | Pyqt how to get a widget's dimensions | <p>I am currently developing an application in which i cannot use modal windows (due to some application constraints). However, in some cases i would like to simulate a popup window. To do so i dynamically create a widget that has the centralwidget as parent and i use the move() method to place it where i want.
I would... | 15,205,853 | 3 | 1 | null | 2013-03-04 14:59:45.73 UTC | 3 | 2018-10-04 12:07:30.337 UTC | null | null | null | null | 1,504,016 | null | 1 | 15 | python|widget|size|pyqt | 54,747 | <p>You can use <a href="http://qt-project.org/doc/qt-4.8/qwidget.html#frameGeometry-prop" rel="nofollow"><code>frameGeometry</code></a> or <a href="http://qt-project.org/doc/qt-4.8/qwidget.html#geometry-prop" rel="nofollow"><code>geometry</code></a> depending on <a href="http://qt-project.org/doc/qt-4.8/application-win... |
15,214,179 | How to read the classifier confusion matrix in WEKA | <p>Sorry, I am new to WEKA and just learning.</p>
<p>In my decision tree (J48) classifier output, there is a confusion Matrix:</p>
<pre><code>a b <----- classified as
130 8 a = functional
15 150 b = non-functional
</code></pre>
<ul>
<li>How do I read this matrix? What's the difference between a &... | 26,616,662 | 2 | 1 | null | 2013-03-05 01:21:40.093 UTC | 7 | 2019-01-18 19:57:06.547 UTC | 2013-12-12 17:01:59 UTC | null | 1,693,859 | null | 1,267,180 | null | 1 | 17 | classification|weka|decision-tree | 46,151 | <p>I'd put it this way:</p>
<p>The confusion matrix is Weka reporting on how good this J48 model is in terms of what it gets right, and what it gets wrong.</p>
<p>In your data, the target variable was either "functional" or "non-functional;" the right side of the matrix tells you that column "a" is functional, and "b... |
15,024,383 | Why are dates in match aggregate query being ignored? | <p>I'm trying to run an aggregation statement in my mongo db. I have a document whose structure is (at least) as follows:</p>
<pre><code>{
"_id": ObjectId,
"date": ISODate,
"keywordGroupId": NumberLong,
"ranking": NumberLong,
}
</code></pre>
<p>I would like to run an aggregation statement that aggregates ... | 15,025,828 | 3 | 0 | null | 2013-02-22 12:35:54.44 UTC | 4 | 2022-08-19 09:25:10.893 UTC | 2022-08-19 09:25:10.893 UTC | null | 542,251 | null | 2,099,122 | null | 1 | 24 | mongodb|aggregation-framework | 86,063 | <p>Remove the <code>$</code> prefix on the <code>$date</code> field of your <code>$match</code>:</p>
<pre><code>{ $match: {
keywordGroupId: 75,
date: {$gte: ISODate("2013-01-01T00:00:00.0Z"), $lt: ISODate("2013-02-01T00:00:00.0Z")}
}},
</code></pre>
<p>You only use the <code>$</code> prefix when the field n... |
43,811,434 | Error: <path> attribute d: Expected number, "MNaN,NaNLNaN,NaN" | <p>I'm tring to create a multi-line chart using D3.js v4. I'm using this example: <a href="https://bl.ocks.org/mbostock/3884955" rel="noreferrer">https://bl.ocks.org/mbostock/3884955</a>.</p>
<p>Sample csv Data:</p>
<pre><code>storageSystem,poolId,availableVolumeCapacity,date
system01,0,18031398,20170413
system01,1,1... | 43,814,401 | 2 | 4 | null | 2017-05-05 18:17:07.623 UTC | 1 | 2017-05-05 22:06:34.803 UTC | 2017-05-05 18:46:44.74 UTC | null | 7,259,469 | null | 7,259,469 | null | 1 | 18 | javascript|d3.js | 47,852 | <p>The root of your problem is that the value <code>d</code> in your anonymous function passed to <code>dataNest.forEach</code> still contains one level of nesting but you are using it as if it doesn't have any nesting. Your code fails because it is looking for <code>date</code> and <code>availableVolumeCapacity</code... |
7,890,685 | Referencing "this" inside setInterval/setTimeout within object prototype methods | <p>Normally I'd assign an alternative "self" reference when referring to "this" within setInterval. Is it possible to accomplish something similar within the context of a prototype method? The following code errors.</p>
<pre><code>function Foo() {}
Foo.prototype = {
bar: function () {
this.baz();
},
... | 7,890,978 | 2 | 1 | null | 2011-10-25 14:15:40.96 UTC | 19 | 2017-12-01 15:39:57.76 UTC | null | null | null | null | 477,610 | null | 1 | 45 | javascript|scope|lexical-scope | 35,232 | <p>Unlike in a language like Python, a Javascript method forgets it is a method after you extract it and pass it somewhere else. You can either</p>
<h2>Wrap the method call inside an anonymous function</h2>
<p>This way, accessing the <code>baz</code> property and calling it happen at the same time, which is necessary f... |
23,531,608 | How do I save streaming tweets in json via tweepy? | <p>I've been learning Python for a couple of months through online courses and would like to further my learning through a real world mini project. </p>
<p>For this project, I would like to collect tweets from the twitter streaming API and store them in json format (though you can choose to just save the key informat... | 23,547,623 | 3 | 6 | null | 2014-05-08 02:15:37.49 UTC | 11 | 2014-10-31 12:12:40.21 UTC | 2017-05-23 11:45:28.967 UTC | null | -1 | null | 3,611,239 | null | 1 | 7 | python|json|tweepy | 21,187 | <p>In rereading your original question, I realize that you ask a <em>lot</em> of smaller questions. I'll try to answer most of them here but some may merit actually asking a separate question on SO.</p>
<ul>
<li><strong>Why does it break with the addition of</strong> <code>on_data</code> <strong>?</strong></li>
</ul>... |
8,945,879 | How to get body of a POST in php? | <p>I submit as POST to a php page the following: </p>
<pre><code>{a:1}
</code></pre>
<p>This is the body of the request (a POST request).<br>
In php, what do I have to do to extract that value? </p>
<pre><code>var_dump($_POST);
</code></pre>
<p>is not the solution, not working.</p> | 8,945,912 | 9 | 3 | null | 2012-01-20 18:05:41.747 UTC | 84 | 2021-05-01 01:03:42.687 UTC | 2012-10-24 21:09:52.77 UTC | null | 895,378 | null | 67,153 | null | 1 | 369 | php|rest|post | 396,532 | <p>To access the entity body of a POST or PUT request (or any other HTTP method):</p>
<pre><code>$entityBody = file_get_contents('php://input');
</code></pre>
<p>Also, the <code>STDIN</code> constant is an already-open stream to <code>php://input</code>, so you can alternatively do:</p>
<pre><code>$entityBody = stre... |
8,672,401 | Get random post in Wordpress | <p>How do I get a random post in Wordpress?</p>
<p>I would like to display a button on a page that, when pressed, goes to a random post from the blog. I don't want a random post to be displayed on the page, I just want a link that leads to that post.
I tried searching for a code on Google and here at stackoverflow but... | 8,683,664 | 5 | 4 | null | 2011-12-29 19:20:20.227 UTC | 2 | 2017-03-14 13:53:02.693 UTC | 2011-12-30 20:03:10.37 UTC | null | 1,038,471 | null | 1,038,471 | null | 1 | 16 | wordpress|random | 42,287 | <p>I found <a href="http://www.wpbeginner.com/wp-tutorials/how-to-redirect-users-to-a-random-post-in-wordpress/" rel="noreferrer">this</a> post which gave me desired results...</p>
<p>Here's a solution copy/pasted from the wpbeginner blog post. No copyright infringement intended.</p>
<p>Just add the following code to... |
5,172,630 | How do I display protected Amazon S3 images on my secure site using PHP? | <p>I am trying to move images for my site from my host to Amazon S3 cloud hosting. These images are of client work sites and cannot be publicly available. I would like them to be displayed on my site preferably by using the PHP SDK available from Amazon.</p>
<p>So far I have been able to script for the conversion so t... | 5,181,773 | 4 | 0 | null | 2011-03-02 19:54:31.773 UTC | 14 | 2015-01-20 22:10:15.61 UTC | null | null | null | null | 599,105 | null | 1 | 27 | php|image|amazon-s3|amazon-web-services|intranet | 26,839 | <p>The best way to serve your images is to generate a url using the PHP SDK. That way the downloads go directly from S3 to your users. </p>
<p>You don't need to download via your servers as @mfonda suggested - you can set any caching headers you like on S3 objects - and if you did you would be losing some major benefi... |
5,252,465 | Android: enum vs static final ints? | <p>What are the advantages (or disadvantages) of having an <code>enum</code> versus having a set of <code>static final int</code>s in Java Android applications? Are there efficiency or performance optimizations that occur that favor the use of one or the other?</p>
<p>I ask this in context of say intent requestCodes a... | 5,252,563 | 4 | 3 | null | 2011-03-09 21:36:08.163 UTC | 8 | 2015-06-09 15:37:10.003 UTC | null | null | null | null | 649,066 | null | 1 | 31 | java|android|enums | 24,223 | <p>Enum advantages from <a href="https://stackoverflow.com/questions/4822877/why-doesnt-android-use-more-enums">this question</a>:</p>
<blockquote>
<ul>
<li>They are much more type-safe than integers, strings, or sets of boolean
flags.</li>
<li>They lead to more readable code.</li>
<li>It's more difficult to... |
5,447,278 | Bash scripts with tmux to launch a 4-paned window | <p>Can anyone help explain what's going on with <code>tmux</code>, <code>bash</code>, and <code>exec</code>? I'm trying to set up a tmux session with a 4-pane window. Ideally, I want to run a command in 3 of the panes: e.g. a Ruby Thin server and a couple of Ruby daemons. This is what I have so far:</p>
<p><code>~/.bi... | 7,720,881 | 4 | 1 | null | 2011-03-27 04:42:30.07 UTC | 27 | 2020-10-31 23:05:09.533 UTC | null | null | null | null | 59,639 | null | 1 | 76 | bash|exec|tmux | 80,135 | <p>As others have mentioned, your commands are being run by the shell script <em>before</em> launching your <code>$SHELL</code>; there is no general way the instance of <code>$SHELL</code> can know what its parent ran before starting it.</p>
<p>To get the “initial command” into the shell history, you need to feed the ... |
5,407,814 | C++ - interval tree implementation | <p><em>Does someone know any good <code>interval tree</code> implementation in C++?</em></p>
<p>Obviously, something template-driven, better in <code>boost</code>-like style.</p>
<p>And another question - if somebody tested, does a basic <code>std::vector</code>-based interval tree implementation with sorting can bea... | 5,408,008 | 5 | 0 | null | 2011-03-23 15:41:47.313 UTC | 11 | 2020-12-18 20:29:42.933 UTC | null | null | null | null | 346,332 | null | 1 | 35 | c++|data-structures|interval-tree | 21,718 | <p>Boost-like ? <a href="http://www.boost.org/doc/libs/1_46_1/libs/icl/doc/html/index.html" rel="noreferrer">Boost ICL</a>!</p>
<p><em>The Boost Interval Container Library</em></p> |
5,013,717 | Are inner classes in C++ automatically friends? | <p>If I define an inner class in C++, is it automatically a friend of the class that contains it? For example, is this legal:</p>
<pre><code>class Outer {
public:
class Inner {
public:
void mutateOuter(Outer& o);
};
private:
int value;
};
void Outer::Inner::mutateOuter(Outer& o) {
... | 14,759,603 | 5 | 8 | null | 2011-02-16 07:37:05.057 UTC | 15 | 2017-06-29 08:50:12.157 UTC | 2015-08-07 14:37:53.77 UTC | null | 5,640 | null | 501,557 | null | 1 | 81 | c++|friend|nested-class | 24,938 | <p>After having asked more or less the same question <a href="https://stackoverflow.com/q/14758881/1984137">here</a> myself, I wanted to share the (apparently) updated answer for C++11: </p>
<p>Quoted from <a href="https://stackoverflow.com/a/14759027/1984137">https://stackoverflow.com/a/14759027/1984137</a>:</p>
<bl... |
5,171,502 | .c vs .cc vs. .cpp vs .hpp vs .h vs .cxx | <blockquote>
<p><strong>Possible Duplicates:</strong><br />
<a href="https://stackoverflow.com/questions/152555/h-or-hpp-for-your-class-definitions">*.h or *.hpp for your class definitions</a><br />
<a href="https://stackoverflow.com/questions/1545080/correct-c-code-file-extension-cc-vs-cpp">Correct C++ code file exten... | 5,171,821 | 6 | 3 | null | 2011-03-02 18:04:59.567 UTC | 82 | 2020-08-23 17:19:18.427 UTC | 2020-08-23 17:19:18.427 UTC | null | 5,740,428 | null | 541,686 | null | 1 | 296 | c++|c|filenames|header-files|naming | 230,968 | <p>Historically, the first extensions used for C++ were <code>.c</code> and <code>.h</code>, exactly like for C. This caused practical problems, especially the <code>.c</code> which didn't allow build systems to easily differentiate C++ and C files.</p>
<p>Unix, on which C++ has been developed, has case sensitive fil... |
5,089,042 | jarsigner: unable to sign jar: java.util.zip.ZipException: invalid entry compressed size (expected 463 but got 465 bytes) | <p>when I am signing the apk, I get "jarsigner: unable to sign jar: java.util.zip.ZipException: invalid entry compressed size (expected 463 but got 465 bytes)" this error message. The apk size is almost 1MB. When I reduce the size to 500KB, signing success. Why this so?..Any Idea?</p> | 5,089,188 | 6 | 2 | null | 2011-02-23 09:29:06.157 UTC | 31 | 2021-07-01 12:01:11.6 UTC | null | null | null | null | 536,091 | null | 1 | 93 | android | 83,700 | <p>You are trying to sign an already signed <code>.apk</code>.
You need to export an unsigned <code>.apk</code> file and then sign it with <code>jarsigner</code>.</p> |
5,484,809 | Full url for an image-path in Rails 3 | <p>I have an Image, which contains carrierwave uploads: </p>
<pre><code>Image.find(:first).image.url #=> "/uploads/image/4d90/display_foo.jpg"
</code></pre>
<p>In my view, I want to find the absolute url for this. Appending the <a href="https://stackoverflow.com/questions/1939942/generate-full-url-to-javascript-in... | 5,484,829 | 9 | 0 | null | 2011-03-30 10:00:28.767 UTC | 11 | 2017-11-21 19:20:56.69 UTC | 2017-05-23 12:03:02.317 UTC | null | -1 | null | 73,673 | null | 1 | 37 | ruby-on-rails|ruby|ruby-on-rails-3|url|path | 43,109 | <p>try <code>path</code> method</p>
<pre><code>Image.find(:first).image.path
</code></pre>
<p><strong>UPD</strong></p>
<pre><code>request.host + Image.find(:first).image.url
</code></pre>
<p>and you can wrap it as a helper to DRY it forever</p>
<pre><code>request.protocol + request.host_with_port + Image.find(:fir... |
5,074,893 | How to remove the last character from a bash grep output | <pre><code>COMPANY_NAME=`cat file.txt | grep "company_name" | cut -d '=' -f 2`
</code></pre>
<p>outputs something like this</p>
<pre><code>"Abc Inc";
</code></pre>
<p>What I want to do is I want to remove the trailing ";" as well. How can i do that? I am a beginner to bash. Any thoughts or suggestions would be help... | 5,074,995 | 14 | 2 | null | 2011-02-22 06:38:48.3 UTC | 10 | 2018-03-27 20:24:08.4 UTC | 2011-02-22 06:50:57.963 UTC | null | 90,848 | null | 316,082 | null | 1 | 64 | bash|grep | 176,823 | <p>I'd use <code>sed 's/;$//'</code>. eg:</p>
<pre><code>COMPANY_NAME=`cat file.txt | grep "company_name" | cut -d '=' -f 2 | sed 's/;$//'`
</code></pre> |
12,132,060 | confirm() on window.onbeforeunload | <p>I want to show a confirmation dialog if the user wants to leave the page with unsaved form data. What I have is:</p>
<pre><code>window.onbeforeunload = function() {
if (not_saved) if (confirm('Changes will not be saved')) return true;
return false;
}
</code></pre>
<p>But no matter what the user clicks, the... | 12,132,076 | 3 | 0 | null | 2012-08-26 16:57:55.667 UTC | 2 | 2018-08-21 13:23:01.273 UTC | null | null | null | null | 993,110 | null | 1 | 11 | javascript | 42,972 | <pre><code>window.onbeforeunload = function(e) {
return 'Dialog text here.';
};
</code></pre>
<p>Docs: </p>
<ul>
<li><a href="https://developer.mozilla.org/en-US/docs/DOM/window.onbeforeunload" rel="noreferrer">https://developer.mozilla.org/en-US/docs/DOM/window.onbeforeunload</a></li>
<li><a href="http://dev.w3.... |
12,480,497 | Why am I getting error for apple-touch-icon-precomposed.png | <p>I have created a new rails3 project but I am seeing following logs many times in my server logs. Why I am getting these request and how can I avoid these?</p>
<blockquote>
<p>Started GET "/apple-touch-icon-precomposed.png" for 192.168.6.2 at
2012-09-18 20:03:53 +0530</p>
<p>ActionController::RoutingError (... | 12,683,605 | 11 | 1 | null | 2012-09-18 15:46:38.53 UTC | 51 | 2018-08-25 13:03:33.27 UTC | 2013-03-13 15:23:12.39 UTC | null | 425,313 | null | 624,657 | null | 1 | 269 | apple-touch-icon | 184,017 | <p>I guess apple devices make those requests if the device owner adds the site to it. This is the equivalent of the favicon. To resolve, add 2 100×100 png files, save it as apple-touch-icon-precomposed.png and apple-touch-icon.png and upload it to the root directory of the server. After that, the error should be gone.<... |
19,022,210 | preferredStatusBarStyle isn't called | <p>I followed <a href="https://stackoverflow.com/questions/17678881/how-to-change-status-bar-text-color-in-ios-7">this thread</a> to override <code>-preferredStatusBarStyle</code>, but it isn't called.
Are there any options that I can change to enable it? (I'm using XIBs in my project.)</p> | 19,032,879 | 25 | 7 | null | 2013-09-26 07:42:14.107 UTC | 118 | 2022-05-06 16:22:07.557 UTC | 2017-05-23 12:26:38.723 UTC | null | -1 | null | 902,136 | null | 1 | 278 | ios|ios7|uikit|uistatusbar | 141,000 | <h2>Possible root cause</h2>
<p>I had the same problem, and figured out it was happening because I wasn't setting the root view controller in my application window. </p>
<p>The <code>UIViewController</code> in which I had implemented the <code>preferredStatusBarStyle</code> was used in a <code>UITabBarController</cod... |
43,343,231 | Enhanced REP MOVSB for memcpy | <p>I would like to use enhanced REP MOVSB (ERMSB) to get a high bandwidth for a custom <code>memcpy</code>. </p>
<p>ERMSB was introduced with the Ivy Bridge microarchitecture. See the section "Enhanced REP MOVSB and STOSB operation (ERMSB)" in the <a href="https://www-ssl.intel.com/content/www/us/en/architecture-and-... | 43,574,756 | 6 | 51 | null | 2017-04-11 10:22:09.467 UTC | 57 | 2022-07-05 03:27:38.697 UTC | 2021-03-11 12:25:59.953 UTC | null | 224,132 | null | 2,542,702 | null | 1 | 87 | performance|assembly|x86|cpu-architecture|memcpy | 25,031 | <p>This is a topic pretty near to my heart and recent investigations, so I'll look at it from a few angles: history, some technical notes (mostly academic), test results on my box, and finally an attempt to answer your actual question of when and where <code>rep movsb</code> might make sense. </p>
<p>Partly, this is a... |
3,362,885 | How to get Users Email Id in Facebook application using PHP? | <p>I have created a simple Facebook application in PHP, that greets user by there user name,
I also want there Email id, to be displayed. But i am not able to do that. the code that i am using is,</p>
<pre><code>require_once('facebook.php');
require_once('config.php');
$facebook = new Facebook(APIKEY, SECRETKEY);
$use... | 3,413,156 | 3 | 2 | null | 2010-07-29 13:20:52.5 UTC | 7 | 2012-04-22 13:30:29.557 UTC | null | null | null | null | 212,595 | null | 1 | 7 | php|facebook | 45,444 | <p>You can get the Email Address, directly without using the FQL.</p>
<pre><code>// initialize facebook
$facebook = new Facebook(array(
'appId' => APP_ID,
'secret' => APP_SECRET));
$session = $facebook->getSession();
if ($session) {
try {
$fbme = $facebook->api('/me');
} catch (F... |
3,730,358 | How to add multiple headers throughout a single ListView with addHeaderView()? | <p>Can Android's addHeaderView() be used to add multiple headers throughout a single ListView? Can someone give an example of how to do this?</p>
<p>I was able to accomplish what I wanted by manipulating the IconicAdapter Class... is there any reason why I should not do it this way? I feel this could be modified for m... | 3,761,414 | 4 | 0 | null | 2010-09-16 20:04:23.013 UTC | 9 | 2014-12-27 06:48:58.243 UTC | 2014-12-27 06:48:58.243 UTC | null | 474,189 | null | 300,129 | null | 1 | 13 | android|listview|header | 23,950 | <p>What you want Android developers might call a list separator or subheading ("headers" and "footers" live only at the top or bottom of the list). The gist of how you can do this is by using a ListAdapter that wraps other ListAdapters and is smart enough to return a header view type for certain rows and keep track of ... |
36,987,636 | Cannot create an instance of OLE DB provider Microsoft.Jet.OLEDB.4.0 for linked server null | <p>I am trying to export from my <code>Table</code> data into <code>Excel</code> through <code>T-SQL</code> query. After little research I came up with this </p>
<pre><code>INSERT INTO OPENROWSET ('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=G:\Test.xls;',
'SELECT * ... | 37,197,221 | 4 | 14 | null | 2016-05-02 16:55:52.233 UTC | 17 | 2021-02-16 15:43:54.637 UTC | 2016-05-12 17:08:20.117 UTC | null | 3,349,551 | null | 3,349,551 | null | 1 | 33 | sql|sql-server|export-to-excel|openrowset | 114,931 | <p>I have MS Sql server 2012, and Office 2013. This seems to be very finicky, so you may have to adjust to your particular versions.</p>
<ol>
<li>Download the Microsoft.ACE.OLEDB.12.0 for Windows, 64 bit version found here: <a href="https://www.microsoft.com/en-us/download/details.aspx?id=13255" rel="noreferrer">htt... |
38,255,655 | Trying to pull files from my Github repository: "refusing to merge unrelated histories" | <p>I'm learning git, and I'm following the Git community book. </p>
<p>Previously (long time ago) I made a public repository on Github, with some files. Now I set up a local Git repository on my current computer, and committed some files. Then I added a remote pointing to my Github page:</p>
<pre><code>[root@osboxes ... | 38,680,153 | 8 | 7 | null | 2016-07-07 21:33:49.263 UTC | 45 | 2021-11-09 14:15:49.92 UTC | null | null | null | null | 2,722,504 | null | 1 | 155 | git|github|git-pull|git-fetch | 185,381 | <p>Try <code>--allow-unrelated-histories</code></p>
<p>Like max630 commented, or as explained here <a href="https://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories">Git refusing to merge unrelated histories</a></p> |
8,430,777 | Programmatically get path to Application Support folder | <p>I'm trying to get an NSString for the user's Application Support folder.</p>
<p>I know I can do <code>NSString *path = @"~/Library/Application Support";</code> but this doesn't seem very elegant. I've played around with using <code>NSSearchPathForDirectoriesInDomains</code> but it seems to be quite long-winded and ... | 8,430,843 | 7 | 6 | null | 2011-12-08 12:05:39.277 UTC | 11 | 2020-05-13 14:44:17.137 UTC | 2017-04-04 12:15:00.967 UTC | null | 1,033,581 | null | 262,455 | null | 1 | 64 | ios|objective-c|swift|cocoa | 40,695 | <p>This is outdated, for current best practice use <code>FileManager.default.urls(for:in:)</code> as in the comment by <a href="https://stackoverflow.com/users/151471/andyvn22">@andyvn22</a> below.</p>
<p>the Best practice is to use <code>NSSearchPathForDirectoriesInDomains</code> with <code>NSApplicationSupportDirect... |
22,155,832 | Spring Java Config: how do you create a prototype-scoped @Bean with runtime arguments? | <p>Using Spring's Java Config, I need to acquire/instantiate a prototype-scoped bean with constructor arguments that are only obtainable at runtime. Consider the following code example (simplified for brevity):</p>
<pre><code>@Autowired
private ApplicationContext appCtx;
public void onRequest(Request request) {
... | 22,184,027 | 9 | 6 | null | 2014-03-03 19:43:43.6 UTC | 72 | 2022-07-20 06:54:25.213 UTC | 2018-12-14 19:21:58.367 UTC | null | 407,170 | null | 407,170 | null | 1 | 170 | java|spring|scope|prototype|spring-java-config | 115,113 | <p>In a <code>@Configuration</code> class, a <code>@Bean</code> method like so</p>
<pre><code>@Bean
@Scope("prototype")
public Thing thing(String name) {
return new Thing(name);
}
</code></pre>
<p>is used to register a <strong>bean definition and provide the factory for creating the bean</strong>. The bea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.