title
stringlengths
15
150
body
stringlengths
38
32.9k
label
int64
0
3
Get KeyValuePair given Key
<p>Given a <code>String</code> that is a <code>Key</code> contained in <code>Dictionary&lt;String, List&lt;String&gt;&gt;</code>, how do I retrieve the <code>KeyValuePair&lt;String, List&lt;String&gt;&gt;</code> that corresponds to that <code>Key</code>?</p>
0
Check with VBA if an element exists on the page
<p>I have 15,000 products and I need to know if they're X, Y or Z. The code below checks on amazon to see if a product is a type of XYZ.</p> <p>God help me, it actually works. The only exception is when it searches a product no longer sold by Amazon. Then the element ID that I'm looking for which contains the product description that I'm searching doesn't exist on the page, and the code breaks on line </p> <pre><code>text = document.getelementbyID("result_0").innertext </code></pre> <p>with the error "Object variable or With block variable not set".</p> <p>How do I check if the element exists before proceeding with the rest of the code?</p> <p>Thanks!</p> <p>Sam</p> <pre><code>Sub LetsAutomateIE() Dim barcode As String Dim rowe As Integer Dim document As HTMLDocument Set ie = CreateObject("InternetExplorer.Application") Dim Element As HTMLDivElement Dim text As String Dim pos As Integer rowe = 2 While Not IsEmpty(Cells(rowe, 2)) barcode = Cells(rowe, "B").Value With ie .Visible = False .navigate2 "https://www.amazon.co.uk/s/ref=nb_sb_noss_1?url=search- alias%3Daps&amp;field-keywords=" &amp; barcode Do Until ie.readyState = 4 Loop End With Set document = ie.document text = document.getElementById("result_0").innerText If InStr(text, "X") Or InStr(text, "Y") Or InStr(text, "Z") &lt;&gt; 0 Then pos = 1 If pos &lt;&gt; 0 Then Cells(rowe, 4) = "Y" Else Cells(rowe, 4) = "N" rowe = rowe + 1 Wend Set ie = Nothing End Sub </code></pre>
0
Heroku Deploy Error: Cannot find module '/app/index.js'
<p>I' m trying to deploy mt app on Heroku but I always get the same error:</p> <pre><code>2016-08-18T10:16:10.988982+00:00 heroku[web.1]: Starting process with command `node index.js` 2016-08-18T10:16:13.180369+00:00 app[web.1]: module.js:341 2016-08-18T10:16:13.180389+00:00 app[web.1]: throw err; 2016-08-18T10:16:13.180390+00:00 app[web.1]: ^ 2016-08-18T10:16:13.180391+00:00 app[web.1]: 2016-08-18T10:16:13.180392+00:00 app[web.1]: Error: Cannot find module '/app/index.js' 2016-08-18T10:16:13.180393+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:339:15) 2016-08-18T10:16:13.180394+00:00 app[web.1]: at Function.Module._load (module.js:290:25) 2016-08-18T10:16:13.180394+00:00 app[web.1]: at Function.Module.runMain (module.js:447:10) 2016-08-18T10:16:13.180399+00:00 app[web.1]: at node.js:405:3 2016-08-18T10:16:13.271966+00:00 heroku[web.1]: Process exited with status 1 2016-08-18T10:16:13.273383+00:00 heroku[web.1]: State changed from starting to crashed </code></pre> <p>As I read in similar requests I have already added a Procfile containing the following code: <code>web: node index.js</code>, but I still have same issue.</p> <p>Anybody have any idea where the problem is? Any guidance would be greatly appreciated. Thank you in advance!</p>
0
How to extract a list from appsettings.json in .net core
<p>I have an appsettings.json file which looks like this:</p> <pre><code>{ "someSetting": { "subSettings": [ "one", "two", "three" ] } } </code></pre> <p>When I build my configuration root, and do something like <code>config["someSetting:subSettings"]</code> it returns null and the actual settings available are something like this:</p> <p><code>config["someSettings:subSettings:0"]</code></p> <p>Is there a better way of retrieving the contents of <code>someSettings:subSettings</code> as a list?</p>
0
Render a View inside a View in Asp.Net mvc
<p>How do I render a full fledged view (not partial view) inside another view?</p> <p>Scenario, I have different controller and want the exactly same view to render which is already there under other controller with different layout.</p> <p>I have Wishlist page in Home Controller which shows list of added products, and when user logged in , when I click on wish list it also show me navigation when user is signed in. </p> <p>How would I do that??</p>
0
How to prevent blur on image resize in Chrome?
<p>The images are really blurry if you use resize an image, for example showing a small image with resized dimensions, like;</p> <pre><code>&lt;img src="largeimage.jpg" width=30 height=30 \&gt; </code></pre> <p>Its not blurry in other browsers, but in Chrome, its so blurry. I have looked at in www.twitter.com , their new design has lots of resized images and somehow, they have managed to clear blur in resized images. I have tried these;</p> <pre><code>image-rendering: crisp-edges; image-rendering: pixelated; </code></pre> <p>But unfortunately, it doesn't solve the problem.</p> <p>Below is a comparison. On the left, you can see that it is quite blurry, compared to that on the right: <a href="https://i.stack.imgur.com/csrNV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/csrNV.png" alt="Comparison of blurriness"></a></p> <p>What is the correct way to do that ?</p>
0
Cannot resolve symbol 'tools' and 'GradleException'
<p>I have started to work on an existing project including Android NDK. I have two issues in build.gradle, which is impossible for me to build the app. For your information, my co-worker (who was working on it) was able to build the app.</p> <p>I have already imported the NDK, from the project structures I can see the correct Android NDK path.</p> <p>Here is how build.gradle looks like : </p> <pre><code>import org.apache.tools.ant.taskdefs.condition.Os buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { // The Fabric Gradle plugin uses an open ended version to react // quickly to Android tooling updates classpath 'io.fabric.tools:gradle:1.21.5' } } allprojects { repositories { maven { url "https://jitpack.io" } } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' apply plugin: 'realm-android' repositories { maven { url 'https://maven.fabric.io/public' } } android { compileSdkVersion 24 buildToolsVersion "24.0.2" dataBinding{ enabled = true; } defaultConfig { applicationId "com.lucien.myapp" minSdkVersion 16 targetSdkVersion 24 versionCode 1 versionName "1.0.0" ndk { moduleName "DSPLib-jni" } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } sourceSets.main.jni.srcDirs = [] // disable automatic ndk-build call, which ignore our Android.mk sourceSets.main.jniLibs.srcDir 'src/main/libs' // call regular ndk-build(.cmd) script from app directory task ndkBuild(type: Exec) { workingDir file('src/main') commandLine getNdkBuildCmd() } tasks.withType(JavaCompile) { compileTask -&gt; compileTask.dependsOn ndkBuild } task cleanNative(type: Exec) { workingDir file('src/main') commandLine getNdkBuildCmd(), 'clean' } clean.dependsOn cleanNative } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.2.0' compile 'com.android.support:design:24.2.0' compile 'com.android.support:support-v4:24.2.0' compile 'com.github.PhilJay:MPAndroidChart:v2.2.5' compile 'com.orhanobut:dialogplus:1.11@aar' compile('com.crashlytics.sdk.android:crashlytics:2.6.2@aar') { transitive = true; } compile 'com.squareup.retrofit2:retrofit:2.1.0' compile 'com.squareup.retrofit2:converter-gson:2.0.2' compile 'com.google.code.gson:gson:2.7' } def getNdkDir() { if (System.env.ANDROID_NDK_ROOT != null) return System.env.ANDROID_NDK_ROOT Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) def ndkdir = properties.getProperty('ndk.dir', null) if (ndkdir == null) throw new GradleException("NDK location not found. Define location with ndk.dir in the local.properties file or with an ANDROID_NDK_ROOT environment variable.") return ndkdir } def getNdkBuildCmd() { def ndkbuild = getNdkDir() + "/ndk-build" if (Os.isFamily(Os.FAMILY_WINDOWS)) ndkbuild += ".cmd" return ndkbuild } </code></pre> <p>I have an issue with the first line, trying to import "org.apache.tools.ant.taskdefs.condition.Os" : Cannot resolve symbol 'tools'</p> <p><a href="https://i.stack.imgur.com/1JgE0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1JgE0.png" alt="tools issue"></a></p> <p>And the same kind of issue for "throw new GradleException("...")"</p> <p><a href="https://i.stack.imgur.com/5C7fj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5C7fj.png" alt="GradleException issue"></a></p> <p>Do I need to update something in my build.gradle ? Or the issue is somewhere else ?</p> <p>Thanks !</p>
0
Android: Why is the constructor for SoundPool deprecated?
<p>Does it mean that we cannot use it anymore? What should we use if the min API is set below 21? Also, is it okay to ignore the warning as older applications built using it work on the new OSes?</p>
0
Stop a for loop when user is finished entering input in c
<p>First of all, thank you for the assist!</p> <p>I'm new to the C language (and programming in general) and I'm trying to write a program wherein the user inputs data points. The data points are then saved in an array where they can then be manipulated. </p> <p>Where I am stuck: I want the user to be able to input (almost) any number of points, then use a 'keyword' of sorts to signal the end of data entry. In this case, the user would type 'done'. </p> <p>Here's what I have so far:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; int main(void) { printf("\n Welcome! \n\n Please enter each data point. Enter 'done' when finished.\n\n"); double data[1048]; int i, count; for (i = 1; ;i++) { printf("Data[%i]: ", i); scanf("%lf", &amp;data[i]); if (data[i] == 'done') { break; } else { count++; } } } </code></pre> <p>I've tried 'return 1;' and 'break;'. Each time, the program works well until the 'keyword' is entered, at which point I get:</p> <pre><code>Data[8]: Data[9]: ... Data[1120]: Data[1Segmentation fault 11 </code></pre> <p>The only time it works is if I have it break when the user inputs a particular number (like -1 or 0). But that doesn't quite work for the user since they might have to enter those numbers as data points.</p> <p>Sorry for the long post, but I appreciate the help!</p>
0
When looking at the differences between X-Auth-Token vs Authorization headers, which is preferred?
<p>What is the difference between the two headers below?<br> Which one is preferred?</p> <ol> <li><p><code>X-Auth-Token : dadas123sad12</code></p></li> <li><p><code>Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==</code></p></li> </ol>
0
http post - how to send Authorization header?
<p>How do you add headers to your http request in Angular2 RC6? I got following code:</p> <pre><code>login(login: String, password: String): Observable&lt;boolean&gt; { console.log(login); console.log(password); this.cookieService.removeAll(); let headers = new Headers(); headers.append("Authorization","Basic YW5ndWxhci13YXJlaG91c2Utc2VydmljZXM6MTIzNDU2"); this.http.post(AUTHENTICATION_ENDPOINT + "?grant_type=password&amp;scope=trust&amp;username=" + login + "&amp;password=" + password, null, {headers: headers}).subscribe(response =&gt; { console.log(response); }); //some return } </code></pre> <p>The problem is, that angular doesn't add Authorization header. Instead of that, in request I can see following additional headers:</p> <pre><code>Access-Control-Request-Headers:authorization Access-Control-Request-Method:POST </code></pre> <p>and sdch added in Accept-Encoding:</p> <pre><code>Accept-Encoding:gzip, deflate, sdch </code></pre> <p>Unfornately there is no Authorization header. How should I add it correctly?</p> <p>Whole request sent by my code looks as follow:</p> <pre><code>OPTIONS /oauth/token?grant_type=password&amp;scope=trust&amp;username=asdf&amp;password=asdf HTTP/1.1 Host: localhost:8080 Connection: keep-alive Pragma: no-cache Cache-Control: no-cache Access-Control-Request-Method: POST Origin: http://localhost:3002 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Access-Control-Request-Headers: authorization Accept: */* Referer: http://localhost:3002/login Accept-Encoding: gzip, deflate, sdch Accept-Language: en-US,en;q=0.8,pl;q=0.6 </code></pre>
0
Failed to resolve: com.android.support:appcompat-v7:23.4.0
<p>I want to use <a href="https://github.com/Cleveroad/MusicBobber" rel="nofollow">MusicBobber</a> library in my project, but this error showed up</p> <pre><code>Error:Failed to resolve: com.android.support:appcompat-v7:23.4.0 </code></pre> <p>I have <code>com.android.support:appcompat-v7:23.1.1</code> and this is complete <code>gradle</code> file:</p> <pre><code>apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.tabaneshahr.playaudiotest" minSdkVersion 15 targetSdkVersion 23 versionCode 1 versionName "1.0" } repositories { maven { url 'http://repo1.maven.org/maven2' } } 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.cleveroad:audiowidget:0.9.2' } </code></pre> <p>I'd searched stackoverflow but noting useful. what should I do? does <code>minSDK</code> must change? shall I download anything?</p>
0
Execution failed for task ':app:processDebugResources' after cleaning project
<p>The error I've been getting is this:</p> <pre><code> FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugResources'. &gt; com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\bliss_000\AppData\Local\Android\Sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1 * Try: Run with --info or --debug option to get more log output. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugResources'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:153) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:150) at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99) at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72) at org.gradle.util.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50) at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:237) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) Caused by: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\bliss_000\AppData\Local\Android\Sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1 at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:207) at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:82) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) ... 70 more Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\bliss_000\AppData\Local\Android\Sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1 at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:43) at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:983) at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:163) ... 78 more Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\bliss_000\AppData\Local\Android\Sdk\build-tools\23.0.3\aapt.exe'' finished with non-zero exit value 1 at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367) at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:41) ... 80 more BUILD FAILED Total time: 1.468 secs </code></pre> <p>Along with this, Android Studio can't resolve R class. By the way, I don't really know how to post errors on here properly, so I just used a snippet. I already tried cleaning the build and rebuilding it, nothing from previous posts and solutions have worked.</p> <p>The following is my Android Manifest file if you were wondering, I don't mind posting any resource files or classes.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.bliss_000.todolistapp" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;application name="com.example.bliss_000.todolistapp.AppController" android:name="com.android.tools.fd.runtime.BootstrapApplication" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.example.bliss_000.todolistapp.LoginActivity" android:label="@string/app_name" android:launchMode="singleTop" android:windowSoftInputMode="adjustPan" &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; &lt;activity android:name="com.example.bliss_000.todolistapp.RegisterActivity" android:label="@string/app_name" android:launchMode="singleTop" android:windowSoftInputMode="adjustPan" /&gt; &lt;activity android:name="com.example.bliss_000.todolistapp.MainActivity" android:label="@string/app_name" android:launchMode="singleTop" /&gt; &lt;activity android:name="com.example.bliss_000.todolistapp.GoalsActivity" android:label="Craft" android:launchMode="singleTop" /&gt; &lt;activity android:name="com.example.bliss_000.todolistapp.GoalsEditorActivity" android:label="Craft" android:launchmode="singleTop" /&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>It could also be something wrong with a resource file, I really don't know how I would be able to find it without taking apart the entire project. </p>
0
Python & Google Places API | Want to get all Restaurants at a specific postion
<p>I want to get all restaurants in London by using python 3.5 and the module <code>googleplaces</code> with the Google Places API. I read the <code>googleplaces</code> documentation and searched here, but I don't get it. Here is my code so far:</p> <pre><code>from googleplaces import GooglePlaces, types, lang API_KEY = 'XXXCODEXXX' google_places = GooglePlaces(API_KEY) query_result = google_places.nearby_search( location='London', keyword='Restaurants', radius=1000, types=[types.TYPE_RESTAURANT]) if query_result.has_attributions: print query_result.html_attributions for place in query_result.places: place.get_details() print place.rating </code></pre> <p>The code doesn't work. What can I do to get a list with all restaurants in this area?</p>
0
How can I get a (MM-DD-YYYY) format from a UTC string in javascript?
<p>I am working with a Date object in a different timezone than the console. I'm using utc string to get the actual time that was logged in that timezone. Is there an easy way to extract the (MM-DD-YYYY) from the utc string than just substringing into the string?</p> <pre><code>isoString = "2016-08-25T15:17:21.033-10:00" utc= (new Date(isoString)).toUTCString() </code></pre> <p>Returns: "Fri, 26 Aug 2016 01:17:21 GMT"</p> <p>Would like (08-26-2016)</p>
0
Angular 2 Inject Dependency outside Constructor
<p>I am currently digging into DI in Angular 2. I'm implementing a REST-Client using a generic subtypes for concrete Datatypes like this:</p> <pre><code>class RESTClient&lt;T&gt;{ constructor() { var inj = ReflectiveInjector.resolveAndCreate([HTTP_PROVIDERS]); this.http = inj.get(Http); this.conf = RESTConfiguration; } } class BookClient extends RESTClient&lt;Book&gt;{ constructor(){ // since I dont want to inject the HTTP Providers here, I'm using a custom injector in the super class super(); } } class WriterClient extends RESTClient&lt;Writer&gt;{ ... ... } </code></pre> <p>So as I understand, there will be one http service shared between all RESTClients injected by the superclasses REST-Service.</p> <p>Now I want to have a RESTConfiguration class as such:</p> <pre><code>@Injectable() export class RESTConfiguration { get baseURL() { return this._baseURL; } set baseURL(value) { alert("sets value to"+value); this._baseURL = value; } private _baseURL; } </code></pre> <p>It should be configured in the main app as such: </p> <pre><code>initializeApp(){ this.restconf.baseURL = "http://localhost:3004/"; } bootstrap(MyApp, [RESTConfiguration]).then(); </code></pre> <p>I'm now wondering how to inject one singleton instance of my RESTConfiguration into the RESTService class without passing it to the constructor which I want to remain argument-less in order to reduce code duplication and avoid issues with generics in typescript.</p> <p>In the above example (first code snippet) I'm trying to inject my configuration using the ReflectiveInjector I created which delivers me a custom instance of my Configuration.</p> <p>I thought about several solutions: </p> <ol> <li><p>Getting access to the Apps "global injector" by making one available using a service or some static class property </p></li> <li><p>Implementing extra singleton-logic into my configuration</p></li> <li><p>finding a way to use the angular-native injection method outside of the constructor?</p></li> </ol> <p>Are there mistakes in my thinking or am I misusing the DI framework ? </p>
0
Problems with cropping a UIImage in Swift
<p>I'm writing an app that takes an image and crops out everything except for a rectangle in the center of the image. (SWIFT) I can't get the crop function to work though. This is what I have now:</p> <pre><code>func cropImageToBars(image: UIImage) -&gt; UIImage { let crop = CGRectMake(0, 200, image.size.width, 50) let cgImage = CGImageCreateWithImageInRect(image.CGImage, crop) let result: UIImage = UIImage(CGImage: cgImage!, scale: 0, orientation: image.imageOrientation) UIImageWriteToSavedPhotosAlbum(result, self, nil, nil) return result } </code></pre> <p>I've looked at a lot of different guides but none of them seem to work for me. Sometimes the image is rotated 90 degrees, I have no idea why it does that.</p>
0
Python how to delete a specific value from a dictionary key with multiple values?
<p>I have a dictionary with multiple values per key and each value has two elements (possibly more). I would like to iterate over each value-pair for each key and delete those values-pairs that meet some criteria. Here for instance I would like to delete the second value pair for the key A; that is: <code>('Ok!', '0')</code>:</p> <pre><code>myDict = {'A': [('Yes!', '8'), ('Ok!', '0')], 'B': [('No!', '2')]} </code></pre> <p>to:</p> <pre><code>myDict = {'A': [('Yes!', '8')], 'B': [('No!', '2')]} </code></pre> <p>I can iterate over the dictionary by key or value, but can't figure out how I delete a specific value.</p>
0
Return List To View
<p>Every Time I loop through the viewbag it gives this error </p> <blockquote> <p>object' does not contain a definition for 'Name'</p> </blockquote> <p>This My Action</p> <pre><code>public ActionResult AssignTask() { var List = db.Employees.Select(x =&gt; new { id = x.id, Name = x.Name }).ToList(); ViewBag.Emp_data = List; return View(); } </code></pre> <p>and this is my view <a href="https://i.stack.imgur.com/wmnHa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wmnHa.png" alt="enter image description here"></a></p>
0
Add extra User Information with firebase
<p>I have integrated firebase auth with my android app. Lets say a user has a mail <code>[email protected]</code>. I want to add some extra information to the user like the name of the user, occupation and address. How can i connect the user auth table with my android app to do that? </p> <p>Do i need to write any APIs for that? </p>
0
Error:java.lang.NullPointerException (no error message)
<p>This question have asked for several times and I follow those questions and tried to solve the problem. The project was successfully build and running I shut down my computer few hours ago. This problem is making me mad please help.</p> <p>Message:</p> <pre><code> Information:Gradle tasks [:app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources] :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2420Library UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72420Library UP-TO-DATE :app:prepareComAndroidSupportCardviewV72420Library UP-TO-DATE :app:prepareComAndroidSupportDesign2420Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72420Library UP-TO-DATE :app:prepareComAndroidSupportSupportCompat2420Library UP-TO-DATE :app:prepareComAndroidSupportSupportCoreUi2420Library UP-TO-DATE :app:prepareComAndroidSupportSupportCoreUtils2420Library UP-TO-DATE :app:prepareComAndroidSupportSupportFragment2420Library UP-TO-DATE :app:prepareComAndroidSupportSupportMediaCompat2420Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42420Library UP-TO-DATE :app:prepareComAndroidSupportSupportVectorDrawable2420Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:mergeDebugShaders Error:java.lang.NullPointerException (no error message) Information:BUILD FAILED Information:Total time: 1.422 secs Information:1 error Information:0 warnings Information:See complete output in console </code></pre> <p>build.gradle :</p> <pre><code> apply plugin: 'com.android.application' android { compileSdkVersion 24 buildToolsVersion '24.0.0' defaultConfig { applicationId "np.com.yipl.yiplandroidlistme" minSdkVersion 15 targetSdkVersion 24 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.2.0' compile 'com.android.support:design:24.2.0' compile 'com.android.support:recyclerview-v7:24.2.0' compile 'com.android.support:cardview-v7:24.2.0' compile 'com.mcxiaoke.volley:library:1.0.19' } </code></pre> <p>Please help .</p>
0
How to print lines between two patterns, inclusive or exclusive (in sed, AWK or Perl)?
<p>I have a file like the following and I would like to print the lines between two given patterns <code>PAT1</code> and <code>PAT2</code>.</p> <pre class="lang-none prettyprint-override"><code>1 2 PAT1 3 - first block 4 PAT2 5 6 PAT1 7 - second block PAT2 8 9 PAT1 10 - third block </code></pre> <p>I have read <a href="https://stackoverflow.com/q/17988756/1983854">How to select lines between two marker patterns which may occur multiple times with awk/sed</a> but I am curious to see all the possible combinations of this, either including or excluding the pattern.</p> <p>How can I print all lines between two patterns?</p>
0
Vector Drawables flag doesn't work on Support Library 24+
<p>Today, it seems as though Android Nougat was <a href="https://android.googleblog.com/2016/08/android-70-nougat-more-powerful-os-made.html" rel="noreferrer">released</a>. Thus, I am more excited than ever to optimize my app for the new features like split-screen. I would like to push a version of my app that targets SDK version <code>24</code> so that users aren't notified that my app may not work in split-screen. However, doing so means that I should also update to version <code>24</code> of the Support Library. Like many others, I experienced a problem when updating to version <code>23.2.0</code> of the Support Library. However, I followed <a href="https://stackoverflow.com/a/35740506/5432386">this answer</a> and it fixed my issue. Now the issue is returning as of version <code>24.0.0</code> and up of the Support Library. In all of my tests I am using the gradle flag described in the linked answer:</p> <pre><code>vectorDrawables.useSupportLibrary = true </code></pre> <p>It is also important to note that this is only happening on pre-Lolliop devices (Kitkat and below). Lollipop and up works perfectly. When using the following dependencies, the flag works fine:</p> <pre><code>compile 'com.android.support:support-v4:23.4.0' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:design:23.4.0' compile 'com.android.support:cardview-v7:23.4.0' </code></pre> <p>But when using these dependencies, I get a crash similar to the one I got before using the flag:</p> <pre><code>compile 'com.android.support:support-v4:24.2.0' compile 'com.android.support:appcompat-v7:24.2.0' compile 'com.android.support:design:24.2.0' compile 'com.android.support:cardview-v7:24.2.0' </code></pre> <p>Here is the stack trace of the crash:</p> <pre><code>FATAL EXCEPTION: main Process: com.badon.brigham.time, PID: 2070 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.badon.brigham.time/com.badon.brigham.time.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f02004f at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method) Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f02004f at android.content.res.Resources.loadDrawable(Resources.java:2101) at android.content.res.Resources.getDrawable(Resources.java:700) at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:346) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:194) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:182) at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:717) at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:187) at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:77) at android.support.v7.app.AppCompatDelegateImplBase.&lt;init&gt;(AppCompatDelegateImplBase.java:127) at android.support.v7.app.AppCompatDelegateImplV9.&lt;init&gt;(AppCompatDelegateImplV9.java:147) at android.support.v7.app.AppCompatDelegateImplV11.&lt;init&gt;(AppCompatDelegateImplV11.java:27) at android.support.v7.app.AppCompatDelegateImplV14.&lt;init&gt;(AppCompatDelegateImplV14.java:50) at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:201) at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:181) at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:521) at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71) ... </code></pre> <p>Am I totally missing something? Or is this already a known issue (I couldn't find anything on Google)? Any help would be appreciated.</p>
0
Drop all data in a pandas dataframe
<p>I would like to drop all data in a pandas dataframe, but am getting <code>TypeError: drop() takes at least 2 arguments (3 given)</code>. I essentially want a blank dataframe with just my columns headers.</p> <pre><code>import pandas as pd web_stats = {'Day': [1, 2, 3, 4, 2, 6], 'Visitors': [43, 43, 34, 23, 43, 23], 'Bounce_Rate': [3, 2, 4, 3, 5, 5]} df = pd.DataFrame(web_stats) df.drop(axis=0, inplace=True) print df </code></pre>
0
Count the number of elements of an array in javascript
<p>Consider the following:</p> <pre><code>var answers = []; answers[71] = { field: 'value' }; answers[31] = { field: 'value' }; console.log(answers); </code></pre> <p>This outputs the <strong>length</strong> of the array as <strong>72</strong> but I was expecting it to return <strong>2</strong>. Here's the output of the script from chrome console:</p> <p><a href="https://i.stack.imgur.com/3VAzQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3VAzQ.png" alt="enter image description here"></a></p> <p>Any ideas why this is?</p>
0
How can I use GitKraken on a private network?
<p>I've been using GitKraken on Windows for various projects and now I have to do some development on a private network (no internet access). But when I start the application it asks me to create an account. I can't do that on this network.</p> <p>How can I configure GitKraken on this network without creating an account?</p>
0
Summernote remove resize bar
<p>I'm using summernote 0.8.2 and I'm trying to remove the resize bar at the bottom of the text editor like the one shown <a href="http://summernote.org/getting-started/#height-and-focus" rel="nofollow">here</a>. I tried options such as the ones listed below. Does anyone know what is the correct way to do this?</p> <pre><code>$("#summernote").summernote({ toolbar: [ ['para', ['ul']] ], focus: true, disableResize: true, // Does not work disableResizeEditor: true, // Does not work either resize: false // Does not work either }); $('.note-statusbar').hide() // Does not work either </code></pre>
0
Set max length for EditText
<p>I want to set a 1 character length in EditText but just in one part of condition. There is a way to set max length via XML but this will be applied for the whole condition. How to set max length programmatically?</p>
0
Angular 2 Dynamic Menu
<p>I'm playing around with Angular 2. Currently I wonder what is the best way to implement a dynamic menu component. The idea is to have a global menu component that receives menu items for every other content component in the app.</p> <p>One idea was, to have a menu.component, a menu.service and other components, that use the service. The service is referenced globally in app.module. The menu.components subscribes to an observable and dynamically add items that get pasted in. I think this is not the best solution.</p> <p>Another idea is, that I put the menu selector/tag in every components template and paste data to the menu component directly. Currently I stuck in how to get items to the menu.component, so that the ngFor generates the menu items after it was initialized.</p> <p><strong>So the question is: Are there any "best practices" or common way to do this?</strong></p> <p>Guess I need some more basics in Angular 2, but it would be nice if you can lead me on the right path. It's just a learning project :)</p> <p>Here is some code of what I've tried:</p> <p>app.module.ts</p> <pre class="lang-js prettyprint-override"><code>import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { HTTP_PROVIDERS } from '@angular/http'; import { AppComponent } from './app.component'; import { appRouterProviders } from './app.routes'; import { MenuComponent } from './menu.component'; import { HomeComponent } from './home.component'; @NgModule({ imports: [BrowserModule], declarations: [ AppComponent ], bootstrap: [AppComponent], providers: [ MenuComponent, appRouterProviders, HTTP_PROVIDERS ] }) export class AppModule { } </code></pre> <p>menu.component.ts</p> <pre class="lang-js prettyprint-override"><code>import { Component } from '@angular/core'; import { ROUTER_DIRECTIVES } from '@angular/router'; export class MenuItem { name: string; path: string; } @Component({ selector: 'component-menu', template: ` &lt;ul&gt; &lt;li *ngFor="let item of menuItems"&gt;&lt;a [routerLink]="[item.path]"&gt;{{item.name}}&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; ` }) export class MenuComponent { public menuItems: Array&lt;MenuItem&gt;; constructor() { } } </code></pre> <p>home.component.ts</p> <pre class="lang-js prettyprint-override"><code>import { Component, OnInit } from '@angular/core'; import { MenuComponent, MenuItem } from './menu.component'; @Component({ selector: 'app-home', directives: [], template: `&lt;h2&gt;Home Component&lt;/h2&gt; &lt;component-menu&gt;&lt;/component-menu&gt;` }) export class HomeComponent implements OnInit{ private menuItems:Array&lt;MenuItem&gt;; constructor(private menuComponent:MenuComponent) { console.log('Home component ctor'); this.menuItems = [ {name:'Home', path: '/home'}, {name:'Content', path: '/content'} ]; this.menuComponent.menuItems = this.menuItems; } ngOnInit(){ } } </code></pre>
0
java.lang.SecurityException: MODE_WORLD_READABLE no longer supported
<p>The exception only occurs in Android 7.0 Nougat (emulator) devices.</p> <blockquote> <p>java.lang.SecurityException: MODE_WORLD_READABLE no longer supported</p> </blockquote> <p>My code:</p> <pre><code>public void SessionMaintainence(Context context) { this.context = context; preferences = context.getSharedPreferences(PREF_NAME, Context.MODE_WORLD_READABLE); editor = preferences.edit(); editor.commit(); } </code></pre> <p>LogCat:</p> <pre><code>&gt; E/AndroidRuntime: FATAL EXCEPTION: main &gt; Process: burpp.av.feedback, PID: 2796 &gt; java.lang.RuntimeException: Unable to create application &gt; burpp.av.feedback.FeedbackApplication: java.lang.SecurityException: &gt; MODE_WORLD_READABLE no longer supported &gt; at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5364) &gt; at android.app.ActivityThread.-wrap2(ActivityThread.java) &gt; at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) &gt; at android.os.Handler.dispatchMessage(Handler.java:102) &gt; at android.os.Looper.loop(Looper.java:154) &gt; at android.app.ActivityThread.main(ActivityThread.java:6077) &gt; at java.lang.reflect.Method.invoke(Native Method) &gt; at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) &gt; at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) &gt; Caused by: java.lang.SecurityException: MODE_WORLD_READABLE no longer supported &gt; at android.app.ContextImpl.checkMode(ContextImpl.java:2162) &gt; at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:363) &gt; at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:358) &gt; at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:164) &gt; at burpp.av.feedback.support.SessionMaintainence.&lt;init&gt;(SessionMaintainence.java:63) &gt; at burpp.av.feedback.FeedbackApplication.onCreate(FeedbackApplication.java:43) &gt; at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024) </code></pre>
0
Object.hasOwnProperty() yields the ESLint 'no-prototype-builtins' error: how to fix?
<p>I am using the following logic to get the i18n string of the given key.</p> <pre><code>export function i18n(key) { if (entries.hasOwnProperty(key)) { return entries[key]; } else if (typeof (Canadarm) !== 'undefined') { try { throw Error(); } catch (e) { Canadarm.error(entries['dataBuildI18nString'] + key, e); } } return entries[key]; } </code></pre> <p>I am using ESLint in my project. I am getting the following error:</p> <blockquote> <p>Do not access Object.prototype method 'hasOwnProperty' from target object. It is a '<em>no-prototype-builtins</em>' error. </p> </blockquote> <p>How do I change my code to resolve this error ? I don't want to disable this rule.</p>
0
Could not load file or assembly 'System.Web.Extensions'
<p>I've been working on this web application for a couple of weeks now. &lt;-- Key information! And everything has been working fine; data goes into the database, etc.</p> <p>It's an ASP.Net 4.0 / C# Web Form.</p> <p>Today, I added a new Web Form page and added a GridView to it. It worked fine.</p> <p>I was editing the columns of the GridView, making some wider for long strings like addresses. It all worked fine. Fine.</p> <p>I wanted to make the "Comments" field wider and multi-line so it displayed nice in the GridView, so I converted it to a "Template Field" and set the Item Control width. When I refreshed the page I got this error:</p> <p>Configuration Error</p> <p>Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. </p> <p>Parser Error Message: Could not load file or assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.</p> <p>Source Error: </p> <p>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.</p> <p>Source File: E:\inetpub\StartupNow\web.config Line: 9 </p> <p>Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.</p> <p>WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].</p> <p>Version Information: Microsoft .NET Framework Version:2.0.50727.5485; ASP.NET Version:2.0.50727.5491</p> <p>-- I get that error on both pages. Even the one I was not working on and worked fine.</p>
0
Protocol "https" not supported or disabled in libcurl
<p>Here's my Podfile content:</p> <pre><code>platform :ios, ‘8.0’ use_frameworks! target 'Project-Name' do pod 'Firebase/Core' pod 'Firebase/Messaging' end </code></pre> <p>Same error occurs while adding <code>pod 'GoogleMaps'</code> into Podfile.</p> <p>Error while running <code>pod install --verbose command</code> on Terminal:</p> <pre><code>[!] Error installing Firebase [!] /usr/local/bin/curl -f -L -o /var/folders/1t/102_4r0x1_3_5dlq8zdbm27r0000gn/T/d20160902-4388-1omozrn/file.tgz https://www.gstatic.com/cpdc/cc5f7aac07ccdd0a/Firebase-3.5.0.tar.gz --create-dirs --netrc-optional curl: (1) Protocol "https" not supported or disabled in libcurl </code></pre> <hr/> <p><strong>Edit 1:</strong> <a href="https://stackoverflow.com/questions/34914473/how-do-i-enable-curl-ssl-on-mac-os-x">How do I enable curl SSL on Mac OS X?</a></p> <p><code>./configure --with-darwinssl</code> not working. </p> <blockquote> <p>-bash: ./configure: No such file or directory</p> </blockquote> <hr/> <p><strong>Edit 2:</strong> <a href="https://stackoverflow.com/questions/19015282/how-do-i-enable-https-support-in-libcurl">How do I enable https support in libcurl?</a></p> <p>This command <code>brew install curl --with-libssh2</code> is executed on terminal, but don't know what to do next:</p> <pre><code>UB:lib aspl$ brew install curl --with-libssh2 --verbose ==&gt; Auto-updated Homebrew! Updated 1 tap (homebrew/core). No changes to formulae. Warning: curl-7.50.1 already installed UB:lib aspl$ curl --version curl 7.48.0 (x86_64-apple-darwin14.5.0) libcurl/7.48.0 zlib/1.2.5 Protocols: dict file ftp gopher http imap ldap ldaps pop3 rtsp smtp telnet tftp Features: IPv6 Largefile libz UnixSockets </code></pre> <p>This command not working:</p> <pre><code>$ otool -L /usr/local/git/libexec/git-core/git-http-push | grep curl /usr/lib/libcurl.4.dylib </code></pre> <blockquote> <p>/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump: '/usr/local/bin/git/libexec/git-core/git-http-push': Not a directory. fatal error: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: internal objdump command failed Binary file /usr/lib/libcurl.4.dylib matches</p> </blockquote> <hr/> <p><strong>Edit:3</strong> Terminal command <code>which git</code> shows <code>/usr/local/bin/git</code></p> <hr/> <p><strong>Edit:4</strong> <a href="http://naleid.com/blog/2009/03/16/enabling-https-support-in-curl-installed-through-macports-on-osx" rel="nofollow noreferrer">Enabling HTTPS Support in Curl Installed Through MacPorts on OSX</a></p> <p>Running either <code>sudo port install curl +ssl</code> or <code>sudo port uninstall curl</code> says: </p> <blockquote> <p>sudo: port: command not found</p> </blockquote> <p>And to install ports(MacPorts) following link is used, which again is an <strong>HTTPS</strong> link:</p> <p><code>$ curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.3.4.tar.bz2</code></p> <p>There also a download option of MacPort folder?</p> <p>But what to do with that downloaded<code>MacPorts-2.3.4</code> folder?</p> <p><strong>EDIT 5:</strong> Force uninstall curl and installing again didn't work :(</p> <pre><code>$ brew uninstall curl Uninstalling /usr/local/Cellar/curl/7.50.1... (366 files, 2.6M) curl 7.46.0 is still installed. Remove them all with `brew uninstall --force curl`. $ brew uninstall --force curl Uninstalling curl... (360 files, 2.6M) $ brew install curl --with-libssh2 --verbose Error: curl 7.50.2 did not build Logs: /Users/aspl/Library/Logs/Homebrew/curl/01.configure /Users/aspl/Library/Logs/Homebrew/curl/01.configure.cc /Users/aspl/Library/Logs/Homebrew/curl/02.make /Users/aspl/Library/Logs/Homebrew/curl/config.log These open issues may also help: curl: migrate to [email protected] https://github.com/Homebrew/homebrew-core/pull/4591 </code></pre>
0
Using junit test to pass command line argument to Spring Boot application
<p>I have a very basic Spring Boot application, which is expecting an argument from command line, and without it doesn't work. Here is the code.</p> <pre><code>@SpringBootApplication public class Application implements CommandLineRunner { private static final Logger log = LoggerFactory.getLogger(Application.class); @Autowired private Reader reader; @Autowired private Writer writer; public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Override public void run(String... args) throws Exception { Assert.notEmpty(args); List&lt;&gt; cities = reader.get("Berlin"); writer.write(cities); } } </code></pre> <p>Here is my JUnit test class.</p> <pre><code>@RunWith(SpringRunner.class) @SpringBootTest public class CityApplicationTests { @Test public void contextLoads() { } } </code></pre> <p>Now, <code>Assert.notEmpty()</code> mandates for passing an argument. However, now, I am writing JUnit test for the same. But, I get following exception raise from the <code>Assert</code>.</p> <pre><code>2016-08-25 16:59:38.714 ERROR 9734 --- [ main] o.s.boot.SpringApplication : Application startup failed java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:801) ~[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:782) ~[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:769) ~[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:111) [spring-boot-test-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.boot.test.autoconfigure.AutoConfigureReportTestExecutionListener.prepareTestInstance(AutoConfigureReportTestExecutionListener.java:46) [spring-boot-test-autoconfigure-1.4.0.RELEASE.jar:1.4.0.RELEASE] at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12] at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12] at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) [spring-test-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) [.cp/:na] at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na] at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) [.cp/:na] at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) [.cp/:na] at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) [.cp/:na] at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) [.cp/:na] Caused by: java.lang.IllegalArgumentException: [Assertion failed] - this array must not be empty: it must contain at least 1 element at org.springframework.util.Assert.notEmpty(Assert.java:222) ~[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.util.Assert.notEmpty(Assert.java:234) ~[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE] at com.deepakshakya.dev.Application.run(Application.java:33) ~[classes/:na] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:798) ~[spring-boot-1.4.0.RELEASE.jar:1.4.0.RELEASE] ... 32 common frames omitted </code></pre> <p>Any idea, how to pass the parameter?</p>
0
str.startswith using Regex
<p>Can i understand why the str.startswith() is not dealing with Regex :</p> <pre><code> col1 0 country 1 Country i.e : df.col1.str.startswith('(C|c)ountry') </code></pre> <p>it returns all the values False :</p> <pre><code> col1 0 False 1 False </code></pre>
0
How to calculate sum of two polynomials?
<p>For instance 3x^4 - 17x^2 - 3x + 5. Each term of the polynomial can be represented as a pair of integers (coefficient,exponent). The polynomial itself is then a list of such pairs like<br> <code>[(3,4), (-17,2), (-3,1), (5,0)]</code> for the polynomial as shown.</p> <p>Zero polynomial, 0, is represented as the empty list <code>[]</code>, since it has no terms with nonzero coefficients.</p> <p>I want to write two functions to add and multiply two input polynomials with the same representation of tuple (coefficient, exponent):</p> <ol> <li><code>addpoly(p1, p2)</code></li> <li><code>multpoly(p1, p2)</code></li> </ol> <p>Test Cases:</p> <ul> <li><p><code>addpoly([(4,3),(3,0)], [(-4,3),(2,1)])</code> <br> should give <code>[(2, 1),(3, 0)]</code></p></li> <li><p><code>addpoly([(2,1)],[(-2,1)])</code> <br> should give <code>[]</code></p></li> <li><p><code>multpoly([(1,1),(-1,0)], [(1,2),(1,1),(1,0)])</code> <br> should give <code>[(1, 3),(-1, 0)]</code></p></li> </ul> <p>Here is something that I started with but got completely struck!</p> <pre><code>def addpoly(p1, p2): (coeff1, exp1) = p1 (coeff2, exp2) = p2 if exp1 == exp2: coeff3 = coeff1 + coeff2 </code></pre>
0
IntelliJ IDEA - Address localhost:1099 is already in use
<p>I try to launch a web application with IntelliJ IDEA, but I get an error: <code>localhost:1099 already in use</code>.</p> <p><img src="https://i.stack.imgur.com/BOR1F.png" alt="port 1099 is already in use"></p> <p>I checked the port 1099 with <code>lsof -i:1099</code> and many other relative commands, so I'm pretty sure the port 1099 is free.</p> <p>This is my running configuration:</p> <p><img src="https://i.stack.imgur.com/nfh7R.png" alt="configs"></p> <p>I've also changed the <code>JMX port</code> to 6666 &amp; 6667 &amp; 6668... and it doesn't work, so I think it's not really related to the port itself.</p> <p>I am so confused... did anyone else have this problem? </p> <p>Any help is appreciated</p>
0
How to alert the value of textbox
<p>I am trying to alert the value one of textbox of form in JavaScript but its not working and my other forms have same code of JavaScript they are working fine. I have spent lot of time to fix this issue but not succeed.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;script&gt; function call(){ var siv=document.getElementById("siv")‌​.value; alert(siv); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="alm" action="#" method="post" onSubmit="call();"&gt; &lt;label&gt;Province: &lt;/label&gt;&lt;br&gt; &lt;select name="ProvinceDropDown" id="ProvinceDropDown"&gt; &lt;option value="SelectProvince"&gt; Please Select &lt;/option&gt; &lt;option value="Sindh" selected='selected'&gt; Sindh &lt;/option&gt; &lt;/select&gt; &lt;input type="text" value="" id="siv" name="siv"&gt; &lt;input type="submit" value="submit" &gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
0
C# How To Separate Login For Admin And User
<p>So basically Admin and User goes to different windows, here's the code</p> <pre><code>private void cmdEnter_Click(object sender, EventArgs e) { if (txtUsername.Text == "" &amp;&amp; txtPassword.Text == "") //Error when all text box are not fill { MessageBox.Show("Unable to fill Username and Password", "Error Message!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtUsername.Text == "") //Error when all text box are not fill { MessageBox.Show("Unable to fill Username", "Error Message!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (txtPassword.Text == "") //Error when all text box are not fill { MessageBox.Show("Unable to fill Password", "Error Message!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { try { string myConnection = "datasource=localhost;port=3306;username=root"; MySqlConnection myConn = new MySqlConnection(myConnection); MySqlCommand SelectCommand = new MySqlCommand("select * from boardinghousedb.employee_table where username='" + this.txtUsername.Text + "' and password='" + this.txtPassword.Text + "' ;", myConn); MySqlDataReader myReader; myConn.Open(); myReader = SelectCommand.ExecuteReader(); int count = 0; while (myReader.Read()) { count = count + 1; } if (count == 1) { MessageBox.Show("Username and Password . . . is Correct", "Confirmation Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); this.Hide(); Menu mm = new Menu(); mm.ShowDialog(); } else if (count &gt; 1) { MessageBox.Show("Duplicate Username and Password . . . Access Denied", "Error Message!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Username and Password is Not Correct . . . Please try again", "Error Message!", MessageBoxButtons.OK, MessageBoxIcon.Error); myConn.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } } </code></pre> <p>but I don't know how, other tutorials talks about local database but I'm using MySQL<a href="http://i.stack.imgur.com/6Ehd9.png" rel="nofollow">Here is the employee table, title=admin or user </a></p>
0
React-native: Images not showing in android device; but shows perfectly in emulator
<p>I am working on a sample react native project. And almost all features except the <code>&lt;Image source=''/&gt;</code> work well with it. The image shows well in android emulator supplied with android studio and genymotion, but does not work on any real devices (moto G3 turbo, nexus 5, galaxy s4 etc...). I don't know what went wrong with my code. Here is my code </p> <pre><code>import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View, Image } from 'react-native'; class ImageTester extends Component { render() { return ( &lt;View style={styles.container}&gt; &lt;Text style={styles.welcome}&gt; Welcome to React Native! &lt;/Text&gt; &lt;Text style={styles.instructions}&gt; To get started, edit index.android.js &lt;/Text&gt; &lt;Text style={styles.instructions}&gt; Double tap R on your keyboard to reload,{'\n'} Shake or press menu button for dev menu &lt;/Text&gt; &lt;Image source={require('./img/first_image.png')}&gt;&lt;/Image&gt; &lt;/View&gt; ); } } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, }, }); AppRegistry.registerComponent('ImageTester', () =&gt; ImageTester); </code></pre> <p>project structure:</p> <p><a href="https://i.stack.imgur.com/qpVCP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qpVCP.png" alt="enter image description here"></a></p> <p>React-native version : react-native: 0.32.1</p>
0
Android popup window not filling screen size?
<p>I am trying to make a simple pop up window. But every time I make one, it ends up being super small...and not the length I want it to be. This is how the pop up looks: <a href="https://i.stack.imgur.com/ijdKCl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ijdKCl.png" alt="enter image description here"></a></p> <p>Here is my layout for the pop up:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/popup_element" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#444444" android:padding="10px" android:orientation="vertical"&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:text="Transfering data" android:textColor="@color/white"/&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="Status" android:textColor="@color/white"/&gt; &lt;TextView android:id="@+id/server_status_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Awaiting answer..." android:paddingLeft="10sp" android:textColor="@color/white"/&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:gravity="center_horizontal|bottom"&gt; &lt;Button android:id="@+id/end_data_send_button" android:layout_width="100dp" android:layout_height="100dp" android:drawablePadding="3sp" android:layout_centerHorizontal="true" android:text="Cancel" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Here is my java code:</p> <pre><code>private PopupWindow pw; private void bindActivity() { fabButton = (ImageButton) findViewById(R.id.activity_profileView_FAB); fabButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { initiatePopupWindow(); } }); } private void initiatePopupWindow() { try { //We need to get the instance of the LayoutInflater, use the context of this activity LayoutInflater inflater = (LayoutInflater) ProfileView.this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); //Inflate the view from a predefined XML layout View layout = inflater.inflate(R.layout.popup, (ViewGroup) findViewById(R.id.popup_element)); // create a 300px width and 470px height PopupWindow pw = new PopupWindow(layout, 300, 470, true); // display the popup in the center pw.showAtLocation(layout, Gravity.CENTER, 0, 0); TextView mResultText = (TextView) layout.findViewById(R.id.server_status_text); Button cancelButton = (Button) layout.findViewById(R.id.end_data_send_button); cancelButton.setOnClickListener(cancel_button_click_listener); } catch (Exception e) { e.printStackTrace(); } } private View.OnClickListener cancel_button_click_listener = new View.OnClickListener() { public void onClick(View v) { pw.dismiss(); } }; </code></pre> <p>Cant figure out why its not working... How would I get the size I want?</p>
0
Setting hidden datalist option values
<p>In the snippet below, I have two methods to choose an item: input with datalist and traditional select with options.</p> <p>The select element keeps the option values hidden, and we're still able to get it with <code>this.value</code>. However, with the datalist, the value is actually displayed and the text content of the option is displayed as a secondary label.</p> <p>What I'd like is to have the input+datalist approach behave like a traditional select, where "Foo" and "Bar" are shown as options that when selected have values of "1" and "2" respectively.</p> <p>I've also added a repeated name "Foo" with value "3". This is to show that any solution must not depend on unique options.</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-html lang-html prettyprint-override"><code>&lt;input list="options" onchange="console.log(this.value)"/&gt; &lt;datalist id="options"&gt; &lt;option value="1"&gt;Foo&lt;/option&gt; &lt;option value="2"&gt;Bar&lt;/option&gt; &lt;option value="3"&gt;Foo&lt;/option&gt; &lt;/datalist&gt; &lt;select onchange="console.log(this.value)"&gt; &lt;option value=""&gt;&lt;/option&gt; &lt;option value="1"&gt;Foo&lt;/option&gt; &lt;option value="2"&gt;Bar&lt;/option&gt; &lt;option value="3"&gt;Foo&lt;/option&gt; &lt;/select&gt;</code></pre> </div> </div> </p>
0
hasNext() for ES6 Generator
<p>How would I implement hasNext() method for a generator. I have tried many options like adding the generator as a return statement and yielding from the closure. Getting the first value printing it and then using the while etc, but none of them actually worked. </p> <p>I know I can use for of or while like <a href="https://stackoverflow.com/questions/34333852/how-to-loop-the-javascript-iterator-that-comes-from-generator">How to loop the JavaScript iterator that comes from generator?</a> but still wondering if I can add hasNext(). </p> <pre><code>function *range(start,end){ while(start &lt; end){ yield start; start++ } } let iterator = range(1,10); // so I can do something like this. while(iterator.hasNext()){ console.log(iterator.next().value); } </code></pre>
0
Predicted vs. Actual plot
<p>I'm new to R and statistics and haven't been able to figure out how one would go about plotting predicted values vs. Actual values after running a multiple linear regression. I have come across similar questions (just haven't been able to understand the code). I would greatly appreciate it if you explain the code. This is what I have done so far:</p> <pre><code># Attach file containing variables and responses q &lt;- read.csv("C:/Users/A/Documents/Design.csv") attach(q) # Run a linear regression model &lt;- lm(qo~P+P1+P4+I) # Summary of linear regression results summary(model) </code></pre> <p>The plot of predicted vs. actual is so I can graphically see how well my regression fits on my actual data.</p>
0
Unable to calculate MD5 : AWS S3 bucket
<p>I have my application hosted on AWS, Elastic Beanstalk - Tomcat 6. My data files are stored in an S3 bucket. When I am hosting my application on local server on my machine , I am able to read and write data to my S3 bucket (using via SDK), but from the application hosted on Elastic Beanstalk the writing operation is showing an error i.e on Elastic Beanstalk Tomcat. I am getting below error:</p> <blockquote> <p>com.amazonaws.AmazonClientExceptio­n: Unable to calculate MD5 hash: visitorsinfo.json (No such file or directory)</p> </blockquote> <p>I do have visitorsinfo.json in my S3 bucket which is successfully accessible from my local server in my machine, but not accessible from Elastic Beanstalk..</p>
0
What is Interface.super
<p>I have recently used default methods in java. In its implementation I found </p> <pre><code>public interface DefaultMethod { default String showMyName(String name){ return "Hai "+name; } } public class DefaultMethodMainImpl implements DefaultMethod{ @Override public String showMyName(String name){ return DefaultMethod.super.showMyName(name); } } </code></pre> <p>My question is in <strong>DefaultMethod.super</strong> where <strong>super</strong> will call it have no super class except Object? <strong>what super will return</strong>?</p>
0
Clear localStorage on tab/browser close but not on refresh
<p>Is there a way to detect tab close event to clear the <code>localStorage</code>. I need <code>localStorage</code> to share data across tabs. <code>window.onbeforeunload</code> event works fine but it has 2 issues for me:</p> <ol> <li>It also fires on page refresh which I dont want. </li> <li>I don't need confirm box on tab close.</li> </ol> <p>Like when window is closed the <code>sessionStorage</code> is cleared. At same time I can clear <code>localStorage</code> but don't know what event to bind to. I checked a few questions already available but none seems to address this issue there are workarounds by using flags for click on links and form submits but not a clean way to do it. Kindly suggest any solution for this. </p>
0
SQL Error: 904, SQLState: 42000 ORA-00904: : invalid identifier
<p>Can below scenario of duplicate alias lead to an error when executed from JDBC or hibernate:</p> <blockquote> <p>SQL Error: 904, SQLState: 42000 ORA-00904: : invalid identifier</p> </blockquote> <pre><code>select * From table_master VW LEFT OUTER JOIN TABLE(test_func(1, 300)) vw ON VW.table_key = vw.function_key </code></pre> <p>Facing this in production only. It works fine in test environment.</p>
0
OS X 10.11.6 El Capitan SSLRead() return error -9841
<p>After curl request in terminal to https website i had this error </p> <pre><code>curl: (56) SSLRead() return error -9841 </code></pre> <p>curl --version</p> <pre><code>curl 7.43.0 (x86_64-apple-darwin15.0) libcurl/7.43.0 SecureTransport zlib/1.2.5 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets </code></pre> <p>How to make curl work?</p> <p>P.S I reinstalled curl by this command <code>brew install --with-openssl curl</code></p>
0
Spark on Amazon EMR: "Timeout waiting for connection from pool"
<p>I'm running a Spark job on a small three server Amazon EMR 5 (Spark 2.0) cluster. My job runs for an hour or so, fails with the error below. I can manually restart and it works, processes more data, and eventually fails again.</p> <p>My Spark code is fairly simple and is not using any Amazon or S3 APIs directly. My Spark code passes S3 text string paths to Spark and Spark uses S3 internally.</p> <p>My Spark program just does the following in a loop: Load data from S3 -> Process -> Write data to different location on S3. </p> <p>My first suspicion is that some internal Amazon or Spark code is not properly disposing of connections and the connection pool becomes exhausted.</p> <pre><code>com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.AmazonClientException: Unable to execute HTTP request: Timeout waiting for connection from pool at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:618) at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:376) at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:338) at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:287) at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3826) at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3.AmazonS3Client.getObjectMetadata(AmazonS3Client.java:1015) at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.services.s3.AmazonS3Client.getObjectMetadata(AmazonS3Client.java:991) at com.amazon.ws.emr.hadoop.fs.s3n.Jets3tNativeFileSystemStore.retrieveMetadata(Jets3tNativeFileSystemStore.java:212) at sun.reflect.GeneratedMethodAccessor45.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:191) at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102) at com.sun.proxy.$Proxy44.retrieveMetadata(Unknown Source) at com.amazon.ws.emr.hadoop.fs.s3n.S3NativeFileSystem.getFileStatus(S3NativeFileSystem.java:780) at org.apache.hadoop.fs.FileSystem.exists(FileSystem.java:1428) at com.amazon.ws.emr.hadoop.fs.EmrFileSystem.exists(EmrFileSystem.java:313) at org.apache.spark.sql.execution.datasources.InsertIntoHadoopFsRelationCommand.run(InsertIntoHadoopFsRelationCommand.scala:85) at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult$lzycompute(commands.scala:60) at org.apache.spark.sql.execution.command.ExecutedCommandExec.sideEffectResult(commands.scala:58) at org.apache.spark.sql.execution.command.ExecutedCommandExec.doExecute(commands.scala:74) at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:115) at org.apache.spark.sql.execution.SparkPlan$$anonfun$execute$1.apply(SparkPlan.scala:115) at org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:136) at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151) at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:133) at org.apache.spark.sql.execution.SparkPlan.execute(SparkPlan.scala:114) at org.apache.spark.sql.execution.QueryExecution.toRdd$lzycompute(QueryExecution.scala:86) at org.apache.spark.sql.execution.QueryExecution.toRdd(QueryExecution.scala:86) at org.apache.spark.sql.execution.datasources.DataSource.write(DataSource.scala:487) at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:211) at org.apache.spark.sql.DataFrameWriter.save(DataFrameWriter.scala:194) at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:237) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357) at py4j.Gateway.invoke(Gateway.java:280) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:128) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:211) at java.lang.Thread.run(Thread.java:745) Caused by: com.amazon.ws.emr.hadoop.fs.shaded.org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool at com.amazon.ws.emr.hadoop.fs.shaded.org.apache.http.impl.conn.PoolingClientConnectionManager.leaseConnection(PoolingClientConnectionManager.java:226) at com.amazon.ws.emr.hadoop.fs.shaded.org.apache.http.impl.conn.PoolingClientConnectionManager$1.getConnection(PoolingClientConnectionManager.java:195) at sun.reflect.GeneratedMethodAccessor43.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.http.conn.ClientConnectionRequestFactory$Handler.invoke(ClientConnectionRequestFactory.java:70) at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.http.conn.$Proxy45.getConnection(Unknown Source) at com.amazon.ws.emr.hadoop.fs.shaded.org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:423) at com.amazon.ws.emr.hadoop.fs.shaded.org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863) at com.amazon.ws.emr.hadoop.fs.shaded.org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at com.amazon.ws.emr.hadoop.fs.shaded.org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57) at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:837) at com.amazon.ws.emr.hadoop.fs.shaded.com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:607) ... 41 more </code></pre>
0
Undefined reference Json::Value and Json::Reader
<p>When I run the following code:</p> <pre><code>#include &lt;cstdio&gt; #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;cstring&gt; #include &lt;C:\Users\User\Documents\jsoncpp-master\dist\json\json.h&gt; #include &lt;C:\Users\User\Documents\jsoncpp-master\dist\json\json-forwards.h&gt; using namespace std; int main(){ Json::Value root; Json::Reader reader; ifstream file("test.json"); return 0; } </code></pre> <p>I get the following errors:</p> <pre><code>undefined reference to `Json::Reader::Reader()' undefined reference to `Json::Value::Value(Json::ValueType)' </code></pre> <p>I am trying to write a program to read the JSON file and this code also has to output the data in the JSON file to be used by another C++ module.</p> <p>UPDATE</p> <pre><code>#include &lt;cstdio&gt; #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;cstring&gt; #include "dist\jsoncpp.cpp" using namespace std; int main(){ Json::Value root; Json::Reader reader; ifstream file("test.json"); return 0; } </code></pre> <p>I have the changed the code to remove the full link and inserted the dist folder I got after I ran:</p> <pre><code>python amalgamate.py </code></pre> <p>And I entered the header files into C:\MinGW\include</p> <p>I am now getting a lot of errors in the jsoncpp.cpp file (this is the file I got after running the python command and I did not change it at all). All the errors say the same message, which is:</p> <pre><code>first defined here </code></pre>
0
Where to define the maximum number of connections in Postgres?
<p>I want to limit the number of users per database in a multi tenant environment. But there are three levels of max connections and I should be grateful for any advice.</p> <p><strong>Level 1 Entire Server</strong></p> <p>By editing the config for Postgresql I can set the Max connection for the all databases on a server</p> <pre><code>postgresql.conf = max_connections = 100 </code></pre> <p><strong>Level 2 Per database</strong></p> <p>I can select and set the database connection limit per database:</p> <pre><code>SELECT datconnlimit FROM pg_database </code></pre> <p><strong>Level 3 Per role</strong></p> <p>I can select and set the role connection limit per "user":</p> <pre><code>SELECT rolconnlimit FROM pg_roles </code></pre> <p>My questions are </p> <ol> <li><p>If the max_connections in postgresql.conf is 100, will it be max connections of all databases regardless database and role settings? e.g. 100 databases can only have 1 connection each simultaneously?</p></li> <li><p>Where is the best place to limit max connections. At the database level or at the role level?</p></li> <li><p>Anything other to be considered?</p></li> </ol> <p>TIA for any advice or clue!</p>
0
How to get asset file path in Xamarin?
<p>I have <code>data.xlsx</code> file in <code>Assets</code> folder and need to get its path to apply some library.</p> <p>Found several solutions here but neither works for me. For example - <a href="https://stackoverflow.com/questions/21775060/file-not-found-exception-in-xamarin-program">File Not Found Exception In Xamarin program</a></p> <p>I tried to use <code>file:///android_asset/data.xlsx</code> but here is no file too.</p> <p>I checked the path with: <code>System.IO.File.Exists(filePath);</code></p> <p>So how to get path to this file? Maybe I have to place it in different folder?</p> <p><strong>Update</strong>: possibly I can solve it this way: <a href="https://stackoverflow.com/questions/6186866/java-io-filenotfoundexception-this-file-can-not-be-opened-as-a-file-descriptor/33359656#33359656">java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed</a></p> <p>But I can't find where to place it.</p> <p><strong>Update</strong>: this question is about Java and this is unclear how to use this solution in Xamarin.Android: <a href="https://stackoverflow.com/questions/8474821/how-to-get-the-android-path-string-to-a-file-on-assets-folder">How to get the android Path string to a file on Assets folder?</a></p>
0
How to click on button when input type =Button in Selenium Web driver by using Java
<p>How to click on button when input type is button , I am using below code, click on button is working but data is not saved.</p> <pre><code>driver.findElement(By.cssSelector("input[type='button'][value='Save']")).click(); driver.findElement(By.cssSelector("input[@type='button'][@value='Save']")).click(); driver.findElement(By.cssSelector("input[@type='button']")).click(); </code></pre> <p>And below is the development code for your reference:</p> <pre><code>&lt;input id="save_btn_expe" class="edit_forms_save_btn" type="button" value="Save"&gt; </code></pre>
0
Module not found: Error: Can't resolve 'react-bootstrap-validation'
<h2>Issue</h2> <p>I keep getting the following error in webpack</p> <pre><code>Error: Cannot find module 'react-bootstrap-validtion' at Function.Module._resolveFilename (module.js:339:15) at Function.Module._load (module.js:290:25) at Module.require (module.js:367:17) at require (internal/module.js:20:19) </code></pre> <p>Have I referenced or installed the module incorrectly?</p> <p>This is how I've done it following the example in the official website. (<a href="https://www.npmjs.com/package/react-bootstrap-validation" rel="noreferrer">https://www.npmjs.com/package/react-bootstrap-validation</a>)</p> <hr> <h2>Environment</h2> <p>This are the node environment I'm working with</p> <pre><code>npm -v 3.10.7 nvm version v5.11.1 node -v v5.11.1 </code></pre> <hr> <p>This is how I've installed the module</p> <p><code>npm install --save react-bootstrap-validation</code></p> <p> <hr> <h2>React Component</h2> <p>This is how I've implemented my React component</p> <pre><code>import React, {Component} from 'react' import { ButtonInput } from 'react-bootstrap' import { Form } from 'react-bootstrap-validation' export default class LoginForm extends Component { constructor(props) { super(props) this.state = { showModal: false, email: '', password: '' } } _handleValidSubmit(values) {} _handleInvalidSubmit(errors, values) {} render() { return ( &lt;div&gt; &lt;div className="account"&gt; &lt;div className="container"&gt; &lt;div className="page-title"&gt;Login&lt;/div&gt; &lt;div className="page-desc"&gt;Email used at sign up&lt;/div&gt; &lt;Form onValidSubmit={this._handleValidSubmit.bind(this)} onInvalidSubmit={this._handleInvalidSubmit.bind(this)}&gt; &lt;ValidatedInput type="text" label="Email" name="email" validate="required,isEmail" errorHelp={{ required: "Please enter your e-mail", isEmail: "Email is invalid" }} /&gt; &lt;ValidatedInput type="password" label="Password" name="password" validate="required,isLength:6:60" errorHelp={{ required: "Please specify a password", isEmail: "Password must be at least 6 characters" }} /&gt; &lt;ButtonInput type="submit" bsSize="large" bsStyle="primary" value="LOGIN" /&gt; &lt;/Form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; ) } } </code></pre>
0
Copying files to a container with Docker Compose
<p>I have a <code>Dockerfile</code> where I copy an existing directory (with content) to the container which works fine:</p> <p><strong>Dockerfile</strong></p> <pre><code>FROM php:7.0-apache COPY Frontend/ /var/www/html/aw3somevideo/ COPY Frontend/ /var/www/html/ RUN ls -al /var/www/html RUN chown -R www-data:www-data /var/www/html RUN chmod -R 755 /var/www/html </code></pre> <p><a href="https://i.stack.imgur.com/AXF1s.png" rel="noreferrer"><img src="https://i.stack.imgur.com/AXF1s.png" alt="Screenshot of directory listing with docker exec"></a></p> <p>But when I use a <code>docker-compose.yml</code> file there is only the directory <code>aw3somevideo</code> and inside <code>aw3somevideo</code> there is nothing.</p> <p><strong>docker-compose.yml</strong>:</p> <pre><code> php: build: php/ volumes: - ./Frontend/ :/var/www/html/ - ./Frontend/index.php :/var/www/html/ ports: - 8100:80 </code></pre> <p><a href="https://i.stack.imgur.com/TyMEq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TyMEq.png" alt="Screenshot of empty directory listing"></a></p> <p>Maybe I do not understand the function of <code>volumes</code> and if that's the case please tell me how to copy my existing files to the container via a <code>docker-compose.yml</code> file.</p>
0
Where are files stored when running ng serve?
<p>When I run <code>ng serve</code>, where are the files generated and stored? I need to troubleshoot why the app works with <code>ng serve</code> but not for production build.</p> <p>Forgot to mention that I'm using webpack version of angular-cli.</p>
0
Disable Chrome strict MIME type checking
<p>Is there any way to disable <code>strict MIME type checking</code> in Chrome.</p> <p>Actually I'm making a JSONP request on cross domain. Its working fine on Firefox but, while using chrome its giving some error in console.</p> <blockquote> <p>Refused to execute script from '<a href="https://example.com" rel="noreferrer">https://example.com</a>' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.</p> </blockquote> <p>Its working perfectly in Mozilla.. Issue is arising in chrome only</p> <p>Here are the response Headers of the request..</p> <pre><code>Cache-Control:no-cache, no-store Connection:Keep-Alive Content-Length:29303 Content-Type:text/plain;charset=ISO-8859-1 Date: xxxx Expires:-1 Keep-Alive:timeout=5 max-age:Thu, 01 Jan 1970 00:00:00 GMT pragma:no-cache Set-Cookie:xxxx Strict-Transport-Security: max-age=31536000; includeSubDomains X-Content-Type-Options:nosniff X-Frame-Options:SAMEORIGIN </code></pre> <p><strong>Workaround what i think</strong> : Externally setting content-type to <code>application/javascript</code> </p>
0
Debugger times out at "Collecting data..."
<p>I am debugging a Python (<code>3.5</code>) program with PyCharm (<code>PyCharm Community Edition 2016.2.2 ; Build #PC-162.1812.1, built on August 16, 2016 ; JRE: 1.8.0_76-release-b216 x86 ; JVM: OpenJDK Server VM by JetBrains s.r.o</code>) on Windows 10.</p> <p><strong>The problem: when stopped at some breakpoints, the Debugger window is stuck at "Collecting data", which eventually timeout.</strong> (with <em>Unable to display frame variables</em>)</p> <p>The data to be displayed is neither special, nor particularly large. It is somehow available to PyCharm since a conditional break point on some values of the said data works fine (the program breaks) -- it looks like the process to gather it for display only (as opposed to operational purposes) fails.</p> <p>When I step into a function around the place I have my breakpoint, its data is displayed correctly. When I go up the stack (to the calling function, the one I stepped down from and where I wanted initially to have the breakpoint) - I am stuck with the "Collecting data" timeout again.</p> <p>There have been numerous issues raised with the same point since at least 2005. Some were fixed, some not. The fixes were usually updates to the latest version (which I have).</p> <p><strong>Is there a general direction I can go to in order to fix or work around this family of problems?</strong></p> <hr> <p>EDIT: a year later the problem is still there and there is still no reaction from the devs/support after the bug was raised.</p> <hr> <p><strong>EDIT April 2018: It looks like the problem is solved in the 2018.1 version</strong>, the following code which was hanging when setting a breakpoint on the <code>print</code> line now works (I can see the variables):</p> <pre><code>import threading def worker(): a = 3 print('hello') threading.Thread(target=worker).start() </code></pre>
0
How to pass command line options to the emulator in Android Studio?
<p>I use Android Studio 2.1.3. When I run an Android app I pick an AVD, where can I pass command line options such as <code>-http-proxy</code>? I don't even find a way in the run configuration.</p>
0
How to reference control names dynamically in MS Access
<p>I have the following code in an MS Access Form object. </p> <pre><code>Private Sub UpdatePMText(sLang As String) 'Used to pass both Mandate and Language Info to called Sub that will execute the queries Dim iMandate As Integer 'Check if there is text in the box. If Me.Controls("txtInput_PM_" &amp; sLang &amp; "_DRAFT") = Null Or Me.Controls("txtInput_PM_" &amp; sLang &amp; "_DRAFT") = "" Then MsgBox ("There is no text in the " &amp; sLang &amp; " DRAFT Field." &amp; vbNewLine &amp; "The operation will not be executed.") Exit Sub End If iMandate = Me.txtMandateID Call modUpdateText.macro_PMText(iMandate, sLang) End Sub </code></pre> <p>If I refer to the Controls directly and simply type out the names of the forms, for example <code>txtInput_PM_EN_DRAFT</code> then the code works as intended.</p> <p>The error message I get is that Access can't find the "Field" I'm referring to when I am on the first <code>IF</code> statement line. I have tried changing the <code>.Controls</code> to <code>.Fields</code> but that didn't work either.</p> <p>I do not want to repeat the same code for every language I need to run. How do I reference control names dynamically in MS Access? What am I missing?</p>
0
Android install apk with Intent.VIEW_ACTION not working with File provider
<p>My app has an auto-update feature that download an APK and when the download is finished that a Intent.VIEW_ACTION to open the app and let the user install the downloaded apk</p> <pre><code>Uri uri = Uri.parse(&quot;file://&quot; + destination); Intent install = new Intent(Intent.ACTION_VIEW); install.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); install.setDataAndType(uri, manager.getMimeTypeForDownloadedFile(downloadId)); activity.startActivity(install); </code></pre> <p>This works great for all the device &lt; 24</p> <p>Now with Android 24 apparently we are not allowed any more to start intents with file:/// and after some googling it was advised to use A File Provider</p> <p>new code:</p> <pre><code>Intent install = new Intent(Intent.ACTION_VIEW); install.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); install.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); Uri apkUri = FileProvider.getUriForFile(AutoUpdate.this, BuildConfig.APPLICATION_ID + &quot;.provider&quot;, file); install.setDataAndType(apkUri, manager.getMimeTypeForDownloadedFile(downloadId)); activity.startActivity(install); </code></pre> <p>Now activity.startActivity(install); throws an error</p> <blockquote> <p>No Activity found to handle Intent { act=android.intent.action.VIEW dat=content://com.xxxx.xx.provider/MyFolder/Download/MyApkFile.apk typ=application/vnd.android.package-archive flg=0x4000000 }</p> </blockquote> <p>Is there any way I can open the APK viewer in Android 7 (24) ?</p>
0
Error installing XAMPP: Windows cannot find -n
<p>I've been trying to install XAMPP for quite some time now, but every time, at the end of the installation, it says:</p> <blockquote> <p>Windows cannot find "-n"</p> </blockquote> <p>And after that, it says:</p> <blockquote> <p>Problem running post-install step. Installation failed (php.exe) Perhaps you have to install Visual C++ 2008 package.</p> </blockquote> <p>I have Visual C++ 2008 package and it still says this. What do I do now? I have Windows 10 64-bit for anyone wondering.</p>
0
Mysterious White Space at bottom of Web Page in Mobile-Chrome
<p>I've looked at many "mysterious white-space at bottom of page" issues here on SO, and played with the <code>viewport</code>tag many times, but I still cannot figure out what I'm doing wrong!</p> <p>The page in question is: <a href="http://www.seniorchoicesunl.com/error_documents/error401.php" rel="noreferrer">http://www.seniorchoicesunl.com/error_documents/error401.php</a></p> <p>Here's what it looks like on mobile from Chrome Dev Tools:<a href="https://i.stack.imgur.com/Y6CmM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Y6CmM.png" alt="enter image description here"></a></p> <p>Any Ideas on what I'm doing wrong?</p> <p>Edit:</p> <p>setting <em>ANY</em> <code>initial-scale</code> is bad news! It makes the font too tiny! Take a look: <a href="https://i.stack.imgur.com/ObSBp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ObSBp.png" alt="enter image description here"></a></p> <p>The desired mobile look, while keeping the desktop and tablets as-is, is this:</p> <p><a href="https://i.stack.imgur.com/wtPY2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wtPY2.png" alt="enter image description here"></a></p> <p>P.S. Fixing this issue could reciprocally fix other related issues I'm having with other webpages.</p>
0
Pushing Viewcontroller through navigation controller , Showing Black screen
<p>I being searching this issue in stack overflow but couldn't get an exact answer to the issue, i being stuck in it for long time. Mine issue is i'm trying to push a TestViewController through navigation controller. when i click the button the TestViewController is being load with navigation bar and the UIScreen is in black colour.</p> <p>Code of <strong>TestViewController</strong></p> <pre><code>import UIKit class TestViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func viewWillAppear(animated: Bool) { super.viewWillAppear(true) navigationItem.title = "Test page" } } </code></pre> <p>Code of Button </p> <pre><code>@IBAction func secondButtonClicked(sender: AnyObject) { buttonPressedNumber = "Two Clicked" buttonTextColor = UIColor.magentaColor() let a = TestViewController() let b:UIViewController = a as UIViewController navigationController?.pushViewController(b, animated: false) } </code></pre> <p><a href="https://i.stack.imgur.com/udG5k.png" rel="noreferrer"><img src="https://i.stack.imgur.com/udG5k.png" alt="enter image description here"></a></p>
0
Haskell - for loop
<p>if I want to express something like [just a simple example]:</p> <pre><code>int a = 0; for (int x = 0; x &lt; n; x += 1) a = 1 - a; </code></pre> <p>what should I do in Haskell, <em>since it doesn't have variable concept?</em> (maybe wrong, see: <a href="https://stackoverflow.com/questions/993124/does-haskell-have-variables">Does Haskell have variables?</a>)</p>
0
Understanding fetch_assoc()
<p>I am trying to understand how/why fetch_assoc works the way it does. I have the following piece of code: </p> <pre><code>$results = $connectToDb-&gt;fetch("SELECT * FROM customer"); $resultsArray = $results-&gt;fetch_assoc(); print_r($resultsArray); //print_r 1 while($row = $results-&gt;fetch_assoc()){ print_r($row); //print_r 2 } </code></pre> <p>The query returns 3 rows from a table. Why does the 1st print_r return only the 1st row of the queried data but the 2nd print_r returns all 3? How does putting fetch_assoc into a while loop tell it to do the action more than once? I read that fetch_assoc returns either an associative array or NULL but I'm struggling to understand how the while loop "tells" fetch_assoc to fetch the next row, if that makes sense?</p> <p>Thank you.</p>
0
Validating JSON against Swagger API schema
<p>I created an API spec from some JSON files and I am trying to test if the files validate against the API spec. </p> <p>There are some good tools to validate against JSON Schema, but I did not have chance to find a tool to validate against specs created in the Swagger (tool for creating API schema). The only solution I found is generating a client/server in the Swagger-Editor, it is quite cumbersome.</p> <p>Is there already an existing tool to validate JSON against Swagger Schema?</p>
0
remove duplicate values of one column by sql query
<p>I have a table with two column, values of one column is null and another column have many duplicated values and blanks. how can I remove duplicated values and blanks from that column by a query?</p>
0
Firebase hosting using custom domain has SSL cert pointing to firebase.com
<p>I am able to complete the <a href="https://firebase.google.com/docs/hosting/custom-domain" rel="nofollow noreferrer">connect to custom domain</a> step successfully and <code>https://example.com</code> is correctly loading my static file app which is hosted on Firebase.</p> <p>However, browser is warning about the site's SSL certificate is not matching <code>example.com</code>. I looked at the certificate and it is of <code>firebase.com</code>, not <code>example.com</code>.</p> <p>This certificate is provided by Firebase for <code>example.com</code> (my custom domain name) and I expect it to be matching it. Is this expected?</p> <p>I know the other solution is to get my own certificate for <code>example.com</code>. However, it seems that Firebase won't let me deploy my own cert.</p> <h2>Update</h2> <p>I retried it some time back and it is fixed. And the whole suite of Firebase db/functions and corresponding sdk/cli are working really well. Great for small dev team.</p>
0
angular 2 - show error message for any exception
<p>I'm trying to do the following in Angular 2 (typescript): For each error (especially errors from the backend server) - present the error to the user (in the UI) - in the main component (mainly since I do't want to write same code in each component).</p> <p>Is it a simple way to do it? I guess what I need is a way to set an "error" member in the main component? How do I do it if I override ExceptionHandler?</p> <p>thanx, Pavel.</p>
0
Datatables + PHP: Server-Side Processing on Multiple Tables
<p><strong>How can I get Datatables <em>Server-Side Processing</em> script to work with a custom query? I need to select columns from multiple tables and have Datatables render them.</strong></p> <p>Datatables.net's Server-Side Processing (SSP) with PHP is summarized here: <a href="https://datatables.net/examples/server_side/simple.html" rel="noreferrer">https://datatables.net/examples/server_side/simple.html</a></p> <p>I found this <a href="https://stackoverflow.com/questions/9870154/datatables-server-side-processing-inner-join-or-multiple-tables">SO question</a>, but the original poster never provided his solution. I don't have sufficient reputation to ask him to provide more detail.</p> <p>Here is my raw SQL without using Datatable's SSP</p> <pre><code>SELECT tbl_houses.style, tbl_houses.roomCount, tbl_residents.firstName, tbl_residents.lastName FROM tbl_houses, tbl_residents WHERE tbl_houses.houseID = tbl_residents.residentID /* * # Equivalent query using JOIN suggested by @KumarRakesh * # Note: JOIN ... ON is a synonym for INNER JOIN ... ON * # Using JOIN conforms to syntax spec'd by ANSI-92 https://stackoverflow.com/a/894855/946957 * * SELECT tbl_houses.style, tbl_houses.roomCount, tbl_residents.firstName, tbl_residents.lastName * FROM tbl_houses * JOIN tbl_residents ON tbl_houses.houseID = tbl_residents.residentID */ </code></pre> <p>How can I get Datatables to run queries off the above using SSP?</p> <p>It appears <a href="https://github.com/DataTables/DataTables/blob/master/examples/server_side/scripts/server_processing.php#L22" rel="noreferrer">server_processing.php</a> only accepts 1 table and no custom filtering (i.e., <code>WHERE</code> clauses).</p> <pre><code>// DB table to use $table = 'datatables_demo'; // Table's primary key $primaryKey = 'id'; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * If you just want to use the basic configuration for DataTables with PHP * server-side, there is no need to edit below this line. */ require( 'ssp.class.php' ); echo json_encode( SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns ) ); </code></pre> <p>However, <a href="https://github.com/DataTables/DataTables/blob/master/examples/server_side/scripts/ssp.class.php#L199" rel="noreferrer">ssp.class.php</a> <strong>does</strong> support filtering using <code>WHERE</code>. I'm thinking I need to modify <code>ssp.class.php</code> to force in my <code>WHERE</code> clause</p> <p><strong>UPDATE</strong></p> <p>Found a solution. Will post when I have free time.</p>
0
Type 'TimeZone' has no member 'local' in Swift3
<p>I am converting project developed in Swift2.3 to Swift3.0 using Xcode8 Beta4. In which I have method to convert date to string, but it fails to convert it.</p> <pre><code>class func convertDateToString(_ date:Date, dateFormat:String) -&gt; String? { let formatter:DateFormatter = DateFormatter(); formatter.dateFormat = dateFormat; formatter.timeZone = TimeZone.local let str = formatter.string(from: date); return str; } </code></pre> <p><a href="https://i.stack.imgur.com/RSzpf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RSzpf.png" alt="enter image description here"></a></p> <p>Also in documentation there is no member named <code>local</code>.</p> <p>Is there any way to use <code>TimeZone</code> directly ? or we have to use <code>NSTimeZone</code> ?</p>
0
how to properly perform HTTP Post of a JSON object using C# HttpClient?
<p>I have a very simple C# Http Client console app, which needs to do an HTTP POST of a json object to a WebAPI v2. Currently, My app can do the POST using FormUrlEncodedContent:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Net.Http; using System.Net.Http.Headers; using Newtonsoft.Json; using System.Net.Http.Formatting; namespace Client1 { class Program { class Product { public string Name { get; set; } public double Price { get; set; } public string Category { get; set; } } static void Main(string[] args) { RunAsync().Wait(); } static async Task RunAsync() { using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:8888/"); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var content = new FormUrlEncodedContent(new[] { new KeyValuePair&lt;string, string&gt;("Category", "value-1"), new KeyValuePair&lt;string, string&gt;("Name", "value-2") }); var result = client.PostAsync("Incident", content).Result; var r = result; } } } } </code></pre> <p>However, when I try to use JSON in the POST body, I get error 415 - Unsupported media Type:</p> <pre><code>class Product { public string Name { get; set; } public double Price { get; set; } public string Category { get; set; } } var gizmo = new Product() { Name = "Gizmo", Price = 100, Category = "Widget" }; var response = await client.PostAsJsonAsync("api/products", gizmo); </code></pre> <p>Doing explicit JSON serialization does not change the outcome for me:</p> <pre><code>string json = JsonConvert.SerializeObject(product); var response = await client.PostAsJsonAsync("api/products", json); </code></pre> <p>What is the proper way to handle this, and to be able to POST JSON?</p>
0
Laravel Check if Array is empty
<p>I am struggling with displaying some content depending on if an array property does have a value or not. If an article has a title, I want to display the content of the entire article, if not I want to show something else. However, it doesn't work. The code in the else statement is not executed.</p> <p>What's wrong here?</p> <p>My Code is:</p> <pre><code>@foreach($restaurantmenue as $daily) @foreach($daily-&gt;articles as $menue) @if(!empty($menue-&gt;title)) &lt;div class="card card-horizontal"&gt; &lt;div class="row"&gt; &lt;div class="col-md-5"&gt; &lt;div class="image" style="background-image: url({{asset('images/frontend/profile/profileHero.jpg')}}); background-size: cover; background-position: center center;"&gt; &lt;img src="{{asset('images/frontend/profile/profileHero.jpg')}}" alt="..." style="display: none;"&gt; &lt;div class="filter filter-azure"&gt; &lt;button type="button" class="btn btn-neutral btn-round"&gt; &lt;i class="fa fa-heart"&gt;&lt;/i&gt; SMÄCKT MIR &lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="col-md-7"&gt; &lt;div class="content"&gt; &lt;p class="category text-info"&gt; &lt;i class="fa fa-trophy"&gt;&lt;/i&gt; Best of &lt;/p&gt; &lt;a class="card-link" href="#"&gt; &lt;h4 class="title"&gt;{{$menue-&gt;title}} &lt;/h4&gt; &lt;/a&gt; &lt;a class="card-link" href="#"&gt; &lt;p class="description"&gt;{{$menue-&gt;body}}&lt;/p&gt; &lt;br /&gt; {{$menue-&gt;price}} € &lt;/a&gt; &lt;div class="footer"&gt; &lt;div class="stats"&gt; &lt;a class="card-link" href="#"&gt; &lt;i class="fa fa-male"&gt;&lt;/i&gt; {{$restaurant-&gt;name}} &lt;/a&gt; &lt;/div&gt; &lt;div class="stats"&gt; &lt;a class="card-link" href="#"&gt; &lt;i class="fa fa-comments"&gt;&lt;/i&gt; 23 Comments &lt;/a&gt; &lt;/div&gt; &lt;div class="stats"&gt; &lt;a class="card-link" href="#"&gt; &lt;i class="fa fa-heart"&gt;&lt;/i&gt; 231 Likes &lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; @else No Articles for Today @endif @endforeach @endforeach </code></pre>
0
Replace <NA> in a factor column
<p>I want to replace <code>&lt;NA&gt;</code> values in a factors column with a valid value. But I can not find a way. This example is only for demonstration. The original data comes from a foreign csv file I have to deal with.</p> <pre><code>df &lt;- data.frame(a=sample(0:10, size=10, replace=TRUE), b=sample(20:30, size=10, replace=TRUE)) df[df$a==0,'a'] &lt;- NA df$a &lt;- as.factor(df$a) </code></pre> <p>Could look like this</p> <pre><code> a b 1 1 29 2 2 23 3 3 23 4 3 22 5 4 28 6 &lt;NA&gt; 24 7 2 21 8 4 25 9 &lt;NA&gt; 29 10 3 24 </code></pre> <p>Now I want to replace the <code>&lt;NA&gt;</code> values with a number.</p> <pre><code>df[is.na(df$a), 'a'] &lt;- 88 In `[&lt;-.factor`(`*tmp*`, iseq, value = c(88, 88)) : invalid factor level, NA generated </code></pre> <p>I think I missed a fundamental R concept about factors. Am I? I can not understand why it doesn't work. I think <code>invalid factor level</code> means that <code>88</code> is not a valid level in that factor, right? So I have to tell the factor column that there is another level?</p>
0
get value of a checked bootstrap checkbox
<p>I have this HTML form:</p> <pre><code>&lt;div class="animated-switch"&gt; &lt;input id="switch-success" name="switch-success" checked="" type="checkbox"&gt; &lt;label for="switch-success" class="label-success"&gt;&lt;/label&gt; &lt;/div&gt; </code></pre> <p>How i can know if the input is checked or not ?</p> <p>I tried like this but nothing alerted:</p> <pre><code>$(document).on('click','.animated-switch',function(e){ alert($('#switch-success:checked').val() ); }); </code></pre> <p>Here a JSFIDDLE file in order to see my clear example: <a href="https://jsfiddle.net/s2f9q3fv/" rel="noreferrer">https://jsfiddle.net/s2f9q3fv/</a></p>
0
How to resolve attribute error in python
<p>on the begin I'll say that I was looking for the answer but can't find it and sorry for so basic question.I created program with TTS. I created global variable called "list_merge", but most of you said that global variables are BAD. So I decided to put this list in init. PS. ignore whitespaces, they exist only because I copied it here.</p> <p>the error is: AttributeError: 'Ver2ProjectWithTTS' object has no attribute 'list_merge'</p> <pre><code>import json import pyttsx from openpyxl import load_workbook class Ver2ProjectWithTTS(object): def __init__(self): self.read_json_file() self.read_xml_file() self.say_something() self.list_merge = [] def read_json_file(self): with open("json-example.json", 'r') as df: json_data = json.load(df) df.close() for k in json_data['sentences']: text_json = k['text'] speed_json = int(k['speed']) volume_json = float(k['volume']) dict_json = {'text': text_json, 'speed': speed_json, 'volume': volume_json} self.list_merge.append(dict_json) def read_xml_file(self): tree = et.parse('xml-example.xml') root = tree.getroot() for k in range(0, len(root)): text_xml = root[k][0].text speed_xml = int(root[k][1].text) volume_xml = float(root[k][2].text) dict_xml = {'text': text_xml, 'speed': speed_xml, 'volume': volume_xml} self.list_merge.append(dict_xml) def say_something(self): for item in self.list_merge: engine = pyttsx.init() engine.getProperty('rate') engine.getProperty('volume') engine.setProperty('rate', item['speed']) engine.setProperty('volume', item['volume']) engine.say(cleared_text) engine.runAndWait() if __name__ == '__main__': a = Ver2ProjectWithTTS() </code></pre> <p>I'm getting AttributeError: 'Ver2ProjectWithTTS' object has no attribute 'list_merge'</p> <p>Any ideas how to avoid this error? Well i'm not good in objectivity and I just cant move on without fixing this. PS. with global variable before init def it worked properly. Thanks for help :)</p>
0
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/spark/Logging
<p>I'm new to Spark. I attempted to run a Spark app (.jar) on CDH 5.8.0-0 on Oracle VirtualBox 5.1.4r110228 which leveraged Spark Steaming to perform sentiment analysis on twitter. I have my twitter account created and all required (4) tokens were generated. I was blocked by the <code>NoClassDefFoundError</code> exception. </p> <p>I've been googling around for a couple of days. The best advice I found so far was in the URL below but apparently my environment is still missing something.</p> <p><a href="http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html#ixzz4Ia99dsp0" rel="noreferrer">http://javarevisited.blogspot.com/2011/06/noclassdeffounderror-exception-in.html#ixzz4Ia99dsp0</a> </p> <p>What does it mean by a library showed up in Compile by was missing at RunTime? How can we fix this?</p> <p>What is the library of Logging? I came across an article stating this Logging is subject to be deprecated. Besides that, I do see log4j in my environment.</p> <p>In my CDH 5.8, I'm running these versions of software: Spark-2.0.0-bin-hadoop2.7 / spark-core_2.10-2.0.0 jdk-8u101-linux-x64 / jre-bu101-linux-x64</p> <p>I appended the detail of the exception at the end. Here is the procedure I performed to execute the app and some verification I did after hitting the exception:</p> <ol> <li>Unzip twitter-streaming.zip (the Spark app)</li> <li>cd twitter-streaming</li> <li>run ./sbt/sbt assembly</li> <li>Update env.sh with your Twitter account</li> </ol> <p>$ cat env.sh</p> <pre><code>export SPARK_HOME=/home/cloudera/spark-2.0.0-bin-hadoop2.7 export CONSUMER_KEY=&lt;my_consumer_key&gt; export CONSUMER_SECRET=&lt;my_consumer_secret&gt; export ACCESS_TOKEN=&lt;my_twitterapp_access_token&gt; export ACCESS_TOKEN_SECRET=&lt;my_twitterapp_access_token&gt; </code></pre> <p>The submit.sh script wrapped up the spark-submit command with required credential info in env.sh:</p> <p>$ cat submit.sh</p> <pre><code>source ./env.sh $SPARK_HOME/bin/spark-submit --class "TwitterStreamingApp" --master local[*] ./target/scala-2.10/twitter-streaming-assembly-1.0.jar $CONSUMER_KEY $CONSUMER_SECRET $ACCESS_TOKEN $ACCESS_TOKEN_SECRET </code></pre> <p>The log of the assembly process: [cloudera@quickstart twitter-streaming]$ ./sbt/sbt assembly</p> <pre><code>Launching sbt from sbt/sbt-launch-0.13.7.jar [info] Loading project definition from /home/cloudera/workspace/twitter-streaming/project [info] Set current project to twitter-streaming (in build file:/home/cloudera/workspace/twitter-streaming/) [info] Including: twitter4j-stream-3.0.3.jar [info] Including: twitter4j-core-3.0.3.jar [info] Including: scala-library.jar [info] Including: unused-1.0.0.jar [info] Including: spark-streaming-twitter_2.10-1.4.1.jar [info] Checking every *.class/*.jar file's SHA-1. [info] Merging files... [warn] Merging 'META-INF/LICENSE.txt' with strategy 'first' [warn] Merging 'META-INF/MANIFEST.MF' with strategy 'discard' [warn] Merging 'META-INF/maven/org.spark-project.spark/unused/pom.properties' with strategy 'first' [warn] Merging 'META-INF/maven/org.spark-project.spark/unused/pom.xml' with strategy 'first' [warn] Merging 'log4j.properties' with strategy 'discard' [warn] Merging 'org/apache/spark/unused/UnusedStubClass.class' with strategy 'first' [warn] Strategy 'discard' was applied to 2 files [warn] Strategy 'first' was applied to 4 files [info] SHA-1: 69146d6fdecc2a97e346d36fafc86c2819d5bd8f [info] Packaging /home/cloudera/workspace/twitter-streaming/target/scala-2.10/twitter-streaming-assembly-1.0.jar ... [info] Done packaging. [success] Total time: 6 s, completed Aug 27, 2016 11:58:03 AM </code></pre> <p>Not sure exactly what it means but everything looked good when I ran Hadoop NativeCheck:</p> <p>$ hadoop checknative -a</p> <pre><code>16/08/27 13:27:22 INFO bzip2.Bzip2Factory: Successfully loaded &amp; initialized native-bzip2 library system-native 16/08/27 13:27:22 INFO zlib.ZlibFactory: Successfully loaded &amp; initialized native-zlib library Native library checking: hadoop: true /usr/lib/hadoop/lib/native/libhadoop.so.1.0.0 zlib: true /lib64/libz.so.1 snappy: true /usr/lib/hadoop/lib/native/libsnappy.so.1 lz4: true revision:10301 bzip2: true /lib64/libbz2.so.1 openssl: true /usr/lib64/libcrypto.so </code></pre> <p>Here is the console log of my exception: $ ./submit.sh</p> <pre><code>Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties 16/08/28 20:13:23 INFO SparkContext: Running Spark version 2.0.0 16/08/28 20:13:24 WARN NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 16/08/28 20:13:24 WARN Utils: Your hostname, quickstart.cloudera resolves to a loopback address: 127.0.0.1; using 10.0.2.15 instead (on interface eth0) 16/08/28 20:13:24 WARN Utils: Set SPARK_LOCAL_IP if you need to bind to another address 16/08/28 20:13:24 INFO SecurityManager: Changing view acls to: cloudera 16/08/28 20:13:24 INFO SecurityManager: Changing modify acls to: cloudera 16/08/28 20:13:24 INFO SecurityManager: Changing view acls groups to: 16/08/28 20:13:24 INFO SecurityManager: Changing modify acls groups to: 16/08/28 20:13:24 INFO SecurityManager: SecurityManager: authentication disabled; ui acls disabled; users with view permissions: Set(cloudera); groups with view permissions: Set(); users with modify permissions: Set(cloudera); groups with modify permissions: Set() 16/08/28 20:13:25 INFO Utils: Successfully started service 'sparkDriver' on port 37550. 16/08/28 20:13:25 INFO SparkEnv: Registering MapOutputTracker 16/08/28 20:13:25 INFO SparkEnv: Registering BlockManagerMaster 16/08/28 20:13:25 INFO DiskBlockManager: Created local directory at /tmp/blockmgr-37a0492e-67e3-4ad5-ac38-40448c25d523 16/08/28 20:13:25 INFO MemoryStore: MemoryStore started with capacity 366.3 MB 16/08/28 20:13:25 INFO SparkEnv: Registering OutputCommitCoordinator 16/08/28 20:13:25 INFO Utils: Successfully started service 'SparkUI' on port 4040. 16/08/28 20:13:25 INFO SparkUI: Bound SparkUI to 0.0.0.0, and started at http://10.0.2.15:4040 16/08/28 20:13:25 INFO SparkContext: Added JAR file:/home/cloudera/workspace/twitter-streaming/target/scala-2.10/twitter-streaming-assembly-1.1.jar at spark://10.0.2.15:37550/jars/twitter-streaming-assembly-1.1.jar with timestamp 1472440405882 16/08/28 20:13:26 INFO Executor: Starting executor ID driver on host localhost 16/08/28 20:13:26 INFO Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 41264. 16/08/28 20:13:26 INFO NettyBlockTransferService: Server created on 10.0.2.15:41264 16/08/28 20:13:26 INFO BlockManagerMaster: Registering BlockManager BlockManagerId(driver, 10.0.2.15, 41264) 16/08/28 20:13:26 INFO BlockManagerMasterEndpoint: Registering block manager 10.0.2.15:41264 with 366.3 MB RAM, BlockManagerId(driver, 10.0.2.15, 41264) 16/08/28 20:13:26 INFO BlockManagerMaster: Registered BlockManager BlockManagerId(driver, 10.0.2.15, 41264) Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/Logging at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method)I at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.apache.spark.streaming.twitter.TwitterUtils$.createStream(TwitterUtils.scala:44) at TwitterStreamingApp$.main(TwitterStreamingApp.scala:42) at TwitterStreamingApp.main(TwitterStreamingApp.scala) 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:498) at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:729) at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:185) at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:210) at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:124) at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala) Caused by: java.lang.ClassNotFoundException: org.apache.spark.Logging at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 23 more 16/08/28 20:13:26 INFO SparkContext: Invoking stop() from shutdown hook 16/08/28 20:13:26 INFO SparkUI: Stopped Spark web UI at http://10.0.2.15:4040 16/08/28 20:13:26 INFO MapOutputTrackerMasterEndpoint: MapOutputTrackerMasterEndpoint stopped! 16/08/28 20:13:26 INFO MemoryStore: MemoryStore cleared 16/08/28 20:13:26 INFO BlockManager: BlockManager stopped 16/08/28 20:13:26 INFO BlockManagerMaster: BlockManagerMaster stopped 16/08/28 20:13:26 INFO OutputCommitCoordinator$OutputCommitCoordinatorEndpoint: OutputCommitCoordinator stopped! 16/08/28 20:13:26 INFO SparkContext: Successfully stopped SparkContext 16/08/28 20:13:26 INFO ShutdownHookManager: Shutdown hook called 16/08/28 20:13:26 INFO ShutdownHookManager: Deleting directory /tmp/spark-5e29c3b2-74c2-4d89-970f-5be89d176b26 </code></pre> <p>I understand my post was lengthy. Your advice or insights are highly appreciated!!</p> <p>-jsung8</p>
0
File upload not working | Php
<p>I'm trying to upload a file in php and unable to do it. The file I'm trying to upload is a csv file, but it should not be a concern. I'm using php to upload my file. I'm also trying to process the form in the same page. Below is my code for file upload and it is not working...</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;File Upload&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="POST"&gt; &lt;input type="file" name="csv_file"&gt; &lt;input type="submit" name="submit"&gt; &lt;/form&gt; &lt;?php if(isset($_POST['submit'])) { if(isset($_POST['csv_file'])) { echo "&lt;p&gt;".$_POST['csv_file']." =&gt; file input successfull&lt;/p&gt;"; fileUpload(); } } function fileUpload () { $target_dir = "var/import/"; $file_name = $_FILES['csv_file']['name']; $file_tmp = $_FILES['csv_file']['tmp_name']; if (move_uploaded_file($file_tmp, $target_dir.$file_name)) { echo "&lt;h1&gt;File Upload Success&lt;/h1&gt;"; } else { echo "&lt;h1&gt;File Upload not successfull&lt;/h1&gt;"; } } ?&gt; </code></pre> <p> </p>
0
A javascript 'let' global variable is not a property of 'window' unlike a global 'var'
<p>I used to check if a global <code>var</code> has been defined with:</p> <pre><code>if (window['myvar']==null) ... </code></pre> <p>or</p> <pre><code>if (window.myvar==null) ... </code></pre> <p>It works with <code>var myvar</code></p> <p>Now that I am trying to switch to let, this does not work anymore.</p> <pre><code>var myvar='a'; console.log(window.myvar); // gives me a let mylet='b'; console.log(window.mylet); // gives me undefined </code></pre> <p>Question: With a global <code>let</code>, is there any place I can look if something has been defined like I could with <code>var</code> from the <code>window</code> object?</p> <p><b>More generally</b>:<br> Is <code>var myvar='a'</code> equivalent to <code>window.myvar='a'</code>?<br> I hear people say that at the global level, <code>let</code> and <code>var</code> are/behave the same, but this is not what I am seeing.</p>
0
Searchbar with filter and from JSON data with Ionic 2
<p>I'm very new to Typescript and Ionic 2 and I'm trying to filter trough a json response with Ionic 2 search bar.</p> <p>This is my code: </p> <pre><code>import {Component} from '@angular/core'; import {NavController} from 'ionic-angular'; import {Http} from '@angular/http'; import 'rxjs/add/operator/map'; @Component({ templateUrl: 'build/pages/home/home.html' }) export class HomePage { posts: any; private searchQuery: string = ''; private items: string[]; constructor(private http: Http) { this.initializeItems(); this.http.get('https://domain.co/open.jsonp').map(res =&gt; res.json()).subscribe(data =&gt; { this.posts = data; console.log(this.posts); }); } initializeItems() { this.items = this.posts; } getItems(ev: any) { // Reset items back to all of the items this.initializeItems(); // set val to the value of the searchbar let val = ev.target.value; // if the value is an empty string don't filter the items if (val &amp;&amp; val.trim() != '') { this.items = this.items.filter((item) =&gt; { return (item.toLowerCase().indexOf(val.toLowerCase()) &gt; -1); }) } } } </code></pre> <p>And the Markup: </p> <pre><code>&lt;ion-header&gt; &lt;ion-searchbar (ionInput)="getItems($event)" [debounce]="500" placeholder="Suchen..."&gt;&lt;/ion-searchbar&gt; &lt;/ion-header&gt; &lt;ion-content&gt; &lt;ion-list&gt; &lt;ion-item *ngFor="let post of posts"&gt; &lt;h1&gt;{{post.storeName}}&lt;/h1&gt; &lt;/ion-item&gt; &lt;/ion-list&gt; &lt;/ion-content&gt; </code></pre> <p>I this error when I search:</p> <blockquote> <p>item.toLowerCase is not a function</p> </blockquote> <p>The JSON data looks like this: </p> <pre><code>[ { storeName: "Avec Hauptbahnhof", addressLink: "", phone: "0326223902", image: "", description: "", link: "", openingHours: [ "05.30 - 22:00", "05.30 - 22:00", "05.30 - 22:00", "05.30 - 22:00", "05.30 - 22:00", "06.30 - 22:00", "7.00 - 22.00" ] }, { storeName: "Manor", addressLink: "", phone: "0326258699", image: "", customer: "", description: "", link: "", openingHours: [ "09.00 - 18.30", "09.00 - 18.30", "09.00 - 18.30", "09.00 - 21:00", "09.00 - 18.30", "08.00 - 17.00", "Geschlossen" ] } ] </code></pre>
0
Access a resource outside a jar from the jar
<p>I'm trying to access a resource from a jar file. The resource is located in the same directory where is the jar.</p> <pre><code>my-dir: tester.jar test.jpg </code></pre> <p>I tried different things including the following, but every time the input stream is null:</p> <p>[1]</p> <pre><code>String path = new File(".").getAbsolutePath(); InputStream inputStream = this.getClass().getResourceAsStream(path.replace("\\.", "\\") + "test.jpg"); </code></pre> <p>[2]</p> <pre><code>File f = new File(this.getClass().getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); InputStream inputStream = this.getClass().getResourceAsStream(f.getParent() + "test.jpg"); </code></pre> <p>Can you give me some hints? Thanks.</p>
0
Code=-1001 "The request timed out."
<p>I am working on a Swift project which requires a lot of consumption of APIs. Everything is working fine but sometimes (1 in 20), I get <code>Code=-1001 "The request timed out."</code> error while calling the API. </p> <p>I am using Alamofire. I am attaching the code to call API.</p> <pre><code>let request = NSMutableURLRequest(URL: url) request.HTTPMethod = "POST" request.HTTPBody = myUrlContents.dataUsingEncoding(NSUTF8StringEncoding) request.timeoutInterval = 15 request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") request.setValue("application/json", forHTTPHeaderField: "Accept") request.setValue("\(myUrlContents.dataUsingEncoding(NSUTF8StringEncoding)!.length)", forHTTPHeaderField: "Content-Length") request.setValue("en-US", forHTTPHeaderField: "Content-Language") Alamofire.request(request) .validate() .responseJSON { [weak self] response in if response.result.isSuccess { if let result = response.result.value { print("Result: \(result)") completion(result: result as! NSDictionary) } } else { print(response.debugDescription) } } </code></pre> <p>And the log is </p> <pre><code>[Request]: &lt;NSMutableURLRequest: 0x18855620&gt; { URL: http://....... (url)} [Response]: nil [Data]: 0 bytes [Result]: FAILURE: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={NSErrorFailingURLStringKey=http://.....(url) NSErrorFailingURLKey=http://.....(url), NSLocalizedDescription=The request timed out., _kCFStreamErrorDomainKey=4, NSUnderlyingError=0x18a08900 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102}}} [Timeline]: Timeline: { "Request Start Time": 493582123.103, "Initial Response Time": 493582138.254, "Request Completed Time": 493582138.254, "Serialization Completed Time": 493582138.256, "Latency": 15.151 secs, "Request Duration": 15.151 secs, "Serialization Duration": 0.002 secs, "Total Duration": 15.153 secs } </code></pre> <p>I know I can increase the timeout period to avoid the error. But I want to know the actual reason why it is throwing the error. None of my API takes more than 2 seconds to return data. Then why it is showing latency of 15.151 seconds.</p> <p>I am using LAMP stack on backend. Any help would be appreciated.</p>
0
Updates were rejected because the tip of your current branch is behind its remote counterpart
<p>Our workflow is such. We have a branch called <code>dev</code> which I can reach at <code>origin/dev</code>. When we do changes, we create a branch off dev:</p> <pre><code>git checkout -b FixForBug origin/dev </code></pre> <p>Now I have a branch called <code>FixForBug</code> which is tracking (I think that's the right word) <code>origin/dev</code>. Thus, if I do a <code>git pull</code> it'll bring in new changes from <code>origin/dev</code> which is great. Now, when I'm finished with my fix, I push to a remote branch called the same thing.</p> <p>First I pull down any changes from <code>origin/dev</code> and do a rebase:</p> <pre><code>git pull --rebase </code></pre> <p>Then I push the changes to a remote branch of the same name:</p> <pre><code>git push origin FixForBug </code></pre> <p>Now, there's a branch on the remote server and I can create a pull request for that change to be approved and merged back in to the dev branch. I don't <em>ever</em> push anything to <code>origin/dev</code> myself. I'm guessing this is as pretty common workflow.</p> <p>The first time I do a <code>git push</code>, it works fine and creates the remote branch. However, if I push a <em>second</em> time (let's say during code-review, someone points out a problem), I get the following error:</p> <blockquote> <p>error: failed to push some refs to 'https://github.mydomain.info/Product/product.git'<br /> hint: Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again.<br /> See the 'Note about fast-forwards' in 'git push --help' for details.</p> </blockquote> <p>However, if I do a <code>git status</code> it says I'm ahead of <code>origin/dev</code> by 1 commit (which makes sense) and if I follow the hint and run <code>git pull</code>, it says everything is up to date. I <em>think</em> this is because I'm pushing to a different branch than my upstream branch. I can fix this issue by running:</p> <p><code>git push -f origin FixForBug</code></p> <p>In that case, it'll push the changes to the remote branch, saying <em>(forced update)</em> and everything <em>appears</em> to be good on the remote branch.</p> <p><strong>My Questions:</strong></p> <p>Why is <code>-f</code> required in this scenario? Usually when you're <em>forcing</em> something, it's because you were doing something wrong or at least against standard practice. Am I ok doing this, or will it mess up something in the remote branch or create a hassle for whoever has to eventually merge my stuff into dev?</p>
0
Serialize Java 8 LocalDate as yyyy-mm-dd with Gson
<p>I am using Java 8 and the latest <code>RELEASE</code> version (via Maven) of <a href="https://github.com/google/gson" rel="noreferrer">Gson</a>. If I serialize a <a href="https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html" rel="noreferrer"><code>LocalDate</code></a> I get something like this</p> <pre><code>"birthday": { "year": 1997, "month": 11, "day": 25 } </code></pre> <p>where I would have preferred <code>"birthday": "1997-11-25"</code>. Does Gson also support the more concise format out-of-the-box, or do I have to implement a custom serializer for <code>LocalDate</code>s? </p> <p>(I've tried <code>gsonBuilder.setDateFormat(DateFormat.SHORT)</code>, but that does not seem to make a difference.)</p>
0
updating partition Key, row movement not allowed
<p>i want to update a partition key. the partition is as below</p> <pre><code>PARTITION_NAME LAST_ANALYZED NUM_ROWS BLOCKS SAMPLE_SIZE HIGH_VALUE PORTAL_SERVICE_1 12/8/2016 4133 174 4133 1 PORTAL_SERVICE_2 6/8/2016 4474 174 4474 2 PORTAL_SERVICE_3 10/8/2016 29602 2014 29602 3 PORTAL_SERVICE_OTHERS 24/5/2016 0 110 DEFAULT </code></pre> <p>this partition is applied on column Portal_Service_id. i want to update the value of portal service id from 2 to 1.</p> <p>when i try </p> <pre><code>update trans set PORTAL_SERVICE_ID = 1 where ID = 2054; </code></pre> <p>i get error: Error report - SQL Error: ORA-14402: updating partition key column would cause a partition change 14402. 00000 - "updating partition key column would cause a partition change"</p> <p>i am not allowed to use Enable Row Movement.</p> <p>Can anybody please suggest any alternative to update the row.</p> <p>can anybody shed some light if this can be used in the scenario:</p> <pre><code>UPDATE &lt;table_name&gt; PARTITION (&lt;partition_name&gt;) SET &lt;column_name&gt; = &lt;value&gt; WHERE &lt;column_name&gt; &lt;condition&gt; &lt;value&gt;; </code></pre>
0
Redux vs plain React
<p>I have been reading some redux tutorials and to be honest I do not see up until now what added value it brings over plain react.</p> <p>As far as I know I can build an app and manage its state using only react, so, what makes redux something worth using?</p> <p>Well, I do recognize redux has a few advantages over react, namely:</p> <ul> <li>Keeps track of all the actions carried out;</li> <li>Makes it easier for debugging due to the previous point;</li> <li>Prevents state from being passed down/up between components.</li> </ul> <p>But maybe due to my lack of experience building large apps I am not convinced that it would make my life easier.</p> <p>Can you elaborate a little more on the advantages of using redux over plain react?</p>
0
Xdebug unable to connect to client, where do I start debugging the debugger?
<p>I'm setting up xdebug for php within sublime text, and xdebug keeps on logging errors related to being unable to connect:</p> <pre><code>Log opened at 2016-08-18 21:06:01 I: Connecting to configured address/port: localhost:9988. E: Could not connect to client. :-( Log closed at 2016-08-18 21:06:01 </code></pre> <p>I hoped that debugging directly by going to <code>http://localhost:9988</code> in my browser might help, but it simply displays the google chrome error page: "localhost refused to connect". Perhaps the error exists on the other end, that data can't be pushed to the sublime text client, I don't know. Sublime text xdebug does show the message "Reloading /var/log/xdebug/xdebug.log" when I run tests/etc, so it seems to be aware of the php code being run, just doesn't get any further.</p> <p>So, I never thought I would have to debug xdebug itself, but: How can I debug the xdebug to code editor connection? If this were nginx, I would start debugging the virtualhost, but since it's xdebug... ...I have no idea where to start debugging the lack of an app to connect to?</p> <h2>## Various Configuration Settings ##</h2> <p>I am on ubuntu linux 14.04.</p> <p>Here is my xdebug.ini conf if pertinent:</p> <pre><code>[xdebug] xdebug.default_enable=1 xdebug.remote_enable=1 xdebug.remote_autostart=1 xdebug.remote_host="localhost" xdebug.remote_handler="dbgp" xdebug.remote_port=9988 xdebug.remote_mode = req xdebug.overload_var_dump=0 xdebug.idekey = sublime.xdebug xdebug.remote_log="/var/log/xdebug/xdebug.log" ;https://github.com/martomo/SublimeTextXdebug </code></pre> <p>Xdebug installed:</p> <pre><code>apt-cache policy php-xdebug php-xdebug: Installed: 2.4.0-5+donate.sury.org~trusty+1 Candidate: 2.4.0-5+donate.sury.org~trusty+1 Version table: *** 2.4.0-5+donate.sury.org~trusty+1 0 500 http://ppa.launchpad.net/ondrej/php/ubuntu/ trusty/main amd64 Packages 100 /var/lib/dpkg/status </code></pre> <p>Module active:</p> <pre><code>php -m | grep -i xdebug xdebug Xdebug </code></pre> <p>phpinfo xdebug settings:</p> <p><a href="https://i.stack.imgur.com/mwMU8.png"><img src="https://i.stack.imgur.com/mwMU8.png" alt="xdebug settings via phpinfo"></a></p>
0
SAS: Define type when importing .xlsx with PROC IMPORT
<p><strong>Questions:</strong> How do I define the variable type of variables being imported from a .xlsx file when using PROC IMPORT?</p> <hr> <p><strong>My work</strong></p> <p>I am using SAS v9.4. So far as I'm aware, it is vanilla SAS. I do not have SAS/ACCESS etc.</p> <p>My data looks like this:</p> <pre><code>ID1 ID2 MONTH YEAR QTR VAR1 VAR2 ABC_1234 1 1 2010 1 869 3988 ABC_1235 12 2 2010 1 639 3144 ABC_1236 13 3 2010 2 698 3714 ABC_1237 45 4 2010 2 630 3213 </code></pre> <p>The procedure I am running is:</p> <pre><code>proc import out=rawdata datafile = "c:\rawdata.xlsx" dbms = xlsx replace; format ID1 $9. ; format ID2 $3. ; format MONTH best2. ; format YEAR best4. ; format QTR best1. ; format VAR1 best3. ; format VAR2 best4. ; run; </code></pre> <p>When I run this step, I get the following log output:</p> <blockquote> <p>ERROR: You are trying to use the character format $ with the numeric variable ID2 in data set WORK.RAWDATA.</p> </blockquote> <p>What this seems to tell me is that SAS automatically assigns the variable type. I want to be able to control it manually. I cannot find documentation which explains how to do this. INFORMAT, LENGTH, and INPUT statements do not seem to work for PROC IMPORT. </p> <p>I am using PROC IMPORT because it has yielded the greatest success with .xlsx files overall. Two possible solutions I can think of are 1) convert .xlsx to .csv and use INFILE in a DATA step and 2) bring the data in as numeric and convert it to character in a later step. I dislike the first solution because it requires me to manually manipulate the data, a potential source of error (such as leading zeros being removed). I dislike the second because it may unintentionally introduce errors (again, such as with leading zeros) and introduces extraneous work.</p>
0
How to check if object has property javascript?
<p>I have this function:</p> <pre><code> function ddd(object) { if (object.id !== null) { //do something... } } </code></pre> <p>But I get this error:</p> <pre><code>Cannot read property 'id' of null </code></pre> <p>How can I check if object has property and to check the property value??</p>
0
How to split url to get url path in JavaScript
<p>I have constructed a url path that are pointing to different hostname <code>www.mysite.com</code>, so for example:</p> <pre><code>var myMainSite = 'www.mymainsite.com' + '/somepath'; </code></pre> <p>so this is equivalent to <code>www.mymainsite.com/path/path/needthispath/somepath</code>.</p> <p>How I'm doing it now is like the code below and this gives me a bunch of indexes of the url in the <code>console.log</code>.</p> <pre><code>var splitUrl = myMainSite.split('/'); </code></pre> <p><code>console.log</code> looks like:</p> <pre><code>0: http:// 1: www. 2: mysite.com 3: path 4: path 5: needthispath 6: somepath </code></pre> <p>and I concat them like <code>splitUrl[5]+'/'+splitUrl[6]</code> and it doesn't look pretty at all.</p> <p>So my question is how to split/remove url location <code>http://www.mymainsite.com/</code> to get the url path <code>needthispath/somepath</code> in js? Is there a quicker and cleaner way of doing this?</p>
0
java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters when using national characters
<p>I'm trying to create some directories which have national symbols like "äöü" etc. Unfortunately I'm getting this exception whenever that is being attempted:</p> <pre><code>java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: /home/pi/myFolder/löwen at sun.nio.fs.UnixPath.encode(UnixPath.java:147) at sun.nio.fs.UnixPath.&lt;init&gt;(UnixPath.java:71) at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281) at java.nio.file.Paths.get(Paths.java:84) at org.someone.something.file.PathManager.createPathIfNecessary(PathManager.java:161) ... at java.lang.Thread.run(Thread.java:744) </code></pre> <p>My code where it occurs looks like this:</p> <pre><code>public static void createPathIfNecessary(String directoryPath) throws IOException { Path path = Paths.get(directoryPath); // if directory exists? if (!Files.exists(path)) { Files.createDirectories(path); } else if (!Files.isDirectory(path)) { throw new IOException("The path " + path + " is not a directory as expected!"); } } </code></pre> <p>I searched for possible solutions and most suggest to set the locale to UTF-8, so I thought I would get this fixed if I set the locale in Linux to UTF-8, but I found out that it has already been UTF-8 all the time, and despite newly setting it, I'm still having the same problem.</p> <pre><code> $ locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= </code></pre> <p>I'm not having this problem on Windows 7, it creates the directories perfectly, so I'm wondering whether I need to improve the java code to handle this situation better, or to change something in my Linux.</p> <p>The Linux I'm running it on is a Raspbian on a Raspberry Pi 2:</p> <pre><code>$ cat /etc/*-release PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)" NAME="Raspbian GNU/Linux" VERSION_ID="7" VERSION="7 (wheezy)" ID=raspbian ID_LIKE=debian ANSI_COLOR="1;31" HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" </code></pre> <p>I am running my application on a Tomcat 7 Server (Java version is 1.8 I believe), my setenv.sh starts with: <code>export JAVA_OPTS="-Dfile.encoding=UTF-8 ...</code></p> <p>Does anybody have a solution to this problem? I need to be able to use those national symbols in directory/file names...</p> <p><strong>EDIT:</strong></p> <p>After adding the extra option Dsun.jnu.encoding=UTF-8 at the start of my setenv.sh for Tomcat and restarting something changed.</p> <p>Currently the my start of setenv.sh looks like this</p> <pre><code>export JAVA_OPTS="-Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8 </code></pre> <p>it seems like this exception is gone and the folder with the national symbols gets created, however the problem seems to not be solved completely, whenever I try to create/write to files within that directory, I now get:</p> <pre><code>java.io.FileNotFoundException: /home/pi/myFolder/löwen/Lowen.tmp (No such file or directory) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:206) at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:156) at org.someone.something.MyFileWriter.downloadFiles(MyFileWriter.java:364) ... at java.lang.Thread.run(Thread.java:744) </code></pre> <p>The code where it happens looks like this:</p> <pre><code>// output here File myOutputFile = new File(filePath); FileOutputStream out = (new FileOutputStream(myOutputFile)); out.write(bytes); out.close(); </code></pre> <p>It seems to fail on (new FileOutputStream(myOutputFile)); when it's trying to initialize the FileOutputStream with the File object, which has the path created from a string which was retrieved from the path in the exception above and an added filename at the end.</p> <p>So now the directory is created, however writing or creating anything inside it still results in the exception above, although the file inside it doesn't event contain national symbols.</p> <p>Creating paths and files in them when they have no national symbols works as perfectly as it did before the change in setenv.sh, so it looks like the problem is connected to the national symbols within the path still...</p>
0
SQL Server : how to update with string replace
<p>How can I update some of columns:</p> <pre><code>UPDATE Product SET Title = REPLACE(Title , 'mn%', 'za%') WHERE (Title LIKE N'mn%') </code></pre> <p>Consider data of one column is <code>mnfmnd</code> and must be changed to <code>zafmnd</code></p>
0
pem file permissions on Bash on Ubuntu on Windows
<p>I am attempting to login to my box using my .pem file however I get the error</p> <pre><code>@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0555 for './arete-server.pem' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: ./arete-server.pem Permission denied (publickey). </code></pre> <p>chmod 400 doesn't work on Bash on Ubuntu on Windows and the best permissions I can give it is -r-xr-xr-x</p> <p>Any idea how to get permissions to a point where I can use this pem file?</p>
0
Warning: POST Content-Length of 90612004 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
<p>I got this error</p> <blockquote> <p><strong>Warning: POST Content-Length of 90612004 bytes exceeds the limit of 8388608 bytes in Unknown on line 0</strong></p> </blockquote> <p>I've done some searches and I changed <code>post_max_size</code> and <code>upload_max_filesize</code> to 150M and reset Wamp but STILL I get this error what should I do?</p>
0
Laravel Blade - yield inside section
<p>I'm trying to yield a section inside another section. But this does not work as expected, I see blank output.</p> <pre><code>@section('3show') This is a text string @stop @section('page-content') &lt;div id="content"&gt; &lt;article&gt; @yield('3show') &lt;/article&gt; &lt;/div&gt; &lt;!--#content--&gt; @stop </code></pre> <p>Any ideas to yield section inside another section ? </p>
0
Why would apache refuse connection to localhost 127.0.0.1 on OSX?
<p>When trying to access sites on my localhost the connection is refused. Two days ago the set up was working without issues with multiple virtual hosts configured. I'm not aware of any changes that could have affected the set up. I spent all day yesterday trying to troubleshoot the issue but have been going around in circles.</p> <p>OS: OSX 10.11.16</p> <p>httpd -V returns this:</p> <pre><code>Server version: Apache/2.4.18 (Unix) Server built: Feb 20 2016 20:03:19 Server's Module Magic Number: 20120211:52 Server loaded: APR 1.4.8, APR-UTIL 1.5.2 Compiled using: APR 1.4.8, APR-UTIL 1.5.2 Architecture: 64-bit Server MPM: prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_FLOCK_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/usr" -D SUEXEC_BIN="/usr/bin/suexec" -D DEFAULT_PIDLOG="/private/var/run/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types" -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf" </code></pre> <p>httpd.conf is configured to allow virtual hosts and nothing has changed in httpd-vhosts.conf file.</p> <pre><code>LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so ... # Virtual hosts Include /private/etc/apache2/extra/httpd-vhosts.conf </code></pre> <p>apachectl configtest returns:</p> <pre><code>Syntax OK </code></pre> <p>I've tried running a port scan for 127.0.0.1 and http port 80 does <em>not</em> show. This and the connection being refused makes me think this is where the issue is but I don't know why. The OSX firewall is turned off. <a href="https://apple.stackexchange.com/questions/131671/problem-accessing-localhost-on-mac-os-x-mavericks-it-was-working-fine-until-i">I've tried the solution posted here</a> but it did not fix it.</p> <p>My /etc/hosts file looks like this:</p> <pre><code># # Host Database # # localhost is used to configure the loopback interface # when the system is booting. Do not change this entry. # 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost 127.0.0.1 site.local 127.0.0.1 othersite.local ... </code></pre> <p>I can ping 127.0.0.1. I previously had homebrew installed to run different PHP versions but I've removed that to try and bring the system back to stock. I really don't know what to try next, any help would be really appreciated.</p>
0
Add android.permission.CAMERA with Cordova
<p>I am using the latest version of Cordova (6.3.1) and I want the following permission to appear in the AndroidManifest.xml :</p> <pre><code>&lt;uses-permission android:name="android.permission.CAMERA" /&gt; </code></pre> <p>Adding this line by hand does not work because the XML is regenerated each time I run the command <code>cordova run android</code></p> <p>I have added the <code>cordova-plugin-camera</code> to my project with </p> <pre><code>cordova plugin add cordova-plugin-camera </code></pre> <p>This plugin does NOT add the CAMERA permission in the AndroidManifest.xml</p> <p>I don't know if this is normal</p> <p>How can I add this permission to my project ?</p> <hr> <p><strong>Edit :</strong> Usually, Cordova plugins are in charge of adding required permissions into the manifest. The camera plugin does not add this specific permission, I wonder :</p> <ul> <li>if the plugin should add this permission (bug ? I have opened an issue on their Jira tracker)</li> <li>if I can add this permission by hand myself, maybe in the Cordova's config.xml</li> </ul>
0
Spark - How many Executors and Cores are allocated to my spark job
<p>Spark architecture is entirely revolves around the concept of executors and cores. I would like to see practically how many executors and cores running for my spark application running in a cluster. </p> <p>I was trying to use below snippet in my application but no luck.</p> <pre><code>val conf = new SparkConf().setAppName("ExecutorTestJob") val sc = new SparkContext(conf) conf.get("spark.executor.instances") conf.get("spark.executor.cores") </code></pre> <p>Is there any way to get those values using <code>SparkContext</code> Object or <code>SparkConf</code> object etc..</p>
0