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
24,746,892
How to calculate Euclidian distance between two points defined by matrix containing x, y?
<p>I am very lost in <strong>Euclidean distance calculation</strong>. I have found functions dist2{SpatialTools} or rdist{fields} to do this, but they doesn´t work as expected.</p> <p>I suppose that one point has two coordinates in carthesian system, so [x,y]. To measure distance between 2 points (defined by row), I n...
24,747,155
4
0
null
2014-07-14 22:13:28.09 UTC
3
2018-07-05 20:10:45.32 UTC
null
null
null
null
2,742,140
null
1
10
r|matrix|euclidean-distance
52,746
<p>If you just want a vector, something like this will work for you.</p> <p>Try something like this:</p> <pre><code>euc.dist &lt;- function(x1, x2) sqrt(sum((x1 - x2) ^ 2)) library(foreach) foreach(i = 1:nrow(x1), .combine = c ) %do% euc.dist(x1[i,],x2[i,]) </code></pre> <p>This will work for any dimensions.</p> <...
28,458,694
Django REST framework: save related models in ModelViewSet
<p>I'm trying to figure out how to save related models using Django REST framework. In my app I have a model <code>Recipe</code> with 2 related models: <code>RecipeIngredient</code> and <code>RecipeStep</code>. A <code>Recipe</code> object MUST have at least 3 related <code>RecipeIngredient</code> and 3 <code>RecipeSte...
28,460,714
2
0
null
2015-02-11 15:55:16.4 UTC
11
2016-09-05 08:41:56.133 UTC
null
null
null
null
267,719
null
1
13
django|django-forms|django-rest-framework|formset
6,685
<p>I was dealing with similiar issue this week and I found out, that django rest framework 3 actually supports nested writable serialisation (<a href="http://www.django-rest-framework.org/topics/3.0-announcement/#serializers" rel="noreferrer">http://www.django-rest-framework.org/topics/3.0-announcement/#serializers</a>...
25,225,927
Android studio doesn't list my phone under "Choose Device"
<p>Just starting out with Android development; have a Nexus 5 bought in Japan, but with English version of android (presumably shouldn't matter). I installed Android Studio on Windows 8.1 to try making an app, but now I don't see my phone under "Choose Device". I've enabled developer mode and selected 'USB debugging'. ...
25,225,936
13
0
null
2014-08-10 05:46:01.467 UTC
9
2021-09-30 06:49:19.927 UTC
null
null
null
null
1,392,189
null
1
34
android|android-studio
148,502
<p>Have you installed drivers for the phone? <a href="http://developer.android.com/sdk/win-usb.html" rel="noreferrer">http://developer.android.com/sdk/win-usb.html</a></p> <p>It appears that the the sdk does not "install" the USB drivers. You can select that usb drivers in the sdk to see the file location, open that u...
42,630,894
Jenkins + Docker: How to control docker user when using Image.inside command
<p>Dear Stackoverflow Community,</p> <p>I am trying to setup a Jenkins CI pipeline using docker images as containers for my build processes. I am defining a Jenkinsfile to have a build pipeline as code. I am doing something like this:</p> <pre><code>node { docker.withRegistry('http://my.registry.com', 'docker-crede...
42,822,143
2
0
null
2017-03-06 16:37:52.847 UTC
6
2018-08-23 14:54:03.673 UTC
2018-01-20 21:44:38.913 UTC
null
3,318,954
null
3,318,954
null
1
44
docker|jenkins|jenkins-pipeline
32,217
<p>As you can see <a href="https://github.com/jenkinsci/docker-workflow-plugin/blob/docker-workflow-1.9/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java#L175" rel="noreferrer">here</a> or <a href="https://github.com/jenkinsci/docker-workflow-plugin/blob/docker-workflow-1.9/src/main/java/org/je...
34,445,636
Why is Cocoapods complaining about the embedded content contains swift setting in the build settings?
<p>I recently added swift files to my test target (combined with older cocoa touch classes).</p> <p>Why is cocoapods complaining about the embedded content contains swift setting in the build settings?</p> <blockquote> <p>[!] The YOURP-PROJECT-Tests [Debug] target overrides the EMBEDDED_CONTENT_CONTAINS_SWIFT bui...
34,445,637
2
0
null
2015-12-24 00:16:12.517 UTC
10
2016-12-12 20:30:24.743 UTC
2015-12-24 02:15:11.43 UTC
null
1,610,029
null
1,610,029
null
1
35
xcode|swift|cocoapods
12,217
<p>I needed to add the $(inherited) flag to the build setting</p> <p><a href="https://i.stack.imgur.com/Uaz6x.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Uaz6x.png" alt="enter image description here"></a></p>
45,155,104
Displaying notification badge on BottomNavigationBar's Icon
<p>I'd like to display notification badge (a colored <strong>marble</strong>) on the <strong>top right corner</strong> of BottomNavigationBar's <strong>Icon</strong> widget when a new message has arrived in the inbox tab. It is similar to <a href="https://developer.android.com/preview/features/notification-badges.html"...
45,434,404
10
0
null
2017-07-17 23:22:06.843 UTC
27
2022-05-05 17:31:35.803 UTC
null
null
null
user8320143
null
null
1
68
dart|flutter
62,431
<p>Yes. It can be done by stacking two icons using the <code>Stack</code> and <code>Positioned</code> widget. </p> <pre><code> new BottomNavigationBarItem( title: new Text('Home'), icon: new Stack( children: &lt;Widget&gt;[ new Icon(Icons.home), new Positioned( /...
7,429,185
Using MsBuild to generate customized MsDeploy manifest (Package target)
<p>I am using Web Deploy to package and deploy web sites for my product. In particular, I have two different projects in my solution I use this method to deploy.</p> <p>I have a third project in the solution (a windows service) that also needs to be installed on the web server.</p> <p>I know I can write a custom man...
8,222,862
1
8
null
2011-09-15 10:10:59.34 UTC
13
2012-04-28 02:46:41.31 UTC
2012-04-28 02:46:41.31 UTC
null
105,999
null
232,593
null
1
18
msbuild|manifest|msdeploy|slowcheetah
8,540
<p>I don't have a complete write up yet for people trying to learn how this works, but I now have a write up for how to at least accomplish this goal.</p> <p><strike><a href="http://thehappypath.net/2011/11/21/using-msdeploy-for-windows-services/" rel="nofollow noreferrer">http://thehappypath.net/2011/11/21/using-msde...
22,650,699
javascript Uncaught TypeError: Cannot read property 'firstChild' of null
<p>I am getting the following error in Google Chrome on a very old Form I inherited (seems to work OK in IE, no errors)</p> <blockquote> <p>Uncaught TypeError: Cannot read property 'firstChild' of null</p> </blockquote> <p>The error applies to the following js <strong>elem.firstChild.nodeValue = dispmessage;</stron...
22,650,720
1
0
null
2014-03-26 03:03:42.093 UTC
null
2014-03-26 03:06:32.733 UTC
null
null
null
null
3,445,112
null
1
13
javascript|html|forms
38,526
<p>This error means the <code>elem</code> object is <code>null</code>. Check the fld value passed and see whether an object with that id actually exists in your code or not.</p>
64,306,943
DefaultValues of react-hook-form is not setting the values to the Input fields in React JS
<p>I want to provide default values in the input field using <code>react-hook-form</code>. First I retrieve the user data from the API endpoint and then setting the state <code>users</code> to that user data. Then I pass the state <code>users</code> to the <code>defaultValues</code> of <code>useForm()</code>.</p> <pre>...
64,307,087
2
0
null
2020-10-11 17:17:59.757 UTC
8
2021-08-18 22:42:54.713 UTC
null
null
null
null
13,847,690
null
1
28
reactjs|react-hook-form
44,156
<p>The problem is that during the first render, <code>users</code> is the <code>useState</code> hook's initial value, which is <code>null</code>. The value only changes after the <code>axios.get()</code> request finishes, which is <em>after</em> the initial render. This means that the the default values passed to <code...
15,417,619
How do you update Xcode on OSX to the latest version?
<p>What is the easiest way to update Xcode on OSX?</p> <p>I see this in the terminal:</p> <pre><code>$ brew install xxxxxxx Warning: Your Xcode (4.3.3) is outdated Please install Xcode 4.6. </code></pre> <p>But when I go to open up <code>Xcode &gt; Preferences &gt; Downloads</code>, it says there are no updates?</p>
15,417,752
14
0
null
2013-03-14 18:42:14.45 UTC
31
2022-08-26 19:22:01.717 UTC
null
null
null
null
639,988
null
1
256
xcode|macos|homebrew
664,581
<ol> <li><p>Open up App Store</p> <p><img src="https://i.stack.imgur.com/BVp6D.png" alt="enter image description here" /></p> </li> <li><p>Look in the top right for the updates section (may also be in lefthand column &quot;Updates&quot;..)</p> <p><img src="https://i.stack.imgur.com/Skf8z.png" alt="enter image descripti...
22,055,889
How to test a Controller Concern in Rails 4
<p>What is the best way to handle testing of concerns when used in Rails 4 controllers? Say I have a trivial concern <code>Citations</code>.</p> <pre><code>module Citations extend ActiveSupport::Concern def citations ; end end </code></pre> <p>The expected behavior under test is that any controller which incl...
22,058,647
4
0
null
2014-02-26 23:34:12.43 UTC
27
2020-11-23 10:42:51.47 UTC
null
null
null
null
224,872
null
1
48
ruby-on-rails|rspec|controller|activesupport-concern
22,613
<p>You will find many advice telling you to use shared examples and run them in the scope of your included controllers.</p> <p>I personally find it over-killing and prefer to perform unit testing in isolation, then use integration testing to confirm the behavior of my controllers.</p> <p><strong>Method 1: without routi...
2,470,285
Foreign keys in django admin list display
<p>If a django model contains a foreign key field, and if that field is shown in list mode, then it shows up as <em>text</em>, instead of displaying a <em>link</em> to the foreign object.</p> <p>Is it possible to automatically display all foreign keys as links instead of flat text?</p> <p>(of course it is possible to...
2,470,606
3
0
null
2010-03-18 13:55:21.007 UTC
15
2021-04-21 08:26:49.937 UTC
null
null
null
null
262,667
null
1
38
django|django-admin|foreign-keys
25,274
<p>I don't think there is a mechanism to do what you want automatically out of the box.</p> <p>But as far as determining the path to an admin edit page based on the id of an object, all you need are two pieces of information:</p> <p>a) <code>self.model._meta.app_label</code></p> <p>b) <code>self.model._meta.module_n...
48,931,958
Fill Proportionally in UIStackView
<p>I am using Storyboard to create a layout which consists of a UITableView and a UIView at the bottom. I am using UIStackView and playing them vertically. I want the UITableView to take 80% of the height and UIView (footer) to take 20%. I am using Fill Proportionally option of UIStackView and even through in Xcode pre...
48,932,048
2
0
null
2018-02-22 16:04:02.867 UTC
12
2018-02-22 16:48:04.64 UTC
2018-02-22 16:35:32.073 UTC
null
5,175,709
null
810,815
null
1
22
ios|autolayout|uistackview
30,598
<p>You will need to set an explicit constraint to make tableView.height 4x bigger than your view size. They don't have intrinsic content size, so the <code>stackView</code> does not &quot;know&quot; how to properly fill the space.</p> <p>Also, set the distribution mode to <code>.fill</code>, because <code>.fillProporti...
1,203,087
Why is Graphics.MeasureString() returning a higher than expected number?
<p>I'm generating a receipt and am using the Graphics object to call the DrawString method to print out the required text.</p> <pre><code>graphics.DrawString(string, font, brush, widthOfPage / 2F, yPoint, stringformat); </code></pre> <p>This works fine for what I needed it to do. I always knew what I was printing out...
6,404,811
2
0
null
2009-07-29 21:14:25.973 UTC
33
2022-09-20 01:07:30.577 UTC
null
null
null
null
74,022
null
1
50
c#|measurement|printdocument
27,276
<p>From WindowsClient.net:</p> <blockquote> <p>GDI+ adds a small amount (1/6 em) to each end of every string displayed. This 1/6 em allows for glyphs with overhanging ends (such as italic '<em>f</em>'), and also gives GDI+ a small amount of leeway to help with grid fitting expansion.</p> <p>The default action of <code>...
2,485,635
Best current framework for unit testing EJB3 / JPA
<p>Starting a new project using EJB 3 / JPA, mainly stateless session beans and batch jobs. I've used JUnit in the past on standard Java webapps and it seemed to work pretty well. In EJB2 unit testing was a pain and required a running container such as JBoss to make the calls into. Now that we're going to be working...
2,498,289
5
0
null
2010-03-21 02:26:39.397 UTC
14
2017-07-13 14:18:31.34 UTC
2010-03-24 17:36:22.273 UTC
null
70,604
null
277,160
null
1
21
java|unit-testing|jpa|jakarta-ee|ejb-3.0
28,861
<p>IMHO, yes they are still relevant. </p> <p>With EJB3, you can test you EJB either like regular POJO, or as managed bean using an embedded EJB container. </p> <p>Same for JPA, you can either embed a JPA implementation for your test and use an in-memory database, or you can mock the data layer completely.</p> <p>Fo...
2,363,040
How to "enable" HTML5 elements in IE 8 that were inserted by AJAX call?
<p><em>See the solution at the bottom of the question.</em></p> <p>IE 8 (and lower) does not work good with unknown elements (ie. HTML5 elements), one cannot style them , or access most of their props. Their are numerous work arounds for this for example: <a href="http://remysharp.com/2009/01/07/html5-enabling-script/...
2,987,541
5
1
null
2010-03-02 12:30:07.98 UTC
7
2015-08-04 07:02:33.78 UTC
2015-08-04 07:02:33.78 UTC
null
82,004
null
82,004
null
1
28
javascript|jquery|ajax|internet-explorer|html
25,239
<p>for all html5 issues in IE7 i use <a href="http://html5shim.googlecode.com/" rel="noreferrer">html5shiv</a> and to accommodate the html5 elements coming back in ajax calls i use <a href="http://jdbartlett.github.com/innershiv/" rel="noreferrer">innershiv</a>.</p> <p>these two small plugins worked for me like a char...
3,078,387
Software patching at a billion miles
<p>Could someone here shed some light about how NASA goes about designing their spacecraft architecture to ensure that they are able to patch bugs in the deployed code? </p> <p>I have never built any “real time” type systems and this is a question that has come to mind after reading this article: </p> <p><a href="htt...
3,081,050
5
5
null
2010-06-20 06:09:40.733 UTC
17
2010-06-20 22:04:30.817 UTC
null
null
null
null
314,661
null
1
32
debugging|real-time
798
<p>I've been a developer on public telephone switching system software, which has pretty severe constraints on reliability, availability, survivability, and performance that approach what spacecraft systems need. I haven't worked on spacecraft (although I did work with many former shuttle programmers while at IBM), and...
3,216,340
How to represent an Enum in an Interface?
<p>How could I define an Interface which has a method that has <code>Enum</code> as a paramater when enums cannot be defined in an interface?</p> <p>For an <code>Enum</code> is not a reference type so an <code>Object</code> type cannot be used as the type for the incoming param, so how then?</p>
3,216,355
5
0
null
2010-07-09 20:30:12.32 UTC
1
2020-07-07 21:37:31.99 UTC
2020-07-07 21:37:31.99 UTC
null
285,795
null
93,468
null
1
36
c#|enums|interface
67,286
<pre><code>interface MyInterface { void MyMethod(Enum @enum); } </code></pre>
3,006,153
Ampersand vs plus for concatenating strings in VB.NET
<p>In VB.NET, is there any advantage to using <code>&amp;</code> to concatenate strings instead of <code>+</code>?</p> <p>For example</p> <pre><code>Dim x as String = "hello" + " there" </code></pre> <p>vs.</p> <pre><code>Dim x as String = "hello" &amp; " there" </code></pre> <p>Yes, I know for a lot of string con...
3,006,235
5
1
null
2010-06-09 13:21:29.867 UTC
10
2020-01-14 13:53:12.2 UTC
2013-03-19 09:44:06.147 UTC
null
63,550
null
109,360
null
1
59
vb.net|string-concatenation
70,681
<p>I've heard good, strong arguments in favor of both operators. Which argument wins the day depends largely on your situation. The one thing I can say is that you should standardize on one or the other. Code that mixes the two is asking for confusion later.</p> <p>The two arguments I remember right now for favorin...
3,143,498
Why check this != null?
<p>Occasionally I like to spend some time looking at the .NET code just to see how things are implemented behind the scenes. I stumbled upon this gem while looking at the <code>String.Equals</code> method via Reflector.</p> <p><strong>C#</strong></p> <pre><code>[ReliabilityContract(Consistency.WillNotCorruptState, Ce...
3,143,558
6
5
null
2010-06-29 18:11:24.387 UTC
17
2014-06-13 03:31:08.953 UTC
2010-07-25 15:03:52.227 UTC
null
158,779
null
158,779
null
1
74
c#|.net|clr|reflector
8,362
<p>I assume you were looking at the .NET 3.5 implementation? I believe the .NET 4 implementation is slightly different.</p> <p>However, I have a sneaking suspicion that this is because it's possible to call even virtual instance methods non-virtually <em>on a null reference</em>. Possible in IL, that is. I'll see if I...
2,381,789
use CSS sprites for list (<li>) background image
<p>Is it possible to use CSS sprites for the list background image? Normally, I render my sprites with CSS like this:</p> <pre><code>.sprite { background: url(sprite.png) no-repeat top left;} .sprite-checkmark { background-position: 0 -24px; width: 24px; height: 23px; } .sprite-comment { background-position: 0 -48px;...
7,017,227
7
0
null
2010-03-04 18:37:27.48 UTC
4
2015-02-22 04:25:01.583 UTC
null
null
null
null
2,749
null
1
35
html|css|css-sprites
56,712
<p>You can also use</p> <pre><code>li:before { background:url(..) no-repeat -##px -##px; width:##px; height:##px; display:block; position:absolute; content: " "; top:##px; left:##px; } </code></pre> <p>and thus get an additional element added to the DOM and give that the background ima...
2,680,389
How to remove all files ending with ~ made by Emacs
<p>Whenever I edit files on emacs, it seems a temporary file is created with the same name with ~ appended to it. Does anyone know an quick/easy way to delete all of these files in the working directory?</p>
2,680,682
7
1
null
2010-04-21 04:48:39.737 UTC
18
2014-09-05 19:05:02.633 UTC
2010-04-21 13:53:09.57 UTC
null
4,958
null
235,771
null
1
45
emacs|backup
37,294
<p>While all the others answers here correctly explain how to remove the files, you ought to understand what's going on. Those files ending in ~ are <em>backup</em> files, automatically created by Emacs. They can be useful sometimes. If you're annoyed by the files and want to delete them every time, then you either </p...
2,630,370
C# ‘dynamic’ cannot access properties from anonymous types declared in another assembly
<p>Code below is working well as long as I have class <code>ClassSameAssembly</code> in same assembly as class <code>Program</code>. But when I move class <code>ClassSameAssembly</code> to a separate assembly, a <code>RuntimeBinderException</code> (see below) is thrown. Is it possible to resolve it? </p> <pre><code...
2,630,439
8
3
null
2010-04-13 14:34:00.523 UTC
12
2018-07-19 10:28:16.18 UTC
2016-01-22 08:46:51.583 UTC
null
1,811,525
null
234,591
null
1
90
dynamic|c#-4.0|anonymous-types
40,078
<p>I believe the problem is that the anonymous type is generated as <code>internal</code>, so the binder doesn't really "know" about it as such.</p> <p>Try using ExpandoObject instead:</p> <pre><code>public static dynamic GetValues() { dynamic expando = new ExpandoObject(); expando.Name = "Michael"; expan...
2,347,770
How do you clear the console screen in C?
<p>Is there a "proper" way to clear the console window in C, besides using <code>system("cls")</code>?</p>
2,347,811
14
2
null
2010-02-27 15:10:41.6 UTC
26
2022-07-13 02:34:40.017 UTC
2017-10-21 20:21:14.497 UTC
null
7,659,995
null
183,441
null
1
69
c|windows|console|console-application
457,490
<p>Well, C doesn't understand the concept of screen. So any code would fail to be portable. Maybe take a look at <a href="http://wikipedia.org/wiki/Conio.h" rel="noreferrer">conio.h</a> or <a href="http://wikipedia.org/wiki/Curses_(programming_library)" rel="noreferrer">curses</a>, according to your needs?</p> <p>Port...
25,027,813
AngularJS/javascript converting a date String to date object
<p>Im stuck on a problem and would appreciate any help. I have read through lot of the discussions already but they dont seem to work for me. </p> <pre><code>//I have a date as a string which I want to get to a date format of dd/MM/yyyy var collectionDate = '2002-04-26T09:00:00'; //used angularjs date filter to form...
25,254,797
4
0
null
2014-07-30 02:24:10.79 UTC
4
2017-03-08 19:30:15.77 UTC
2015-07-29 12:21:46.75 UTC
null
3,576,214
null
2,789,797
null
1
26
javascript|angularjs|date
143,328
<p>This is what I did on the controller</p> <pre><code>var collectionDate = '2002-04-26T09:00:00'; var date = new Date(collectionDate); //then pushed all my data into an array $scope.rows which I then used in the directive </code></pre> <p>I ended up formatting the date to my desired pattern on the directive as follo...
10,814,828
REDIS - Get value of multiple keys
<p>How do I get the value of multiple keys from redis using a sorted set?</p> <pre><code>zadd Users 0 David zadd Users 5 John zadd Users 15 Linda zrevrange Users 0 -1 withscores </code></pre> <p>This will have two users in it.</p> <p>How can I retrieve the users with key 'David' and 'Linda' in one query?</p>
10,817,335
4
0
null
2012-05-30 10:52:01 UTC
5
2014-11-14 13:38:20.353 UTC
2012-05-30 13:11:33.99 UTC
null
1,114,486
null
763,285
null
1
14
redis
43,331
<p>There are multiple ways to do it without introducing a new command in Redis.</p> <p>For instance, you can fill a temporary set with the names you are interested in, then calculate the intersection between the temporary set and the zset:</p> <pre><code>multi sadd tmp David Linda ... and more ... zinterstore res...
10,590,978
How to publish nuget prerelease version package
<p>I understand how to publish a nuget package using nuget command line </p> <p><a href="http://docs.nuget.org/docs/reference/command-line-reference" rel="noreferrer">nuget command line</a> </p> <p>But I Have searched around I don't find docs about how to publish a nuget prerelease package </p> <p><img src="https://...
10,605,480
3
0
null
2012-05-14 21:00:53.813 UTC
8
2021-08-30 05:45:47.893 UTC
2013-05-06 23:21:50.463 UTC
null
96,864
null
96,864
null
1
81
package|nuget|pack
34,647
<p>You only need to specify a version string that uses SemVer format (e.g. 1.0-beta) instead of the usual format (e.g. 1.0) and NuGet will automatically treat it as a prerelease package.</p> <p>"As of NuGet 1.6, NuGet supports the creation of prerelease packages by specifying a prerelease string in the version number ...
6,119,867
stocks splitting api google or yahoo
<p>I am looking for a way to get stock splitting information. Using the yahoo stock API I can get all types of info on any symbol but I don't think I can get the split ratio or even whether it split. Does anyone know of a way of getting this info?</p>
6,123,886
2
0
null
2011-05-25 05:21:02.69 UTC
11
2020-07-22 15:07:57.353 UTC
2014-06-10 19:37:06.92 UTC
null
881,229
null
503,513
null
1
7
yahoo-finance|google-finance
8,609
<p>This is how the <a href="http://www.quantmod.com/">quantmod</a> <a href="http://www.r-project.org">R</a> package does it. The split information is in the "Dividend Only" CSV:<br> <a href="http://ichart.finance.yahoo.com/x?s=IBM&amp;a=00&amp;b=2&amp;c=1962&amp;d=04&amp;e=25&amp;f=2011&amp;g=v&amp;y=0&amp;z=30000">ht...
19,472,058
Angular JS and Directive Link and $timeout
<p>i have a problem with a very basic example with AngularJS and directives. I want to create a directive that show a webcam image with webrtc. My code show the stream perfectly but if i add a timeout ( for example to refresh a canvas ) the $timeout don't work this is the code:</p> <pre><code>wtffDirectives.directive(...
19,472,376
3
0
null
2013-10-19 22:58:01.827 UTC
1
2017-02-08 14:34:40.423 UTC
2017-02-08 14:34:15.667 UTC
null
381,422
null
1,745,729
null
1
34
javascript|angularjs|angularjs-directive|timeout
51,087
<p>In your code your comment says 'show only one "pass"'. Timeout only executes one time, after the specified, delay. </p> <p>Perhaps you want setInterval (if you're pre angular 1.2)/ $interval (new to 1.2) which sets up a recurring call. Here's the setInterval version:</p> <pre><code>var timeout = setInterval(fun...
32,344,017
Check If field exists in an sub-document of an Array
<p>I have a schema that is similar to this. </p> <pre class="lang-js prettyprint-override"><code>{id: Number, line_items: [{ id: String, quantity: Number, review_request_sent :Boolean }], total_price: String, name: String, order_number: Number } </code></pre> <p>What I want to find is all docu...
32,344,116
4
0
null
2015-09-02 03:05:07.36 UTC
4
2020-10-13 07:18:45.69 UTC
2019-07-13 19:10:25.447 UTC
null
6,887,435
null
841,818
null
1
22
mongodb|mongoose|mongodb-query
43,759
<p>You basically want <a href="http://docs.mongodb.org/master/reference/operator/query/elemMatch/" rel="noreferrer"><strong><code>$elemMatch</code></strong></a> and the <a href="http://docs.mongodb.org/master/reference/operator/query/exists/" rel="noreferrer"><strong><code>$exists</code></strong></a> operator, as this ...
47,310,537
How to change zsh-autosuggestions color
<p>I am new at <code>zsh</code>.</p> <p>I've installed the plugin <code>zsh-autosuggestions</code> in <a href="https://github.com/robbyrussell/oh-my-zsh" rel="noreferrer">oh-my-zsh</a> using instruction mentioned <a href="https://github.com/zsh-users/zsh-autosuggestions" rel="noreferrer">here</a>. I am using Linux (Fe...
47,313,453
3
0
null
2017-11-15 14:54:50.543 UTC
16
2019-12-17 01:10:16.933 UTC
null
null
null
null
4,590,997
null
1
63
linux|zsh|oh-my-zsh|zshrc|zsh-completion
32,169
<p>You can edit your ~/.zshrc and change/add the variable: <code>ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=value'</code></p> <p>I have just tested the value from <code>fg=8</code> to <code>fg=5</code>. I think <code>fg</code> stands for Foreground.</p> <p><code>ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=5'</code></p> <p>**OBS: A...
19,158,327
Android Linear Layout Weight Programmatically
<p>I want to add three linear layouts to an activity programatically each of same width. the problem is i am not able to set the weights of these layouts programmatically. I could do this within xml, but I want to do this in program. here is what I want: <img src="https://i.stack.imgur.com/2503h.jpg" alt="enter image d...
19,158,669
4
0
null
2013-10-03 11:44:16.277 UTC
4
2019-05-14 15:32:06.887 UTC
2019-05-14 15:32:06.887 UTC
null
648,265
null
1,841,812
null
1
28
android|android-linearlayout|android-layout-weight
38,017
<p>Here its the solution </p> <pre><code> LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, 100); lp.weight = 1; </code></pre> <p>See Full Solution </p> <pre><code>LinearLayout ll1, ll2, ll3; /* Find these LinearLayout by ID i.e ll1=(LinearLayout)findViewById(R.id.ll1); */ Li...
25,604,969
Setting a system variable within a maven profile
<p>Is it possible within maven to set a system property that is attainable from within a java class.</p> <p>I have seen that this is possible (<a href="https://stackoverflow.com/questions/9622121/pass-a-java-parameter-from-maven">here</a>) within the surefire plugin as follows;</p> <pre><code>String param = System.ge...
25,605,901
1
0
null
2014-09-01 11:34:52.563 UTC
6
2018-04-08 07:49:25.33 UTC
2017-05-23 12:25:13.057 UTC
null
-1
null
287,732
null
1
28
java|maven|environment-variables
50,904
<p>You should check out the <a href="http://www.mojohaus.org/exec-maven-plugin/" rel="noreferrer"><strong>exec-maven-plugin</strong></a>.</p> <p>With the following configuration (notice the <code>&lt;systemProperties&gt;</code>)...</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; ...
8,471,551
What is STATE_SAVING_METHOD parameter in JSF 2.0
<p>I am not able to understand what is the function of this line in web.xml</p> <pre><code>&lt;context-param&gt; &lt;param-name&gt;javax.faces.STATE_SAVING_METHOD&lt;/param-name&gt; &lt;param-value&gt;server&lt;/param-value&gt; &lt;/context-param&gt; </code></pre> <p>I have read that the NetBeans default is <...
8,474,609
2
0
null
2011-12-12 08:23:03.347 UTC
23
2015-03-01 16:14:08.8 UTC
2013-09-10 01:45:13.57 UTC
null
814,702
null
1,000,510
null
1
48
jsf-2
53,924
<blockquote> <pre><code>java.io.NotSerializableException </code></pre> </blockquote> <p>This kind of exception has usually a message in the root cause which shows the fully qualified class name of the class which doesn't implement <code>Serializable</code>. You should pay close attention to this message to learn about...
328,061
How to make a surface with a transparent background in pygame
<p>Can someone give me some example code that creates a surface with a transparent background in pygame?</p>
328,067
3
0
null
2008-11-29 21:58:40.3 UTC
9
2020-10-24 11:29:49.25 UTC
null
null
null
Paul Eden
3,045
null
1
45
python|transparency|pygame
42,562
<p>This should do it:</p> <pre><code>image = pygame.Surface([640,480], pygame.SRCALPHA, 32) image = image.convert_alpha() </code></pre> <p>Make sure that the color depth (32) stays explicitly set else this will not work.</p>
39,418,491
AnyString() as parameter for unit test
<p>I have to deal with a legacy application that has no tests. So before I begin refactoring I want to make sure everything works as it is.</p> <p>Now imagine the following situation:</p> <pre><code>public SomeObject doSomething(final OtherObject x, final String something) { if(x == null) throw new RuntimeExcepti...
39,418,972
4
0
null
2016-09-09 19:27:14.297 UTC
1
2019-08-07 17:00:50.027 UTC
null
null
null
user4063815
null
null
1
4
java|junit|mockito|powermock|assertj
56,546
<p>Well, like Mockito is trying to tell you via that exception, that's not really how you'd use <code>anyString</code>. Such methods are only to be used by mocks. </p> <p>So, why not try testing with an actual random string? My personal favorite in such a scenario: <a href="https://docs.oracle.com/javase/7/docs/api/ja...
22,181,264
Prevent cell numbers from incrementing in a formula in Excel
<p>I have a formula in Excel that needs to be run on several rows of a column based on the numbers in that row divided by one constant. When I copy that formula and apply it to every cell in the range, all of the cell numbers increment with the row, including the constant. So:</p> <pre><code>B1=127 C4='=IF(B4&lt;&gt;"...
22,181,304
4
0
null
2014-03-04 19:34:46.85 UTC
9
2021-11-16 17:26:39.453 UTC
2015-06-13 20:37:53.863 UTC
null
445,131
null
1,533,046
null
1
73
excel
176,257
<p>There is something called 'locked reference' in excel which you can use for this, and you use <code>$</code> symbols to lock a range. For your example, you would use:</p> <pre><code>=IF(B4&lt;&gt;"",B4/B$1,"") </code></pre> <p>This locks the <code>1</code> in <code>B1</code> so that when you copy it to rows below,...
22,096,274
Object Serialization to JSON (using Gson). How to set field names in UpperCamelCase?
<p>I need to serialize a list of simple Java objects to JSON using Google Gson library.</p> <p>The object:</p> <pre><code>public class SimpleNode { private String imageIndex; private String text; public String getImageIndex() { return imageIndex; } public void setImageIndex(String imageI...
22,096,369
1
0
null
2014-02-28 13:17:27.617 UTC
8
2016-10-26 07:16:22.177 UTC
2016-10-26 07:16:22.177 UTC
null
1,075,341
null
1,735,047
null
1
34
java|json|serialization|gson
34,981
<p>Taken from the docs:</p> <p>Gson supports some pre-defined field naming policies to convert the standard Java field names (i.e. camel cased names starting with lower case --- "sampleFieldNameInJava") to a Json field name (i.e. sample_field_name_in_java or SampleFieldNameInJava). See the FieldNamingPolicy class for ...
22,177,590
Click by bounds / coordinates
<p>I know it is possible for Espresso to click by bounds the way <a href="https://stackoverflow.com/questions/20519905/uiautomator-click-on-a-imagebutton-with-no-text-or-content-desc">UiAutomator does</a>. (x and y coordinates) I have read through the documentation but I can't seem to find it. Any help is appreciated. ...
22,798,043
3
0
null
2014-03-04 16:33:10.863 UTC
4
2018-01-25 15:39:10.273 UTC
2017-05-23 12:26:06.337 UTC
null
-1
null
1,642,079
null
1
30
android|android-testing|android-espresso
12,479
<p>Espresso has the <a href="http://code.google.com/p/android-test-kit/source/browse/espresso/lib/src/main/java/com/google/android/apps/common/testing/ui/espresso/action/GeneralClickAction.java"><code>GeneralClickAction</code></a>, this is the underlying implementation of ViewActions <code>click()</code>, <code>doubleC...
36,627,613
SQL query to check if a name begins and ends with a vowel
<p>I want to query the list of <code>CITY</code> names from the table <code>STATION(id, city, longitude, latitude)</code> which have vowels as both their first and last characters. The result cannot contain duplicates.</p> <p>For this is I wrote a query like <code>WHERE NAME LIKE 'a%'</code> that had 25 conditions, ea...
36,627,696
33
2
null
2016-04-14 15:29:19.14 UTC
28
2022-08-16 19:23:55.63 UTC
2017-04-10 20:54:01.887 UTC
null
7,802,200
null
5,735,244
null
1
76
mysql|sql|select
303,700
<p>You could use a <a href="http://dev.mysql.com/doc/refman/5.7/en/regexp.html#operator_regexp" rel="noreferrer">regular expression</a>:</p> <pre><code>SELECT DISTINCT city FROM station WHERE city RLIKE '^[aeiouAEIOU].*[aeiouAEIOU]$' </code></pre>
35,268,857
Bootstrap datepicker in modal not working
<p>I've tried to google and search SO for a similar question, but haven't found anything as of yet. I have an issue where I create and open a modal from jquery and try to access a date picker, however it doesn't activate the datepickers JS.</p> <pre><code>$("[id=add]").click(function () { $("#myModal .modal-header...
35,269,000
10
2
null
2016-02-08 11:44:26.83 UTC
1
2020-01-14 22:19:27.76 UTC
2016-02-16 13:41:01.52 UTC
null
1,016,716
null
1,267,690
null
1
19
javascript|jquery|html|datepicker
62,220
<p><strong>The datepicker is hiding behind the modal.</strong></p> <p>Set datepicker's <code>z-index</code> above the modal's which is <code>1050</code>.</p> <p>Additionally wrap your datepicker code in bootstrap's modal shown event.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" d...
28,572,700
I am trying to set maxFileSize but it is not honored
<p>I am developing an application utilizing JHipster. I have added the following to my application-dev.yml file:</p> <pre><code>spring: profiles: active: dev multipart: maxFileSize: -1 </code></pre> <p>But I am still getting an error when I try to try to upload a file > 1MB:</p> <pre><code>...
28,572,901
7
1
null
2015-02-17 22:51:24.213 UTC
9
2020-04-17 06:51:13.663 UTC
2016-12-16 17:28:27.893 UTC
null
4,410,762
null
4,410,762
null
1
53
spring-boot|jhipster
53,897
<p>In addition to configuring max file size, you may also need to configure max request size if you have a single file that's greater than 10MB or you want to upload multiple files in the same request with sizes that total more than 10MB.</p> <p>The exact properties that need to be used depend on the version of Spring...
20,688,851
java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
<p>I use maven to manage my web project dependency. I add apache poi dependency into my pom file. it does not show error when complied. but when it runs, it will throw RuntimeException at my MainApplication() class. while it gives that java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook</p> <p>I have ...
20,693,788
1
0
null
2013-12-19 18:17:23.43 UTC
1
2014-02-20 19:13:50.24 UTC
2014-02-20 19:13:50.24 UTC
null
1,165,907
null
3,120,272
null
1
4
excel|apache-poi|runtimeexception
42,419
<p><a href="http://poi.apache.org/overview.html#components" rel="noreferrer">Apache POI provides a components page</a> which details all of the different parts of the project, what jars you need, and what Maven artifacts you need. If you look there you'll see the following:</p> <pre><code>|Component | Application type...
36,013,063
What is the purpose of meshgrid in Python / NumPy?
<p>Can someone explain to me what is the purpose of <code>meshgrid</code> function in Numpy? I know it creates some kind of grid of coordinates for plotting, but I can't really see the direct benefit of it.</p> <p>I am studying "Python Machine Learning" from Sebastian Raschka, and he is using it for plotting the decis...
36,014,586
9
1
null
2016-03-15 13:43:43.957 UTC
255
2022-07-17 08:54:41.13 UTC
2018-09-07 10:11:57.713 UTC
null
670,206
null
3,441,597
null
1
463
python|numpy|multidimensional-array|mesh|numpy-ndarray
299,719
<p>The purpose of <code>meshgrid</code> is to create a rectangular grid out of an array of x values and an array of y values.</p> <p>So, for example, if we want to create a grid where we have a point at each integer value between 0 and 4 in both the x and y directions. To create a rectangular grid, we need every combi...
20,330,174
AVCapture capturing and getting framebuffer at 60 fps in iOS 7
<p>I'm developping an app which requires capturing framebuffer at as much fps as possible. I've already figured out how to force iphone to capture at 60 fps but</p> <pre><code>- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnectio...
20,332,209
3
0
null
2013-12-02 14:04:26.91 UTC
21
2017-04-12 08:41:47.673 UTC
2013-12-03 14:21:14.117 UTC
null
962,658
null
962,658
null
1
19
ios|iphone|camera|avcapturesession|frame-rate
23,168
<p>I am getting samples at 60 fps on the iPhone 5 and 120 fps on the iPhone 5s, both when doing real time motion detection in captureOutput and when saving the frames to a video using AVAssetWriter.</p> <p>You have to set thew AVCaptureSession to a format that supports 60 fps:</p> <pre><code>AVsession = [[AVCaptureSe...
6,161,418
Android - Failed to find an AVD compatible with target 'Android 1.6' error
<p>I'm trying to run a Hello World app for Android for the first time, but I keep getting a:</p> <pre><code>Failed to find an AVD compatible with target 'Android 1.6' </code></pre> <p>error when I try to create an AVD.</p> <p>I have tried the following solution in order to fix the issue:</p> <ul> <li>Checked that I...
6,161,805
4
0
null
2011-05-28 11:42:17.76 UTC
1
2014-04-15 16:43:50.533 UTC
null
null
null
null
2,106,959
null
1
7
android|eclipse
40,547
<p>In this end I solved in by the following method:</p> <p>I set a new environment variable ANDROID_SDK_HOME to the same location as my HOME environment variable which is C:\Users\MyName (This was suggested by one of the commenters in <a href="http://techtraveller.blogspot.com/2009/07/android-fixed-unknown-virtual-dev...
34,864,824
Twitter Bootstrap: margin-bottom built in css class
<p>Is there built in margin bottom class to use? I tried with <code>bottom5</code> like</p> <pre><code>&lt;div class="col-lg-2 bottom5"&gt;&lt;/div&gt; </code></pre> <p>but this doesn't work.</p>
34,865,025
6
1
null
2016-01-18 21:59:35.16 UTC
3
2020-06-17 01:15:16.86 UTC
2016-01-18 22:04:05.11 UTC
null
3,874,768
null
1,765,862
null
1
17
css|twitter-bootstrap|twitter-bootstrap-3
67,143
<p>There is no bootstrap class for margins like you describe. The reasons would be the need for classes for margins 0 to 10s or 100s, as well as the need for multiple units, such as <code>px</code>, <code>em</code>, <code>%</code>, etc.</p> <p>You can make your own classes fairly easy. Even easier with sublime text-ed...
1,602,831
One file per component or several files per component?
<p>Should I wrap all the files I want to install in individual components? What is the advantage of putting several files in one component?</p>
1,604,348
2
2
null
2009-10-21 18:51:32.103 UTC
25
2019-10-31 00:29:19.08 UTC
2019-06-24 16:42:54.42 UTC
null
142,162
null
122,732
null
1
69
wix|windows-installer|wix3
20,497
<p>One reason for "one file per component" is <a href="http://support.microsoft.com/kb/290997" rel="noreferrer">resiliency</a>. When an application is started, Windows Installer can check whether the <a href="https://stackoverflow.com/questions/2003043/what-is-the-wix-keypath-attribute">keypath</a> of any component is ...
2,246,206
What is the equivalent in F# of the C# default keyword?
<p>I'm looking for the equivalent of C# <code>default</code> keyword, e.g:</p> <pre><code>public T GetNext() { T temp = default(T); ... </code></pre> <p>Thanks</p>
2,246,216
2
0
null
2010-02-11 17:17:36.03 UTC
9
2020-06-21 15:44:58.513 UTC
2010-06-25 22:17:50.423 UTC
null
161,331
null
161,331
null
1
85
c#|f#|default|keyword|c#-to-f#
11,874
<p>I found this in a blog: "<a href="http://lorgonblog.spaces.live.com/blog/cns!701679AD17B6D310!725.entry" rel="noreferrer">What does this C# code look like in F#? (part one: expressions and statements)</a>"</p> <blockquote> <p>C# has an operator called "default" that returns the zero-initialization value of a ...
66,082,776
Uncommon homebrew error: "Unknown command: switch"
<p>I am in the process of trying to restart some legacy project that demands the use of an older version of openssl.</p> <p>I have found good input on the issue <a href="https://stackoverflow.com/a/61086871/921573">here</a>, which worked on one of my machines but not the other, which gives me the following error:</p> <...
66,101,345
2
2
null
2021-02-06 22:48:36.767 UTC
4
2022-02-07 14:16:29.247 UTC
null
null
null
null
921,573
null
1
24
openssl|homebrew|macos-catalina
38,034
<p>As I commented above, <a href="https://github.com/Homebrew/discussions/discussions/339" rel="noreferrer">Homebrew got rid of the <code>switch</code> command</a> entirely, which is why it says &quot;Unknown command&quot;.</p> <p>But rbenv provides a tap that you can install openssl from. You can run the command below...
57,243,677
Proportional height (or width) in SwiftUI
<p>I started exploring SwiftUI and I can't find a way to get a simple thing: I'd like a View to have proportional height (basically a percentage of its parent's height). Let's say I have 3 views vertically stacked. I want:</p> <ul> <li>The first to be 43% (of its parent's height) high</li> <li>The second to be 37% (of ...
57,244,001
1
3
null
2019-07-28 18:08:05.083 UTC
10
2021-08-18 21:21:37.48 UTC
2021-08-18 21:21:37.48 UTC
null
1,291,872
null
1,291,872
null
1
66
ios|swift|autolayout|swiftui
31,298
<p>You can make use of <code>GeometryReader</code>. Wrap the reader around all other views and use its closure value <code>metrics</code> to calculate the heights:</p> <pre><code>let propHeight = metrics.size.height * 0.43 </code></pre> <p>Use it as follows:</p> <pre><code>import SwiftUI struct ContentView: View { ...
6,042,829
How can i open a url in web browser (such as IE) and pass credentials
<p>I want to open a page that required Basic authentication. I want to pass the Basic authentication header to the browser along with the URL.</p> <p>How can i do that?</p>
6,043,412
5
5
null
2011-05-18 09:53:55.867 UTC
6
2017-09-24 16:47:45.683 UTC
2011-05-18 10:53:26.953 UTC
null
41,956
null
243,967
null
1
16
c#|.net|.net-4.0
49,275
<p>Via a header you can:</p> <pre><code>string user = "uuuuuuu"; string pass = "ppppppp"; string authHdr = "Authorization: Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(user + ":" + pass)) + "\r\n"; webBrowserCtl.Navigate("http://example.com", null, null, authHdr); </code></pre> <p>given that this needs t...
6,193,126
How to get row count from EXEC() in a TSQL SPROC?
<p>I have a TSQL sproc that builds a query as and executes it as follows:</p> <pre><code>EXEC (@sqlTop + @sqlBody + @sqlBottom) </code></pre> <p>@sqlTop contains something like SELECT TOP(x) col1, col2, col3... </p> <p>TOP(x) will limit the rows returned, so later I want to know what the actual number of rows in the...
6,193,212
7
0
null
2011-05-31 20:23:00.217 UTC
1
2021-03-26 18:00:03.393 UTC
null
null
null
null
172,359
null
1
25
tsql|sql-server-2008|stored-procedures
63,735
<p>You could instead have the dynamic query return the result as a row set, which you would then insert into a table variable (could be a temporary or ordinary table as well) using the <code>INSERT ... EXEC</code> syntax. Afterwards you can just read the saved value into a variable using <code>SELECT @var = ...</code>:...
6,293,498
Check whether user has a Chrome extension installed
<p>I am in the process of building a Chrome extension, and for the whole thing to work the way I would like it to, I need an external JavaScript script to be able to detect if a user has my extension installed. </p> <p>For example: A user installs my plugin, then goes to a website with my script on it. The website det...
6,293,601
16
3
null
2011-06-09 13:27:16.853 UTC
59
2021-07-14 21:59:40.02 UTC
2013-01-16 23:10:26.743 UTC
null
122,162
user179169
null
null
1
125
javascript|google-chrome|google-chrome-extension
135,229
<p>I am sure there is a direct way (calling functions on your extension directly, or by using the JS classes for extensions), but an indirect method (until something better comes along):</p> <p>Have your Chrome extension look for a specific DIV or other element on your page, with a very specific ID.</p> <p>For exampl...
5,827,944
Git error on commit after merge - fatal: cannot do a partial commit during a merge
<p>I ran a <code>git pull</code> that ended in a conflict. I resolved the conflict and everything is fine now (I used mergetool also).</p> <p>When I commit the resolved file with <code>git commit file.php -m "message"</code> I get the error:</p> <pre><code>fatal: cannot do a partial commit during a merge. </code></p...
8,062,976
20
3
null
2011-04-29 04:36:59.377 UTC
72
2022-08-28 01:58:32.477 UTC
2021-09-23 19:24:15.793 UTC
null
967,621
null
134,143
null
1
334
git|commit|git-merge|git-merge-conflict
367,130
<p>I found that adding "-i" to the commit command fixes this problem for me. The -i basically tells it to stage additional files before committing. That is:</p> <pre><code>git commit -i myfile.php </code></pre>
6,275,299
How to disable copy/paste from/to EditText
<p>In my application, there is a registration screen, where i do not want the user to be able to copy/paste text into the <code>EditText</code> field. I have set an <code>onLongClickListener</code> on each <code>EditText</code> so that the context menu showing copy/paste/inputmethod and other options does not show up....
12,331,404
31
4
null
2011-06-08 07:05:12.15 UTC
30
2022-03-07 07:05:17.793 UTC
2011-12-08 11:28:57.97 UTC
null
68,805
null
607,968
null
1
147
android-widget|android-edittext|android|android-keypad
127,438
<p>If you are using API level 11 or above then you can stop copy,paste,cut and custom context menus from appearing by.</p> <pre><code>edittext.setCustomSelectionActionModeCallback(new ActionMode.Callback() { public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; ...
4,979,252
JSLint error: "Move the invocation into the parens that contain the function"
<p>What does <strong>JSLint</strong> mean by this error? And how should it be rewritten?</p> <p><code>Error: Problem at line 78 character 3: Move the invocation into the parens that contain the function: })(jQuery); </code></p>
4,979,255
1
0
null
2011-02-12 16:48:57.423 UTC
14
2015-11-24 16:17:25.043 UTC
2015-11-24 16:17:25.043 UTC
null
509,670
null
509,670
null
1
74
javascript|jquery|debugging|compiler-errors|jslint
25,663
<p>To pass JSLint's criteria, it needs to be written like this:</p> <p><code>}(jQuery));</code></p> <p>Though I think that particular criteria is a bit subjective. Both ways seem fine in my opinion.</p> <p><code>(function () {})()</code> makes a bit more sense to me since you wrap the full function, then call it</p>...
24,884,174
Generate random number in Laravel
<p>Please am working on a Project on Laravel and I wanted to Generate a Random Number in this format: one character in any position order and the rest integers. Example: C87465398745635, 87474M745436475, 98487464655378J8 etc. and this is my Controller: </p> <pre><code> function generatePin( $number ) { $pins = ...
24,884,343
6
1
null
2014-07-22 09:53:39.947 UTC
3
2021-03-03 14:08:41.52 UTC
2014-07-22 10:00:31.94 UTC
null
1,269,513
null
3,798,413
null
1
18
php|string|random|laravel
106,860
<p>If you want to generate the random string like you said, replace: </p> <pre><code>$string = str_random(15); </code></pre> <p>with</p> <pre><code>// Available alpha caracters $characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; // generate a pin based on 2 * 7 digits + a random character $pin = mt_rand(1000000, 9999999) ...
19,419,374
Android convert date and time to milliseconds
<p>I have one date and time format as below:</p> <pre><code>Tue Apr 23 16:08:28 GMT+05:30 2013 </code></pre> <p>I want to convert into milliseconds, but I actually dont know which format it is. Can anybody please help me.</p>
19,419,480
10
0
null
2013-10-17 06:06:51.477 UTC
8
2019-12-12 08:35:00.603 UTC
null
null
null
null
644,603
null
1
49
android|datetime
110,137
<blockquote> <p>Update for <a href="https://developer.android.com/reference/java/time/format/DateTimeFormatter?hl=en" rel="noreferrer">DateTimeFormatter</a> introduced in API 26. </p> </blockquote> <p>Code can be written as below for API 26 and above</p> <pre><code>// Below Imports are required for this code snippe...
41,100,333
Difference between docker run --user and --group-add parameters
<p>What is the difference between <code>docker run</code> parameters:</p> <pre><code> -u, --user="" Sets the username or UID used and optionally the groupname or GID for the specified command. The followings examples are all valid: --user [user | user:group | uid | uid:gid | user:gid | uid:group ] ...
41,101,828
2
0
null
2016-12-12 11:55:36.71 UTC
7
2016-12-12 16:31:34.39 UTC
null
null
null
null
6,128,602
null
1
38
docker
73,553
<p><code>docker run --user=demo_user &lt;image_name&gt; &lt;command&gt;</code> runs a container with the given command as <strong>demo_user</strong> <a href="https://i.stack.imgur.com/shNJb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/shNJb.png" alt="enter image description here"></a></p> <p><code>docker...
41,675,077
How can I filter array of state in react?
<p>I have order reducer, which has many states.</p> <pre><code>const initialState = { channel: null, order: {}, fetching:true, menu: [], categories: [], subcategories: [], currentCategoryId: 1, currentSubcategoryId: 5, currentMenu: [], }; </code></pre> <p>What I want to filter is <code>menu</code>. <code>men...
41,675,421
4
0
null
2017-01-16 11:11:44.293 UTC
1
2020-08-04 11:16:36.7 UTC
null
null
null
null
6,303,312
null
1
4
reactjs|filter|redux
77,334
<p>Please use the <code>filter</code> function:</p> <pre><code>{...state,currentMenu: action.menu.filter((menu) =&gt; state.currentCategoryId == menu.category_id)} </code></pre> <p>P.S: I agree with the below answer, it's better to use Immutable.js</p>
60,121,962
This class is visible to consumers via SomeModule -> SomeComponent, but is not exported from the top-level library entrypoint
<p>I upgraded all my angular library to <code>angular 9.0.0</code> using <code>ng update</code> and when I try to build them I got below error.</p> <p><strong>Error:</strong></p> <blockquote> <p>Unsupported private class SomeComponent. This class is visible to consumers via SomeModule -> SomeComponent, but is not e...
60,122,077
4
0
null
2020-02-07 22:27:13.847 UTC
11
2022-08-26 20:04:54.167 UTC
2020-02-09 09:25:29.037 UTC
null
1,000,551
null
537,647
null
1
87
angular|angular-library|angular9
37,893
<p>This error happens if any component is exported in <code>NgModule</code>and not included in your <code>public_api.ts</code>, <code>Angular 9</code> will throw an error now.</p> <p>This error was not coming in <code>Angular 8</code> but after upgrading to <code>Angular 9</code> it started showing.</p> <p>If you expor...
26,553,924
What is the difference in Swift between 'unowned(safe)' and 'unowned(unsafe)'?
<p>Apple's <a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/index.html"><em>Swift Programming Language Guide</em></a> mentions the <em>capture specifiers</em> <code>unowned(safe)</code> and <code>unowned(unsafe)</code>, in addition to <code>weak</code> and <code...
26,557,046
4
0
null
2014-10-24 18:19:33.597 UTC
13
2021-05-21 01:03:25.59 UTC
2014-10-24 18:40:59.35 UTC
null
656,912
null
656,912
null
1
37
memory-management|swift|automatic-ref-counting
9,236
<p>From what I understand, although I can't find a definitive source from Apple, <code>unowned</code> can be broken into two flavors, <code>safe</code> and <code>unsafe</code>.</p> <p>A bare <code>unowned</code> is <code>unowned(safe)</code>: it is a specially wrapped reference which will throw an exception when a dea...
27,784,528
numpy division with RuntimeWarning: invalid value encountered in double_scalars
<p>I wrote the following script:</p> <pre><code>import numpy d = numpy.array([[1089, 1093]]) e = numpy.array([[1000, 4443]]) answer = numpy.exp(-3 * d) answer1 = numpy.exp(-3 * e) res = answer.sum()/answer1.sum() print res </code></pre> <p>But I got this result and with the error occurred:</p> <pre><code>nan C:\Use...
27,784,588
2
0
null
2015-01-05 17:15:04.447 UTC
20
2019-06-18 21:57:10.327 UTC
null
null
null
null
2,330,923
null
1
100
python|numpy|warnings
346,020
<p>You can't solve it. Simply <code>answer1.sum()==0</code>, and you can't perform a division by zero. </p> <p>This happens because <code>answer1</code> is the exponential of 2 very large, negative numbers, so that the result is rounded to zero.</p> <p><code>nan</code> is returned in this case because of the division...
43,940,857
after upgrade to 2.7 ClassNotFoundException: org.mockito.exceptions.Reporter when run test
<p>I try to set up junit, mokito and powermock together but when I ran a test I get ClassNotFoundException :(</p> <pre><code>testCompile 'junit:junit:4.12' testCompile 'org.mockito:mockito-core:2.7.22' androidTestCompile 'org.mockito:mockito-core:2.7.22' androidTestCompile "org.mockito:mockito-android:2.7.22" testCom...
44,883,638
4
0
null
2017-05-12 15:00:48.313 UTC
1
2018-10-17 06:23:46.773 UTC
null
null
null
null
1,461,568
null
1
34
java|junit|mockito|powermock
36,916
<p>That's what worked for me: </p> <pre><code>testCompile 'junit:junit:4.12' testCompile 'org.mockito:mockito-core:2.8.0' testCompile 'org.powermock:powermock-api-mockito2:1.7.0RC2' testCompile 'org.powermock:powermock-module-junit4:1.7.0' testCompile 'org.powermock:powermock-core:1.7.0' testCompile 'org.powermock:pow...
21,577,573
Intellij IDEA can not resolve symbol with Play framework
<p>I am using IDEA 13 with Play 2.2.1 and was doing the examples on the <a href="http://www.playframework.com/documentation/2.2.x/JavaTodoList" rel="noreferrer">play site</a>.</p> <pre><code>public static Result index() { return redirect(routes.Application.tasks()); } </code></pre> <p>IDEA says "cannot resolve met...
21,596,223
7
1
null
2014-02-05 12:39:53.6 UTC
7
2019-12-09 09:25:35.09 UTC
null
null
null
null
2,239,106
null
1
31
intellij-idea|playframework
33,681
<p>I had a similar problem when testing my controller. I solved it by <code>"File" &gt; "Open Project"</code> and choose the base folder of the Play framework project (delete all idea settings file from the folder before so that it will reimport using the SBT settings).</p> <p>The last version of the SBT support for I...
32,997,269
COPYing a file in a Dockerfile, no such file or directory?
<p>I have a Dockerfile set up in my root (~) folder. The first three lines of my file look like this:</p> <pre><code>COPY file1 /root/folder/ COPY file2 /root/folder/ COPY file3 /root/folder/ </code></pre> <p>but it returns the following error for each line:</p> <blockquote> <p>No such file or directory</p> </bloc...
32,997,442
22
1
null
2015-10-07 16:09:13.45 UTC
18
2022-06-18 20:01:35.2 UTC
2017-01-22 16:45:32.187 UTC
null
1,323,398
null
2,485,799
null
1
150
docker
252,148
<p>The COPY instruction in the <code>Dockerfile</code> copies the files in <code>src</code> to the <code>dest</code> folder. Looks like you are either missing the <code>file1</code>, <code>file2</code> and <code>file3</code> or trying to build the <code>Dockerfile</code> from the wrong folder. </p> <p><a href="https:/...
9,338,180
Why HotSpot will optimize the following using hoisting?
<p>In the "Effective Java", the author mentioned that</p> <pre><code>while (!done) i++; </code></pre> <p>can be optimized by HotSpot into </p> <pre><code>if (!done) { while (true) i++; } </code></pre> <p><br> I am very confused about it. The variable <code>done</code> is usually not a <em>const</em>, why can co...
9,338,302
4
0
null
2012-02-18 03:12:18.173 UTC
13
2021-02-19 07:21:28.523 UTC
2018-03-28 11:07:04.943 UTC
null
814,702
null
705,414
null
1
23
java|jvm-hotspot
2,900
<p>The author assumes there that the variable <code>done</code> is a local variable, which does not have any requirements in the Java Memory Model to expose its value to other threads without synchronization primitives. Or said another way: the value of <code>done</code> won't be changed or viewed by any code other th...
9,051,516
clojure and leiningen - using a git repository as dependency
<p>Is it possible to have leiningen pull a project directly from a git repository (on github) as a dependency?</p> <p>Using Bundler with Ruby, it is possible to map a gem to a git repo, allowing for rapid development and integration of dependent projects.</p> <p><strong>Update</strong> </p> <p>Based on the accepted ...
47,482,800
4
0
null
2012-01-29 06:56:00.723 UTC
14
2021-03-16 18:40:39.2 UTC
2012-01-30 01:57:43.22 UTC
null
14,971
null
14,971
null
1
38
git|clojure|github|dependency-management|leiningen
7,150
<h1>Answer for 2017: Use <a href="https://github.com/LonoCloud/lein-voom/" rel="nofollow noreferrer"><em>lein-voom</em></a></h1> <p>You can use <a href="https://github.com/LonoCloud/lein-voom/" rel="nofollow noreferrer"><em><strong>lein-voom</strong></em></a> to pull and build project dependencies from GitHub or other...
64,331,095
How to add a button to every row in MUI DataGrid
<p>I cant add a button into every row of MUI <code>DataGrid</code>. I have a MUI <code>DataGrid</code> which I render like this:</p> <pre><code>&lt;DataGrid rows={rows} columns={columns} pageSize={5} checkboxSelection /&gt; </code></pre> <p>I have added into the columns variable 'actions' column where the button should...
64,331,367
3
2
null
2020-10-13 08:03:30.877 UTC
9
2021-11-01 02:07:01.853 UTC
2021-11-01 02:07:01.853 UTC
null
9,449,426
null
14,420,292
null
1
22
reactjs|datagrid|material-ui
48,223
<p>You can add your custom component by overriding <a href="https://mui.com/components/data-grid/columns/#render-cell" rel="noreferrer"><code>GridColDef.renderCell</code></a> method and return whatever element you want.</p> <p>The example below displays an action column that renders a single button in each row. When cl...
30,141,204
Calling R as a web service with parameters and load a JSON?
<p>I am pretty new with <code>R</code>. What I am trying to do is to be able to load a URL from another application (Java) which will run an <code>R</code> script and output a <code>JSON</code> so my application can work with it.</p> <p>I understand there are some frameworks like <code>shiny</code> which act as web se...
30,579,225
3
4
null
2015-05-09 14:38:33.007 UTC
11
2020-06-29 16:46:19.977 UTC
2015-05-09 21:25:04.05 UTC
null
3,093,387
null
402,933
null
1
19
json|r|web-services|shiny
12,681
<p>If you have not done so yet please checkout <a href="http://deployr.revolutionanalytics.com/" rel="nofollow noreferrer">[DeployR]</a>. You can also post questions to the <strong>DeployR Google Group</strong> for help.</p> <p>For full disclose I am one of the authors of <strong>DeployR</strong></p> <p><strong>Overv...
10,806,345
@RunWith(MockitoJUnitRunner.class) vs MockitoAnnotations.initMocks(this)
<p>While writing a new jUnit4 test, I'm wondering whether to use <code>@RunWith(MockitoJUnitRunner.class)</code> or <code>MockitoAnnotations.initMocks(this)</code>.</p> <p>I created a new test &amp; the wizard automatically generated a test with the Runner. Javadocs for MockitoJUnitRunner state the following:</p> <bloc...
10,812,752
2
1
null
2012-05-29 20:34:46.337 UTC
51
2020-09-13 00:40:41.763 UTC
2020-09-13 00:40:41.763 UTC
null
1,173,112
null
289,918
null
1
140
java|junit4|mockito
123,893
<p><code>MockitoJUnitRunner</code> gives you automatic validation of framework usage, as well as an automatic <code>initMocks()</code>.</p> <p>The automatic validation of framework usage is actually worth having. It gives you better reporting if you make one of these mistakes.</p> <ul> <li><p>You call the static <co...
7,549,177
Expires vs max-age, which one takes priority if both are declared in a HTTP response?
<p>If a HTTP response that returns both Expires and max-age indications which one is used?</p> <pre><code>Cache-Control: max-age=3600 Expires: Tue, 15 May 2008 07:19:00 GMT </code></pre> <p>Considering that each one refers to a different point in time.</p>
7,549,558
2
0
null
2011-09-25 22:56:54.437 UTC
9
2019-10-22 06:28:40.903 UTC
2014-01-23 20:56:48.07 UTC
null
2,642,204
null
307,976
null
1
49
http|http-headers|cache-control|http-caching
25,214
<p>See this answer:</p> <p><a href="https://stackoverflow.com/questions/3740952/difference-between-three-htaccess-expire-rules/3746325#3746325">Difference between three .htaccess expire rules</a></p> <blockquote> <p>If a response includes both an Expires header and a max-age directive, <strong>the max-age directi...
18,892,560
Is there any way in Elasticsearch to get results as CSV file in curl API?
<p>I am using elastic search. I need results from elastic search as a CSV file. Any curl URL or any plugins to achieve this?</p>
22,945,812
9
1
null
2013-09-19 10:46:24.35 UTC
17
2022-04-05 09:43:44.323 UTC
2019-08-11 19:02:43.183 UTC
null
10,607,772
null
1,410,115
null
1
61
csv|elasticsearch
90,646
<p>I've done just this using cURL and <a href="http://stedolan.github.io/jq/">jq</a> ("like <code>sed</code>, but for JSON"). For example, you can do the following to get CSV output for the top 20 values of a given facet:</p> <pre><code>$ curl -X GET 'http://localhost:9200/myindex/item/_search?from=0&amp;size=0' -d ' ...
35,582,521
How to calculate receptive field size?
<p>I'm reading paper about using CNN(Convolutional neural network) for object detection.</p> <p><a href="https://www.cs.berkeley.edu/~rbg/papers/r-cnn-cvpr.pdf" rel="noreferrer">Rich feature hierarchies for accurate object detection and semantic segmentation</a></p> <p>Here is a quote about receptive field:</p> <pre...
35,582,860
6
2
null
2016-02-23 16:11:44.917 UTC
9
2019-12-11 17:25:49.513 UTC
2019-12-04 14:48:28.153 UTC
null
3,104,974
null
1,179,925
null
1
21
deep-learning|computer-vision|receptive-field
26,972
<p>1) It is the size of the area of pixels that impact the output of the last convolution. </p> <p>2) For each convolution and pooling operation, compute the size of the output. Now find the input size that results in an output size of 1x1. Thats the size of the receptive field</p> <p>3) You don't need to use a libra...
3,865,934
Self Executing functions in PHP5.3?
<p>I was trying to borrow some programing paradigms from JS to PHP (just for fun). Is there a way of doing:</p> <pre><code>$a = (function(){ return 'a'; })(); </code></pre> <p>I was thinking that with the combination of <code>use</code> this can be a nice way to hide variables JS style</p> <pre><code>$a = (functio...
3,865,976
1
4
null
2010-10-05 16:59:02.007 UTC
10
2016-06-29 06:11:47.13 UTC
null
null
null
null
87,222
null
1
36
php|lambda|closures|php-5.3
14,111
<p><a href="http://wiki.php.net/rfc/fcallfcall" rel="noreferrer">Function Call Chaining, e.g. <code>foo()()</code> is in discussion for PHP5.4.</a> Until then, use <code>call_user_func</code>:</p> <pre><code>$a = call_user_func(function(){ $hidden = 'a'; return function($new) use (&amp;$hidden){ $hidde...
18,249,847
How to build a protocol on top of tcp?
<p>I was searching a lot but I could not find any resources which go through the building of an own protocol which uses TCP as a transport layer. What are the necessary steps? The protocol should be some kind of "Control protocol" for devices. So I can send commands to devices and control them and get information back....
18,250,112
1
1
null
2013-08-15 09:27:30.827 UTC
18
2021-06-11 05:58:50.273 UTC
2016-02-02 07:51:37.62 UTC
null
1,291,235
null
1,291,235
null
1
21
networking|tcp|network-programming|protocols
16,857
<p>As long as you can write a specification that defines the data you send through the TCP socket, you've got your own protocol.</p> <p>It's mostly about defining commands and payloads. You've got to serialize your command packet before putting them through TCP. Endianness is a common pitfall if you pack the packet in ...
18,320,731
Jackson @JsonProperty(required=true) doesn't throw an exception
<p>I am using jackson 2.2 annotation @JsonProperty with required set to true. While deserializing json file which doesn't contain that property via ObjectMapper readValue() method no exception is being thrown. Is it supposed to work in a different way or did I missed something?</p> <p>My dto class:</p> <pre><code>pub...
18,324,899
2
0
null
2013-08-19 18:37:57.287 UTC
4
2017-08-29 02:41:58.253 UTC
2016-03-18 08:49:33.13 UTC
null
918,959
null
1,221,966
null
1
58
java|json|jackson
105,759
<p>As per Jackson annotations <a href="http://fasterxml.github.io/jackson-annotations/javadoc/2.2.0/com/fasterxml/jackson/annotation/JsonProperty.html#required%28%29">javadocs</a>: "Note that as of 2.0, this property is NOT used by BeanDeserializer: support is expected to be added for a later minor version."</p> <p>Th...
1,747,519
How to hide Gtk Popup Window when user clickes outside the window
<p>I have developed one popup window (Non decorated) using GTK+ and glade tool in C. It popup on its parent window when a button clicked. I want to destroy or hide this popup window when user clicks out side this window. User can click on parent window or any other window. I have tried to capture <code>GDK_FOCUS_CHAN...
1,748,436
3
2
null
2009-11-17 09:11:50.06 UTC
9
2015-11-01 11:34:23.69 UTC
2009-11-17 17:04:41.28 UTC
null
140,814
null
202,635
null
1
13
c|gtk
12,276
<p>Changes:</p> <ul> <li>switch from <code>GTK_WINDOW_POPUP</code> to <code>GTK_WINDOW_TOPLEVEL</code>, counter-intuitive, but I could not figure out how to get a popup to accept focus.</li> <li>add <code>gtk_window</code> hints to prevent popup from showing in taskbar and pager</li> <li>intentionally set the focus on...
2,293,970
error: expected unqualified-id before ‘for’
<p>The following code returns this: <code>error: expected unqualified-id before ‘for’</code></p> <p>I can't find what is causing the error. Thanks for the help!</p> <pre><code>#include&lt;iostream&gt; using namespace std; const int num_months = 12; struct month { string name; int n_days; }; month *months ...
2,293,978
3
1
null
2010-02-19 03:59:34.39 UTC
5
2022-02-23 11:33:38.073 UTC
null
null
null
null
253,197
null
1
22
c++
77,355
<p>Your <code>for</code> loop is outside a function body.</p>
1,430,956
Should I output warnings to STDERR or STDOUT?
<p>I'm making a script that handles a predefined set of data, outputting to a file. I want to pop up a warning when one datum (which is always "Regular" in every set that I've had access to) is different stating that this value is unhandled (since I don't know how it affects the data). Should I output this warning to s...
1,430,971
3
0
null
2009-09-16 04:34:26.537 UTC
11
2022-04-08 06:02:29.967 UTC
2009-09-16 04:39:52.72 UTC
null
34,799
null
34,799
null
1
36
warnings|stdout|stderr
8,938
<p>If I save the output of this script (i.e. stdout only) so that I could process it later, would that warning interfere with how the output is parsed? Moreover, if output is piped to another process, the warning should show up on the terminal, so the user sees it immediately.</p> <p>For those reasons, in general, you...
8,790,079
Animate infinite scrolling of an image in a seamless loop
<p>Currently I have an image of clouds of 2048x435 that scrolls across a Landscaped oriented UIImageView of 1024x435 using CABasicAnimation. The cloud image scrolls as it should, however I am having some trouble trying to to get a duplicate clouds image to connect to the back of the the current clouds image so that th...
8,794,252
3
1
null
2012-01-09 14:39:37.367 UTC
15
2017-04-07 01:00:22.49 UTC
2012-01-09 20:08:55.683 UTC
null
77,567
null
1,089,875
null
1
22
objective-c|xcode|cocoa-touch|ipad
12,039
<p>You say that your image is 2048 wide and your view is 1024 wide. I don't know if this means you have duplicated the contents of a 1024-wide image to make a 2048-wide image.</p> <p>Anyway, here's what I suggest. We'll need to store the cloud layer and its animation in instance variables:</p> <pre><code>@implement...
8,413,009
How to create the delay of 1 sec before set the alpha of View?
<p>In My Application i am going to set the alpha after one animation. As like:</p> <pre><code>hideMenu = AnimationUtils.loadAnimation( getApplication(), R.anim.menu_layout_hide); menuLayout.startAnimation(hideMenu); menuLayout.setVisibility(View.GONE); </code></pre> <p>But i want to set the delay of 1 Sec before th...
8,413,164
5
1
null
2011-12-07 09:28:45.9 UTC
6
2018-02-08 10:56:24.123 UTC
null
null
null
null
881,635
null
1
45
android|xml|animation|android-animation|layout-animation
57,992
<p>In your animation <code>xml</code> file you can use <code>android:startOffset</code> attribute:</p> <pre><code>android:startOffset int. The amount of milliseconds the animation delays after start() is called. </code></pre>
19,411,510
How do you change background color in the settings of JetBrain's IDE?
<p>What are the settings to change the background color in JetBrains' IDE?</p> <ul> <li>Project explorer pane</li> <li>Console pane </li> <li>Code editor</li> <li>Other Panes </li> </ul> <p>I'm running v12.1.6 Ultimate Version. Are there major differences between different versions of the software?</p>
19,449,932
8
1
null
2013-10-16 18:56:47.12 UTC
18
2021-08-12 06:40:20.26 UTC
2017-05-08 06:01:49.267 UTC
null
2,254,878
null
897,756
null
1
79
intellij-idea|ide|settings
111,199
<h3>Console pane:</h3> <p><code>Settings / Editor / Colors &amp; Fonts / Console colors</code></p> <p>Console, background</p> <h3>Project view:</h3> <p><code>Settings / File colors</code></p> <p>Add (Alt+insert), choose 'project files' scope, select a color.</p> <p>Uncheck the 'Use in editor tabs' checkbox, make ...
919,921
no ocijdbc9 in java.library.path
<p>When I try to run Java application, I receive the following error:</p> <blockquote> <p><code>Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path</code></p> </blockquote> <p>I don't have a file <code>ocijdbc9.*</code> on my PC, but I have <code>ocijdbc10.dll</code> in <code...
919,988
4
0
null
2009-05-28 09:11:19.253 UTC
1
2018-09-28 14:06:42.127 UTC
2018-09-28 14:05:30.6 UTC
null
241,164
null
26,276
null
1
3
java|oracle|linker|linker-errors
38,157
<p>You're missing a file from your java CLASSPATH.</p> <p>You need to add the OCI jar to your classpath.</p> <p>For my oracle 10.0.2 install on windows it's located in </p> <pre><code>%ORACLE_HOME%\jdbc\lib\ojdbc14.jar </code></pre> <p>If your application requires ocijdbc9 then you'll have to download it from somew...
1,013,916
How to enable JMX on Weblogic 10.x
<p>I have an application that is JMX enabled. It has its own JMX Agent and some MBeans. When I launch the application in WebLogic, I am able to connect to the JMX agent via the RMI url and perform the operations on MBeans via "<strong>JConsole</strong>". </p> <p>But when I get into the Weblogic console, I can not see ...
1,099,117
4
0
null
2009-06-18 17:02:14.953 UTC
3
2012-06-05 11:44:31.103 UTC
2012-05-02 11:40:02.403 UTC
null
741,249
null
119,512
null
1
6
weblogic|jmx
41,354
<p>hope this helps,refer to this url -> <a href="http://forums.oracle.com/forums/thread.jspa?messageID=3570887" rel="nofollow noreferrer">http://forums.oracle.com/forums/thread.jspa?messageID=3570887</a> </p>
856,575
SQL Server 2008 takes up a lot of memory?
<p>I am conducting stress tests on my database, which is hosted on SQL Server 2008 64-bit running on a 64-bit machine with 10 GB of RAM.</p> <p>I have 400 threads. Each thread queries the database every second, but the query time does not take time, as the SQL profiler says that, but after 18 hours SQL Server uses up ...
856,607
4
2
null
2009-05-13 07:38:55.17 UTC
5
2022-08-12 15:53:38.77 UTC
2011-03-15 00:04:52.28 UTC
null
496,830
null
42,749
null
1
11
sql-server|sql-server-2008|memory-consumption
39,747
<p>SQL Server is designed to use as much memory as it can get its hands on, to improve performance by caching loads of stuff in memory. The recommendation is to use dedicated machines for SQL Server, which makes this a perfectly valid approach, as it isn't expecting anybody else to need the memory. So you shouldn't wor...
897,552
Assert that arrays are equal in Visual Studio 2008 test framework
<p>Is there an easy way to check in a unit test that two arrays are equal (that is, have the same number of elements, and each element is the same?).</p> <p>In Java, I would use <code>assertArrayEquals (foo, bar);</code>, but there seems to be no equivalent for C#. I tried <code>Assert.AreEqual(new string[]{"a", "b"},...
897,570
4
0
null
2009-05-22 12:14:22.3 UTC
8
2010-05-04 22:07:10.367 UTC
null
null
null
null
39,912
null
1
86
c#|visual-studio-2008|unit-testing
39,703
<p>It's <code>CollectionAssert.AreEqual</code>, see also the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.collectionassert(VS.80).aspx" rel="noreferrer">documentation for CollectionAssert</a>.</p>
22,356,313
Define Changeset for insert query in liquibase
<p>I have two table as following :</p> <pre><code>CREATE TABLE StudentMaster ( sId SERIAL, StudentName VARCHAR(50) ); CREATE TABLE StudentClassMap ( studnetId BIGINT UNSIGNED NOT NULL, studentClass VARCHAR(10), FOREIGN KEY (studnetId) REFERENCES StudentMaster (sId) ); </code></pre> <p>This is my inser...
22,362,273
1
0
null
2014-03-12 15:30:37.427 UTC
1
2016-04-21 16:27:54.23 UTC
null
null
null
null
1,152,398
null
1
16
mysql|sql|liquibase|changeset|insert-query
42,484
<p>Use the valueComputed attribute:</p> <pre><code>&lt;changeSet author="unknown" id="insert-example-2"&gt; &lt;insert tableName="StudentClassMap"&gt; &lt;column name="studentId" valueComputed="(SELECT sId from StudentMaster where studentName='Jay Parikh')"/&gt; &lt;column name="studentClass" value...
22,126,299
Change apk name with Gradle
<p>I have an Android project which uses Gradle for build process. Now I want to add two extra build types staging and production, so my build.gradle contains:</p> <pre><code>android { buildTypes { release { runProguard false proguardFile getDefaultProguardFile('proguard-android.txt'...
22,126,638
8
1
null
2014-03-02 10:14:28.78 UTC
18
2022-09-09 19:11:00.377 UTC
2015-07-08 12:11:58.617 UTC
null
1,331,451
null
343,096
null
1
44
android|gradle|apk|android-gradle-plugin
38,091
<p>As CommonsWare wrote in his comment, you should call <code>appendVersionNameVersionCode</code> only for staging variants. You can easily do that, just slightly modify your <code>appendVersionNameVersionCode</code> method, for example:</p> <pre><code>def appendVersionNameVersionCode(variant, defaultConfig) { //c...
30,520,265
Migrating from Spring 3 to Spring 4 - org.springframework.scheduling.quartz.CronTriggerBean
<p>I'm trying to migrate from spring 3.0.5 to spring 4.1.X .</p> <p>Spring 3 has Class named as "org.springframework.scheduling.quartz.CronTriggerBean"</p> <p>But Spring 4 doesn't include this class name.</p> <blockquote> <p>[5/28/15 20:10:16:798 EDT] 00000092 ClassPathXmlA W org.springframework.context.support....
30,530,557
2
1
null
2015-05-29 02:43:25.833 UTC
1
2016-12-14 03:11:23.987 UTC
2016-07-11 19:53:33.45 UTC
null
2,057,902
null
2,057,902
null
1
30
java|spring|spring-mvc|scheduled-tasks|quartz-scheduler
30,769
<p>From Spring 3.1+, Change the Class names for the CronTriggerFactoryBean &amp; JobDetailFactoryBean as like below</p> <pre><code> org.springframework.scheduling.quartz.CronTriggerBean org.springframework.scheduling.quartz.CronTriggerFactoryBean org.springframework.scheduling.quar...
29,402,155
Android unit test not mocked
<p>I followed this guide <a href="https://sites.google.com/a/android.com/tools/tech-docs/unit-testing-support">https://sites.google.com/a/android.com/tools/tech-docs/unit-testing-support</a> but i am stuck with this error:</p> <pre><code>junit.framework.AssertionFailedError: Exception in constructor: testSaveJson (ja...
30,759,769
5
1
null
2015-04-01 22:46:35.253 UTC
8
2021-10-18 08:08:38.5 UTC
2015-06-10 14:39:47.13 UTC
null
346,232
null
1,634,451
null
1
57
android|unit-testing|junit
26,304
<p>JSON is bundled up with the Android SDK, so you'll just be hitting a stub. You can pull in a JSON jar, which will provide real objects to use.</p> <p>To do this, you'll need to add this to your build.gradle:</p> <pre><code>testImplementation 'org.json:json:20140107' </code></pre> <p>Alternatively, you can download a...
25,113,692
Create executable Jar file under Eclipse
<p>I created a Java application and I want to create jar file for this application. This application imported other external jar files by Build Path>Add External Jar File. How can I generate executable JAR file for this application in Ubuntu with these external libraries dependencies?</p>
25,114,143
2
2
null
2014-08-04 07:30:16.617 UTC
1
2020-12-16 13:56:37.91 UTC
2014-08-04 08:19:35.05 UTC
null
146,073
null
3,766,188
null
1
12
java|eclipse
73,058
<p>To create a new runnable JAR file in the workbench:</p> <ol> <li>From the menu bar's File menu, select Export.</li> <li>Expand the Java node and select Runnable JAR file. Click Next.</li> <li>In the Runnable JAR File Specification page, select a 'Java Application' launch configuration to use to create a runnable JA...
19,856,192
Run OpenGL on AWS GPU instances with CentOS
<p>I need to execute some off-screen rendering program on AWS EC2 GPU instance with CentOS. However, while I found that Ubuntu is very easy to setup, I cannot let CentOS work properly. </p> <p>The goal is to run some essential utility/test tool on EC2 GPU instance (without screen or X client). In the following article...
19,875,706
2
1
null
2013-11-08 09:59:06.217 UTC
20
2017-01-22 23:07:02.64 UTC
2013-11-09 09:14:16.86 UTC
null
606,314
null
606,314
null
1
23
opengl|amazon-web-services|amazon-ec2|centos|gpu
11,685
<p><code>lspci | grep VGA</code></p> <p>You should see the <code>busID</code> is <code>0:3:0</code>.</p> <p>Using sudo, add this into your xorg.conf like so:</p> <pre><code>Section "Device" Identifier "Device0" Driver "nvidia" VendorName "NVIDIA Corporation" BoardName "GRID K520"...
8,159,233
TypeError: Illegal Invocation on console.log.apply
<p>If you run this in the chrome console:</p> <pre><code>console.log.apply(null, [array]) </code></pre> <p>Chrome gives you back an error:</p> <pre><code>// TypeError: Illegal Invocation </code></pre> <p>Why? <em>(Tested on Chrome 15 via OSX)</em></p>
8,159,338
1
0
null
2011-11-16 21:50:50.27 UTC
22
2017-09-10 14:52:24.057 UTC
2016-02-09 09:48:17.843 UTC
null
4,464,702
null
332,578
null
1
132
javascript|google-chrome|console
27,205
<p>It may not work in cases when execution context changed from console to any other object:</p> <blockquote> <p>This is expected because console.info expects its "this" reference to be console, not window.</p> <pre><code>console.info("stuff") stuff undefined console.info.call(this, "stuff") TypeError: Illegal in...
1,597,732
PHP: Force file download and IE, yet again
<p>Folks, I know there have been lots of threads about forcing the download dialog to pop up, but none of the solutions worked for me yet. </p> <p>My app sends mail to the user's email account, notifying them that "another user sent them a message". Those messages might have links to Excel files. When the user clicks ...
1,597,946
4
0
null
2009-10-20 22:45:22.087 UTC
9
2014-07-21 16:58:35.85 UTC
2012-05-06 17:33:20.083 UTC
null
1,205,135
null
16,668
null
1
9
php|file|internet-explorer|download
25,379
<p>This will check for versions of IE and set headers accordingly.</p> <pre><code>// assume you have a full path to file stored in $filename if (!is_file($filename)) { die('The file appears to be invalid.'); } $filepath = str_replace('\\', '/', realpath($filename)); $filesize = filesize($filepath); $filename = subs...
1,511,129
boost::asio::ip::tcp::socket is connected?
<p>I want to verify the connection status before performing read/write operations.</p> <p>Is there a way to make an isConnect() method?</p> <p>I saw <a href="http://lists.boost.org/boost-users/2007/06/28936.php" rel="nofollow noreferrer">this</a>, but it seems "ugly".</p> <p>I have tested <a href="http://www.boost.o...
1,512,608
4
2
null
2009-10-02 18:31:22.017 UTC
12
2021-06-23 15:53:07.023 UTC
2018-07-24 17:24:21.143 UTC
null
174,605
null
174,605
null
1
19
c++|sockets|boost-asio
25,446
<p>TCP is meant to be robust in the face of a harsh network; even though TCP provides what looks like a persistent end-to-end connection, it's all just a lie, each packet is really just a unique, unreliable datagram.</p> <p>The connections are really just virtual conduits created with a little state tracked at each end...
1,343,874
Using loops to get at each item in a ListView?
<p>What is a nice and effective way of getting at each item in a ListView of more than one column using loops?</p> <p>After doing a fair bit of digging around I couldn't really find anything so I when I did find something I wanted to share it on here see if people have better ways of doing it. Also sort of like preemp...
1,347,193
5
3
null
2009-08-27 21:38:56.06 UTC
1
2020-11-13 19:53:11.127 UTC
2009-10-12 11:29:18.59 UTC
null
63,550
null
162,607
null
1
5
c#|winforms|listview|loops
60,222
<p>I suggest using IEnumerable as the return type of the method and using "yield return" to return each subitems.</p> <pre><code>private IEnumerable&lt;ListViewSubItem&gt; GetItemsFromListViewControl() { foreach (ListViewItem itemRow in this.loggerlistView.Items) { for...
7,118,543
Does the Linux filesystem cache files efficiently?
<p>I'm creating a web application running on a Linux server. The application is constantly accessing a 250K file - it loads it in memory, reads it and sends back some info to the user. Since this file is read all the time, my client is suggesting to use something like memcache to cache it to memory, presumably because ...
7,118,584
5
4
null
2011-08-19 07:56:07.647 UTC
9
2013-03-09 22:18:37.78 UTC
2011-08-19 17:16:37.18 UTC
null
168,868
null
561,309
null
1
23
linux|filesystems|memcached
12,351
<p>Yes, if you do not modify the file each time you open it.</p> <p>Linux will hold the file's information in copy-on-write pages in memory, and "loading" the file into memory should be very fast (page table swap at worst).</p> <p>Edit: Though, as cdhowie points out, there is no 'linux filesystem'. However, I believe...
7,559,880
LeaseExpiredException: No lease error on HDFS
<p>I am trying to load large data to HDFS and I sometimes get the error below. any idea why?</p> <p>The error:</p> <pre><code>org.apache.hadoop.ipc.RemoteException: org.apache.hadoop.hdfs.server.namenode.LeaseExpiredException: No lease on /data/work/20110926-134514/_temporary/_attempt_201109110407_0167_r_000026_0/hba...
7,567,440
6
2
null
2011-09-26 18:55:50.217 UTC
9
2018-04-13 07:32:21.41 UTC
null
null
null
null
449,466
null
1
29
hadoop|hdfs
64,960
<p>I managed to fix the problem:</p> <p>When the job ends he deletes /data/work/ folder. If few jobs are running in parallel the deletion will also delete the files of the another job. actually I need to delete /data/work/.</p> <p>In other words this exception is thrown when the job try to access to files which are ...