title
stringlengths
15
150
body
stringlengths
38
32.9k
label
int64
0
3
Ordering functions by Asymptotic Growth Rate
<p>List the following functions in non-descending order of asymptotic growth rate. If two or more functions have the same asymptotic growth rate then group them together.</p> <p>g1(n) = n</p> <p>g2(n) = n^3 +4n</p> <p>g3(n) = 2n log(base 2) n </p> <p>g4(n) = 2^n</p> <p>g5(n) = 3 ^ (3 * log(base 3) n)</p> <p>g6(n) = 10^n</p> <p>I've been looking through several examples online but I have no idea how to do this, it just seems like a completely foreign concept to me. If anyone could help me, that would be much appreciated. how do I even calculate the growth rate?</p>
1
sparse list of values using ranges
<p>is there a more terse way of writing</p> <pre><code>listOf('a'..'z','A'..'Z').flatMap { it } </code></pre> <p>The idea here is to iterate over some values in a range, like the numbers from 1 through 100, skipping 21 through 24</p> <pre><code>listOf(1..20, 25..100).flatMap { it } </code></pre>
1
Excel template migration from JXLS 1 to JXLS 2
<p>With JXLS 1 it was possible to make replacements within an Excel template through a simple invocation to </p> <pre><code>XLSTransformer.transformXLS(is,beans) </code></pre> <p>For example, we had bean objects which were organized something like this (not so nice, ok..:)):</p> <pre><code>class Person{ private String name; private String lastname; private String tel; private String gender; private Integer count; public Person(String name, String lastname, String telephone, String gender){ this.name = name; this.lastname = lastname; this.tel = telephone; this.gender = gender; this.count = null; } public Person(String gender, int count){ this.gender = gender; this.count = count; } //getters } </code></pre> <p>Now, given this template:</p> <p><a href="https://i.stack.imgur.com/DCYRN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DCYRN.jpg" alt="template"></a></p> <p>and the following initialization:</p> <pre><code>List&lt;Person&gt; p = Arrays.asList( new Person(„Johnny“, „Cash“, „1394567“, „M“), new Person(„Paul“, „Newman“, „234667“, „M“), new Person(„M“,2), new Person(„Jessica“, „Alba“, „134566“, „F“), new Person(„F“,1) ); Map&lt;String, List&lt;? extends Object&gt;&gt; beans = new HashMap&lt;String, List&lt;? extends Object&gt;&gt;(); beans.put(„persons“, p); beans.put(„heading“, Arrays.asList(„This is the heading“)); </code></pre> <p>a simple call to </p> <pre><code>transformer.transformXLS(templateInputStream, beans); </code></pre> <p>would have done the trick and generated something like this:</p> <p><a href="https://i.stack.imgur.com/tIlkR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tIlkR.jpg" alt="generated XLS"></a></p> <p>Now, I needed to migrate to JXLS 2 in order to use SXSSFWorkbook for very big XLSX files, but I couldn't succeed to translate the good old tags into their comment equivalent: in the online-doc I read that it's possible to combine more expression together, but for example something like <strong><em>jx:each</em></strong> followed by a <strong><em>jx:if</em></strong> which uses the loop’s variable would generate an expression EvaluationException.</p> <p>Do you have any hints / examples which may help?</p> <p>Thanks in advance!</p>
1
Error with Maven Spring Boot project
<p>I'm in virtualbox and behind the organization's firewall &amp; proxy, I see this error, i have been trying to fix this issue since morning with no luck. Can anyone help me bypass this issue with spring boot jars.</p> <p>I have the network connections set to the proxy for http and https with Native, Direct and Manual</p> <pre><code>[DEBUG] Writing tracking file /home/.../.m2/repository/org/springframework/boot/spring-boot-starter-parent/1.3.2.RELEASE/spring-boot-starter-parent-1.3.2.RELEASE.pom.lastUpdated [ERROR] [ERROR] Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for demo:demo:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.3.2.RELEASE from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.40.215] failed: Connection timed out and 'parent.relativePath' points at no local POM @ line 14, column 10 @ [ERROR] The build could not read 1 project -&gt; [Help 1] org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs: [FATAL] Non-resolvable parent POM for demo:demo:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.3.2.RELEASE from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.40.215] failed: Connection timed out and 'parent.relativePath' points at no local POM @ line 14, column 10 at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:422) at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419) at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410) at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83) at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) [ERROR] [ERROR] The project demo:demo:0.0.1-SNAPSHOT (/home/.../Documents/workspace-sts-3.7.2.RELEASE/SpringBoot/pom.xml) has 1 error [ERROR] Non-resolvable parent POM for demo:demo:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.3.2.RELEASE from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.40.215] failed: Connection timed out and 'parent.relativePath' points at no local POM @ line 14, column 10 -&gt; [Help 2] org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.3.2.RELEASE from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.40.215] failed: Connection timed out at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:197) at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:246) at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:1000) at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:800) at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:329) at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:469) at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:438) at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:401) at org.apache.maven.graph.DefaultGraphBuilder.collectProjects(DefaultGraphBuilder.java:419) at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor(DefaultGraphBuilder.java:410) at org.apache.maven.graph.DefaultGraphBuilder.build(DefaultGraphBuilder.java:83) at org.apache.maven.DefaultMaven.buildGraph(DefaultMaven.java:491) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:219) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.3.2.RELEASE from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.40.215] failed: Connection timed out at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223) at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294) at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:193) ... 25 more Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.3.2.RELEASE from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.40.215] failed: Connection timed out at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355) at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581) at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520) at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421) ... 29 more Caused by: org.apache.maven.wagon.TransferFailedException: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.40.215] failed: Connection timed out at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1066) at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:960) at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116) at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88) at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61) at org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run(WagonTransporter.java:560) at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:427) at org.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTransporter.java:404) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:447) at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350) ... 34 more Caused by: org.apache.maven.wagon.providers.http.httpclient.conn.ConnectTimeoutException: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.40.215] failed: Connection timed out at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:138) at org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318) at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363) at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.execute(MainClientExec.java:219) at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195) at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec.execute(RetryExec.java:86) at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RedirectExec.execute(RedirectExec.java:108) at org.apache.maven.wagon.providers.http.httpclient.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184) at org.apache.maven.wagon.providers.http.httpclient.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:832) at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:983) ... 43 more Caused by: java.net.ConnectException: Connection timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:239) at org.apache.maven.wagon.providers.http.httpclient.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123) ... 53 more </code></pre>
1
Protractor : get element which has not a specific class
<p>Im trying to get an e2e test to work on the next example:</p> <p><strong>HTML:</strong></p> <pre><code>&lt;div ng-if="selectedItem"&gt; &lt;span class-"xxx"&gt;This is line 1&lt;/span&gt; &lt;span class="xxx yyy"&gt;This is line 2&lt;/span&gt; &lt;/div&gt; </code></pre> <p><strong>Protractor:</strong></p> <pre><code>.. element.findByCss('div[ng-if="selectedItem"] span[class!="yyy"]'); .. </code></pre> <p>Gives the following error:</p> <blockquote> <p>Failed: invalid element state: Failed to execute 'querySelectorAll' on 'Document': 'div[ng-if="selectedItem"] span[class!="yyy"]' is not a valid selector.</p> </blockquote> <p>The selector works with jQuery though.. I know its not the same. But i cant seem to find how to exclude a class with protractor</p>
1
No current query in data reader MYSQL
<pre><code>mscon.Open(); mscom = new MySqlCommand("SELECT * FROM cbin_tbl WHERE cb_id=(SELECT MAX(cb_id) FROM cbin_tbl)", mscon); MySqlDataReader msmdr1 = mscom.ExecuteReader(); while (msmdr1.Read()) { barcode = msmdr.GetString("cb_id"); } mscon.Close(); </code></pre> <p>IM A BEGINNER HERE AND HELP ME ON THIS MYSQL SYNTAX :D THANKS</p>
1
Error 422 Unprocessable Entity in laravel with ajax
<p>I have the next error in a application of Laravel:</p> <pre><code>422 Unprocessable Entity </code></pre> <p>The request is:</p> <pre><code>_token LgJFXgWTMLtGcax4k2BoU86U2x1MEL7fqXrvl3i0 txtDetalle qqq txtSucursal 123 </code></pre> <p>And the server response it's:</p> <pre><code>{"txtSucursal":["The txt sucursal must be at least 4 characters."]} </code></pre> <p>Generates the following error:</p> <pre><code>"NetworkError: 422 Unprocessable Entity -" </code></pre> <p>The code is the next:</p> <p><a href="https://i.stack.imgur.com/dYI6j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dYI6j.png" alt="Request"></a></p>
1
Powershell Script to Export All Groups and Members Assigned for a given OU to a CSV
<p>I am trying to export all groups and the members assigned (if any) for a given OU. How do I include groups with no members?</p> <pre><code>Get-ADGroup -Properties * -Filter * -SearchBase "OU=BI-Security,OU=BH-Security Groups,DC=bh,DC=intra" | Foreach { $Group = $_ Get-ADGroupMember -Id $Group | ` select @{Expression={$Group.Name};Label="Group Name"},Name | ` Export-CSV C:\Scripts\BIGroups.CSV -NoTypeInformation -append } </code></pre> <p>Thanks in advance.</p>
1
How can I return different values from a mocked method using AngularJS and Karma?
<p>I'm testing ServiceA which uses ServiceB within itself. ServiceB has a method called getData() and sometimes it returns true and sometimes it returns false. Service A has different logic depending on whether ServiceB returns true or false and I need to test both situations. Currently, I'm mocking Service B like this:</p> <pre><code>beforeEach(angular.mock.module('app', function ($provide) { serviceB = { getData: function () { return true; } }; $provide.value('serviceB', serviceB); })); </code></pre> <p>So how I can test what happens when serviceB returns true and then make anothter test to verify its behavior when it returns false? Can I create the mock within the it() methods rather than in beforeEach() so that I can have the mock return different values in different test methods?</p>
1
Openpyxl - Apply Borders to Cells
<p>I am hoping someone can help me as I have been unable to figure this one out for myself unfortunately. </p> <p>I am trying to put a thin border around a cell using openpyxl 2.3.3 and python 3.4. I have the following code:</p> <pre><code>from openpyxl.styles import Border ws.cell('A1').border = Border(top = Side(border_style='thin', color='FF000000'), right = Side(border_style='thin', color='FF000000'), bottom = Side(border_style='thin', color='FF000000'), left = Side(border_style='thin', color='FF000000')) </code></pre> <p>Oddly this is throwing the following error:</p> <pre><code>NameError: name 'Side' is not defined </code></pre> <p>I have looked at the official documentation here: </p> <p><a href="http://openpyxl.readthedocs.org/en/2.4/styles.html" rel="nofollow noreferrer">http://openpyxl.readthedocs.org/en/2.4/styles.html</a> <a href="http://openpyxl.readthedocs.org/en/2.4/_modules/openpyxl/styles/borders.html" rel="nofollow noreferrer">http://openpyxl.readthedocs.org/en/2.4/_modules/openpyxl/styles/borders.html</a></p> <p>I have also looked at the following articles with no luck:</p> <p><a href="https://bitbucket.org/openpyxl/openpyxl/issues/365/styling-merged-cells-isnt-working" rel="nofollow noreferrer">https://bitbucket.org/openpyxl/openpyxl/issues/365/styling-merged-cells-isnt-working</a></p> <p><a href="https://stackoverflow.com/questions/24917201/applying-borders-to-a-cell-in-openpyxl">Applying borders to a cell in OpenPyxl</a></p> <p><a href="https://stackoverflow.com/questions/13650059/apply-borders-to-all-cells-in-a-range-with-openpyxl">Apply borders to all cells in a range with openpyxl</a></p> <p><a href="https://stackoverflow.com/questions/34520764/apply-border-to-range-of-cells-using-openpyxl">Apply Border To Range Of Cells Using Openpyxl</a></p> <p>Is anyone able to help me out?</p> <p>Thanks in advance,</p> <p>Eamon</p>
1
Can I specify mandatory arguments with optparse
<p>I am using the <a href="https://cran.r-project.org/web/packages/optparse/index.html" rel="nofollow">optparse</a> package but cannot find out if I can specify mandatory arguments.</p> <pre><code>install.packages('optparse') library('optparse') library('data.table') # example from vignette option_list &lt;- list( # those 2 are linked together by dest='verbose' # store_true makes sure it does not take any arg by storing TRUE (or default if specified) make_option(c("-v", "--verbose"), action="store_true", default=TRUE, help="Print extra output [default %default]"), make_option(c("-q", "--quietly"), action="store_false", dest="verbose", help="Print little output"), # make_option(c("-c", "--count"), type="integer", default=5L, help="Number of rgn [default %default]", metavar="number"), make_option("--generator", default="rnorm", help = "Function to generate random deviates [default \"%default\"]") ) parser &lt;- OptionParser(option_list=option_list) # vanilla case parsedArgs &lt;- parse_args(parser, args = c("-c","100","--generator","fakeGen")) setcolorder(setDT(stack(parsedArgs)),c('ind','values'))[] # ind values #1: verbose TRUE #2: count 100 #3: generator fakeGen #4: help FALSE </code></pre> <p>Say I want the user to input a [-d --date SOMEDATE] it does not really make sense to provide a default date... how can I tell <strong>optparse</strong> that some args are mandatory ?</p>
1
How to deal with the missing data in stan?
<p>I am a newbie to stan and I am implementing the probabilistic matrix factorization model. </p> <p>Given a user-item rating matrix:</p> <pre><code> item user 1 3 NA 4 5 NA 2 0 3 NA 1 5 1 1 NA NA NA 0 .... </code></pre> <p>How should I represent the observable data in the <code>data</code> block and the missing data for prediction in the <code>parameter</code> block? </p> <p>Thank you in advance!</p> <p>EDIT:</p> <p>Now I am implementing the model as below:</p> <pre><code>pmf_code = """ data { int&lt;lower=0&gt; K; //number of factors int&lt;lower=0&gt; N; //number of user int&lt;lower=0&gt; M; //number of item int&lt;lower=0&gt; D; //number of observation int&lt;lower=0&gt; D_new; //number of pridictor int&lt;lower=0, upper=N&gt; ii[D]; //item int&lt;lower=0, upper=M&gt; jj[D]; //user int&lt;lower=0, upper=N&gt; ii_new[D_new]; // item int&lt;lower=0, upper=N&gt; jj_new[D_new]; // user real&lt;lower=0, upper=5&gt; r[D]; //rating real&lt;lower=0, upper=5&gt; r_new[D_new]; //pridict rating } parameters { row_vector[K] i[M]; // item profile row_vector[K] u[N]; // user profile real&lt;lower=0&gt; alpha; real&lt;lower=0&gt; alpha_i; real&lt;lower=0&gt; alpha_u; } transformed parameters { matrix[N,M] I; // indicator variable I &lt;- rep_matrix(0, N, M); for (d in 1:D){ I[ii[d]][jj[d]] &lt;- 1; } } model { for (d in 1:D){ r[d] ~ normal(u[jj[d]]' * i[ii[d]], 1/alpha); } for (n in 1: N){ u[n] ~ normal(0,(1/alpha_u) * I); } for (m in 1:M){ i[m] ~ normal(0,(1/alpha_i) * I); } } generated_quantities{ for (d in 1:D_new){ r_new[d] &lt;- normal(u[jj_new[d]]' * i[ii_new[d]], 1/alpha); } } """ </code></pre> <p>but got an <code>No matches for: real ~ normal(matrix, real)</code> error in this line of code:</p> <pre><code>for (d in 1:D){ r[d] ~ normal(u[jj[d]]' * i[ii[d]], 1/alpha); } </code></pre> <p>But the <code>jj[d]</code> should be a integer, denoting the id of <code>user</code>. And u[<code>int</code>] should be a <code>row_vector</code> has <code>k</code> factors and so is <code>i[ii[d]]</code>. The product of them should be a single real value, why stan said it was a <code>matrix</code>?</p>
1
Bootstrap grid doesn't fit in my main container
<p>I'm sure of the fact that I'm doing something so wrong, I tried to solve that this morning.</p> <p>Here's the deal, I'm trying to build a responsive HTML page, that will have the behaviour of the picture you see below : </p> <p><a href="https://i.stack.imgur.com/38Rjv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/38Rjv.png" alt="enter image description here"></a></p> <p>So I told myself, for the elements that have to be move like the elements below "Besoin d'un devis", etc, I will use a the boostrap grid, and use for that an WYSIWIG generator. But instead, when I try to resize the window here's what happens : </p> <p><strong>Without resizing the window - Normal behaviour :</strong> </p> <p><a href="https://i.stack.imgur.com/aIRQ7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aIRQ7.png" alt="enter image description here"></a></p> <p><strong>When I resize the window and I try to test the boostrap grid :</strong></p> <p><a href="https://i.stack.imgur.com/IsfNN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IsfNN.png" alt="enter image description here"></a></p> <p>I uploaded a test version in the internet so you can see my problem. <a href="http://test-stackoverflow.co.nf" rel="nofollow noreferrer">http://test-stackoverflow.co.nf</a></p> <p>If you need the code, I will provide it. I just don't know a way to provide a whole "test website" and a case like this in stack.</p>
1
Multiple interact() commands duplicate widgets in IPython
<p>I am using an IPython Jupyter notebook. In the following situation, I call a function using <code>interact()</code>, which in turns calls a second function again using <code>interact()</code>.</p> <pre><code>def fun1(dataset_id): dataset = read_dataset(dataset_id) interact(fun2, data=dataset, var=(0,dataset.property,0.1)) def fun2(data, var): # something interact(fun1, dataset_id=(0,5,1)) </code></pre> <p>When first running this, it display 2 slider widgets: one for <code>dataset_id</code>, and one for the variable <code>var</code>. But if I vary the <code>dataset_id</code> slider once, a second slider for <code>var</code> is added below the first <code>var</code> slider, so now I have 3 sliders in total. How can I avoid this?</p>
1
Can't resolve dependency in Android Studio with jcenter
<p>Why my program hang on resolving dependency for appDebug in andorid studio? I can't resolve any library.</p> <p>This is my root gradle file:</p> <pre><code>buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.5.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } </code></pre> <p>and this is my app gradle :</p> <pre><code>apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.example.alimohammadi.myapplication" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:design:23.1.1' } </code></pre> <p>And I can't resolve junit. And I can't access to <a href="https://jcenter.bintray.com/" rel="noreferrer">https://jcenter.bintray.com/</a> with my browser (it gave me connection time out while other site return true response).</p>
1
spark.ml StringIndexer throws 'Unseen label' on fit()
<p>I'm preparing a toy <code>spark.ml</code> example. <code>Spark version 1.6.0</code>, running on top of <code>Oracle JDK version 1.8.0_65</code>, pyspark, ipython notebook.</p> <p>First, it hardly has anything to do with <a href="https://stackoverflow.com/questions/34681534/spark-ml-stringindexer-handling-unseen-labels">Spark, ML, StringIndexer: handling unseen labels</a>. The exception is thrown while fitting a pipeline to a dataset, not transforming it. And suppressing the exception might not be a solution here, since, I'm afraid, the dataset gets messed pretty bad in this case.</p> <p>My dataset is about 800Mb uncompressed, so it might be hard to reproduce (smaller subsets seem to dodge this issue).</p> <p>The dataset looks like this:</p> <pre><code>+--------------------+-----------+-----+-------+-----+--------------------+ | url| ip| rs| lang|label| txt| +--------------------+-----------+-----+-------+-----+--------------------+ |http://3d-detmold...|217.160.215|378.0| de| 0.0|homwillkommskip c...| | http://3davto.ru/| 188.225.16|891.0| id| 1.0|оформить заказ пе...| | http://404.szm.com/| 85.248.42| 58.0| cs| 0.0|kliknite tu alebo...| | http://404.xls.hu/| 212.52.166|168.0| hu| 0.0|honlapkészítés404...| |http://a--m--a--t...| 66.6.43|462.0| en| 0.0|back top archiv r...| |http://a-wrf.ru/c...| 78.108.80|126.0|unknown| 1.0| | |http://a-wrf.ru/s...| 78.108.80|214.0| ru| 1.0|установк фаркопна...| +--------------------+-----------+-----+-------+-----+--------------------+ </code></pre> <p>The value being predicted is <code>label</code>. The whole pipeline applied to it:</p> <pre class="lang-python prettyprint-override"><code>from pyspark.ml import Pipeline from pyspark.ml.feature import VectorAssembler, StringIndexer, OneHotEncoder, Tokenizer, HashingTF from pyspark.ml.classification import LogisticRegression train, test = munge(src_dataframe).randomSplit([70., 30.], seed=12345) pipe_stages = [ StringIndexer(inputCol='lang', outputCol='lang_idx'), OneHotEncoder(inputCol='lang_idx', outputCol='lang_onehot'), Tokenizer(inputCol='ip', outputCol='ip_tokens'), HashingTF(numFeatures=2**10, inputCol='ip_tokens', outputCol='ip_vector'), Tokenizer(inputCol='txt', outputCol='txt_tokens'), HashingTF(numFeatures=2**18, inputCol='txt_tokens', outputCol='txt_vector'), VectorAssembler(inputCols=['lang_onehot', 'ip_vector', 'txt_vector'], outputCol='features'), LogisticRegression(labelCol='label', featuresCol='features') ] pipe = Pipeline(stages=pipe_stages) pipemodel = pipe.fit(train) </code></pre> <p>And here is the stacktrace:</p> <pre><code>Py4JJavaError: An error occurred while calling o10793.fit. : org.apache.spark.SparkException: Job aborted due to stage failure: Task 18 in stage 627.0 failed 1 times, most recent failure: Lost task 18.0 in stage 627.0 (TID 23259, localhost): org.apache.spark.SparkException: Unseen label: pl-PL. at org.apache.spark.ml.feature.StringIndexerModel$$anonfun$4.apply(StringIndexer.scala:157) at org.apache.spark.ml.feature.StringIndexerModel$$anonfun$4.apply(StringIndexer.scala:153) at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.evalExpr2$(Unknown Source) at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown Source) at org.apache.spark.sql.execution.Project$$anonfun$1$$anonfun$apply$1.apply(basicOperators.scala:51) at org.apache.spark.sql.execution.Project$$anonfun$1$$anonfun$apply$1.apply(basicOperators.scala:49) at scala.collection.Iterator$$anon$11.next(Iterator.scala:328) at scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:389) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at org.apache.spark.storage.MemoryStore.unrollSafely(MemoryStore.scala:282) at org.apache.spark.CacheManager.putInBlockManager(CacheManager.scala:171) at org.apache.spark.CacheManager.getOrCompute(CacheManager.scala:78) at org.apache.spark.rdd.RDD.iterator(RDD.scala:268) at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306) at org.apache.spark.rdd.RDD.iterator(RDD.scala:270) at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306) at org.apache.spark.rdd.RDD.iterator(RDD.scala:270) at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:73) at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:41) at org.apache.spark.scheduler.Task.run(Task.scala:89) at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:213) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Driver stacktrace: at org.apache.spark.scheduler.DAGScheduler.org$apache$spark$scheduler$DAGScheduler$$failJobAndIndependentStages(DAGScheduler.scala:1431) at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1419) at org.apache.spark.scheduler.DAGScheduler$$anonfun$abortStage$1.apply(DAGScheduler.scala:1418) at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47) at org.apache.spark.scheduler.DAGScheduler.abortStage(DAGScheduler.scala:1418) at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:799) at org.apache.spark.scheduler.DAGScheduler$$anonfun$handleTaskSetFailed$1.apply(DAGScheduler.scala:799) at scala.Option.foreach(Option.scala:236) at org.apache.spark.scheduler.DAGScheduler.handleTaskSetFailed(DAGScheduler.scala:799) at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.doOnReceive(DAGScheduler.scala:1640) at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1599) at org.apache.spark.scheduler.DAGSchedulerEventProcessLoop.onReceive(DAGScheduler.scala:1588) at org.apache.spark.util.EventLoop$$anon$1.run(EventLoop.scala:48) at org.apache.spark.scheduler.DAGScheduler.runJob(DAGScheduler.scala:620) at org.apache.spark.SparkContext.runJob(SparkContext.scala:1832) at org.apache.spark.SparkContext.runJob(SparkContext.scala:1952) at org.apache.spark.rdd.RDD$$anonfun$reduce$1.apply(RDD.scala:1025) at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150) at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:111) at org.apache.spark.rdd.RDD.withScope(RDD.scala:316) at org.apache.spark.rdd.RDD.reduce(RDD.scala:1007) at org.apache.spark.rdd.RDD$$anonfun$treeAggregate$1.apply(RDD.scala:1136) at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:150) at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:111) at org.apache.spark.rdd.RDD.withScope(RDD.scala:316) at org.apache.spark.rdd.RDD.treeAggregate(RDD.scala:1113) at org.apache.spark.ml.classification.LogisticRegression.train(LogisticRegression.scala:271) at org.apache.spark.ml.classification.LogisticRegression.train(LogisticRegression.scala:159) at org.apache.spark.ml.Predictor.fit(Predictor.scala:90) at org.apache.spark.ml.Predictor.fit(Predictor.scala:71) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:381) at py4j.Gateway.invoke(Gateway.java:259) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:209) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.spark.SparkException: Unseen label: pl-PL. at org.apache.spark.ml.feature.StringIndexerModel$$anonfun$4.apply(StringIndexer.scala:157) at org.apache.spark.ml.feature.StringIndexerModel$$anonfun$4.apply(StringIndexer.scala:153) at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.evalExpr2$(Unknown Source) at org.apache.spark.sql.catalyst.expressions.GeneratedClass$SpecificUnsafeProjection.apply(Unknown Source) at org.apache.spark.sql.execution.Project$$anonfun$1$$anonfun$apply$1.apply(basicOperators.scala:51) at org.apache.spark.sql.execution.Project$$anonfun$1$$anonfun$apply$1.apply(basicOperators.scala:49) at scala.collection.Iterator$$anon$11.next(Iterator.scala:328) at scala.collection.Iterator$$anon$14.hasNext(Iterator.scala:389) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327) at org.apache.spark.storage.MemoryStore.unrollSafely(MemoryStore.scala:282) at org.apache.spark.CacheManager.putInBlockManager(CacheManager.scala:171) at org.apache.spark.CacheManager.getOrCompute(CacheManager.scala:78) at org.apache.spark.rdd.RDD.iterator(RDD.scala:268) at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306) at org.apache.spark.rdd.RDD.iterator(RDD.scala:270) at org.apache.spark.rdd.MapPartitionsRDD.compute(MapPartitionsRDD.scala:38) at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:306) at org.apache.spark.rdd.RDD.iterator(RDD.scala:270) at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:73) at org.apache.spark.scheduler.ShuffleMapTask.runTask(ShuffleMapTask.scala:41) at org.apache.spark.scheduler.Task.run(Task.scala:89) at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:213) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ... 1 more </code></pre> <p>The most interesting line is: </p> <pre><code>org.apache.spark.SparkException: Unseen label: pl-PL. </code></pre> <p><strike>No idea, how <code>pl-PL</code> which is a value from <code>lang</code> column could have gotten mixed up in the <code>label</code> column, which is a <code>float</code>, not <code>string</code></strike> edited: some hasty coclusions, corrected thanks to @zero323</p> <p>I've looked further into it and found, that <code>pl-PL</code> is a value from the testing part of the dataset, not training. So now I don't even know where to look for the culprit: it might easily be the <code>randomSplit</code> code, not <code>StringIndexer</code>, and who knows what else.</p> <p>How do I investigate this?</p>
1
Error when using "diff" function inside of dplyr mutate
<p>I try to <code>mutate</code> new column to data.frame. When <code>V</code> column order changes from decreasing to increasing order, I use <code>diff</code> function inside of <code>mutate</code> to categorize them in new column <code>H</code>. </p> <pre><code>V &lt;- c(seq(30,-10,-10),seq(-10,30,10)) gr = rep(seq(1,3),each=10) df &lt;- data.frame(V,gr) library(dplyr) diff_df &lt;- df%&gt;% group_by(gr)%&gt;% mutate(H=ifelse(diff(V)&lt;0,"back","forward")) </code></pre> <p>However getting error </p> <pre><code>Error: incompatible size (9), expecting 10 (the group size) or 1 </code></pre> <p>But when I do </p> <blockquote> <p>diff(df$V)</p> </blockquote> <p>[1] -10 -10 -10 -10 0 10 10 10 10 0 -10 -10 -10 -10 0 10 10 10 10 0 -10 -10 -10 -10 0 10 10 10 10</p> <p>seems to be working logically. Why I'm getting error when I do inside of <code>dplyr?</code></p>
1
Print Struct name in swift
<p>It is possible to know the name of a struct in swift ? I know this is possible for <code>class</code>:</p> <p><strong>Example</strong></p> <pre><code>class Example { var variable1 = "one" var variable2 = "2" } </code></pre> <p>printing this class name, I would simply do:</p> <pre><code>NSStringFromClass(Example).componentsSeparatedByString(".").last! </code></pre> <p>but can I do something similar for <code>struct</code> ?</p> <p><strong>Example</strong></p> <p>If i have a <code>struct</code> :</p> <pre><code>struct structExample { var variable1 = "one" var variable2 = "2" } </code></pre> <p>how can I get the name <em>"<strong>structExample</strong>"</em> of this <code>struct</code>? </p> <p>Thanks. </p>
1
How to emulate CTRL + A & CTRL + C in selenium IDE
<p>I can't figure out how to do <kbd>Ctrl</kbd> + <kbd>A</kbd> to select all the text in a text box and <kbd>Ctrl</kbd> + <kbd>C</kbd> to copy it. I tried to do it using the following [see image] but it didnt' work. </p> <p><a href="https://i.stack.imgur.com/7E8CX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7E8CX.png" alt="enter image description here"></a></p>
1
Spring boot app - How to make database connection?
<p>I'm trying to create my first Spring Boot application and I have an issu with database connection. </p> <p>At the run, I have an </p> <blockquote> <p>java.sql.SQLException : Driver.com.musql.jdbc.Driver which return null</p> </blockquote> <p>( the complete error at the bottom)</p> <p>When I'm connecting to my localhost's database without Spring Boot this is working perfectly, I tested that with this piece of code : </p> <blockquote> <pre><code> try { Class.forName("com.mysql.jdbc.Driver"); java.sql.Connection connection = DriverManager .getConnection("jdbc:mysql://127.0.0.1:3306/logsdb","logsdb", "logsdb"); System.out.println("connection ok"); System.out.println(connection.getCatalog()); } catch (SQLException e) { System.out.println("Connection Failed! Check output console"); e.printStackTrace(); return; } </code></pre> </blockquote> <p>This return the database I created in localhost.</p> <p>But it is not working with Spring boot.</p> <p>I followed this tutorial : <a href="http://spring.io/guides/gs/batch-processing/#scratch" rel="nofollow">http://spring.io/guides/gs/batch-processing/#scratch</a> </p> <p><a href="http://i.stack.imgur.com/eTG6f.png" rel="nofollow">Screen of the structure of the project on this link </a></p> <p><strong>My Pom.xml</strong> :</p> <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;com.toto.logsDB&lt;/groupId&gt; &lt;artifactId&gt;logsDB&lt;/artifactId&gt; &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt; &lt;packaging&gt;jar&lt;/packaging&gt; &lt;parent&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt; &lt;version&gt;1.3.1.RELEASE&lt;/version&gt; &lt;/parent&gt; &lt;properties&gt; &lt;java.version&gt;1.7&lt;/java.version&gt; &lt;/properties&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-batch&lt;/artifactId&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-jdbc&lt;/artifactId&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;mysql&lt;/groupId&gt; &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; </code></pre> <p></p> <p><strong>My "application.properties" :</strong> </p> <pre><code>spring.datasource.url= jdbc:mysql//localhost:3306/logsdb spring.datasource.username=logsdb spring.datasource.password=logsdb spring.datasource.driverClassName=com.mysql.jdbc.Driver </code></pre> <p><strong>The error :</strong> </p> <pre><code> 2016-01-27 14:18:12.396 INFO 3436 --- [ main] c.toto.logsDB.application.Application : Starting Application on EB-OR6105938 with PID 3436 (C:\workspaceLogs\target\classes started by GGFF7580 in C:\workspaceLogs) 2016-01-27 14:18:12.398 INFO 3436 --- [ main] c.toto.logsDB.application.Application : No active profile set, falling back to default profiles: default 2016-01-27 14:18:12.425 INFO 3436 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@10f93f9: startup date [Wed Jan 27 14:18:12 CET 2016]; root of context hierarchy 2016-01-27 14:18:12.807 WARN 3436 --- [ main] o.s.c.a.ConfigurationClassEnhancer : @Bean method ScopeConfiguration.stepScope is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method's declaring @Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @Bean javadoc for complete details. 2016-01-27 14:18:12.814 WARN 3436 --- [ main] o.s.c.a.ConfigurationClassEnhancer : @Bean method ScopeConfiguration.jobScope is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as @Autowired, @Resource and @PostConstruct within the method's declaring @Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see @Bean javadoc for complete details. 2016-01-27 14:18:13.112 ERROR 3436 --- [ main] o.a.tomcat.jdbc.pool.ConnectionPool : Unable to create initial connections of pool. **java.sql.SQLException: Driver:com.mysql.jdbc.Driver@9ff430 returned null for URL:jdbc:mysql//localhost:3306/logsdb** at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:326) ~[tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200) ~[tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:708) [tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:642) [tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:464) [tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.ConnectionPool.&lt;init&gt;(ConnectionPool.java:141) [tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115) [tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102) [tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:126) [tomcat-jdbc-8.0.30.jar:na] at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) [spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) [spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:289) [spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:329) [spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.batch.support.DatabaseType.fromMetaData(DatabaseType.java:95) [spring-batch-infrastructure-3.0.6.RELEASE.jar:3.0.6.RELEASE] at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.getDatabaseType(BatchDatabaseInitializer.java:71) [spring-boot-autoconfigure-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.initialize(BatchDatabaseInitializer.java:50) [spring-boot-autoconfigure-1.3.1.RELEASE.jar:1.3.1.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_21] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_21] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_21] at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_21] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:354) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:305) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) [spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at com.toto.logsDB.application.Application.main(Application.java:37) [classes/:na] 2016-01-27 14:18:13.113 WARN 3436 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchDatabaseInitializer': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Unable to detect database type 2016-01-27 14:18:13.114 INFO 3436 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2016-01-27 14:18:13.115 ERROR 3436 --- [ main] o.s.boot.SpringApplication : Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchDatabaseInitializer': Invocation of init method failed; nested exception is **java.lang.IllegalStateException**: **Unable to detect database type** at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:764) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:357) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:305) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1124) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1113) [spring-boot-1.3.1.RELEASE.jar:1.3.1.RELEASE] at com.toto.logsDB.application.Application.main(Application.java:37) [classes/:na] Caused by: java.lang.IllegalStateException: Unable to detect database type at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.getDatabaseType(BatchDatabaseInitializer.java:74) ~[spring-boot-autoconfigure-1.3.1.RELEASE.jar:1.3.1.RELEASE] at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.initialize(BatchDatabaseInitializer.java:50) ~[spring-boot-autoconfigure-1.3.1.RELEASE.jar:1.3.1.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_21] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_21] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_21] at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_21] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:354) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:305) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133) ~[spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE] ... 17 common frames omitted Caused by: org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta data; nested exception is **org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Driver:com.mysql.jdbc.Driver@9ff430 returned null for URL:jdbc:mysql//localhost:3306/logsdb** at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:302) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:329) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.batch.support.DatabaseType.fromMetaData(DatabaseType.java:95) ~[spring-batch-infrastructure-3.0.6.RELEASE.jar:3.0.6.RELEASE] at org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer.getDatabaseType(BatchDatabaseInitializer.java:71) ~[spring-boot-autoconfigure-1.3.1.RELEASE.jar:1.3.1.RELEASE] ... 25 common frames omitted Caused by: **org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection**; nested exception is java.sql.SQLException: Driver:com.mysql.jdbc.Driver@9ff430 returned null for URL:jdbc:mysql//localhost:3306/logsdb at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:289) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] ... 28 common frames omitted Caused by: java.sql.SQLException: Driver:com.mysql.jdbc.Driver@9ff430 returned null for URL:jdbc:mysql//localhost:3306/logsdb at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:326) ~[tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200) ~[tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:708) ~[tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:642) ~[tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:464) ~[tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.ConnectionPool.&lt;init&gt;(ConnectionPool.java:141) ~[tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:115) ~[tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:102) ~[tomcat-jdbc-8.0.30.jar:na] at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:126) ~[tomcat-jdbc-8.0.30.jar:na] at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) ~[spring-jdbc-4.2.4.RELEASE.jar:4.2.4.RELEASE] ... 29 common frames omitted 2016-01-27 14:18:13.117 INFO 3436 --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/C:/workspaceLogs/target/classes/, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot-starter-batch/1.3.1.RELEASE/spring-boot-starter-batch-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot-starter/1.3.1.RELEASE/spring-boot-starter-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot/1.3.1.RELEASE/spring-boot-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot-autoconfigure/1.3.1.RELEASE/spring-boot-autoconfigure-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot-starter-logging/1.3.1.RELEASE/spring-boot-starter-logging-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/ch/qos/logback/logback-classic/1.1.3/logback-classic-1.1.3.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/ch/qos/logback/logback-core/1.1.3/logback-core-1.1.3.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/slf4j/slf4j-api/1.7.13/slf4j-api-1.7.13.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/slf4j/jcl-over-slf4j/1.7.13/jcl-over-slf4j-1.7.13.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/slf4j/jul-to-slf4j/1.7.13/jul-to-slf4j-1.7.13.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/slf4j/log4j-over-slf4j/1.7.13/log4j-over-slf4j-1.7.13.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-core/4.2.4.RELEASE/spring-core-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/yaml/snakeyaml/1.16/snakeyaml-1.16.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/hsqldb/hsqldb/2.3.3/hsqldb-2.3.3.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-jdbc/4.2.4.RELEASE/spring-jdbc-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-beans/4.2.4.RELEASE/spring-beans-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-tx/4.2.4.RELEASE/spring-tx-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/batch/spring-batch-core/3.0.6.RELEASE/spring-batch-core-3.0.6.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/com/ibm/jbatch/com.ibm.jbatch-tck-spi/1.0/com.ibm.jbatch-tck-spi-1.0.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/javax/batch/javax.batch-api/1.0/javax.batch-api-1.0.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/com/thoughtworks/xstream/xstream/1.4.7/xstream-1.4.7.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/codehaus/jettison/jettison/1.2/jettison-1.2.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/batch/spring-batch-infrastructure/3.0.6.RELEASE/spring-batch-infrastructure-3.0.6.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/retry/spring-retry/1.1.2.RELEASE/spring-retry-1.1.2.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-aop/4.2.4.RELEASE/spring-aop-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-context/4.2.4.RELEASE/spring-context-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/spring-expression/4.2.4.RELEASE/spring-expression-4.2.4.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/springframework/boot/spring-boot-starter-jdbc/1.3.1.RELEASE/spring-boot-starter-jdbc-1.3.1.RELEASE.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/apache/tomcat/tomcat-jdbc/8.0.30/tomcat-jdbc-8.0.30.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/org/apache/tomcat/tomcat-juli/8.0.30/tomcat-juli-8.0.30.jar, file:/C:/Users/GGFF7580/Documents/maven2/repository/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar] </code></pre> <p>I read a lot of posts on stackoverflow but I wasn't able to find the good solution, if you have an idea..</p> <p>Best regards, Jimmy</p>
1
How to change background color for every other row in a ListView?
<p>Is there a way to change the the background color for every second row in a ListView? </p> <p>I figured it should be doable with an if statement that recognises if it is a even or odd row and choose the style based on this. However, it does not seem possible to utilise this in React-Native. </p> <p>My renderRow function looks like this:</p> <pre><code>renderRow={(rowData) =&gt; { return ( &lt;TouchableHighlight onPress={() =&gt; this.props.onSelectNote(rowData)} style={styles.rowStyle} underlayColor="#9E7CE3" &gt; &lt;Text style={styles.rowText}&gt;{rowData.title}&lt;/Text&gt; &lt;/TouchableHighlight&gt; ) } } </code></pre> <p>As of now all rows will be styled according to rowStyle. How would it be possible to have different styles for different rows?</p>
1
Minizinc search 2d array with constraints
<p>How could I select the smallest number from each row of a 2d array while making sure the same column can at most be selected twice (in the following case, for row 1, column 5 is chosen; for row 2, column 5 is chosen while for row 3, column 5 can no longer be selected, so column 2 is selected as the min): (Besides, in java, it is often that ArrayList is used to add and remove elements but how is it possible to do this in Minizinc using constraints)?</p> <pre><code>int: m = 3; int: n = 5; array[1..m,1..n] of int: diffs = [|14,18,24,30,13 |10,12,18,24,7 | 8,7,12,18,6|] </code></pre>
1
Symfony 3 form - what is ::class and where is name?
<p>What does the <strong>::class</strong> used in the forms Symfony 3?</p> <p>For example:</p> <pre><code>-&gt;add('task', TextType::class) </code></pre> <p>or</p> <pre><code>$form = $this-&gt;createForm(TaskType::class, $task); </code></pre> <p>Where can I read about the method <strong>::class</strong>?</p> <p>In Symfony2 was:</p> <pre><code>public function getName() { return 'appbundle_task'; } </code></pre> <p>And next in view I had prefix, for example:</p> <pre><code>&lt;input id="appbundle_task_name" type="text" name="appbundle_task[name]"&gt; </code></pre> <p>What it is now the principle of generating names in inputs?</p>
1
Laravel How to pass post data from one post method to another post method within the same controller?
<p>Suppose I have a search form which submit the search parameters to a post method with ajax, on that method I have returned the result in a view. Now on that view I have an option for user to select the range of record for printing in excel, so for this once again I need to submit the search parameters along with print settings to one another post method, on that method I need to search again for search parameters, and also limit the search for selected print ranges. So for this I need the same code block, but for avoiding that is it possible to call the search post method from within the print post method? If possible How can I do that? Or any other way?</p>
1
How to get Flask/Gunicorn to handle concurrent requests for the same Route?
<p><strong>tl;dr</strong> A method decorated with <code>route</code> can't handle concurrent requests while Flask is served behind a gunicorn started with multiple workers and threads, while two different methods handle concurrent requests fine. Why is this the case, and how can the same route be served concurrently?</p> <hr> <p>I have this simple flask app:</p> <pre><code>from flask import Flask, jsonify import time app = Flask(__name__) @app.route('/foo') def foo(): time.sleep(5) return jsonify({'success': True}), 200 @app.route('/bar') def bar(): time.sleep(5) return jsonify({'success': False}), 200 </code></pre> <p>If I run this via:</p> <pre><code>gunicorn test:app -w 1 --threads 1 </code></pre> <p>If I quickly open up <code>/bar</code> and <code>/foo</code> in two different tabs in a browser, whichever tab I hit enter on first will load in 5 seconds, and the second tab will load in 10 seconds. This makes sense because gunicorn is running one worker with one thread.</p> <p>If I run this via either:</p> <pre><code>gunicorn test:app -w 1 --threads 2 gunicorn test:app -w 2 --threads 1 </code></pre> <p>In this case, opening up <code>/foo</code> and <code>/bar</code> in two different tabs both take 5 seconds. This makes sense, because gunicorn is running either 1 worker with two threads, or two workers with one thread each, and can serve up the two routes at the same time.</p> <p><strong>However, If I open up two <code>/foo</code> at the same time, regardless of the gunicorn configuration, the second tab will always take 10 seconds.</strong></p> <p>How can I get the same method decorated by <code>route</code> to serve concurrent requests?</p>
1
Dynamic Button Icon Windows app
<p>I'm trying to do a pause/play button windows 10 app.</p> <p>So far I know 3 ways to set the button using</p> <p>button.context = "some segoe code" - works fine when I initialize it with the button but on the code to change the context the button appears as a bunch of squares</p> <p>Button symbolicon - works fine initializing but no idea how to alter the symbolicon value outside of button declaration</p> <p>button uri - only thing I could find online about button changing, but I don't have the button libraries that come in windows phone...</p> <p>what is your recommendations so on clickrelease the button changes to either the pause or the play</p>
1
Auto increment value in javascript class
<p>I'm trying to auto increment a properties value each time I instantiate a new instance of the class. This is what my class constructor looks (I abstracted it down just a bit): </p> <pre><code>var Playlist = function(player, args){ var that = this; this.id = ?; //Should auto increment this.tracks = []; this.ready = false; this.unloaded = args.length; this.callback = undefined; this.onready = function(c){ that.callback = c; }; this.add = function(tracks){ for(var i = 0; i &lt; tracks.length; i++){ this.tracks.push(tracks[i]); this.resolve(i); } }; this.resolve = function(i){ SC.resolve(that.tracks[i]).then(function(data){ that.tracks[i] = data; if(that.unloaded &gt; 0){ that.unloaded--; if(that.unloaded === 0){ that.ready = true; that.callback(); } } }); }; player.playlists.push(this); return this.add(args); }; var playlist1 = new Playlist(player, [url1,url2...]); //Should be ID 0 var playlist2 = new Playlist(player, [url1,url2...]); //Should be ID 1 </code></pre> <p>I'd like to not define an initial variable that I increment in the global scope. Could anyone hint me in the right direction? Cheers!</p>
1
Broadcast receiver and memory leaks
<p>In my app; I want to receive network connectivity changes in all my services since I have to manage db locally as well as on server both. </p> <p>I have made <code>BaseConnectivityService</code> which has receiver for connectivity change as follows:</p> <pre><code>public abstract class BaseConnectivityService extends IntentService { private ConnectivityManager mConnectivityManager; public BaseConnectivityService(String name) { super(name); } @Override public void onCreate() { super.onCreate(); mConnectivityManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); registerReceivers(); } @Override public void onDestroy() { unregisterReceivers(); mConnectivityManager = null; super.onDestroy(); } private void registerReceivers() { IntentFilter connectivityIntentFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION); registerReceiver(mConnectivityChangeReceiver, connectivityIntentFilter); } private void unregisterReceivers() { unregisterReceiver(mConnectivityChangeReceiver); } /** * will be invoked when network connectivity has been changed and network is in connected state */ protected abstract void onNetworkConnected(); /** * will be invoked when network connectivity has been changed and network is NOT in connected state */ protected abstract void onNetworkDisconnected(); /** * checks whether network is available and is in connected state * * @return true if network is connected; false otherwise */ protected final boolean isNetworkConnected() { NetworkInfo activeNetworkInfo = mConnectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null &amp;&amp; activeNetworkInfo.isAvailable() &amp;&amp; activeNetworkInfo.isConnected(); } private final BroadcastReceiver mConnectivityChangeReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (isNetworkConnected()) { onNetworkConnected(); } else { onNetworkDisconnected(); } } }; } </code></pre> <p>Now if I extend all my services with <code>BaseConnectivityService</code>; will it cause memory leak as that system will keep the services in memory for the purpose of notifying connectivity changes?</p> <p>I have read <a href="https://groups.google.com/forum/#!topic/android-developers/Uf6gXIf5ntc" rel="nofollow">this thread</a>; which is somewhat similar question. As Mark Murphy has written there :</p> <blockquote> <p>You will leak memory, as your BroadcastReceiver will keep the component in RAM (even if it was destroyed) until such time as Android terminates the process.</p> </blockquote> <p>Is it be applicable for my scenario? If yes, what can be the good solution for avoiding memory leak and getting notified of network connectivity changes?</p>
1
Appending to dict of lists adds value to every key
<p>I have a dictionary of empty lists with all keys declared at the beginning:</p> <pre><code>&gt;&gt;&gt; keys = ["k1", "k2", "k3"] &gt;&gt;&gt; d = dict.fromkeys(keys, []) &gt;&gt;&gt; d {'k2': [], 'k3': [], 'k1': []} </code></pre> <p>When I try to add a coordinate pair (the list <code>["x1", "y1"]</code>) to one of the key's lists, it instead adds to all the keys' lists:</p> <pre><code>&gt;&gt;&gt; d["k1"].append(["x1", "y1"]) &gt;&gt;&gt; d {'k1': [['x1', 'y1']], 'k2': [['x1', 'y1']], 'k3': [['x1', 'y1']]} </code></pre> <p>What I was looking for was:</p> <pre><code>&gt;&gt;&gt; d {'k1': [['x1', 'y1']], 'k3': [], 'k1': []} </code></pre> <p>How can I achieve this in Python 3?</p>
1
resize AVPlayerItem container view based on aspect ratio from video
<p>I have a container UIView called <code>videoView</code>. I add a AVPLayerLayer to that view. I do not know how to resize the <code>videoView</code> to be of the same proportions as the avplayer layer. Using <code>videoGravity</code> does not have the desired effect. </p> <pre><code>AVPlayerItem* playerItem = [AVPlayerItem playerItemWithURL:path]; _videoPlayer = [[AVPlayer alloc] initWithPlayerItem:playerItem]; AVPlayerLayer *layer = [AVPlayerLayer layer]; [_avplayerLayer setPlayer:_videoPlayer]; [_avplayerLayer setBackgroundColor:[UIColor whiteColor].CGColor]; [_avplayerLayer setVideoGravity:AVLayerVideoGravityResizeAspectFill]; [_avplayerLayer setFrame:_videoView.bounds]; [_videoView.layer addSublayer:_avplayerLayer]; </code></pre> <p>I am using autolayout, and my layout would accommodate a change in the height of _videoView. </p>
1
what does the --yes parameter at npm init mean?
<p>What does the --yes parameter at npm init mean? I saw it <a href="https://devcenter.heroku.com/articles/node-best-practices#start-every-new-project-with-npm-init" rel="noreferrer">here</a> and would like to know what it does exactly. Is there a difference between --y and --yes? </p>
1
Loop postgresql Function through Date Range
<p>I have a user defined function. <a href="https://stackoverflow.com/questions/14413203/writing-a-function-in-sql-to-loop-through-a-date-range-in-a-udf">This question</a> shows how to loop through dates. Using this approach, I tried this query:</p> <pre><code>select myfun(a::date) from generate_series('2015-01-01'::date,'2016-01-27','1 day') s(a) </code></pre> <p>This doesn't quite work. What it returns is a single column of the form:</p> <pre><code>(10101, "Sample", "test") (10102, "Sample2", "test2") </code></pre> <p>When in reality there should be three columns. It merges them into one.</p> <p>I noticed that this is the same behavior that you get in a vanilla query such as <code>select mytable</code> when I omit the asterisk. The above query doesn't have an asterisk in it, but adding one causes an error. </p>
1
Get audio from HTML5 video
<p>I have been trying to figure out this for a week. I have two completely different video tags with their respective audio. I also have one audio tag. At first, both muted attribute is set for both video tags. When I want to get video1 audio, I would like to get it audio source and assign it to the audio tag. Also do the same for video2. </p> <p>Is this possible with Javascript? I have tried Web audio API but I'm lost. Please help.</p>
1
How to change/rename specific attributes within a data frame column
<p>I need help changing/renaming attributes within columns of a data frame in R. I can get pretty close to what I need, but I haven't been able to work around the way that my "solution" changes the data. </p> <p>Here's a dummy data frame:</p> <pre><code>cols &lt;- c("green", "green", "red", "blue", "black", "blue") num &lt;- c(1, 1, 2, 3, 4, 3) df &lt;- data.frame(cols, num) df$cols &lt;- as.character(df$cols) &gt; df cols num 1 green 1 2 green 1 3 red 2 4 blue 3 5 black 4 6 blue 3 </code></pre> <p>Let's say there was a mistake in my data and that all of my "green" attributes need to be "purple." Here's the bit of code I tried that was suggested over at the GIS StackExchange for a similar problem:</p> <pre><code>df[df$cols == "green", ] &lt;- "purple" &gt; df cols num 1 purple purple 2 purple purple 3 red 2 4 blue 3 5 black 4 6 blue 3 </code></pre> <p>As you can see, it does indeed change my green attributes to purple...but also changes its corresponding number column. With my real data frame, I have many other necessary columns that can't be changed like this. So how do I change attribute names within a column WITHOUT affecting other columns?</p>
1
Is there a way to configure multiple Serilog RollingFiles through appSetting configuration
<p>Is there a way to configure multiple Serilog RollingFiles through appSetting?</p> <p>I want to create separate log files for Information and Error levels.</p>
1
How to make the size of ellipse to get smaller and bigger in processing automatically
<p>I am creating something using classes in order to get used to them and I am trying to get the size of the ellipse I have drawn to get smaller and larger on its own so that it makes it look more interactive however I don't know what code to implement.</p> <p>I have shown the code I am using below;</p> <pre class="lang-java prettyprint-override"><code>void setup() { size(640, 480); } void draw() { background(255); for (int i = height-50; i &gt; 0; i-= 20) { fill(random(255), random(255), random(255)); ellipse(width/2, height/2, i, i); } } </code></pre>
1
How to use arrayformula to dynamically join strings in google spreadsheet?
<p>I use <code>Arrayformula()</code> to make my reports dynamic and easier to edit. For example, if I have a Column A with a list o number o blue balls in a set and a Column B with a list red balls in a set, on the cell C1 I can write <code>=ArrayFormula(add(A1:A,B1:B))</code> and in the Column C will have the total of balls in each set. It would be exactly the same as writing <code>=A1+B1</code> in cell C1 and dragging the formula down to the last row. <code>Arrayformula()</code> has some benefits, because it will work if some adds or removes rows from the sheet and also it makes the reports way more organized and easier to edit.</p> <p>Since I´ve discovered <code>arrayformula()</code>, my life has changed, because of the fact that googleSheets expands the formula to other cells. It does not work every time, but the idea of expanding to other cells seems to be possible some way or another, <a href="https://stackoverflow.com/questions/35037640/how-to-make-a-range-repeat-n-times-in-google-spreadsheet/35039281#35039281">here is a good example</a> of a problem that was not resolved by <code>arrayformula()</code>, but has the same idea.</p> <p>Keeping that idea in mind, imagine that on Column A there is a list of First Names and on Column B there is a list of Last names. On Column C I want to join this two string using a simples space. The way to do that would be in the cell C1 write <code>=join(" ",A1,B1)</code> and then drag down this formula. This method method however is prone to error since people can add and remove rows, deleting my formula. I want to use a formula that I can write in one single cell and it expands to other cells. I´ve tried <code>=arrayformula(join(" ",A1:A,B1:B))</code>, but it does not work. </p> <p>Is that a way to do that using <code>=arrayformula()</code> or other native function?</p> <p>I know I could write a script or custom formula to do that, but this is not my goal here.</p>
1
Reason for Redis `dir` path changing dynamically
<p>We are facing an issue with redis, where the <code>'dir'</code> path for the redis is getting set without any notice.</p> <p>Resulting in the following error (while writing to redis).</p> <blockquote> <p>MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.</p> </blockquote> <p><strong>Information</strong> we have to support this.</p> <p><strong>- Redis Config file</strong></p> <p>A look at our <code>redis.conf</code> (located at <code>/etc/redis/redis.conf</code>) hint us that the <code>dir</code> path value is...</p> <pre><code># The working directory. # # The DB will be written inside this directory, with the filename specified # above using the 'dbfilename' configuration directive. # # The Append Only File will also be created inside this directory. # # Note that you must specify a directory here, not a file name. dir /var/lib/redis </code></pre> <p><strong>- Redis INFO Result.</strong></p> <blockquote> <p>{"redis_version"=>"2.8.17", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "redis_build_id"=>"e2de0295da7f0ee1", "redis_mode"=>"standalone", "os"=>"Linux 3.16.0-4-amd64 x86_64", "arch_bits"=>"64", "multiplexing_api"=>"epoll", "gcc_version"=>"4.9.2", "process_id"=>"6860", "run_id"=>"4ecd0ff19798a88793e7a3ce281f398ba9aa2f5a", "tcp_port"=>"6379", "uptime_in_seconds"=>"99525", "uptime_in_days"=>"1", "hz"=>"10", "lru_clock"=>"11741717", "config_file"=>"/etc/redis/redis.conf", "connected_clients"=>"2", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"784840", "used_memory_human"=>"766.45K", "used_memory_rss"=>"3624960", "used_memory_peak"=>"784840", "used_memory_peak_human"=>"766.45K", "used_memory_lua"=>"33792", "mem_fragmentation_ratio"=>"4.62", "mem_allocator"=>"jemalloc-3.6.0", "loading"=>"0", "rdb_changes_since_last_save"=>"0", "rdb_bgsave_in_progress"=>"0", "rdb_last_save_time"=>"1454582288", "rdb_last_bgsave_status"=>"ok", "rdb_last_bgsave_time_sec"=>"0", "rdb_current_bgsave_time_sec"=>"-1", "aof_enabled"=>"0", "aof_rewrite_in_progress"=>"0", "aof_rewrite_scheduled"=>"0", "aof_last_rewrite_time_sec"=>"-1", "aof_current_rewrite_time_sec"=>"-1", "aof_last_bgrewrite_status"=>"ok", "aof_last_write_status"=>"ok", "total_connections_received"=>"12", "total_commands_processed"=>"4651", "instantaneous_ops_per_sec"=>"0", "rejected_connections"=>"0", "sync_full"=>"0", "sync_partial_ok"=>"0", "sync_partial_err"=>"0", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"0", "keyspace_misses"=>"0", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "latest_fork_usec"=>"206", "role"=>"master", "connected_slaves"=>"0", "master_repl_offset"=>"0", "repl_backlog_active"=>"0", "repl_backlog_size"=>"1048576", "repl_backlog_first_byte_offset"=>"0", "repl_backlog_histlen"=>"0", "used_cpu_sys"=>"57.78", "used_cpu_user"=>"25.71", "used_cpu_sys_children"=>"0.00", "used_cpu_user_children"=>"0.00", "db0"=>"keys=2851,expires=0,avg_ttl=0"}</p> </blockquote> <p>Key point</p> <pre><code> redis.info['config_file'] =&gt; /etc/redis/redis.conf </code></pre> <p>Process id of Redis</p> <pre><code> redis.info['process_id'] =&gt; 6860 </code></pre> <p><strong>- Redis Config</strong></p> <p>And then I inspected redis config and...</p> <pre><code>redis.config "get" ,"dir" =&gt; ["dir", "/etc/ssh"] ## ideally should be /var/lib/redis </code></pre> <p>Things, I did to fix the above error.</p> <pre><code>redis.config "set" ,"dir","/var/lib/redis" =&gt; "OK" redis.config "get", "dir" =&gt; ["dir", "/var/lib/redis"] </code></pre> <p>This sort of fix it (the above issue). But for <em>temporary</em> purpose only because.....</p> <p><strong>After couple of hours</strong> I noticed this.</p> <pre><code>redis.config "get" ,"dir" =&gt; ["dir", "/etc/ssh"] </code></pre> <p>Inspecting the redis config again</p> <p><strong>- Redis Info</strong> </p> <blockquote> <p>{"redis_version"=>"2.8.17", "redis_git_sha1"=>"00000000", "redis_git_dirty"=>"0", "redis_build_id"=>"e2de0295da7f0ee1", "redis_mode"=>"standalone", "os"=>"Linux 3.16.0-4-amd64 x86_64", "arch_bits"=>"64", "multiplexing_api"=>"epoll", "gcc_version"=>"4.9.2", "process_id"=>"6860", "run_id"=>"4ecd0ff19798a88793e7a3ce281f398ba9aa2f5a", "tcp_port"=>"6379", "uptime_in_seconds"=>"109032", "uptime_in_days"=>"1", "hz"=>"10", "lru_clock"=>"11751224", "config_file"=>"/etc/redis/redis.conf", "connected_clients"=>"2", "client_longest_output_list"=>"0", "client_biggest_input_buf"=>"0", "blocked_clients"=>"0", "used_memory"=>"788984", "used_memory_human"=>"770.49K", "used_memory_rss"=>"3629056", "used_memory_peak"=>"808952", "used_memory_peak_human"=>"789.99K", "used_memory_lua"=>"33792", "mem_fragmentation_ratio"=>"4.60", "mem_allocator"=>"jemalloc-3.6.0", "loading"=>"0", "rdb_changes_since_last_save"=>"82", "rdb_bgsave_in_progress"=>"0", "rdb_last_save_time"=>"1454591521", "rdb_last_bgsave_status"=>"ok", "rdb_last_bgsave_time_sec"=>"0", "rdb_current_bgsave_time_sec"=>"-1", "aof_enabled"=>"0", "aof_rewrite_in_progress"=>"0", "aof_rewrite_scheduled"=>"0", "aof_last_rewrite_time_sec"=>"-1", "aof_current_rewrite_time_sec"=>"-1", "aof_last_bgrewrite_status"=>"ok", "aof_last_write_status"=>"ok", "total_connections_received"=>"14", "total_commands_processed"=>"6966", "instantaneous_ops_per_sec"=>"0", "rejected_connections"=>"0", "sync_full"=>"0", "sync_partial_ok"=>"0", "sync_partial_err"=>"0", "expired_keys"=>"0", "evicted_keys"=>"0", "keyspace_hits"=>"0", "keyspace_misses"=>"0", "pubsub_channels"=>"0", "pubsub_patterns"=>"0", "latest_fork_usec"=>"135", "role"=>"master", "connected_slaves"=>"0", "master_repl_offset"=>"0", "repl_backlog_active"=>"0", "repl_backlog_size"=>"1048576", "repl_backlog_first_byte_offset"=>"0", "repl_backlog_histlen"=>"0", "used_cpu_sys"=>"62.96", "used_cpu_user"=>"27.97", "used_cpu_sys_children"=>"0.00", "used_cpu_user_children"=>"0.00", "db0"=>"keys=2902,expires=0,avg_ttl=0"}</p> </blockquote> <p>Key point.</p> <pre><code> redis.info["process_id"] =&gt; 6860 redis.info['config_file'] =&gt; /etc/redis/redis.conf </code></pre> <p>So,</p> <ol> <li><p>Redis Server was never restarted. (<code>process_id</code> says a lot about this).</p></li> <li><p>Redis is picking the correct config file i.e. <code>/etc/redis/redis.conf</code>.</p></li> </ol> <h2>Question.</h2> <p>So, If point 1, and 2 are true what is causing <code>redis</code> to set the <code>config</code> <code>dir</code> value to <code>/etc/ssh</code> after some hours? ( <strong>I have reset the config 5-6 times since yesterday.</strong>)</p> <p><strong>Note:</strong></p> <p>Also restarted the server (<strong>yesterday</strong>) in a hope that the issue would be resolved permanently. But with no luck.</p> <p><strong>Note:</strong></p> <p>Responding to @Keith answer</p> <p>Yes! the server is perfectly behind a <em>restrictive</em> firewall.</p> <p>Thought?</p>
1
LINQ statement - WHERE clause for ENUM type
<p>I followed MSDN tutorial about filtering functionality in ASP.NET MVC web app > <a href="http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application" rel="nofollow">http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/sorting-filtering-and-paging-with-the-entity-framework-in-an-asp-net-mvc-application</a></p> <p>Unfortunately, I can't select an object which has an enum attriubute.</p> <p>Used model is:</p> <pre><code>public Bus() { public int BusID { get; set; } public string RegNum { get; set; } public Status? Status { get; set; } public string Latitude { get; set; } public string Longitude { get; set; } } </code></pre> <p>where the enum type is:</p> <pre><code>public enum Status { ON, OFF } </code></pre> <p>According to the mentioned tutorial I implemented sorting method in BusController as shown below:</p> <pre><code>public ViewResult Index(string searchString) { var buses = from b in db.Buses select b; if (!String.IsNullOrEmpty(searchString)) { buses = buses.Where(b =&gt; b.RegNum.ToUpper().Contains(searchString.ToUpper()) ); } return View(buses.ToList()); } </code></pre> <p>it works fine for RegNum filtering, but I can't select the Bus for the given status by searchstring value.</p> <p>b.Status.Equals(searchstring) doesn't work.</p> <p>I'd be grateful for any hints</p>
1
Expect matcher for reference object with GoogleMock in C++
<p>I'm attempting to use mocks to test that a certain method was called with certain arguments and am having trouble testing that <code>*this</code> is one of the arguments.</p> <p>Here's the code under test:</p> <pre><code>class Component { virtual void update(Entity &amp;entity, const uint32_t dt) {}; ... void Entity::update(const uint32_t dt) { for (unsigned int i = 0; i &lt; components_.size(); ++i) { components_[i]-&gt;update(*this, dt); } } </code></pre> <p>And the test:</p> <pre><code>ea_ = new aronnax::Entity(cla_); EXPECT_CALL(mockComponent, update(Eq(ByRef(ea_)), testDt)).Times(1); ea_-&gt;update(testDt); </code></pre> <p>I'm getting errors that the two types aren't comparable. I'm relatively new to c++ and am having trouble understanding how to compare the pointer <code>ea_</code> to the pointer reference (<code>*&amp;</code>) to <code>ea_</code> passed into <code>update</code>.</p>
1
ClassLoader referenced unknown path when going to next activity
<p>I currently have 4 different buttons. 3 of them lead to the same activity, but populate an ArrayList with different data. The only difference between the different sets of data is the size. </p> <p>Everytime I use the working button <code>selectCountryAndStateButton</code> everything works fine. However when I use the <code>getAllFacilitiesButton</code> the application returns to the previous activity and I get the following in LogCat</p> <pre><code>02-08 11:56:26.649 22325-22325/? W/System: ClassLoader referenced unknown path: /data/app/com.company.app-1/lib/x86 02-08 11:56:26.668 22325-22325/? I/GMPM: App measurement is starting up, version: 8487 02-08 11:56:26.668 22325-22325/? I/GMPM: To enable debug logging run: adb shell setprop log.tag.GMPM VERBOSE 02-08 11:56:26.791 22325-22336/com.company.app I/art: Background partial concurrent mark sweep GC freed 418(17KB) AllocSpace objects, 0(0B) LOS objects, 40% free, 4MB/7MB, paused 9.593ms total 21.620ms 02-08 11:56:27.097 22325-22359/com.company.app D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 02-08 11:56:27.177 22325-22359/com.company.app I/OpenGLRenderer: Initialized EGL, version 1.4 02-08 11:56:27.187 22325-22359/com.company.app W/EGL_emulation: eglSurfaceAttrib not implemented 02-08 11:56:27.187 22325-22359/com.company.app W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad7e0960, error=EGL_SUCCESS </code></pre> <p>Prior to the error, I received the following. </p> <pre><code>02-08 11:38:41.064 14907-14907/? E/GMPM: GoogleService failed to initialize, status: 10, Missing an expected resource: 'R.string.google_app_id' for initializing Google services. Possible causes are missing google-services.json or com.google.gms.google-services gradle plugin. </code></pre> <p>However I corrected the error by adding <code>google_app_id.xml</code> to my resources. </p> <p>Why am I getting a class loader unknown reference problem when the same exact code works with a set of data that is much smaller? </p> <p>EDIT: 2/8/2016 1:25pm [central] </p> <p>Found out my messages were filtered. I'm getting the following error:</p> <pre><code>E/JavaBinder: !!! FAILED BINDER TRANSACTION !!! (parcel size = 526172) </code></pre> <p>Which means my List of 644 objects is too big to pass to the next activity. Will answer with solution </p> <p>-----Below is my code-----</p> <p>Working Button (facilities.size() &lt; 100 )</p> <pre><code>selectCountryAndStateButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ServiceConnector sc = getServiceConnector(); sc.execute(APICallEnum.SEARCH_BY_COUNTRY, countrySelected, stateSelected); try { String data = sc.get(); List&lt;Facility&gt; facilities = JSONParser.getFromJson(data); //Open list activity of facilities openListActivity(facilities); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }); </code></pre> <p>Button does not work (facilities.size() = 644)</p> <pre><code>getAllFacilitiesButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.i("Search", "get all"); ServiceConnector sc = getServiceConnector(); sc.execute(APICallEnum.GET_ALL_FACILITIES); try { String data = sc.get(); List&lt;Facility&gt; facilities = JSONParser.getFromJson(data); openListActivity(facilities); } catch (ExecutionException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }); </code></pre> <p>Open next Activity code </p> <pre><code>private void openListActivity(List&lt;Factility&gt; f) { Intent intent = new Intent(FindLocation.this, ListingActivity.class); intent.putExtra("facilities", new FacilityList(f)); startActivity(intent); } </code></pre>
1
Can't access an object's methods from an ArrayList in Java
<p>Java tells me it can't find getName() when i try to run the main method. I'm not sure why, I've looked around stackexchange to no avail. It seems like such a simple solution but I can't seem to figure it out.</p> <pre><code>import java.util.*; public class ArrayTester { public static ArrayList&lt;Object&gt; array; public static void main(String args[]) { array = new ArrayList&lt;Object&gt;(); array.add(new TestObject("Some Name")); System.out.println("Object Name: " + array.get(0).getName()); } } </code></pre> <p>Object:</p> <pre><code>public class TestObject { private String name; public TestObject(String cname){ name = cname; } public String getName(){ return name; } } </code></pre> <p>Thanks for your help in advance. I apologize if there is an identical question somewhere that I didn't see.</p>
1
"App not installed" error when updating an app on Marshmallow
<p>My Android app update gives the error message "App not installed" on Marshmallow while it works fine in a previous version. I am using a signed APK to update both the older app &amp; the new app. </p> <p>I am getting this error in the log when I update the app on Android One device(marshmallow)</p> <pre><code>02-03 11:24:56.025 138-151/? E/Vold: Error creating imagefile (Permission denied) 02-03 11:24:56.025 138-151/? E/Vold: ASEC image file creation failed (Permission denied) 02-03 11:24:56.025 138-151/? W/Vold: Returning OperationFailed - no handler for errno 13 02-03 11:24:56.025 557-607/? D/VoldConnector: RCV &lt;- {400 92 asec operation failed (Permission denied)} 02-03 11:24:56.026 21687-21699/? E/PackageHelper: Failed to create secure container smdl870766772.tmp 02-03 11:24:56.027 21687-21699/? W/DefContainer: Failed to copy package at /storage/emulated/0/KAHMobile-release.apk java.io.IOException: Failed to create container smdl870766772.tmp at com.android.defcontainer.DefaultContainerService.copyPackageToContainerInner(DefaultContainerService.java:326) at com.android.defcontainer.DefaultContainerService.-wrap1(DefaultContainerService.java) at com.android.defcontainer.DefaultContainerService$1.copyPackageToContainer(DefaultContainerService.java:108) at com.android.internal.app.IMediaContainerService$Stub.onTransact(IMediaContainerService.java:60) at android.os.Binder.execTransact(Binder.java:453) </code></pre>
1
InstallShield Limited Edition 2015 warning -6245 .Net Framework required
<p>I've created a project using VS2015, it uses .net framework v4.6.1.<br> I'm now trying to create an install program for it using InstallShield Limited Edition. When I compile the install shield package I get the following warning :</p> <p>ISEXP : warning -6245: One or more of the project's components contain .NET properties that require the .NET Framework. It is recommended that the release include the .NET Framework.</p> <p>With the limited edition I don't see the option to include the .net framework, nor do I see a way to make the .net framework v4.6.1 a requirement.</p>
1
Creating a record does not appear to persist to the test database, rspec, factory_girl_rails
<p>According to the <a href="https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md" rel="nofollow noreferrer">factory_girl_rails</a> documentation: here is the difference between the factory_girl <code>build()</code> and <code>create()</code> methods:</p> <blockquote> <p># Returns a User instance that's not saved</p> <p>user = build(:user)</p> <p># Returns a saved User instance</p> <p>user = create(:user)</p> </blockquote> <p>I know the power of factories is that they make your test suite fast because it allows you to run tests without having to touch the database at all via the <code>build()</code> method. The <code>create()</code> method on the other hand does still touch the database because it persists the record to the database. </p> <p>I am confused because when I put a break point within my test after using <code>create()</code></p> <ul> <li>The rails console says that the object is persisted to the database <em>(as expected)</em></li> <li>The <code>test/test.log</code> show that the object was persisted to the database <em>(as expected)</em></li> <li><p>But when I look at the table within the test database: It is not there <em>(not expected. I would expect to see the object within the database)</em></p> <pre><code>#someApp/spec/models/user_spec.rb RSpec.describe User, type: :model do it "checks the age on the basic 'User' Factory " do user = create(:user) # should create a user and persist it to the database binding.pry expect(user.age).to eq(28) end end </code></pre></li> </ul> <p>Execution stops at the break point and the rails console opens up. I test for persistence and it returns true:</p> <pre><code>user.persisted? =&gt; true </code></pre> <p>However, I look within my test database at the table, refresh the table, and yet still no record is shown:</p> <p><a href="https://i.stack.imgur.com/wKhzK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wKhzK.png" alt="record does not display in table"></a></p> <p>What am I missing? I thought that when you use <code>create()</code> the record will be persisted to the database. Does it actually not save to the database at all?</p>
1
Azure Data Factory Copy Activity - Can column mappings be composites or use a Templating function?
<p>When using a Data Factory Copy Activity to take delimited text files from Blob Storage to Table Storage, I am able to specify the input and output schemas and the relevant one-to-one Column Mappings.</p> <p>It is possible to concatenate or format one or more columns (with $$Text.Format perhaps?) in the source schema and map these to a single column in the destination? </p> <p>If possible, this would be especially useful if I can also set the Partition Key using a similar approach (a composite key taken from 2 or more source column values or better still, the SliceStart plus a concatenated source column value).</p>
1
Define Type of Immutable Map With Builder
<p>I am trying to make a <code>Map&lt;BooleanSupplier, List&lt;String&gt;&gt;</code> as part of my flow I make the suppliers and then try to use an immutable map builder.</p> <p>Something like: </p> <pre><code> //Build up BooleanSuppliers Map&lt;BooleanSupplier, List&lt;String&gt;&gt; bsList = ImmutableMap.builder() .put(bs1, Collections.singletonList("bs1string")) .put(bs2, Arrays.asList("bs4","bs6")) .... .build(); </code></pre> <p>The problem is that intellij says that the types are not convertible even when I do an explicit cast because the ImmutableMap is of type <code>&lt;Object, Object&gt;</code>. Is there a way to explicitly cast or initialize the immutable map builder to be of type <code>ImmutableMap&lt;BooleanSupplier, List&lt;String&gt;&gt;</code>?</p>
1
SQLAlchemy for Python, 'Query' object has no attribute 'fetchone'
<p>I'm working on a database-centric project with a fellow programmer. We have the following code for retrieving information from our database:</p> <pre><code># create connection to database engine = create_engine(URL(**DATABASE)) Session = sessionmaker(bind=engine) session = Session() # construct query query = session.query(MediaText.line_number, MediaText.start_time_stamp, MediaText.end_time_stamp).\ filter(MediaText.oclc_id == oclcId) # get info about first line to snapshot line_to_snapshot = query.fetchone() </code></pre> <p>When I try to run the code, I get the following error:</p> <blockquote> <p>AttributeError: 'Query' object has no attribute 'fetchone'</p> </blockquote> <p>What's confusing is that my partner can run the code just fine. We're both running Python 3.4 and have version 1.0.9 of the SQLAlchemy library on our systems. Does anyone know what could be going wrong here?</p>
1
Prism Custom Confirmation Interaction
<p>I created a custom confirmation window in an app with Prism Unity, WPF &amp; Mvvm. I need help with the notifications that need to be sent back to the viewmodel. I have this in the detail record view, let's call it MyDetailView.</p> <pre><code>&lt;!-- Custom Confirmation Window --&gt; &lt;ie:Interaction.Triggers&gt; &lt;interactionRequest:InteractionRequestTrigger SourceObject="{Binding ConfirmationRequest, Mode=TwoWay}"&gt; &lt;mycontrols:PopupWindowAction1 IsModal="True"/&gt; &lt;/interactionRequest:InteractionRequestTrigger&gt; &lt;/ie:Interaction.Triggers&gt; </code></pre> <p>As shown above, I made the interaction Mode=TwoWay so that the confirmation popup window can send back the button click result for the OK or Cancel button. The confirmation window appears as it should, but I don't know how to send the button click result back to my viewmodel, say MyDetailViewModel. That is the main question.</p> <p>EDIT: This is MyDetailViewMmodel method that raises the InteractionRequest.</p> <pre><code>private void RaiseConfirmation() {ConfirmationRequest .Raise(new Confirmation() { Title = "Confirmation Popup", Content = "Save Changes?" }, c =&gt;{if (c.Confirmed) { UoW.AdrTypeRos.Submit();} </code></pre> <p>This is the PopupWindowAction1 class. Part of the answer to the question may be how do I implement the Notification and FinishedInteraction methods.</p> <pre><code>class PopupWindowAction1 : PopupWindowAction, IInteractionRequestAware { protected override Window GetWindow(INotification notification) { // custom metrowindow using mahapps MetroWindow wrapperWindow = new ConfirmWindow1(); wrapperWindow.DataContext = notification; wrapperWindow.Title = notification.Title; this.PrepareContentForWindow(notification, wrapperWindow); return wrapperWindow; } public INotification Notification { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public Action FinishInteraction { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } } </code></pre> <p>Is there some interaction I need to put in my ConfirmWindow1, something like this?</p> <pre><code>&lt;i:Interaction.Triggers&gt; &lt;i:EventTrigger EventName="PreviewMouseLeftButtonUp"&gt; &lt;ei:CallMethodAction TargetObject="{Binding RelativeSource={RelativeSource AncestorType=UserControl}, Path=DataContext}" MethodName="DataContext.ValidateConfirm"/&gt; &lt;/i:EventTrigger&gt; &lt;/i:Interaction.Triggers&gt; </code></pre> <p>Do I even need to do that type of interaction within the button? If so, how do I code it needs so that it corresponds to the particular viewmodel that invoked the interaction. Any suggestions? Thank you.</p>
1
Mix keyword-driven testing and data-driven testing in one robot file
<p>Is it possible to mix keyword-driven testing and data-driven testing in one robot file? I don't know how to put those two pieces together. And I need it in only ONE robot file.</p> <p>An example of data-driven testing:</p> <pre><code>*** Settings *** Test Template Invalid Login *** Test Cases *** USERNAME PASSWORD Invalid Username invalid ${VALID PASSWORD} Invalid Password ${VALID USERNAME} invalid Invalid Both invalid invalid Empty Username ${EMPTY} ${VALID PASSWORD} Empty Password ${VALID USERNAME} ${EMPTY} Empty Both ${EMPTY} ${EMPTY} *** Keywords *** Invalid Login [Arguments] ${username} ${password} Input Username ${username} Input Password ${password} Submit Credentials Error Page Should Be Open </code></pre> <p>How to use keywords of my keyword-driven test here?</p>
1
Docker, Django and Selenium - Selenium unable to connect
<p>I have Docker configured to run Postgres and Django using docker-compose.yml and it is working fine.</p> <p>The trouble I am having is with Selenium not being able to connect to the Django liveserver.</p> <p>Now it makes sense (to me at least) that django has to access selenium to control the browser and selenium has to access django to access the server.</p> <p>I have tried using the docker 'ambassador' pattern using the following configuration for docker-compose.yml from here: <a href="https://github.com/docker/compose/issues/666" rel="nofollow">https://github.com/docker/compose/issues/666</a></p> <pre><code>postgis: dockerfile: ./docker/postgis/Dockerfile build: . container_name: postgis django-ambassador: container_name: django-ambassador image: cpuguy83/docker-grand-ambassador volumes: - "/var/run/docker.sock:/var/run/docker.sock" command: "-name django -name selenium" django: dockerfile: ./docker/Dockerfile-dev build: . command: python /app/project/manage.py test my-app container_name: django volumes: - .:/app ports: - "8000:8000" - "8081:8081" links: - postgis - "django-ambassador:selenium" environment: - SELENIUM_HOST=http://selenium:4444/wd/hub selenium: container_name: selenium image: selenium/standalone-firefox-debug ports: - "4444:4444" - "5900:5900" links: - "django-ambassador:django" </code></pre> <p>When I check <a href="http://DOCKER-MACHINE-IP:4444/wd/hub/static/resource/hub.html" rel="nofollow">http://DOCKER-MACHINE-IP:4444/wd/hub/static/resource/hub.html</a> I can see that firefox starts, but all the tests fail as firefox is unable to connect to django</p> <pre><code>'Firefox can't establish a connection to the server at localhost:8081' </code></pre> <p>I also tried this solution here <a href="https://github.com/docker/compose/issues/1991" rel="nofollow">https://github.com/docker/compose/issues/1991</a> however this is not working cause I can't get django to connect to postgis and selenium at the same time</p> <pre><code>'django.db.utils.OperationalError: could not translate host name "postgis" to address: Name or service not known' </code></pre> <p>I tried using the networking feature as listed below </p> <pre><code>postgis: dockerfile: ./docker/postgis/Dockerfile build: . container_name: postgis net: appnet django: dockerfile: ./docker/Dockerfile-dev build: . command: python /app/project/manage.py test foo container_name: django volumes: - .:/app ports: - "8000:8000" - "8081:8081" net: appnet environment: - SELENIUM_HOST=http://selenium:4444/wd/hub selenium: container_name: selenium image: selenium/standalone-firefox-debug ports: - "4444:4444" - "5900:5900" net: appnet </code></pre> <p>but the result is the same</p> <pre><code>'Firefox can't establish a connection to the server at localhost:8081' </code></pre> <p>So how can I get selenium to connect to django?</p> <p>I have been playing around with this for days - would really appreciate any help.</p> <p><strong>More Info</strong></p> <p>Another weird thing is that when the testserver is running <strong>not</strong> using docker (using my old config of virtualenv etc.) if I run ./manage.py test foo I can access the server through any browser at <a href="http://localhost:8081" rel="nofollow">http://localhost:8081</a> and get served up webpages, but I can't access the test server when I run the equivalent command if I run it under docker. This is weird cause I am mapping port 8081:8081 - is this related?</p> <p>Note: I am using OSX and Docker v1.9.1</p>
1
In Python, how can I print out a board of numbers representing tic-tac-toe, with a "|" in between each number?
<p>I want to be able to rewrite the code in as few lines as possible, possibly in list comprehension syntax. Here is what the output should be:</p> <pre><code>1|2|3 4|5|6 7|8|9 </code></pre> <p>This is what I have thought up. The separator doesn't actually print the "|". Any suggestions?</p> <pre><code>for i in [1,2,3,4,5,6,7,8,9]: print(i, sep = "|", end = "") if (i) % 3 == 0: print() </code></pre>
1
Launch an activity in main app from an Android Library Module
<p>I am building my first library module that I am planning on filling with reusable code for multiple projects. My first roadblock is that I need to be able to launch an activity in the main app from the library module.</p> <p>For example, I have a splash screen activity. It runs for 2 seconds, then launches the main activity. I believe that I can reuse this splash screen activity, and I want to put it in my library module. However, I am unsure how to launch the main activity from the library.</p> <p>Mainfest in main app setup: </p> <pre><code>&lt;activity android:name="com.example.myLibraryModule.SplashScreen" android:theme="@style/AppTheme.NoActionBar"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; </code></pre> <p>The manifest launches the splash screen which currently resides in my library module.</p> <p>Since the library is a dependency of the main application and not the other way around, I am not sure how to go about launching the <code>MainActivity</code> from my <code>SplashScreenActivity</code>. It's not as easy as:</p> <pre><code>Intent i = new intent(this, MainActivity.class); startActivity(i); </code></pre>
1
Incorrect syntax near the keyword 'convert'
<p>I have procedure</p> <pre><code>create procedure dbo.updateView(@cobdate datetime) as begin Update hir_view set ValidTo=@cobdate where HierarchyId in ( select distinct HierarchyId from hir_organisation where ValidTo&lt;getDate() and HierarchyId not in ( select HierarchyId from hir_organisation where ValidTo&gt;getDate() ) ) and ValidTo&gt;getDate() end go </code></pre> <p>whenI try to call this using</p> <pre><code>exec updateView( convert( dateTime,'20160209') ); </code></pre> <p>i get the error stating Lookup Error - Msg 156, Level 15, State 34, Server DSLNPHX02, Line 18 - Sybase Database Error: Incorrect syntax near the keyword 'convert'.</p> <p>I am not sure where am i going wrong</p>
1
How to delay push notifications permission popup Swift
<p>I'm working on an app with push notifications, I want to delay the appearance of the push notifications permission pop up until after the user enters my app for the third time. So he should be interested in my app, then I want to ask him for his permission. I there a way to do that? I searched a lot for a way, like here: <a href="https://stackoverflow.com/questions/2438400/reset-push-notification-settings-for-app">Reset push notification settings for app</a> but I didn't get any useful answers. Please Help. Thanks</p>
1
Login to a website using Jsoup and stay on the site
<p>I try to log in here: <a href="http://www.gszi.sulinet.hu/dinaweb/diakok/belepes.jsp" rel="noreferrer">http://www.gszi.sulinet.hu/dinaweb/diakok/belepes.jsp</a> with this:</p> <pre><code>Connection.Response loginForm = Jsoup.connect("http://www.gszi.sulinet.hu/dinaweb/diakok/belepes.jsp") .method(Connection.Method.GET) .execute(); Document doc = Jsoup.connect("http://www.gszi.sulinet.hu/dinaweb/diakok/belepes.jsp") .data("name","myid") .data("name","mycode") .cookies(loginForm.cookies()) .post(); </code></pre> <p>Afterwards, getting the html of a page which I have to login to see, I realize that I couldn't log in. Is there a way to login and then get the html of pages I have access now? Any link, advice or help appreciated.</p>
1
How to merge four videos on one screen with ffmpeg
<p>I have a video test.mp4, and I need to make it appear four times at once on a screen.</p> <p><a href="https://stackoverflow.com/questions/7581665/multiple-video-sources-combined-into-one">Here</a> I found a command that makes two videos appear at a time</p> <pre><code>ffmpeg -i input0.avi -vf &quot;movie=input1.avi [in1]; [in]pad=640*2:352[in0]; [in0][in1] overlay=640:0 [out]&quot; out.avi </code></pre> <p>But it doesn't work with mp4 videos, and I need four videos at a time.</p>
1
Having my bundle in a non-root folder
<p>I'm creating a web-site with <code>react</code> using <code>webpack</code>.</p> <p>Currently my <code>webpack.config.js</code> looks like this:</p> <pre><code>var path = require('path'); var webpack = require('webpack'); module.exports = { entry: './scripts/main.js', output: { path: __dirname, filename: 'bundle.js' }, module: { loaders: [ { test: /.jsx?$/, loader: 'babel-loader', exclude: /node_modules/, query:{ presets: ['es2015', 'react'] } } ] } } </code></pre> <p>Then I start the dev server using <code>webpack-dev-server --progress --colors</code> and whenever I change a javascript file, my web-page refreshes, and everything seems to be working fine. However, I would like my <code>bundle.js</code> file to reside in another folder than the root folder. I therefore changed the line <code>path: __dirname,</code> to <code>path: __dirname + '/dist',</code>.</p> <p>Now, when I make a change to the script files, the bundle does not get automatically updated, but if I manually run the <code>webpack</code> command it gets built. So my question is: what is the proper way to get my <code>bundle.js</code>file to be put in the <code>dist</code> folder and still get the <code>webpack-dev-server</code> to automatically update when I do a change to my scripts?</p>
1
How to avoid double inclusion of Bootstrap.js?
<p>We've been developing a Wordpress theme and stumbled on a weird problem. A popup displayed by bootstrap.js appears for a fraction of a second and then disappears. After thorough research I have figured out that the problem is caused by a plugin which also uses bootstrap.js. Two bootstrap.js were loaded, one from our theme and another from the plugin. How to avoid this conflict?</p>
1
Android : MPAndroidChart how to remove left side line
<p>for Line chart i'm using mp android chart i want to remove the line which is left side of the graph not the gridlines.</p> <p>code:-</p> <pre><code> chart.setGridBackgroundColor(128); chart.setBorderColor(255); chart.getAxisRight().setEnabled(false); YAxis leftAxis = chart.getAxisLeft(); leftAxis.setEnabled(false); chart.setDrawGridBackground(true); XAxis xAxis = chart.getXAxis(); xAxis.setDrawGridLines(true); chart.getAxisRight().setDrawLabels(false); chart.getAxisLeft().setDrawLabels(false); chart.getLegend().setEnabled(false); chart.setPinchZoom(false); chart.setDescription(""); chart.setTouchEnabled(false); chart.setDoubleTapToZoomEnabled(false); chart.getXAxis().setEnabled(true); chart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM); chart.getXAxis().setDrawGridLines(false); chart.invalidate(); </code></pre> <p><a href="https://i.stack.imgur.com/9uxNL.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9uxNL.jpg" alt=""></a></p>
1
Make longest flex item set the width for the column
<p>I have multiple divs. Inside each I have <code>label</code> and <code>span</code>.</p> <p>I want the labels' width to be set by the longest label, and the spans will all start at the same point.</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>.container { display: flex; flex-direction: row; justify-content: space-between; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;article&gt; &lt;div class="container"&gt; &lt;label class="key"&gt;text&lt;/label&gt; &lt;span class="value"&gt;text&lt;/span&gt; &lt;/div&gt; &lt;/article&gt;</code></pre> </div> </div> </p>
1
Unresolved reference error while calling add method in Kotlin Set interface
<p>If I use a <em>Set</em> interface reference and I try to call <em>add</em> method I get an unresolved reference error: </p> <pre><code> fun main(args : Array&lt;String&gt;) { val set = HashSet&lt;Integer&gt;() set.add(Integer(1)) //OK val seti : Set&lt;Integer&gt; = HashSet&lt;Integer&gt;() seti.add(Integer(2)) //FAILING: Unresolved reference to add** } </code></pre> <p>I don't understand that behaivour. Java <em>Set</em> interface has an <em>add</em> method and I expected Kotlin one to be an extended version and not to had less methods. </p> <p>PD1: I get the same error in Idea IDE or building with gradle. PD2: Using kotlin 1.0.0-beta-4584</p>
1
How to run a API GET call in node js everyday at 11:00pm
<p>I have a aws API GET call in node js.</p> <blockquote> <p><a href="http://localhost:3000/amazon/api" rel="nofollow">http://localhost:3000/amazon/api</a></p> </blockquote> <p>I have mentioned necessary functionalities within this call. I want to run this call everyday at 11:00PM using node js. I went through <code>cron and other scheduling</code> package documents. Bit confusing.</p>
1
How to connect to mysql running on docker using Sequel Pro
<p>I have a docker-machine up and it has a mysql container running. </p> <pre><code>~ ▶ boot2docker ip 192.168.59.103 ~ ▶ docker-machine ip default 192.168.99.100 ~ ▶ docker-machine ls NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default * virtualbox Running tcp://192.168.99.100:2376 v1.9.1 ~ ▶ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b14062dd1e25 mysql:5.6 "/entrypoint.sh mysql" 6 hours ago Up 6 hours 3306/tcp, 0.0.0.0:3306-&gt;9090/tcp i-mysql </code></pre> <p>logs from <code>docker logs i-mysql</code></p> <pre><code>2016-01-20 04:14:41 1 [Note] InnoDB: Highest supported file format is Barracuda. 2016-01-20 04:14:41 1 [Note] InnoDB: 128 rollback segment(s) are active. 2016-01-20 04:14:41 1 [Note] InnoDB: Waiting for purge to start 2016-01-20 04:14:41 1 [Note] InnoDB: 5.6.28 started; log sequence number 1625997 2016-01-20 04:14:41 1 [Note] Server hostname (bind-address): '*'; port: 3306 2016-01-20 04:14:41 1 [Note] IPv6 is available. 2016-01-20 04:14:41 1 [Note] - '::' resolves to '::'; 2016-01-20 04:14:41 1 [Note] Server socket created on IP: '::'. 2016-01-20 04:14:41 1 [Warning] 'proxies_priv' entry '@ root@b14062dd1e25' ignored in --skip-name-resolve mode. 2016-01-20 04:14:41 1 [Note] Event Scheduler: Loaded 0 events 2016-01-20 04:14:41 1 [Note] mysqld: ready for connections. Version: '5.6.28' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) </code></pre> <p>How can I connect to the mysql instance in this container from my localhost laptop running OSX using Sequel Pro. </p> <p>I'm using the below settings but I can't seem to connect:</p> <p><a href="https://i.stack.imgur.com/a0wev.png" rel="noreferrer"><img src="https://i.stack.imgur.com/a0wev.png" alt="enter image description here"></a></p> <blockquote> <p>Unable to connect to host 192.168.99.100, or the request timed out.</p> <p>Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).</p> <p>MySQL said: Can't connect to MySQL server on '192.168.99.100' (61)</p> </blockquote>
1
Is it good practice to use @BeanProperty in Scala instead of defining getter/setter functions?
<p>Defining data members in a class that can be publicly accessed/modified</p> <pre><code>var _foo: Int = _ def foo_(foo: Int) = _foo = foo // setter function def foo = _foo // getter function </code></pre> <p>Is it a good practice to convert this using annotation <code>@BeanProperty</code>?</p> <pre><code>import scala.reflect.BeanProperty @BeanProperty var foo: Int = _ </code></pre> <p>and when to use this annotation and when not to?</p>
1
Why does sockJS add a '/info' to a given websocket url path
<p>I want to open a websocket port with a "webapp/socket.do" path. When I use SockJS and try to initiate the call by code</p> <pre><code> var socket = new SockJS('/webapp/socket.do'); stompClient = Stomp.over(socket); stompClient.connect({}, ... </code></pre> <p>SockJS will by default add a "/info" to the end of the given path. I want to know why? Can this be changed or prevented? </p> <p>When using this with Spring MVC and have url pattern mappings to DispatcherServlet like <code>&lt; url-pattern &gt;*.do&lt;/url-pattern&gt;</code>, this will return a 404 error. it is blocked because of the "/info" string added by sockJS to the given url.</p> <p>Spring web.xml servlet mapping code:</p> <pre><code>&lt;servlet-mapping&gt; &lt;servlet-name&gt;dispatch-servlet&lt;/servlet-name&gt; &lt;url-pattern&gt;*.do&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; </code></pre> <p>Does any know what sockJS is trying there and why?</p>
1
YoutubeData API V3 - Error 400: required parameter - part
<p>I'm trying to fetch data from Youtube API using jQuery and Ajax GET request with the required parameter, including "part". The GET request is ok (code 200), however when I see the data I'm getting an error 400 "required parameter: part". Could anyone give me some tip to overcome this issue? This is part of my jQuery and the result of the ajax request is right below.</p> <pre><code>$(document).ready(function(){ console.log('doc ok'); $('#tag-search').submit(function(){ var search_term = { q: "test" }; search(search_term); }); }); function search(search_term) { console.log('searching ...'); console.dir(search_term); var search_term = ''; var desireSearch = $ ('#tag').val(); var channelName = 'Iron_Maiden'; $.ajax({ method: 'GET', url: 'https://www.googleapis.com/youtube/v3/channels?', part : 'contentDetails', forUsername: channelName, key: '(My personal key)', dataType: 'jsonp' }) .done(function(results){ var result = results.data; console.log(result); }); } </code></pre> <p>And this is what I got: </p> <pre><code>jQuery1900617815546458587_1453343296717 ( { "error": { "errors": [ { "domain": "global", "reason": "required", "message": "Required parameter: part", "locationType": "parameter", "location": "part" } ], "code": 400, "message": "Required parameter: part" } } ) </code></pre>
1
Get Api end points from wsdl file
<p>I'm trying to consume a commercial soap Api. I know their wsdl file but did not have any api endpoints to make request. I have searched on internet about how to get api endpoints from wsdl file but did not succeed. the wsdl file location is <a href="http://cbs.zong.com.pk/reachcwsv2/corporatesms.svc?wsdl" rel="nofollow">http://cbs.zong.com.pk/reachcwsv2/corporatesms.svc?wsdl</a>. </p>
1
sendmail/mailx and verbose mode not working the same
<p>i have been running centOS-6 for some time now. whenever i issue a mailx or sendmail command from the command line such as this:</p> <pre><code>echo 'Subject: testing'|sendmail -v [email protected] -s this is a test'; </code></pre> <p>i get a lot of good diagnostic messages such as:</p> <pre><code>this,is,a,test,-s,[email protected]... Connecting to [127.0.0.1] via relay... 220 domainname.info ESMTP Postfix &gt;&gt;&gt; EHLO domainname.info 250-domainname.info 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-ENHANCEDSTATUSCODES 250-8BITMIME </code></pre> <p>however, on centOS-7 i am not seeing the same verbose messages, even with identical command lines. all i am seeing is this:</p> <pre><code>Mail Delivery Status Report will be mailed to &lt;[email protected]&gt;. </code></pre> <p>in both servers (centOS-6 &amp; 7) the email is indeed coming through successfully.</p> <p>any suggestions will be most appreciated.</p>
1
How to upload a file to Azure Storage with WinSCP (SFTP)?
<p>theI have a C# service using WinSCP which reliably uploads files to any SFTP server. I'd like to use it to connect to MS Azure Storage and <strong>upload</strong> files there using the same SFTP protocol. <strong><em>Please note I am not looking to use any other protocol (i.e.: FTP, FTPS, HTTPS, etc.) as well as I am not looking to SFTP files [out] of the Azure Storage.</em></strong> There are plenty of examples of how to use WinSCP when SFTP [out] from Azure Storage but none of them covers how to SFTP [in].</p> <p>I have searched Stack Overflow knowledge base, Azure Help Documentation (<a href="https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-blobs/" rel="nofollow noreferrer">https://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-blobs/</a>) as well as WinSCP docs (<a href="http://winscp.net/eng/docs/guide_microsoft_azure_webjob_sftp" rel="nofollow noreferrer">http://winscp.net/eng/docs/guide_microsoft_azure_webjob_sftp</a>, etc.).</p> <p>Any help appreciated. Thanks.</p> <p><strong>UPDATE: 2016-01-29</strong> So... from what I understand so far, it is not possible to upload files to Azure Storage using SFTP protocol. MS Azure does not support this feature. Can anybody confirm that for me please? </p> <p><strong>UPDATE: 2016-02-01</strong> The similar Q/A here (<a href="https://stackoverflow.com/questions/21711592/facading-azure-storage-blob-with-sftp-service">Facading Azure storage blob with sFTP service</a>) does not answer my question because: a) all answers are suggesting a theoretical workarounds using VM or other substitutes b) it does not provide clear answer to my question</p> <p><strong>This should not be so difficult to answer.</strong> If the SFTP is not supported then the answer is: <strong><em>"SFTP is not supported in Azure"</em></strong>. If the SFTP protocol is supported, then please provide more details about the settings, methods, and/or C# example. My question is clearly defined on purpose so others with the same need can quickly find the answer without wasting their time.</p>
1
create image thumbnails i laravel 5.0
<p>**how to create image thumbnails i use different library but thumbnail not create **</p> <pre><code> public function store(Request $request){ $user_id = \Auth::user()-&gt;id; $image = new Image(); $this-&gt;validate($request, [ 'title' =&gt; 'required', 'description' =&gt; 'required', 'image' =&gt; 'required' ]); $image-&gt;title = $request-&gt;title; $image-&gt;description = $request-&gt;description; $image-&gt;user_id = $user_id; if($request-&gt;hasFile('image')) { $file = Input::file('image'); //getting timestamp $timestamp = str_replace([' ', ':'], '-', Carbon::now()-&gt;toDateTimeString()); $name = $timestamp. '-' .$file-&gt;getClientOriginalName(); $image-&gt;filePath = $name; $file-&gt;move(public_path().'/images/', $name); } $image-&gt;save(); return $this-&gt;upload()-&gt;with('success', 'Image Uploaded Successfully'); } </code></pre> <p>** **how to create image thumbnails i use different library but thumbnail not create ****</p>
1
How to open a child window from the main window
<p>My question is tough to explain but I am trying my best. Please help me in this regard.</p> <p>I designed a gui in QtDesigner and converted .ui files into .py e.g. main_window.py. Now in order to avoid changing in main_window.py I created another class for listeners.</p> <pre><code>class Main(): window = None app = None def __init__(self): self.launch() self.attach_listener() self.execute() ''' Launch GUI ''' def launch(self): self.app = QtGui.QApplication(sys.argv) self.window = Ui_MainWindow() self.window.show() ''' Execute Window ''' def execute(self): sys.exit(self.app.exec_()) ''' Attach Listeners ''' def attach_listener(self): self.window.add_button.clicked.connect(self.add_listener) self.window.delete_button.clicked.connect(self.delete_listener) self.window.update_button.clicked.connect(self.update_listener) self.window.connect(self.window.combo_box, QtCore.SIGNAL('activated(QString)'), self.logout_listener) </code></pre> <p>I have another child_window.py with same structure, but I can't open that window from this one because of QApplication. I searched for the answer but couldn't apply on my code. Those answers were applicable when class was extending from QtGui.QMainWindow or QtGui.QWidget, but my scenario is different.</p>
1
Swift protocol conform: Candidate has non-matching type
<p>I was trying to define a protocol with some property of type AnyObject, then in the class that conforms to the protocol the property type is SomeClass. However this returned a compiler error. I had to change the type in the class to AnyObject. How can I use the super class in protocol definition and use the sub class as property type?</p> <p>Thanks!</p> <pre><code>protocol TestProtocol { var prop: [AnyObject] {get} } class Test: TestProtocol { var prop = [SomeClass]() //compiler error var prop = [AnyObject]() //this will work } </code></pre>
1
Json Formatting.Indented using Web Api Controller, ASP.NET MVC
<p>I generate a json data for name, shorttext, geolocation ann image information, which I collect from web api. Throug my code I can generate JSON data /api/wiki/name. But I cannot formatting the data. When I want to save it in a file it stores in a line.I tried to write Formatting.Indented in the return result, but it shows error. My code look like this-</p> <pre><code> public class WikiController : ApiController { public JsonResult&lt;PoiInfo&gt; Get(string id) { WebClient client = new WebClient(); var TextResponse = client.DownloadString("https://en.wikipedia.org/w/api.php?format=json&amp;action=query&amp;prop=extracts&amp;exlimit=max&amp;explaintext&amp;exintro&amp;titles=" + id + "&amp;redirects="); var ImageResponse = client.DownloadString(new Uri("https://en.wikipedia.org/w/api.php?action=query&amp;format=json&amp;prop=pageimages&amp;pithumbsize=400&amp;titles=" + id)); var GeoResponse = client.DownloadString("https://en.wikipedia.org/w/api.php?action=query&amp;format=json&amp;prop=coordinates&amp;titles=" + id); var TextResponseJson = JsonConvert.DeserializeObject&lt;Rootobject&gt;(TextResponse); var TextfirstKey = TextResponseJson.query.pages.First().Key; var Text = TextResponseJson.query.pages[TextfirstKey].extract; Regex regex = new Regex(@".(?&lt;=\()[^()]*(?=\)).(.)"); string.Format("Before:{0}", Text); Text = regex.Replace(Text, string.Empty); string TextResult = String.Format(Text); TextResult = Regex.Replace(TextResult, @"\\n", " "); var ImgresponseJson = JsonConvert.DeserializeObject&lt;ImgRootobject&gt;(ImageResponse); var ImgfirstKey = ImgresponseJson.query.pages.First().Key; var ImageResult = ImgresponseJson.query.pages[ImgfirstKey].thumbnail.source; var GeoResponseJson = JsonConvert.DeserializeObject&lt;GeoRootobject&gt;(GeoResponse); var firstKey = GeoResponseJson.query.pages.First().Key; var Latitude = GeoResponseJson.query.pages[firstKey].coordinates.First().lat; var Longitude = GeoResponseJson.query.pages[firstKey].coordinates.First().lon; var result = new PoiInfo(); result.Shorttext = Text; result.Name = id; result.Images = new List&lt;string&gt; { ImageResult }; result.GeoCoordinates = new GeoCoordinates { Latitude = Latitude, Longitude = Longitude }; return Json(result,Formatting.Indented); //show error } } </code></pre> <p>The error I found is -</p> <pre><code>Error 1 The best overloaded method match for 'System.Web.Http.ApiController.Json&lt;CallListService.Models.PoiInfo&gt;( (CallListService.Models.PoiInfo, Newtonsoft.Json.JsonSerializerSettings)' has some invalid arguments Error 2 Argument 2: cannot convert from 'Newtonsoft.Json.Formatting' to 'Newtonsoft.Json.JsonSerializerSettings' </code></pre>
1
How to fix one or more indexers are invalid error in Magento?
<p>I'm getting an error in Magento:</p> <blockquote> <p>One or more indexers are invalid</p> </blockquote> <p>I tried this in the command prompt:</p> <pre><code>php bin/magento indexer:reindex </code></pre> <p>but when I do, I get this error:</p> <p><a href="https://i.stack.imgur.com/osTPm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/osTPm.png" alt="enter image description here" /></a></p> <p>I'm not familiar with Windows; I'm used to working on a Ubuntu terminal.</p> <p>please check the Magento dashboard error below: <a href="https://i.stack.imgur.com/pslA8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pslA8.png" alt="enter image description here" /></a></p>
1
ClosedXML: Export To Excel not downloading the File MVC 4
<p>I have a <code>List&lt;T&gt;</code>, which I convert to a Datatable and then export that Datatable to Excel via <a href="http://www.kingsoftstore.com/spreadsheets-free.html" rel="nofollow noreferrer">Kingsoft-Spreadsheets</a> using ClosedXML library. </p> <p>However, for some reason the code is not working and the sheet is not getting downloaded. I am getting strange symbolic screen on my MVC view. I have attached the image for reference. Any help much appreciated.</p> <p><a href="https://i.stack.imgur.com/NYmJE.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NYmJE.jpg" alt="enter image description here"></a> </p>
1
How to check if form has errors in twig?
<p>Beside the form field specific error messages directly attached to the form field I would like to display a message above the form that the form contains errors.</p> <p>How can I check in a Symfony3 twig template if a form has errors? There <a href="https://gist.github.com/smottt/1621293" rel="noreferrer">used to be something like this in Symfony2</a>:</p> <pre><code>{% if form.get('errors') is not empty %} &lt;div class="error"&gt;Your form has errors. Please check fields below.&lt;/div&gt; {% endif %} </code></pre> <p>But this doesn't work in Symfony3. Any ideas? (<code>form.vars.errors</code> doesn't work.)</p>
1
How does C3js decide the y axis range
<p>I'm working with C3.js to build graphs for my JSON data. However, I do not understand what decides the Y-axis ranges on the graph. I have a common code to generate 2 bar charts, out of which one comes as expected whereas the other one has high range for Y-axis causing my data bar being diminished. Please take a look at the image below.</p> <p><a href="https://i.stack.imgur.com/Kk9fM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kk9fM.png" alt="enter image description here"></a></p> <p>The bar chart on the left has data value equal to 1, yet the axis ranges to 35. A similar graph on the right adjust well.</p> <p>Does anyone know what could be the reason for this?</p>
1
ModuleParseError: Module parse failed: iconv-lite
<p>My project was working perfectly fine.. But after doing a git push, I'm suddenly getting an error when I run <code>gulp</code>:</p> <pre><code>{ [Error: ModuleParseError: Module parse failed: /Users/xyz/project/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json Line 1: Unexpected token : You may need an appropriate loader to handle this file type. | {"uChars":[128,16 .... </code></pre> <p>Why is this happening? I have uninstalled and reinstalled this module <code>iconv-lite</code>, but it doesn't seem to help.</p>
1
Azure Service Fabric Multi-Tenancy
<p>I'm trying to get a little follow up to this question that's already been answered...</p> <p><a href="https://stackoverflow.com/questions/34616020/service-fabric-multi-tenant">Service Fabric multi-tenant</a></p> <p>If I were to setup my tenants as Azure Service Fabric Stateless Services (they'll get their state out-of-band), how can I put more than one tenant on each node in the cluster? In testing, it seems that Service Fabric gags if you try and make your instance count greater than the node count.</p> <p>These tenants are very lightweight, so I should be able to run dozens of them on each node (we will have hundreds overall), and I don't want to have to do a node for each one. Specifically, the tenants are more-or-less just opening a long-polling HTTP connection to an external customer service and streaming that data back into our system - so there's no public endpoints in play here. I just need the ability to spin up a lot of these workers that'll each open up their own long-polling connection.</p> <p>Can somebody point me in the right direction?</p> <p>FYI, I've explained a little bit more here... <a href="https://social.msdn.microsoft.com/Forums/en-US/efd172e2-0783-489b-b3ab-ec62fb7b8ee4/multiple-instances-per-node?forum=AzureServiceFabric" rel="nofollow noreferrer">https://social.msdn.microsoft.com/Forums/en-US/efd172e2-0783-489b-b3ab-ec62fb7b8ee4/multiple-instances-per-node?forum=AzureServiceFabric</a></p> <p>Thanks in advance!</p>
1
Maven cannot find opencsv csv parser
<p>I've come across one problem with maven and opencsv</p> <p>I am trying to use the csvparser as followed:</p> <pre><code>import java.io.IOException; import au.com.bytecode.opencsv.CSVParser; import org.apache.hadoop.io.*; import org.apache.hadoop.mapreduce.Mapper; public class FlightsByCarrierMapper extends Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { @Override protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { if (key.get() &gt; 0) { String[] lines = new CSVParser().parseLine(value.toString()); context.write(new Text(lines[8]), new IntWritable(1)); } } } </code></pre> <p>I've added the opencsv dependency and can use the csvreader without problem. The csvparser though cannot be resolved and throws and error whenever I try to compile the code.</p> <p>Maven then throws the following error.</p> <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project FlightsByCarrier: Compilation failure: Compilation failure: [ERROR] /root/workspace/FlightsByCarrier/src/main/java/com/root/hadoop/FlightsByCarrier/FlightsByCarrierMapper.java:[6,30] error: cannot find symbol [ERROR] package au.com.bytecode.opencsv [ERROR] /root/workspace/FlightsByCarrier/src/main/java/com/root/hadoop/FlightsByCarrier/FlightsByCarrierMapper.java:[18,2] error: cannot find symbol </code></pre> <p>The dependency looks like this right now:</p> <pre class="lang-xml prettyprint-override"><code>&lt;dependency&gt; &lt;groupId&gt;net.sf.opencsv&lt;/groupId&gt; &lt;artifactId&gt;opencsv&lt;/artifactId&gt; &lt;version&gt;1.8&lt;/version&gt; &lt;/dependency&gt; </code></pre>
1
How to change the border color of a full div when on focus?
<p>I'm new to development so this may be a simple answer. I'm trying to figure out how to change the border color of an entire div when in focus/active. I am able to change the text box border but that seems to be the only answers I can find. Any help is appreciated. Thanks!</p>
1
Disabling printer default margin with css (with chrome)?
<p>With Adobe Indesign it's possible to get this result:</p> <p><a href="https://i.stack.imgur.com/3DfYI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3DfYI.jpg" alt="enter image description here"></a></p> <p>I tried to get the same result with css</p> <pre><code>&lt;style type="text/css" media="print"&gt; @page { size: auto; /* auto is the initial value */ margin: 0mm; /* this affects the margin in the printer settings */ } body { background-color:#FFFFFF; border: solid 1px black ; margin: 0px; /* this affects the margin on the content before sending to printer */ } &lt;/style&gt; </code></pre> <p>but it's impossible to set the margins to 0. I always have a margin on the 4 sides:</p> <p><a href="https://i.stack.imgur.com/ou7Gq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ou7Gq.jpg" alt="enter image description here"></a> I'm using google chrome to do my tests. I also tried:</p> <p><a href="https://i.stack.imgur.com/aitXE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aitXE.png" alt="enter image description here"></a></p> <p>same thing, some little white margins on the 4 sides...what's wrong? </p> <p>Any help would be appreciate. JsFiddle : <a href="https://jsfiddle.net/L63dc1yd/" rel="nofollow noreferrer">https://jsfiddle.net/L63dc1yd/</a></p>
1
Sequelize BulkCreate Error
<p>I am trying to figure out how to use the bulkCreate method with my jQuery field values. Currently I am trying to pass the values of the fields in an array and expected each value to get parsed out into a new record, but it doesn't appear like this method works that way and as a result I receive an error:</p> <pre><code>Error during Post: SequelizeDatabaseError: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '['Test 1','Test 2','Test 3'],'6','2016-02-01 03:26:59','2016-02-01 03:26:59')' at line 1 </code></pre> <p>Is this because I should actually apply loop logic within the route to handle the different values? Should I change up the jQuery?</p> <p>view file (discoveryName is the field for bulkCreate):</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;head&gt; {{&gt; head}} &lt;/head&gt; &lt;body&gt; {{&gt; navigation}} &lt;div class="container"&gt; &lt;div class="col-md-6 col-md-offset-3"&gt; &lt;form action="/app/sign-up/organization" method="post"&gt; &lt;p&gt;{{user.email}}&lt;/p&gt; &lt;input type="hidden" name="admin" value="{{user.email}}"&gt; &lt;input type="hidden" name="organizationId"&gt; &lt;label for="sign-up-organization"&gt;Test Name&lt;/label&gt; &lt;input type="text" class="form-control" id="sign-up-organization" name="organizationName" value="" placeholder="Company/Organization"&gt; &lt;a href="#" id="sign-up-add-discovery-source"&gt;Add Another&lt;/a&gt; &lt;div id="sign-up-organization-discovery-source"&gt; &lt;input type="text" id="discovery-source-field" placeholder="Discovery Source" name="discoverySource[0]"&gt; &lt;/div&gt; &lt;br /&gt; &lt;button type="submit"&gt;Submit&lt;/button&gt; &lt;/form&gt; &lt;a href="/login"&gt;Already have an account? Login here!&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; $(function() { var dataSourceField = $('#sign-up-organization-discovery-source'); var i = $('#sign-up-organization-discovery-source p').size(); var sourceCounter = 1; $('#sign-up-add-discovery-source').on('click', function() { $('&lt;p&gt;&lt;label for="discovery-source-field"&gt;&lt;input type="text" id="discovery-source-field" size="20" name="discoverySource[{'+ sourceCounter++ +'}]" value="" placeholder="Discovery Source" /&gt;&lt;/label&gt; &lt;a href="#" class="remove"&gt;Remove&lt;/a&gt;&lt;/p&gt;').appendTo(dataSourceField); i++; return false; }); $('#sign-up-organization-discovery-source').on('click', '.remove', function() { if (i &gt; 1) { $(this).parent('p').remove(); i--; } return false; }); }); &lt;/script&gt; &lt;/body&gt; </code></pre> <p>Route:</p> <pre><code>var express = require('express'); var appRoutes = express.Router(); var passport = require('passport'); var localStrategy = require('passport-local').Strategy; var models = require('../models/db-index'); appRoutes.route('/sign-up/organization/discovery-source') .get(function(req, res){ models.Organization.find({ where: { organizationId: req.user.organizationId }, attributes: ['organizationId'] }).then(function(organization){ res.render('pages/app/sign-up-discovery-source.hbs',{ organization: organization }); }); }) .post(function(req, res){ models.DiscoverySource.bulkCreate([ { discoverySource: req.body.discoverySource, organizationId: req.body.organizationId } ]).then(function(){ return models.DiscoverySource.findAll(); }).then(function(discoverySource){ console.log(discoverySource); res.redirect('/app'); }).catch(function(error){ res.send(error); console.log('Error during Post: ' + error); }); }); </code></pre> <p>DiscoverySource model fields:</p> <pre><code> discoverySourceId: { type: DataTypes.INTEGER, field: 'discovery_source_id', autoIncrement: true, primaryKey: true }, discoverySource: { type: DataTypes.STRING, field: 'discovery_source' }, organizationId: { type: DataTypes.TEXT, field: 'organization_id' }, </code></pre>
1
Can't plot colorbar in Jupyter QtConsole: No mappable was found ... error
<p>I see the following example to plot both image and colormap:</p> <p><a href="https://i.stack.imgur.com/eDPaX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eDPaX.jpg" alt="enter image description here"></a></p> <p>Code:</p> <pre><code>imgplot = plt.imshow(lum_img) plt.colorbar() </code></pre> <p>From here: <a href="http://matplotlib.org/users/image_tutorial.html" rel="nofollow noreferrer">http://matplotlib.org/users/image_tutorial.html</a></p> <p>But when I do this from my console, I get:</p> <p><a href="https://i.stack.imgur.com/xrqsO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xrqsO.jpg" alt="enter image description here"></a></p> <p>i.e. image displayed immediately, not waiting for second command, and after the second command the following error occurs: </p> <blockquote> <p>RuntimeError: No mappable was found to use for colorbar creation. First define a mappable such as an image (with imshow) or a contour set (with contourf).</p> </blockquote>
1
Eager load hasMany & belongsTo (circular reference/infinite loop)
<p><strong>UPDATE (SOLUTION)</strong></p> <ul> <li>If you need <code>-&gt;user</code> relationship from one of the <code>$image</code> inside <code>$user-&gt;images</code>, then <code>$user</code> variable is already available cause you loaded the <code>-&gt;images</code> from it!</li> <li>Don't use <code>protected $with</code> Eloquent property. It's an anti-pattern.</li> <li>Instead explicitly eager load relationships on-demand from where/when it's needed (<em>Note</em>: it should not prevent you to keep things DRY!)</li> <li>If you really need/want to, see @nicksonyap answer. It does the trick (I believe – not tested).</li> </ul> <p><strong>ORIGINAL</strong></p> <p>I'm running into what I believe is a simple problem:</p> <ul> <li>I have a <code>User</code> object that <em>has many</em> <code>Image</code>s</li> <li><code>Image</code> <em>belongs to</em> <code>User</code>... (inverse relation)</li> </ul> <p>My problem is that I want to eager load both the <code>images()</code> on the <code>User</code> model and the <code>user()</code> on the <code>Image</code> model. To do so, I just setup a <code>$with</code> property as explained in the docs.</p> <p>My <code>User</code> model:</p> <pre class="lang-php prettyprint-override"><code>class User extends EloquentModel { protected $with = ['images']; public function images() { return $this-&gt;hasMany(Image::class); } } </code></pre> <p>My <code>Image</code> model:</p> <pre class="lang-php prettyprint-override"><code>class Image extends EloquentModel { protected $with = ['user']; public function user() { return $this-&gt;belongsTo(User::class); } } </code></pre> <p>But when performing:</p> <pre class="lang-php prettyprint-override"><code>$user = User::find(203); </code></pre> <p>This results in an infinite loop (php segmentation fault). There must be some kind of circular reference that I am not able to locate:</p> <pre><code>[1] 85728 segmentation fault </code></pre> <p><strong>EDIT 2016/02</strong></p> <p>This is the simplest "Workaround" I found:</p> <pre class="lang-php prettyprint-override"><code>// User.php public function setRelation($relation, $value) { if ($relation === 'images') { foreach ($value as $image) { $image-&gt;setUser($this); } } return parent::setRelation($relation, $value); } </code></pre>
1
Kendoui- set color in chart dynamically
<p>When we work with KendoUI, we need to specify the backcolor of the chart. like this:</p> <pre><code>{ category: "Latin America", value: 16.3, color: "#068c35" } </code></pre> <p>See the full code below or example <a href="http://dojo.telerik.com/OtUmi" rel="nofollow">here</a>. I want to know, instead of specifying the backcolor for each component, is it possible to set the base color and then kendoui will use variation of the base color and set the backcolor for remaining component. </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;base href="http://demos.telerik.com/kendo-ui/donut-charts/index"&gt; &lt;style&gt;html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }&lt;/style&gt; &lt;title&gt;&lt;/title&gt; &lt;link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.112/styles/kendo.common-material.min.css" /&gt; &lt;link rel="stylesheet" href="//kendo.cdn.telerik.com/2016.1.112/styles/kendo.material.min.css" /&gt; &lt;script src="//kendo.cdn.telerik.com/2016.1.112/js/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="//kendo.cdn.telerik.com/2016.1.112/js/kendo.all.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="example"&gt; &lt;div class="demo-section k-content wide"&gt; &lt;div id="chart" style="background: center no-repeat url('../content/shared/styles/world-map.png');"&gt;&lt;/div&gt; &lt;/div&gt; &lt;script&gt; function createChart() { $("#chart").kendoChart({ title: { position: "bottom", text: "Share of Internet Population Growth" }, legend: { visible: false }, chartArea: { background: "" }, seriesDefaults: { type: "donut", startAngle: 150 }, series: [{ name: "2011", data: [{ category: "Asia", value: 30.8, color: "#9de219" },{ category: "Europe", value: 21.1, color: "#90cc38" },{ category: "Latin America", value: 16.3, color: "#068c35" },{ category: "Africa", value: 17.6, color: "#006634" },{ category: "Middle East", value: 9.2, color: "#004d38" },{ category: "North America", value: 4.6, color: "#033939" }] }, { name: "2012", data: [{ category: "Asia", value: 53.8, color: "#9de219" },{ category: "Europe", value: 16.1, color: "#90cc38" },{ category: "Latin America", value: 11.3, color: "#068c35" },{ category: "Africa", value: 9.6, color: "#006634" },{ category: "Middle East", value: 5.2, color: "#004d38" },{ category: "North America", value: 3.6, color: "#033939" }], labels: { visible: true, background: "transparent", position: "outsideEnd", template: "#= category #: \n #= value#%" } }], tooltip: { visible: true, template: "#= category # (#= series.name #): #= value #%" } }); } $(document).ready(createChart); $(document).bind("kendo:skinChange", createChart); &lt;/script&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
1
Go cgo ldap_init could not determine kind of name for C.ldap_init
<p>I was trying to learn and understand cgo. I am writing a program in Go where I connect to AD and parse the output. I tested the code in C, which is working fine as expected. The relevant part in <code>C</code> is</p> <pre><code>char *ldap_host = "x.x.x.x"; int ldap_port = 389; ldap = ldap_init(ldap_host, ldap_port)) </code></pre> <p>Now I am trying to get the same working in go as</p> <pre><code>//#cgo CFLAGS: -lldap //#include &lt;ldap.h&gt; import "C" func main() { var hostname *string hostname = &amp;os.Args[1] ldap_port := 389 ldap := C.ldap_init(*hostname, ldap_port) } </code></pre> <p>But I am getting the following error</p> <pre><code>could not determine kind of name for C.ldap_init </code></pre> <p>What am I doing wrong here?</p>
1
Type mismatch: cannot convert from ResultSet to BigDecimal
<p>Hi I am using a <code>talend</code> job to schedule the integration of data from one database to another. My job is like:</p> <pre><code>tOracleInput---&gt;tMap---&gt;tOracleRow---&gt;tOracleRecordSet--&gt;tOracleOutput </code></pre> <p>In my <code>tOracleRow</code> there is a <code>big decimal</code> value I get using a select query:</p> <pre><code>Select my_value+1 my_value from MY_TABLE where id=? </code></pre> <p>I also propagated the query on one of my input, and using a <code>preparedStatement</code>.</p> <p>On running the job I keep having this error: <code>Type mismatch: cannot convert from ResultSet to BigDecimal</code>, on my <code>tOracleRow</code> component.</p>
1
Swift: Are global functions bad practice?
<p>I've read that global variables are bad. But, what about global functions? Say I add to my iPhone app project a file called <code>Globals.swift</code> containing <code>func foo() { print("foo") }</code>. Isn't that bad because it could conflict with other global functions of the same name &amp; signature? By the same argument, isn't it bad to use extensions to add new methods to existing types?</p>
1
OSX installing numpy via brew for python3
<p>I can't install numpy for python3 via brew.</p> <p>I type:</p> <pre><code>brew install numpy --with-python3 </code></pre> <p>then it's OK for python2</p> <pre><code>Python 2.7.6 (default, Sep 9 2014, 15:04:36) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import numpy &gt;&gt;&gt; </code></pre> <p>but still not found for python3</p> <pre><code>Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. &gt;&gt;&gt; import numpy Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; ImportError: No module named 'numpy' &gt;&gt;&gt; </code></pre> <p>How to make it work for python3 ?</p>
1
How to checkin files to TFS in new build task
<p>We try to migrate our old XAML build to new build system with task on on-premise TFS2015 Update1. In XAML build we have step where we check-out some files do some modification and do check-in. I found powershell <a href="https://github.com/Microsoft/vso-agent-tasks/blob/5809b4e83531ce21fdde486c77283810c1498277/Tasks/PublishSymbols/LegacyIndexHelpers.ps1" rel="nofollow noreferrer">helper</a> where is connection to TFS. Than I can check-out files, get list of pending check-out, but cannot do check-in. When I call</p> <pre><code>$tfsProvider.Workspace.CheckIn($pendingChanges, &quot;some text&quot;) </code></pre> <p>I get error</p> <pre><code>Exception calling &quot;CheckIn&quot; with &quot;2&quot; argument(s): &quot;Could not load file or assembly 'Microsoft.TeamFoundation.WorkItemTracking.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies </code></pre> <p>I think problem is that assembly Microsoft.TeamFoundation.VersionControl.Client.dll depends on assembly Microsoft.TeamFoundation.WorkItemTracking.Client. But this assembly is not in Agent worker folder. Is only way to get this assembly to copy to agent folder or install VS2015 on machine with agent and load assembly from VS folder?</p> <p>Thanks Regards</p>
1
MongoDB index: object keys vs array of strings
<p>I'm new to the MongoDB and have been researching schema designs and indexing. I know you can index a property regardless of its value (ID, array, subdocument, etc...) but what I don't know is if there is a performance benefit to either indexing an array of strings or a nested object's keys.</p> <p>Here's an example of both scenarios that I'm contemplating (in Mongoose):</p> <pre><code>// schema mongoose.Schema({ visibility: { usa: Boolean, europe: Boolean, other: Boolean } }); // query Model.find({"visibility.usa": true}); </code></pre> <p>OR</p> <pre><code>// schema mongoose.Schema({ visibility: [String] // strings could be "usa", "europe", and/or "other" }); // query Model.find({visibility: "usa"}); </code></pre> <p>Documents could have one, two, or all three visibility options.</p> <p>Furthermore, if I went with the Boolean object design, could I simple index the visibility field or would I need to put an index on usa, europe, and other?</p>
1
Drag & Drop Espresso
<p>Is it possible to perform drag &amp; drop action via Espresso? I need to move one view down (in straight line) in order to accept some conditions in my automation test.</p>
1
how to copy one index documents to other index in elasticsearch?
<p>I created a new index with mappings. 500 000 documents are stored in it.</p> <p>I want to change the mapping of the index, but it is not possible in elastic search.so I created another index with new new mappings and now I am trying to copy the documents from old index to new index.</p> <p>I am using scan and scroll type to retrieve the documents from old index and copying to new index.for copying its taking more time and the system is slowing down.</p> <p>Below is the code that I am using.</p> <pre><code>$client= app('elastic_search'); $params = [ "search_type" =&gt; "scan", // use search_type=scan "scroll" =&gt; "30s", // how long between scroll requests. should be small! "size" =&gt; 500000, // how many results *per shard* you want back "index" =&gt; "admin_logs422", "body" =&gt; [ "query" =&gt; [ "match_all" =&gt; [] ] ] ]; $docs = $client-&gt;search($params); // Execute the search $scroll_id = $docs['_scroll_id']; while (\true) { // Execute a Scroll request $response = $client-&gt;scroll([ "scroll_id" =&gt; $scroll_id, //...using our previously obtained _scroll_id "scroll" =&gt; "500s" // and the same timeout window ] ); if (count($response['hits']['hits']) &gt; 0) { foreach($response['hits']['hits'] as $s) { $params = [ 'index' =&gt; 'admin_logs421', 'type' =&gt; 'admin_type421', 'id'=&gt; $s['_id'], 'client' =&gt; [ 'ignore' =&gt; [400, 404], 'verbose' =&gt; true, 'timeout' =&gt; 10, 'connect_timeout' =&gt; 10 ], 'body' =&gt; $s['_source'] ]; $response = app('elastic_search')-&gt;create($params); } $scroll_id = $response['_scroll_id']; } else { // No results, scroll cursor is empty. You've exported all the data return response("completed"); } } </code></pre>
1
Bootstrap 3 data-target attribute on tab not working
<p>I am using Bootstrap tabs in my website. When page loads tab will be filled with data at run-time using dynamic content. I am using <code>data-target</code> attribute on anchor tag for that, but it does not seems to work at all.</p> <p>Here is what I tried so far:</p> <p><strong>HTML</strong></p> <pre><code>&lt;div class="container"&gt; &lt;div class="row"&gt; &lt;ul class="nav nav-tabs" role="tablist"&gt; &lt;li role="presentation" class="active"&gt; &lt;a href="showTab1.do" data-target="#test_1" aria-controls="test_1" role="tab" data-toggle="tab"&gt;Tab 1&lt;/a&gt; &lt;/li&gt; &lt;li role="presentation"&gt; &lt;a href="showTab2.do" data-target="#test_2" aria-controls="test_2" role="tab" data-toggle="tab"&gt;Tab 2&lt;/a&gt; &lt;/li&gt; &lt;li role="presentation"&gt; &lt;a href="showTab3.do" data-target="#test_3" aria-controls="test_3" role="tab" data-toggle="tab"&gt;Tab 3&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;div class="tab-content"&gt; &lt;div role="tabpanel" class="tab-pane active" id="test_1"&gt;&lt;/div&gt; &lt;div role="tabpanel" class="tab-pane active" id="test_2"&gt;&lt;/div&gt; &lt;div role="tabpanel" class="tab-pane active" id="test_3"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here I am trying to load content of remote file <code>showTab1.do</code> inside div with <code>id="test_1"</code> when using <code>data-target="#test_1"</code> on anchor tag. But it is not working. What I know is if I am using <strong>data-target</strong> we don't need to write any jQuery/JavaScript to load data in tab as data-target will do that for us(correct me if I am wrong). My Bootstrap version is v3.3.6.</p> <p>Please correct me where I am wrong. Thanks </p>
1
GLSL cube signed distance field implementation explanation?
<p>I've been looking at and trying to understand the following bit of code</p> <pre><code>float sdBox( vec3 p, vec3 b ) { vec3 d = abs(p) - b; return min(max(d.x,max(d.y,d.z)),0.0) + length(max(d,0.0)); } </code></pre> <p>I understand that <code>length(d)</code> handles the SDF case where the point is off to the 'corner' (ie. all components of <code>d</code> are positive) and that <code>max(d.x, d.y, d.z)</code> gives us the proper distance in all other cases. What I don't understand is how these two are combined here without the use of an if statement to check the signs of <code>d</code>'s components.</p> <p>When all of the <code>d</code> components are positive, the return expression can be reduced to <code>length(d)</code> because of the way <code>min/max</code> will evaluate - and when all of the <code>d</code> components are negative, we get <code>max(d.x, d.y, d.z)</code>. But how am I supposed to understand the in-between cases? The ones where the components of <code>d</code> have mixed signs?</p> <p>I've been trying to graph it out to no avail. I would really appreciate it if someone could explain this to me in geometrical/mathematical terms. Thanks.</p>
1
Using Flexbox order with Bootstrap rows
<p>I am trying to adjust the stacking order of columns within two bootstrap rows. I have two rows, each with two columns. In my JSBin example below, I am trying to stack the order on a phone to thing a, thing b, thing d and thing c. </p> <p>I am trying to use flex box in a media query to adjust the order of the columns using the flexbox order property without success. From my research, I wrapped both rows in a wrapper div with <code>display:flex</code> and set the order on each column, but this isn't working...</p> <p><a href="https://output.jsbin.com/wixogafebe/" rel="nofollow">https://output.jsbin.com/wixogafebe/</a></p>
1
AWS CLI create Lambda function cannot unzip uploaded file
<p>I'm trying to create an AWS Lambda function using the AWS CLI. So I generated the JSON input skeleton for use with the <code>aws lambda create-function</code> function by passing in the <code>--generate-cli-skeleton</code> parameter and then substituting the values accordingly.</p> <p>The problem is that when I execute the command to create the function it gives me this error:</p> <p><code>A client error (InvalidParameterValueException) occurred when calling the CreateFunction operation: Could not unzip uploaded file. Please check your file, then try to upload again.</code></p> <p>This is how I run the command:</p> <p><code>aws lambda create-function --cli-input-json file://C:\Projects\Automated_Deployment\lambda_function_deploy.json</code></p> <p>The contents of the <em>.json</em> file are:</p> <pre><code>{ "FunctionName": "MyFunction", "Runtime": "nodejs", "Role": "arn:aws:iam::------------:role/lambda_dynamo", "Handler": "index.handler", "Code": { "ZipFile": "fileb://C:/Projects/src/zip/MyFunction.zip" }, "Description": "description goes here", "Timeout": 10, "MemorySize": 128, "Publish": true } </code></pre> <p>Surprisingly if I try to create the function without using the JSON file and providing all the parameters in the command-line then it works. So for instance, this works without any issues at all:</p> <pre><code>aws lambda create-function --function-name MyFunction --runtime nodejs --role arn:aws:iam::------------:role/lambda_dynamo --handler index.handler --zip-file fileb://C:/Projects/src/zip/MyFunction.zip </code></pre> <p>This is the same .zip file. Any hints as to what am I doing wrong here? I have tried replacing <code>"ZipFile": "fileb://C:/Projects/src/zip/MyFunction.zip"</code> with:</p> <p><code>"ZipFile": "file://C:/Projects/src/zip/MyFunction.zip"</code> and <code>"ZipFile": "C:/Projects/src/zip/MyFunction.zip"</code> but the issue remains.</p> <p><strong>EDIT:</strong> I found out the --debug option which we can pass to the CLI command. The problem is that the tool is not reading the ZipFile properly when we provide the input from JSON. So for instance if I run the command providing all the parameters in the command itself, I can see the zip file properly base64 encoded i.e.:</p> <pre><code>2016-02-08 10:43:59,831 - MainThread - botocore.endpoint - DEBUG - Making request for &lt;botocore.model.OperationModel object at 0x0000000004149F28&gt; (verify_ssl=True) with params: {'body': '{"Code": {"ZipFile": "UEsDBBQAAAAIAFiGPUiLOeW/nwcAANsdAAAIAAAAaW5kZXguanO1Gdtu2zb0PUD+gdVDI2OOmrZrBzgICi9OC29FYsRpX4pCUCQ65iJLqk .... redacted </code></pre> <p>But when I provide the parameters from the JSON file i.e. --cli-input-json then the command base64 encodes the value of the ZipFile key in the JSON (which is the URI to that file i.e. fileb://C:/Projects/src/zip/MyFunction.zip)</p> <p>Now I'm not sure what value we need to provide to the ZipFile key, or is it a bug in the tool/command?</p> <p><strong>EDIT2:</strong> If I provide the base64 encoded string of my zip file, the command will base64 encode that string again which will gave the same error (i.e. cannot unzip.) So my question is what does the field ZipFile require? A URL with file:// protocol or fileb:// ? Zip file's contents base-64 encoded?</p>
1
How to remove all Docker containers
<p>I want to remove all of my docker containers at once. I tried to use $ docker rm [container_id] to do so, but it removed only one container, not all.</p> <p>Is there any way to remove all docker containers using one single line of code?</p>
1