Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
38,832,593
CoreData ManagedObjectContext Recursive Save Error
<p>Some users of mine are encountering a CoreData error when performing a save. I haven't been able to find any information online about this error or how to symbolicate the stack trace.</p> <p>The error message is <code>attempt to recursively call -save: on the context aborted, stack trace</code>, with the full error message below.</p> <p>Doe anyone have any hints or ideas on how to figure out what is going wrong?</p> <pre><code>Error Domain=NSCocoaErrorDomain Code=132001 "(null)" UserInfo={message=attempt to recursively call -save: on the context aborted, stack trace=( 0 CoreData 0x0000000188cbe70c + 164 1 Primetime 0x0000000100077ea4 Primetime + 130724 2 Primetime 0x00000001000ae988 Primetime + 354696 3 Primetime 0x0000000100081674 Primetime + 169588 4 Primetime 0x00000001000802ac Primetime + 164524 5 CoreData 0x0000000188d8bbd4 + 4568 6 CoreData 0x0000000188d8a9ec + 124 7 CoreFoundation 0x00000001869ac24c + 20 8 CoreFoundation 0x00000001869ab950 + 400 9 CoreFoundation 0x00000001869ab6cc + 60 10 CoreFoundation 0x0000000186a187bc + 1504 11 CoreFoundation 0x00000001868ef32c _CFXNotificationPost + 376 12 Foundation 0x000000018738296c + 68 13 CoreData 0x0000000188cc16e8 + 724 14 CoreData 0x0000000188d43ca4 + 1336 15 CoreData 0x0000000188cbfd04 + 2116 16 CoreData 0x0000000188cbe808 + 416 17 Primetime 0x0000000100077ea4 Primetime + 130724 18 Primetime 0x0000000100089968 Primetime + 203112 19 Primetime 0x00000001001d47c0 Primetime + 1558464 20 libdispatch.dylib 0x0000000186459058 + 24 21 libdispatch.dylib 0x0000000186459018 + 16 22 libdispatch.dylib 0x000000018645dbcc _dispatch_main_queue_callback_4CF + 1000 23 CoreFoundation 0x00000001869bfc48 + 12 24 CoreFoundation 0x00000001869bd834 + 1660 25 CoreFoundation 0x00000001868ed764 CFRunLoopRunSpecific + 292 26 GraphicsServices 0x00000001882f0198 GSEventRunModal + 180 27 UIKit 0x000000018c8668d0 + 664 28 UIKit 0x000000018c86163c UIApplicationMain + 208 29 Primetime 0x00000001000ada1c Primetime + 350748 30 libdyld.dylib 0x00000001864905b8 + 4 </code></pre>
<ios><core-data><nsmanagedobjectcontext>
2016-08-08 15:02:42
HQ
38,832,702
Qt Quick Controls 2.0 Text Field Cannot Select Text
<p>I'm having difficulty with selecting text on a <a href="http://doc.qt.io/qt-5/qml-qtquick-controls2-textfield.html" rel="noreferrer">TextField</a> from Qt Quick Controls 2.0 with a mouse. When I hover over the TextField the cursor does not change from the cursor arrow to the cursor I beam and I am unable to select text. I verified text selection is possible by using the keyboard shortcut Ctrl+A. I also tested this with the <a href="http://doc.qt.io/qt-5/qml-qtquick-controls-textfield.html" rel="noreferrer">TextField</a> from Qt Quick Controls 1.4, and it works as expected (the mouse cursor changes to an I beam and I can select text). I think I must be missing something obvious because this seems like basic text field functionality. Does anyone have any ideas? Below is my code:</p> <pre><code>import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.0 ApplicationWindow { visible: true width: 640 height: 480 title: qsTr("Hello World") TextField { anchors.centerIn: parent height: 50 width: 100 } } </code></pre>
<c++><qt><qtquickcontrols2>
2016-08-08 15:07:51
HQ
38,832,723
How to write properly an if statement in regards to a BooleanParameter in Jenkins pipeline Jenkinsfile?
<p>I'm setting a Jenkins pipeline Jenkinsfile and I'd like to check if a booleanparameter is set.</p> <p>Here's the relevant portion of the file:</p> <pre><code>node ("master") { stage 'Setup' ( [[$class: 'BooleanParameterValue', name: 'BUILD_SNAPSHOT', value: 'Boolean.valueOf(BUILD_SNAPSHOT)']], </code></pre> <p>As I understand, that is the way to access the booleanparameter but I'm not sure how to state the IF statement itself.</p> <p>I was thinking about doing something like:</p> <pre><code>if(BooleanParameterValue['BUILD_SNAPSHOT']){... </code></pre> <p>What is the correct way to write this statement please?</p>
<jenkins><jenkins-pipeline>
2016-08-08 15:08:49
HQ
38,832,753
How to disable IntelliSense in VS Code for Markdown?
<p>I don't want word completion for Markdown files in Visual Studio Code, how do I disable it? Ideally, for Markdown only but in the worst case, even a global switch would be good.</p>
<intellisense><visual-studio-code>
2016-08-08 15:09:55
HQ
38,832,851
RouterLink does not work
<p>My routing in the angular2 apps works well. But i am going to make some routeLink based on <a href="https://angular.io/docs/ts/latest/guide/router.html" rel="noreferrer">this</a>:</p> <p>Here is my routing:</p> <pre><code>const routes: RouterConfig = [ { path:'home' , component: FormComponent }, { path:'about', component: AboutComponent }, { path:'**' , component: FormComponent } ]; </code></pre> <p>And here is the links that i made:</p> <pre><code>&lt;ul class="nav navbar-nav item"&gt; &lt;li&gt; &lt;a routerLink='/home' routerLinkActive="active"&gt;Home&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a routerLink='/about' routerLinkActive="active"&gt;About this&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I expect that, when i click on them it navigates to the respected component, but they do not perform anything?</p>
<angular><angular2-routing>
2016-08-08 15:14:13
HQ
38,834,020
Sending Push via Postman using Firebase Messaging
<p>I'm trying to use <a href="https://www.getpostman.com/" rel="noreferrer">Postman</a> to send a single Push Notification using <code>Firebase</code> Cloud Messaging service.</p> <p>This is a working <code>cURL</code> command for the same purposal, on which I'm using as a reference.</p> <pre><code>curl -X POST --header "Authorization: key=&lt;API_ACCESS_KEY&gt;" --Header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{\"to\":\"&lt;YOUR_DEVICE_ID_TOKEN&gt;\",\"notification\":{\"body\":\"Firebase\"} \"priority":\"10"}" </code></pre> <p>What I have done so far..</p> <p>1 - Set the <strong>Headers</strong> appropriately</p> <p><a href="https://i.stack.imgur.com/yH6f9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/yH6f9.png" alt="enter image description here"></a></p> <p>2- At <strong>Body</strong> , I'm using <code>raw</code></p> <pre><code>{ "to" : "&lt;YOUR_DEVICE_ID_TOKEN&gt;" , "notification": { "body": "Firebase Cloud Message" } } </code></pre> <p>When executing, I'm getting back <code>401 - Unauthorized</code>.</p> <p>What's missing to correctly send the push notification?</p>
<curl><firebase><postman><firebase-cloud-messaging>
2016-08-08 16:14:19
HQ
38,834,042
Version conflict updating to play-services 9.4.0 Android studio 2.2
<p>I get an error saying </p> <pre><code> Error:Execution failed for task ':app:processDebugGoogleServices'. &gt; Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0. </code></pre> <p>I tried looking at <a href="https://bintray.com/android/android-tools/com.google.gms.google-services/">https://bintray.com/android/android-tools/com.google.gms.google-services/</a> and com.google.gms:google-services:3.0.0 seems to be the latest. This is my project gradle</p> <pre><code>dependencies { classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } </code></pre> <p>And this is how my app gradle looks like</p> <pre><code>buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' apply plugin: 'com.google.gms.google-services' repositories { maven { url 'https://maven.fabric.io/public' } } android { compileSdkVersion 24 buildToolsVersion "24.0.1" useLibrary 'org.apache.http.legacy' defaultConfig { applicationId "com.myapp.preburn" minSdkVersion 10 targetSdkVersion 24 versionCode 14 versionName "2.0.1" renderscriptTargetApi 22 renderscriptSupportModeEnabled true } buildTypes { release { lintOptions { disable 'MissingTranslation' } minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } android { packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' } } repositories { mavenCentral() jcenter() } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile fileTree(dir: 'libs', include: 'Parse-*.jar') compile 'com.parse.bolts:bolts-android:1.2.0' compile 'com.android.support:appcompat-v7:24.1.1' compile 'com.mcxiaoke.volley:library:1.0.9' compile 'com.google.android.gms:play-services-gcm:9.4.0' compile 'com.google.android.gms:play-services-location:9.4.0' compile 'com.google.android.gms:play-services-maps:9.4.0' compile 'com.google.android.gms:play-services-ads:9.4.0' compile 'com.google.android.gms:play-services-plus:9.4.0' compile 'com.google.android.gms:play-services-analytics:9.4.0' compile 'me.leolin:ShortcutBadger:1.1.3@aar' compile 'com.squareup.picasso:picasso:2.5.2' compile files('libs/jsoup-1.7.3.jar') compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true; } compile files('libs/InMobi-5.2.2.jar') compile files('libs/libadapterinmobi.jar') compile files('libs/StartAppAdMobMediation-1.0.1.jar') compile files('libs/StartAppInApp-3.3.1.jar') compile 'org.adw.library:discrete-seekbar:1.0.1' compile 'com.pnikosis:materialish-progress:1.0' } </code></pre> <p>If I change the play services to 9.0.0 everything compiles fine. What am I missing here?</p>
<android><android-studio><gradle><google-play-services>
2016-08-08 16:16:07
HQ
38,835,001
Skip type check on unused parameters
<p>When I compile my typescript project, I'm using the <code>noImplicitAny</code> option so that I won't forget to specify the types on my variables and arguments.</p> <p>However sometimes you have arguments that you don't use. For example:</p> <pre><code>jQuery.ajaxTransport("+*", function (options: JQueryAjaxSettings) { return { abort: function (_, callback: JQueryCallback) { </code></pre> <p>I am not interested in the first argument of the abort function, so I ignore it by naming it _.</p> <p>Is that the proper way to do that in TypeScript? I couldn't find it in the guide. I suspect that it isn't the proper way, because I can only name one argument _.</p> <p>Typescript raises the following error: </p> <blockquote> <p>error TS7006: Parameter '_' implicitly has an 'any' type.</p> </blockquote> <p>I could just type <code>_:any</code> but that seems a bit overkill for an argument that I don't use.</p>
<typescript><unused-variables>
2016-08-08 17:14:20
HQ
38,835,273
When does code in a service worker outside of an event handler run?
<p>(I am paraphrasing question asked by Rich Harris in the "<a href="https://gist.github.com/Rich-Harris/fd6c3c73e6e707e312d7c5d7d0f3b2f9">Stuff I wish I'd known sooner about service workers</a>" gist.)</p> <p>If I have code in my service worker that runs outside an event handler, when does it run?</p> <p>And, closely related to that, what is the difference between putting inside an <code>install</code> handler and putting it outside an event handler entirely?</p>
<service-worker>
2016-08-08 17:32:10
HQ
38,835,571
Error Handling in Swift 3
<p>I'm migrating my code over to Swift 3 and see a bunch of the same warnings with my do/try/catch blocks. I want to check if an assignment doesn't return nil and then print something out to the console if it doesn't work. The catch block says it "is unreachable because no errors are thrown in 'do' block". I would want to catch all errors with one catch block.</p> <pre><code>let xmlString: String? do{ //Warning for line below: "no calls to throwing function occurs within 'try' expression try xmlString = String(contentsOfURL: accessURL, encoding: String.Encoding.utf8) var xmlDict = XMLDictionaryParser.sharedInstance().dictionary(with: xmlString) if let models = xmlDict?["Cygnet"] { self.cygnets = models as! NSArray } //Warning for line below: "catch block is unreachable because no errors are thrown in 'do' block } catch { print("error getting xml string") } </code></pre> <p>How would I write a proper try catch block that would handle assignment errors?</p>
<swift><error-handling><try-catch><swift3>
2016-08-08 17:51:07
HQ
38,836,212
query results and loop them into a table by catagory
I'm trying to query my products table; +-------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | name | varchar(50) | NO | | NULL | | | make | varchar(50) | NO | | NULL | | | email | varchar(200) | NO | | NULL | | | catagory | longtext | NO | | NULL | | +-------------------+--------------+------+-----+---------+----------------+ i want to query the database and echo the results in a table like so, i want it to echo the catagory name then echo all the <td></td> which will contain the name, make and some other details etc.. I want to show it like so; Catagory: name name name name ------------------------------------- Catagory: name name name name ------------------------------------- Catagory: name name name name ------------------------------------- Catagory: name name name name ------------------------------------- where each name is a different product in the product table. Not sure where too look and what to search for.
<php><html><mysql>
2016-08-08 18:35:02
LQ_EDIT
38,836,269
Does TensorFlow view all CPUs of one machine as ONE device?
<p>From the experiments I run, it seems like TensorFlow uses automatically all CPUs on one machine. Furthermore, it seems like TensorFlow refers to all CPUs as /cpu:0. </p> <p>Am I right, that only the different GPUs of one machine get indexed and viewed as separate devices, but all the CPUs on one machine get viewed as a single device? </p> <p>Is there any way that a machine can have multiple CPUs viewing it from TensorFlows perspective? </p>
<python><tensorflow>
2016-08-08 18:38:25
HQ
38,836,471
how can I acheive excel Find() in postgress
How can I find the position of a string starting from a specified index in postgresql-9.3+ Example find('ranranran','an',1) should outputs 2 find('ranranran','an',3) => 5 find('ranranran','an',6) => 8 Thanks
<postgresql><postgresql-9.3>
2016-08-08 18:49:45
LQ_EDIT
38,836,532
How to add Web Animations API polyfill to an Angular 2 project created with Angular CLI
<p>The <a href="https://angular.io/docs/ts/latest/guide/animations.html" rel="noreferrer">Angular 2 animations documentation</a> refers to the <a href="https://github.com/web-animations/web-animations-js" rel="noreferrer">Web Animations API polyfill</a> for browsers that don't support the native one.</p> <p><strong>What's the <em>proper</em> way to add this polyfill to an Angular 2 project created with Angular CLI?</strong></p> <p>(I am using angular-cli: 1.0.0-beta.10)</p> <p>With no luck, I have tried the ideas and solutions mentioned here:</p> <ul> <li><a href="https://github.com/angular/angular-cli/issues/949" rel="noreferrer">https://github.com/angular/angular-cli/issues/949</a></li> <li><a href="https://github.com/angular/angular-cli/issues/1015" rel="noreferrer">https://github.com/angular/angular-cli/issues/1015</a></li> <li><a href="https://github.com/angular/angular-cli/issues/718#issuecomment-225493863" rel="noreferrer">https://github.com/angular/angular-cli/issues/718#issuecomment-225493863</a></li> </ul> <p>I downloaded it via NPM and added it to <code>system-config.ts</code>. I believe this is along the lines of what's <em>recommended</em> but the polyfill doesn't get loaded (I can tell because the animations don't work in Safari).</p> <p>I only got this to work by including the polyfill in <code>index.html</code>, which I know it's not the proper way:</p> <pre><code> &lt;script src="https://rawgit.com/web-animations/web-animations-js/master/web-animations.min.js"&gt;&lt;/script&gt; </code></pre> <p>I will add here any details that may help clarify my question, but if you need to see the code, I have it on Github: </p> <p><a href="https://github.com/cmermingas/connect-four" rel="noreferrer">https://github.com/cmermingas/connect-four</a></p> <p>Thanks in advance!</p>
<angular><angular-cli>
2016-08-08 18:53:40
HQ
38,838,088
How do I make custom buttons in Visual Studio? C#
I'm trying to make a launcher for a game that fixes some of it's bugs. Right now I'm just working on the interface and I want to make custom buttons, not just those generic squares, but I can't figure out how. Here's some example images. [Regular button, not moused over.][1] [Moused over / Highlighted button.][2] [1]: http://i.stack.imgur.com/kT4iU.png [2]: http://i.stack.imgur.com/KKYAg.png I just threw those buttons together quickly, but that's what I want. I want the button to highlight when I mouse over it, without it being inside of the default square buttons. I hope I explained that well, I tried my best.
<c#><button>
2016-08-08 20:35:54
LQ_EDIT
38,838,362
MPAndroidChart - First and last bars not rendering correctly
<ol> <li><p>In the bar chart I am creating the first and last rows are consistently being cut in half (even if I add additional bars). This also causes the values above the bars to be out of place. I am inflating this within a fragment.</p></li> <li><p>The axis are also only increasing by 0.9 instead of 1. To fix this do I need to implement the AxisValueFormatter interface?</p></li> </ol> <p>Image:</p> <p><a href="https://i.stack.imgur.com/ryrxj.png"><img src="https://i.stack.imgur.com/ryrxj.png" alt="enter image description here"></a></p> <p>Code: .java</p> <pre><code>chart = (BarChart) view.findViewById(R.id.chart1); // Chart settings chart.setDrawGridBackground(false); chart.setHighlightFullBarEnabled(true); chart.setDrawBarShadow(false); chart.setDrawValueAboveBar(true); chart.setDescription(""); // Settings for X-Axis XAxis xAxis = chart.getXAxis(); xAxis.setDrawGridLines(false); xAxis.setEnabled(true); xAxis.setDrawLabels(true); xAxis.setPosition(XAxisPosition.BOTTOM); // Settings for Y-Axis YAxis leftAxis = chart.getAxisLeft(); YAxis rightAxis = chart.getAxisRight(); leftAxis.setAxisMinValue(0f); rightAxis.setAxisMinValue(0f); BARENTRY = new ArrayList&lt;&gt;(); BarEntryLabels = new ArrayList&lt;String&gt;(); BARENTRY.add(new BarEntry(2f, 1)); BARENTRY.add(new BarEntry(3f, 2)); BARENTRY.add(new BarEntry(4f, 3)); BARENTRY.add(new BarEntry(5f, 4)); BARENTRY.add(new BarEntry(6f, 5)); Bardataset = new BarDataSet(BARENTRY, "Projects"); Bardataset.setColors(ColorTemplate.COLORFUL_COLORS); BARDATA = new BarData(Bardataset); chart.setData(BARDATA); chart.invalidate(); // refresh chart.animateY(1500); return view; </code></pre>
<android><mpandroidchart>
2016-08-08 20:55:04
HQ
38,838,378
npm run does nothing
<p>I've been working with Node.js/npm for a while, but I never used npm scripts. I was quite surprised to find that I can't get them to work at all on my Windows/Cygwin system. With a package.json like this ...</p> <pre><code>{ "name": "demo", "scripts": { "env": "env", "hello": "echo Hello!", "crap": "I am complete nonsense." } } </code></pre> <p>... all three npm run commands do nothing. <code>npm run crap</code> executes and returns immediately with an OK status (I tested with the -dd parameter); <code>npm run doesntexist</code> throws the expected error. Testing without Cygwin on the regular Windows shell made no difference.</p>
<node.js><npm><cygwin>
2016-08-08 20:55:53
HQ
38,839,244
Loop until variable is isset then excute a code
<p>I try to do a while loop but something is missing I need to loop until variable is isset then execute a code something like dis :</p> <pre><code>$counter=o; while(null!==($var)){ $counter ++; } if (isset($var)){ excute code .... } </code></pre>
<php>
2016-08-08 22:08:10
LQ_CLOSE
38,839,650
Load ordering of dynamically added script tags
<p>I have a typescript application that dynamically adds script tags that point to JS files. Due to some restrictions I cant have these script tags statically defined in a html file, so I add them dynamically through typescript like this:</p> <pre><code>for (let src of jsFiles) { let sTag = document.createElement('script'); sTag.type = 'text/javascript'; sTag.src = src; sTag.defer = true; document.body.appendChild(script); } </code></pre> <p>Now, I am noticing that, when I add script tags dynamically, their doesn't seem to be a guarantee in the order in which they are loaded. Unfortunately, the <code>jsFiles</code> array has scripts that are dependent on each other. So, the 2nd script in the array can only be loaded after the first one is fully loaded. The second script references a function that is defined in the first one. Is there a way I can specify the order in which scripts are ordered and executed when adding them dynamically (similar to how ordering is done when you statically define script tags in a html file)?</p> <p>P.S. I would like to avoid using the onload callback to solve this issue since I noticed a performance degradation with my application. My second script file is very large and I am assuming that caused the degradation. </p>
<javascript><html><typescript><load-order>
2016-08-08 22:50:29
HQ
38,840,028
Gradle cannot resolve the most recent Firebase libraries , i.e, versions of 9.4.0
<p>I am trying to upgrade my Firebase libraries to the new 9.4.0 version; however, I get the "can't resolve" error in Gradle upon syncing. Here's the error: </p> <pre><code>Error:(38, 13) Failed to resolve: com.google.firebase:firebase-core:9.4.0 Error:(40, 13) Failed to resolve: com.google.firebase:firebase-auth:9.4.0 Error:(40, 13) Failed to resolve: com.google.firebase:firebase-storage:9.4.0 </code></pre> <p>Tried with and without firebase-core, no difference. </p> <p>Here's my Gradle for both app and project level: project level:</p> <pre><code> buildscript { repositories { jcenter() mavenLocal() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() mavenLocal() } } task clean(type: Delete) { delete rootProject.buildDir } </code></pre> <p>and for the module:app level: apply plugin: 'com.android.application'</p> <pre><code> android { compileSdkVersion 24 buildToolsVersion "24.0.0" defaultConfig { applicationId "com.example.main.projectone" minSdkVersion 18 targetSdkVersion 24 versionCode 1 versionName "1.0" multiDexEnabled true } 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.google.android.gms:play-services-gcm:9.2.0' // compile 'com.google.android.gms:play-services:9.2.1' compile('com.facebook.android:facebook-android-sdk:4.7.0') { exclude module: 'bolts-android' } // compile 'com.fasterxml.jackson.core:jackson-core:2.8.1' // compile 'com.fasterxml.jackson.core:jackson-databind:2.8.1' compile 'com.android.support:appcompat-v7:24.0.0' compile 'com.google.firebase:firebase-core:9.4.0' compile 'com.google.firebase:firebase-auth:9.4.0' compile 'com.google.firebase:firebase-storage:9.4.0' compile 'com.android.support:design:24.0.0' compile 'com.parse:parse-android:1.13.0' compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar' compile 'com.squareup.okhttp3:okhttp:3.3.1' compile 'com.android.support:cardview-v7:24.0.0' compile 'com.android.support:support-v4:24.0.0' compile 'com.google.android.gms:play-services:9.2.1' compile 'com.android.support:multidex:1.0.1' compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.1' compile 'de.hdodenhof:circleimageview:2.1.0' compile 'com.android.support:recyclerview-v7:24.0.0' } apply plugin: 'com.google.gms.google-services' </code></pre> <p>Any idea why Gradle cannot resolve the libraries? Here's Firebase website addressing them <a href="https://firebase.google.com/docs/android/setup" rel="noreferrer">Firebase Newest Libs</a>. Appreciate your help. </p>
<android-studio><firebase><android-gradle-plugin>
2016-08-08 23:40:54
HQ
38,840,319
Put a 2d Array into a Pandas Series
<p>I have a 2D Numpy array that I would like to put in a pandas Series (not a DataFrame):</p> <pre><code>&gt;&gt;&gt; import pandas as pd &gt;&gt;&gt; import numpy as np &gt;&gt;&gt; a = np.zeros((5, 2)) &gt;&gt;&gt; a array([[ 0., 0.], [ 0., 0.], [ 0., 0.], [ 0., 0.], [ 0., 0.]]) </code></pre> <p>But this throws an error:</p> <pre><code>&gt;&gt;&gt; s = pd.Series(a) Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in &lt;module&gt; File "/miniconda/envs/pyspark/lib/python3.4/site-packages/pandas/core/series.py", line 227, in __init__ raise_cast_failure=True) File "/miniconda/envs/pyspark/lib/python3.4/site-packages/pandas/core/series.py", line 2920, in _sanitize_array raise Exception('Data must be 1-dimensional') Exception: Data must be 1-dimensional </code></pre> <p>It is possible with a hack:</p> <pre><code>&gt;&gt;&gt; s = pd.Series(map(lambda x:[x], a)).apply(lambda x:x[0]) &gt;&gt;&gt; s 0 [0.0, 0.0] 1 [0.0, 0.0] 2 [0.0, 0.0] 3 [0.0, 0.0] 4 [0.0, 0.0] </code></pre> <p>Is there a better way?</p>
<python><pandas><numpy>
2016-08-09 00:25:10
HQ
38,840,889
Java: Is there a way to know if an inputStream is a readonly file
<p>We encounter errors because we update a read only file. Currently I have a method that soft deletes a file. This method has a parameter DataHandler which has a field that contains an input stream. Would like to ask for some suggestions if there is a way to determine if dataHandler.getInputStream is a ready only. Writing the stream in a file on hard disk is not an option either</p>
<java><file><inputstream><datahandler>
2016-08-09 01:55:52
LQ_CLOSE
38,842,275
How to set the logging level for the elasticsearch library differently to my own logging?
<p>How can I set the logging level for the elasticsearch library differently to my own logging? To illustrate the issue, I describe the module scenario. I have a module <code>lookup.py</code> which uses <code>elasticsearch</code> like this:</p> <pre><code>import logging logger = logging.getLogger(__name__) import elasticsearch def get_docs(): logger.debug("search elastic") es = elasticsearch.Elasticsearch('http://my-es-server:9200/') res = es.search(index='myindex', body='myquery') logger.debug("elastic returns %s hits" % res['hits']['total']) . . . </code></pre> <p>Then in my main file I do</p> <pre><code>import logging import lookup.py logging.root.setLevel(loglevel(args)) get_docs() . . . </code></pre> <p>I get lots of debug messages from <em>inside</em> the Elasticsearch object. How can I suppress them with some code in <code>lookup.py</code> without suppressing the debug messages in <code>lookup.py</code> itself? The <code>Elasticsearch</code> class seems to have a <code>logger</code> object; I I tried to set it to <code>None</code>, but this didn't change anything.</p>
<python><logging><module>
2016-08-09 04:47:27
HQ
38,842,454
Why should I keep the state flat
<p>I'm using ReactJs with Redux and on some tutorials and codes I see people suggesting and using normalizr to <strong>keep the state flat</strong>. But what is the real advantage in keeping it flat ? Will I encounter any problems if I don't ? Is it necessary ?</p>
<reactjs><redux><flux><normalizr>
2016-08-09 05:05:02
HQ
38,842,507
what different between fixed rate and fixed delay in schedule spring?
<p>I am implementing scheduled tasks using spring and i see have 2 type config time that scheduled works again from latest. What different between 2 type this config.</p> <pre><code> @Scheduled(fixedDelay = 5000) public void doJobDelay() { // do anything } @Scheduled(fixedRate = 5000) public void doJobRate() { // do anything } </code></pre>
<java><spring><scheduled-tasks>
2016-08-09 05:09:55
HQ
38,842,868
How can i displays the output coz it keeps on looping. Can anyone help please?
please solve this. i cant display the output it keeps on looping, im a beginner on this guys hehe it suppose to check whether the input is alpha or digits and store it as identifier and if operator it will store as symbol and check the input for keywords. #include <stdio.h> #include <string.h> #include <ctype.h> void keyword(char str[10]) { if(strcmp("for",str)==0||strcmp("while",str)==0||strcmp("do",str)==0||strcmp("int",str)==0||strcmp("float",str)==0||strcmp("char",str)==0||strcmp("double",str)==0||strcmp("static",str)==0||strcmp("switch",str)==0||strcmp("case",str)==0) printf("\n%s is a keyword",str); else printf("\n%s is an identifier",str); } main() { FILE *f1,*f2,*f3; char c,str[10],st1[10]; int num[100], lineo=0,tokenvalue=0,i=0,j=0,k=0; printf("\nEnter the c program "); gets(st1); f1=fopen("input","w"); while((c=getchar())!=EOF) putc(c,f1); fclose(f1); f1=fopen("input","r"); f2=fopen("identifier","w"); f3=fopen("specialchar","w"); while((c=getc(f1))!=EOF) { if(isdigit(c)) { tokenvalue=c-'0'; c=getc(f1); while(isdigit(c)) { tokenvalue*=10+c-'0'; c=getc(f1); } num[i++]=tokenvalue; ungetc(c,f1); } else if(isalpha(c)) { putc(c,f2); c=getc(f1); while(isdigit(c)||isalpha(c)||c=='_'||c=='$') { putc(c,f2); c=getc(f1); } putc(c,f2); ungetc(c,f1); } else if(c==' '||c=='\t') printf(""); else if(c=='\n') lineo++; else putc(c,f3); } fclose(f2); fclose(f3); fclose(f1); printf("\nThe no. im the program are"); for(j=0;j<i;j++) printf("%d",num[j]); printf("\n"); f2=fopen("identifier","r"); k=0; printf("The keywords and identifiers are: "); while((c=getc(f2))!=EOF) { if(c!='\0') str[k++]=c; else { str[k]='\0'; keyword(str); k=0; } } fclose(f2); f3=fopen("specialchar","r"); printf("\nSpecial Characters are: "); while((c=getc(f3))!=EOF) printf("%c",c); printf("\n"); fclose(f3); printf("Total no. of lines are:%d",lineo); }
<c>
2016-08-09 05:41:01
LQ_EDIT
38,843,202
What is different between save(), create() function in laravel 5
<p>I need to know what is the difference of <code>save()</code> and <code>create()</code> function in laravel 5. Where we can use <code>save()</code> and <code>create()</code> ?</p>
<laravel><laravel-5><laravel-5.2>
2016-08-09 06:05:41
HQ
38,843,580
Installation of Minishlink/web-push
i am unable to install this library from github. [ Minishlink/web-push ]<br><br> I have Lravel 5 installed on my server, I want to install this in the larvel directory (project). And will use the library via custom PHP.<br><br> I am facing below issues, 1. when i run `composer require minishlink/web-push`, i get below eror[![enter image description here][1]][1] 2. when i run `composer require mdanter/eec`, i get below error[![enter image description here][2]][2] 3. when i run `composer require pargonie/rndom_compat`, i get below error[![enter image description here][3]][3] [1]: http://i.stack.imgur.com/5ClD3.jpg [2]: http://i.stack.imgur.com/YukqG.jpg [3]: http://i.stack.imgur.com/nWvRq.jpg
<php><linux><shell><github><composer-php>
2016-08-09 06:28:39
LQ_EDIT
38,845,168
What is different between props and vars object in JMeter
<p>Im new in load and performance testing so could anyone explain me, what is difference between vars object and props object in JMeter beanshell script.</p> <p>Im also bit confuse about JMeter variable and properties.</p> <p>Thanks.</p>
<jmeter>
2016-08-09 07:59:55
HQ
38,845,637
Reload current page in Aurelia
<p>I have an <a href="http://www.aurelia.io">Aurelia</a> application where the user can select the company they're currently "working on". Every page in the app is dependent on the currently selected company, and the user can select a new company from a drop-down menu. The drop-down is a component sitting on the nav-bar.</p> <p>What I'd like is to have that component reload the current page on the <code>change.delegate</code> handler without restarting the app. So setting <code>window.location.href</code> is out of the question.</p> <p><strong>Is there a way to force the aurelia <code>Router</code> to reload the current route/page?</strong></p> <p>The alternative would be to use the <code>EventAggregator</code> to signal a company change throughout the app, but that would require either subscribing to that event on every page or having every page inherit from a base class that subscribes to that event, but these are much more involved options.</p>
<aurelia>
2016-08-09 08:27:51
HQ
38,846,058
How to make an array of buttons which change text upon clicking using Tkinter
<p>I'm trying to implement a simple GUI for the game of Tic Tac Toe using Tkinter. As a first step, I'm trying to make an array of buttons which change from being unlabeled to having the "X" label when clicked. I've tried the following:</p> <pre><code>import Tkinter as tk class ChangeButton: def __init__(self, master, grid=np.diag(np.ones(3))): frame = tk.Frame(master) frame.pack() self.grid = grid self.buttons = [[tk.Button()]*3]*3 for i in range(3): for j in range(3): self.buttons[i][j] = tk.Button(frame, text="", command=self.toggle_text(self.buttons[i][j])) self.buttons[i][j].grid(row=i, column=j) def toggle_text(self, button): if button["text"] == "": button["text"] = "X" root = tk.Tk() root.title("Tic Tac Toe") app = ChangeButton(root) root.mainloop() </code></pre> <p>However, the resulting window looks like this:</p> <p><a href="https://i.stack.imgur.com/Vl6N5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vl6N5.png" alt="enter image description here"></a></p> <p>and the buttons don't change when clicked. Any ideas why this does not work?</p>
<python><tkinter>
2016-08-09 08:47:10
LQ_CLOSE
38,846,223
Access props sent to components along with Redux state data
<p>Normally you can access props sent by parent to child on child component. But when redux is used on child components the props sent by parent is lost with use of 'connect' method which maps redux state with components props.</p> <p>E.g.:</p> <p>Declaring a component with properties: <code>&lt;A_Component prop1='1' prop2='2' /&gt;</code></p> <p>Accessing without redux on child component, works fine: <code>this.props.prop1</code> or <code>this.props.prop2</code></p> <p>Same statements will give <code>undefined</code> error if redux states are used.</p>
<javascript><reactjs><redux><state>
2016-08-09 08:55:27
HQ
38,847,819
Android protect Manifest.xml and layout From Reverse engineering
I have been doing lot of research on how to prevent from accessing Manifest and layout files. i know `proguard` is used for obfuscating code. but than it works only on Java code not on `res` folder. I have been though some answers like download content at run time instead keeping them in assets and all that.But for now my concern is not to protect asset files. In my case it is Manifest and res folder i need to take care of. i have many types of keys stored in here like example analytics xml file `app_tracker.xml`. This is not only questions of secret keys i have in xml files. But also logic of layout designing is being on risk. this are the threads i found while i was doing research on. but nothing was of any help to me. 1) http://stackoverflow.com/q/13854425/3479012 2) http://stackoverflow.com/q/7045613/3479012 I know reverse engineer cannot be avoided. but is there any way i can protect my manifest from being readable from hackers.
<android><apk><android-proguard><android-security>
2016-08-09 10:07:05
LQ_EDIT
38,848,362
Parse File name in Bash script
<p>I have a filename in a format like:</p> <pre><code> Master.csv-yyyy-mm-dd.txt example:- Master.csv.2016-07-06.txt </code></pre> <p>I want substring from that in the following format.</p> <pre><code> YY-MM </code></pre> <p>please help me quickly </p>
<linux><bash><shell>
2016-08-09 10:34:08
LQ_CLOSE
38,848,364
how to use multiple if conditions in AWK?
i am quite new to awk so i have a following query. i have below input file which i need to parse. input.csv "11111","TRUE","aa" "456789","TRUE","aa;bb;cc" "2345","TRUE","bb" "434566","","cc" **i am trying to create an awk command which should give me following output.** output.csv "11111","TRUE","aa,," "456789","TRUE","aa,bb,cc" "2345","TRUE",",bb," "434566","",",,cc" so i have created following command. **awk 'BEGIN{FS=",";OFS=","} { if( $3 ~ /aa/ ) { value="aa" } else { value="," }; if( $3 ~ /bb/ ) { value="$value,bb" } else { value="$value," }; if( $3 ~ /cc/ ) { value="$value,cc" } else { value="$value,"}; print $1 , $2 , $value}' input.csv > output.csv** But it is giving me following output. **"11111","TRUE","11111","TRUE","aa" "456789","TRUE","456789","TRUE","aa;bb;cc" "2345","TRUE","2345","TRUE","bb" "434566","","434566","","cc"** i am not sure why it is print first two atrributes twice and then printing the third value. Can someone please help me out as i am quite new to awk although i am able to do it in shell script but i need to do it using awk.
<awk>
2016-08-09 10:34:14
LQ_EDIT
38,848,759
ValueError: all the input arrays must have same number of dimensions
<p>I'm having a problem with <code>np.append</code>.</p> <p>I'm trying to duplicate the last column of 20x361 matrix <code>n_list_converted</code> by using the code below:</p> <pre><code>n_last = [] n_last = n_list_converted[:, -1] n_lists = np.append(n_list_converted, n_last, axis=1) </code></pre> <p>But I get error: </p> <blockquote> <p>ValueError: all the input arrays must have same number of dimensions</p> </blockquote> <p>However, I've checked the matrix dimensions by doing</p> <pre><code> print(n_last.shape, type(n_last), n_list_converted.shape, type(n_list_converted)) </code></pre> <p>and I get </p> <blockquote> <p>(20L,) (20L, 361L) </p> </blockquote> <p>so the dimensions match? Where is the mistake?</p>
<python><arrays><numpy><append>
2016-08-09 10:52:32
HQ
38,848,870
To write a Query to sort in Uppercase in php my admin.
<p>How to execute a query to convert a column in UPPERCASE in php myadmin?</p>
<php><mysql><phpmyadmin>
2016-08-09 10:58:09
LQ_CLOSE
38,848,940
how to put an object in an array?
My array is like this "taxDetails": [ { "taxType": "Flat Service Charge", "taxAmount": 0 }, { "taxTypeId": "1", "taxType": "Service Tax", "validFrm": "2016-01-18", "validTo": "2020-02-27", "taxPrctgSbt": 200, "taxPrctg": 14.5, "taxAmount": 300, "remarks": "test" }, { "taxTypeId": "2", "taxType": "VAT", "validFrm": "2016-01-18", "validTo": "2020-02-29", "taxPrctgSbt": 300, "taxPrctg": 12.5, "taxAmount": 400, "remarks": "rest" }, { "taxTypeId": "3", "taxType": "Swatch Bharath Cess", "validFrm": "2016-01-18", "validTo": "2020-03-31", "taxPrctgSbt": 400, "taxPrctg": 1, "taxAmount": 500, "remarks": "fest" }, { "taxTypeId": "5", "taxType": "Swatch Bharath Cess", "validFrm": "2016-01-18", "validTo": "2020-03-31", "taxPrctgSbt": 400, "taxPrctg": 1, "taxAmount": 500, "remarks": "fest" }, { "taxTypeId": "6", "taxType": "Percent Service Char", "validFrm": "2016-01-18", "validTo": "2020-08-01", "taxPrctgSbt": 200, "taxPrctg": 10, "taxAmount": 200, "remarks": "zest" }, { "taxTypeId": "7", "taxType": "Percent Service Char", "validFrm": "2016-01-18", "validTo": "2020-08-01", "taxPrctgSbt": 300, "taxPrctg": 15, "taxAmount": 200, "remarks": "zest" } ] and my code is $scope.paymentForm.taxDetails = []; //$scope.taxDetails = []; var flat= {"flat" : true}; $scope.taxList = function () { $http.get('http://192.168.0.113:8080/feasthunt/registration/getTaxDetails?restUniqCode='+uniqueCode) .success(function (response) { $scope.paymentForm.taxDetails = response; for(var i=0; i< $scope.paymentForm.taxDetails.length; i++){ $scope.paymentForm.taxDetails[i].push( flat ); } }) .error(function (data, status, header, config) { //alert('error'); }); }; $scope.taxList(); I want add another object in every array of elements. And final result will be like this "taxDetails": [ { "taxType": "Flat Service Charge", "taxAmount": 0, "flat": true }, { "taxTypeId": "1", "taxType": "Service Tax", "validFrm": "2016-01-18", "validTo": "2020-02-27", "taxPrctgSbt": 200, "taxPrctg": 14.5, "taxAmount": 300, "remarks": "test", "flat": true }, { "taxTypeId": "2", "taxType": "VAT", "validFrm": "2016-01-18", "validTo": "2020-02-29", "taxPrctgSbt": 300, "taxPrctg": 12.5, "taxAmount": 400, "remarks": "rest", "flat": true }, { "taxTypeId": "3", "taxType": "Swatch Bharath Cess", "validFrm": "2016-01-18", "validTo": "2020-03-31", "taxPrctgSbt": 400, "taxPrctg": 1, "taxAmount": 500, "remarks": "fest", "flat": true }, { "taxTypeId": "5", "taxType": "Swatch Bharath Cess", "validFrm": "2016-01-18", "validTo": "2020-03-31", "taxPrctgSbt": 400, "taxPrctg": 1, "taxAmount": 500, "remarks": "fest", "flat": true }, { "taxTypeId": "6", "taxType": "Percent Service Char", "validFrm": "2016-01-18", "validTo": "2020-08-01", "taxPrctgSbt": 200, "taxPrctg": 10, "taxAmount": 200, "remarks": "zest", "flat": true }, { "taxTypeId": "7", "taxType": "Percent Service Char", "validFrm": "2016-01-18", "validTo": "2020-08-01", "taxPrctgSbt": 300, "taxPrctg": 15, "taxAmount": 200, "remarks": "zest", "flat": true } ] Any one can give the answer for my question because it's very urgent requirement Thanks for responses
<javascript><angularjs>
2016-08-09 11:00:36
LQ_EDIT
38,849,138
AngularJS Sentence Builder similar to http://niklr.github.io/angular-query-builder/
I need angularjs solution (plugin or any fiddle/codepen etc. workaround) which is similar to query builders as below(which are available in github) http://niklr.github.io/angular-query-builder/ I should be able to form sentence with operators: if, then, else, and, or, on fields: xyzproduct, etc.. unit: quantity, value,.. conditions: =, <, <=, >, >=, <>, between finally i should be able to form a promotion or discount kind of thing. Output: > (if xyzproduct quantity between 1 and 100) (then discount 10%) > (if xyzproduct value > 500) (then discount 20%)
<javascript><jquery><angularjs>
2016-08-09 11:10:36
LQ_EDIT
38,850,633
App submission with coming soon alert
<p>I am new in ios development. I have created one app, in this app some features are not available right now. So my question is can i submit my app to app store with same design by giving coming soon alert for those features. Thanks in advance.</p>
<ios><app-store>
2016-08-09 12:22:23
LQ_CLOSE
38,851,017
How to create Fragment witch shows element clicked on RecyclerView?
I'm new at Android so maybe I'm just lack of understanding how things work. So what I have right now is RecyclerView of five elements. Each of them contains figure of different shape, different fruit name and different color bar. What I seek is to create Fragment which would show some background color, figure and fruit name inside that figure, depending on what Recyclerview element user clicks. How can I do that? That's my **MyAdapter.java** public class MyAdapter extends RecyclerView.Adapter <MyAdapter.MyViewHolder> { Context context; ArrayList<Information> data; public MyAdapter(Context context, ArrayList<Information> data) { this.context = context; this.data = data; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_row,parent,false); MyViewHolder holder = new MyViewHolder(view); return holder; } @Override public void onBindViewHolder(final MyViewHolder holder, final int position) { holder.textView.setText(data.get(position).title); holder.relativeLayout.setBackground(context.getResources().getDrawable(data.get(position).shape)); holder.textView2.setBackground(context.getResources().getDrawable(data.get(position).color)); } @Override public int getItemCount() { return data.size(); } class MyViewHolder extends RecyclerView.ViewHolder { TextView textView,textView2; RelativeLayout relativeLayout; public MyViewHolder(View itemView) { super(itemView); textView = (TextView) itemView.findViewById(R.id.txt_view); relativeLayout = (RelativeLayout) itemView.findViewById(R.id.img_view); textView2 = (TextView) itemView.findViewById(R.id.textView); } } } **MyActivity.java** public class MyActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view); MyAdapter adapter = new MyAdapter(this, Data.getData(this)); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new GridLayoutManager(this,1)); } } **activity_my.xml** <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" > <android.support.v7.widget.RecyclerView android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="wrap_content"> </android.support.v7.widget.RecyclerView> </android.support.design.widget.CoordinatorLayout> and **fragment_layout.xml** <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/fragment_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" > <RelativeLayout android:id="@+id/fragment_img" android:layout_width="100dp" android:layout_height="100dp" android:layout_gravity="center" android:rotation="180" android:layout_centerVertical="true" android:layout_centerHorizontal="true"> <TextView android:id="@+id/fragment_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:rotation="180" android:textSize="20sp" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /> </RelativeLayout> </RelativeLayout>
<java><android><android-fragments><android-recyclerview>
2016-08-09 12:39:45
LQ_EDIT
38,851,114
Appending a div with a class based on checkbox state
<p>I have a checkbox in admin in Sitecore. How can I append a <code>hidden-xs</code> class to a custom div if the box is checked? Can jQuery's append be avoided or not?</p>
<jquery><html><visual-studio><sitecore>
2016-08-09 12:43:55
LQ_CLOSE
38,851,217
Postgres 9.5+: UPSERT to return the count of updated and inserted rows
<p>I get the canonical example:</p> <pre><code> INSERT INTO user_logins (username, logins) VALUES ('Naomi',1),('James',1) ON CONFLICT (username) DO UPDATE SET logins = user_logins.logins + EXCLUDED.logins; </code></pre> <p>But now I also need to know:</p> <ol> <li>How many rows were inserted</li> <li>How many rows were updated because existing</li> <li>How many rows could not be inserted because of constraints</li> <li>If the constraint is not respected for the last row, will the previous inserted/updated rows be persisted in the DB? </li> </ol>
<postgresql><upsert>
2016-08-09 12:48:30
HQ
38,851,456
AWS S3 Object Expiration Less Than 24 Hours
<p>The built in Object Expiration is 1 day (plus the time to next midnight UTC). Is there a mechanism to do this at a more frequent basis? Given it appears that AWS does this across the board at midnight UTC then it's likely there would need to be another mechanism to delete objects sooner. We're looking for something in the 6-8 hour time frame. What other options if any would there be?</p> <p>Thank you</p>
<amazon-web-services><amazon-s3>
2016-08-09 12:58:51
HQ
38,852,412
Edit XML Layouts Before Inflating Them
<p>I need to make changes to an XML layout file before I inflate it, but any change I try to make give a <code>null object error</code>. Is there any possible way to do this?</p>
<android><android-layout><android-studio>
2016-08-09 13:39:39
LQ_CLOSE
38,853,157
How to daily rotate logs using Winston except the first day
<p>I need to rotate the logs daily except the file for current day. I'm using <strong>winston</strong> and <strong>winston-daily-rotate-file</strong> libraries.</p> <p>In the following example, a file "info.log.2016-08-09" is generated just the first time I execute node.</p> <p>But, I really need to generate the file "info.log", and after this day, should be renamed to "info.log.2016-08-09", and create a new "info.log" for the current day. I understant that this is the normal behaviour in other applications.</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-js lang-js prettyprint-override"><code>var logger = new (winston.Logger)({ transports: [ new dailyRotateFile( { name: 'cronInfo', filename: path.join(__dirname,"log", "info.log"), level: 'info', timestamp: function(){ return utils.formatDate(new Date(), "yyyy-mm-dd'T'HH:MM:ss.l'Z'") }, formatter: function(options) { return options.timestamp() +' ['+ options.level.toUpperCase() +'] '+ (undefined !== options.message ? options.message : '') + (options.meta &amp;&amp; Object.keys(options.meta).length ? '\n\t'+ JSON.stringify(options.meta) : '' ); }, json:false, datePattern:".yyyy-MM-dd" }) ] }); </code></pre> </div> </div> </p>
<node.js><logging><winston>
2016-08-09 14:10:48
HQ
38,853,867
Haskell - Tranform leters into numbers
i'm very new to haskell and would like to make a program to turn characters in a string into numbers. Something like this: A = 06 B = 07 C = 08 ... Z So for example: Input: Hi Output: 14 15 Does anyone know how I can go about doing this? Thanks In advanced.
<haskell>
2016-08-09 14:41:24
LQ_EDIT
38,853,972
Python client error 'Connection reset by peer'
<p>I have written a very small python client to access confluence restful api. I am using https protocol to connect with the confluence. I am running into <code>Connection reset by peer</code> error. Here is the full stack trace.</p> <pre><code>/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning. SNIMissingWarning /Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Traceback (most recent call last): File "wpToConfluence.py", line 15, in &lt;module&gt; main() File "wpToConfluence.py", line 11, in main headers={'content-type': 'application/json'}) File "/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/api.py", line 71, in get return request('get', url, params=params, **kwargs) File "/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/api.py", line 57, in request return session.request(method=method, url=url, **kwargs) File "/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/sessions.py", line 475, in request resp = self.send(prep, **send_kwargs) File "/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/sessions.py", line 585, in send r = adapter.send(request, **kwargs) File "/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/adapters.py", line 453, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', error(54, 'Connection reset by peer')) </code></pre> <p>Here is my client code:</p> <pre><code>import requests def main(): auth = open('/tmp/confluence', 'r').readline().strip() username = 'rakesh.kumar' response = requests.get("https://&lt;HOST-NAME&gt;/rest/api/content/", auth=(username, auth), headers={'content-type': 'application/json'}) print response if __name__ == "__main__": main() </code></pre> <p>I am running this script in a virtual environment and following packages are installed on that environment:</p> <pre><code>(wpToConfluence.py)➜ Python pip list You are using pip version 6.1.1, however version 8.1.2 is available. You should consider upgrading via the 'pip install --upgrade pip' command. appnope (0.1.0) backports.shutil-get-terminal-size (1.0.0) decorator (4.0.10) ipdb (0.10.1) ipython (5.0.0) ipython-genutils (0.1.0) pathlib2 (2.1.0) pexpect (4.2.0) pickleshare (0.7.3) pip (6.1.1) prompt-toolkit (1.0.5) ptyprocess (0.5.1) Pygments (2.1.3) requests (2.10.0) setuptools (25.1.6) simplegeneric (0.8.1) six (1.10.0) traitlets (4.2.2) urllib3 (1.16) wcwidth (0.1.7) </code></pre> <p>It does complain about the python version number but I am not sure how to update my Mac/Virtual environment python.</p> <p>I have tried to curl command and Postman both of them work fine for the given parameters.</p>
<python><python-requests><confluence-rest-api>
2016-08-09 14:46:33
HQ
38,854,831
Reading the Microsoft Exchange Email in c#
Iam getting the exception "The Autodiscover service couldn't be located." The version number of Microsoft Exchange is showing up as 14.3.266.4001,Hence am using ExchangeVersion.Exchange2010_SP2.Is it the correct Exchange Version? ExchangeService exchange = null; exchange = new ExchangeService(ExchangeVersion.Exchange2010_SP2); exchange.Credentials = new WebCredentials("deepak.kothari", "*****", "domain.com"); exchange.AutodiscoverUrl("deepak.kothari@domain.com"); Console.WriteLine("Connected to Exchange Server : " + exchange.Url.Host); Please help me resolve the above exception. Note : Iam working virtual machine.And iam trying to access the Microsoft exchange which is residing in another machine. Let me know if i can use any other library which is freely available for the above purpose in case?
<c#><.net><exchangewebservices>
2016-08-09 15:28:46
LQ_EDIT
38,855,204
Check if a row in one data frame exist in another data frame
<p>I have a data frame A like this:</p> <p><a href="https://i.stack.imgur.com/uu12A.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uu12A.png" alt="enter image description here"></a></p> <p>And another data frame B which looks like this:</p> <p><a href="https://i.stack.imgur.com/DI78z.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DI78z.png" alt="enter image description here"></a></p> <p>I want to add a column 'Exist' to data frame A so that if User and Movie both exist in data frame B then 'Exist' is True, otherwise it is False. So A should become like this: <a href="https://i.stack.imgur.com/sPxfb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sPxfb.png" alt="enter image description here"></a></p>
<python><pandas><dataframe>
2016-08-09 15:46:06
HQ
38,855,271
C# static Main(strng[] args)
Hi I'm trying to learn some C# programming and I came across something that I'm having a difficult time udnerstanding. I usually deal with vb6 vb.net and vba for the most part so i have some understanding of programming. here's what I'm not sure about... Let's say you have two snippets of code.. 1) static int Area(int h, int w) { return h*w; } 2) static void Main(string[] args) { int res = Area(w: 5, h: 8); console.writeline(res); } So in the first snippet, I'm doing the return which does the multiplication of H * W but we do not write it as we do in the #2 with console.writeline? What does the return actually do? In #2 - the first line static void Main(string[] args) - especially the string []args part - what does this mean?
<c#><.net><console-application>
2016-08-09 15:49:22
LQ_EDIT
38,856,410
Monitoring the asyncio event loop
<p>I am writing an application using python3 and am trying out asyncio for the first time. One issue I have encountered is that some of my coroutines block the event loop for longer than I like. I am trying to find something along the lines of top for the event loop that will show how much wall/cpu time is being spent running each of my coroutines. If there isn't anything already existing does anyone know of a way to add hooks to the event loop so that I can take measurements?</p> <p>I have tried using cProfile which gives some helpful output, but I am more interested in time spent blocking the event loop, rather than total execution time.</p>
<python-3.x><profiler><python-asyncio>
2016-08-09 16:49:22
HQ
38,856,819
What is the point of calling super in custom error classes in python?
<p>So I have a simple custom error class in Python that I created based on the Python 2.7 documentation:</p> <pre><code>class InvalidTeamError(Exception): def __init__(self, message='This user belongs to a different team'): self.message = message </code></pre> <p>This gives me warning <code>W0231: __init__ method from base class %r is not called</code> in PyLint so I go look it up and am given the very helpful description of "explanation needed." I'd normally just ignore this error but I have noticed that a ton code online includes a call to super in the beginning of the <strong>init</strong> method of custom error classes so my question is: Does doing this actually serve a purpose or is it just people trying to appease a bogus pylint warning?</p>
<python><python-2.7><exception><pylint>
2016-08-09 17:14:36
HQ
38,857,038
MPAndroidChart - Adding labels to bar chart
<p>It is necessary for my application to have a label on each bar of the bar chart. Is there a way to do this with MPAndroidChart? I could not find a way to do this on the project wiki/javadocs.</p> <p>If there isn't a way to do this is there another software that will allow me to?</p> <p><a href="https://i.stack.imgur.com/dGrlb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dGrlb.png" alt="enter image description here"></a></p>
<android><mpandroidchart>
2016-08-09 17:27:39
HQ
38,857,156
How to query many to many relationship sequelize?
<p>Tables have many to many relationship, junction by an order table in between. </p> <p>Outlet --> Order &lt;-- Product</p> <p>I want to get the list of Outlet for today Order. </p> <p>So here is a function to get all outlets:</p> <pre><code>db.Outlet.findAll({include: [ {model:db.Product, attributes: ['id', 'name', 'nameKh']} ]}).then(function(outlets){ return res.jsonp(outlets); }) </code></pre> <p>I got this result:</p> <p><a href="https://i.stack.imgur.com/P6gx9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/P6gx9.png" alt="enter image description here"></a></p> <p>I can only select with where Product Id by using this:</p> <pre><code>db.Outlet.findAll({include: [ {model:db.Product, attributes: ['id', 'name', 'nameKh'], where: {id: 2} ]}).then(function(outlets){ return res.jsonp(outlets); }) </code></pre> <p>How can I query by specific order amount, or today order date? </p> <p>Here are my models:</p> <p>Outlet:</p> <pre><code>var Outlet = sequelize.define('Outlet', { outletCode: DataTypes.STRING, outletName: DataTypes.STRING, outletNameKh: DataTypes.STRING, outletSubtype: DataTypes.STRING, perfectStoreType: DataTypes.STRING, address: DataTypes.STRING }, { associate: function(models){ Outlet.belongsToMany(models.Product, {through: models.Order}); Outlet.belongsTo(models.Distributor); // Outlet.hasMany(models.Order); } } ); </code></pre> <p>Product:</p> <pre><code>var Product = sequelize.define('Product', { inventoryCode: DataTypes.STRING, name: DataTypes.STRING, nameKh: DataTypes.STRING, monthlyCaseTarget: DataTypes.INTEGER, pieces: DataTypes.INTEGER, star: DataTypes.BOOLEAN, price: DataTypes.FLOAT, active: DataTypes.BOOLEAN }, { associate: function(models){ Product.belongsToMany(models.Outlet, {through: models.Order}); Product.belongsTo(models.Category); // Product.hasMany(models.Order); } } ); </code></pre> <p>Order:</p> <pre><code>var Order = sequelize.define('Order', { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true }, amount: DataTypes.INTEGER }, { associate: function(models){ Order.belongsTo(models.Outlet); Order.belongsTo(models.Product); Order.belongsTo(models.User); } } ); </code></pre>
<javascript><mysql><node.js><sequelize.js>
2016-08-09 17:35:06
HQ
38,857,162
Bootstrap collapse has a jumpy transition
<p>I have a problem with the transition of the bootstrap navbar. the collapse has a jumpy transition when the collapsing element has padding </p> <p>I googled this issue and it seems that the problem is the padding:</p> <pre><code>.menu-menu-container{ padding: 100px 30px 60px 30px; background-color: yellow; } </code></pre> <p>in fact if i remove the padding from menu-menu-container element, the animation works well, and it is very smooth </p> <p>this i my codepen > <a href="http://codepen.io/mp1985/pen/EyOJYE" rel="noreferrer">http://codepen.io/mp1985/pen/EyOJYE</a></p> <p>How can I achieve the same result without this weird issue?</p> <p>any help, suggestion or advice?</p>
<javascript><jquery><css><twitter-bootstrap><collapse>
2016-08-09 17:35:32
HQ
38,857,439
Which data structure should I use for storing eye retina?
<p>I need to develop and application for opening/closing of main gate of my office. That application will recognize human eye retina and then open the gate if it is valid. The image of retina is to be stored in database where it matches the upcoming image with the stored images of retina in db. Also when i want to delete the data of retina of specific person from database, it should be deleted. In my criteria, memory usage is to be less and very fast response of time</p> <p><strong>Which data structure should I use for this scenario?</strong></p>
<data-structures><functional-programming><artificial-intelligence><image-recognition>
2016-08-09 17:55:28
LQ_CLOSE
38,858,418
How do I hide the VR Mode / Goggles icon for A-Frame?
<p>In the bottom right corner, by default, is a Goggles icon that when clicked, enters VR or fullscreen (if no headset). How do I hide this so I can add my own UI, or disable VR altogether?</p> <p><img src="https://i.imgur.com/xhbdEJ4.jpg" alt=""></p>
<aframe><webvr>
2016-08-09 18:56:10
HQ
38,858,512
Select to End/Beginning of Line in Visual Studio Code
<p>In most editors (including Visual Studio proper), I can use Shift+End to select all of the text from the cursor location to the end of the current line, and Shift+Home to select all text up to the beginning of the line.</p> <p>These shortcuts don't seem to work out-of-the box (at least, on the Mac version). Is there some way to enable this, perhaps with a plugin or a setting I'm missing?</p>
<macos><visual-studio-code>
2016-08-09 19:01:39
HQ
38,858,615
transforming JSON into patent child relation
I am tring to convert `JSON vm.scholasticlist` into `JSON vm.parentList2`. In `JSON vm.scholasticlist`, ***s_gid*** is unique key, and ***parent_id*** point to parent ***s_gid***. I am trying following code, but unable to build it. vm.scholasticlist = []; vm.parentList = []; vm.parentList2 = []; for (var i in vm.scholasticlist) { if(vm.scholasticlist[i]['parent_id'] == 0 ){ vm.parentList.push(vm.scholasticlist[i]) } } vm.parentList2 = vm.parentList; for (var i in vm.parentList) { console.log(vm.parentList[i]['s_gid']) for (var x in vm.scholasticlist) { if(vm.scholasticlist[x]['parent_id'] === vm.parentList[i]['s_gid'] ){ console.log(vm.parentList[i]['s_gid']) vm.parentList2.push(vm.scholasticlist[x]) } } } vm.scholasticlist = [{ "s_gid": "10", "m_s_p_id": "1", "subject_group_name": "Foundation of Information Technology", "parent_id": "0", "sname": "" }, { "s_gid": "11", "m_s_p_id": "2", "subject_group_name": "Life Skills", "parent_id": "0", "sname": "" }, { "s_gid": "15", "m_s_p_id": "2", "subject_group_name": "Thinking Skills", "parent_id": "11", "sname": "Th.sk" }, { "s_gid": "15", "m_s_p_id": "2", "subject_group_name": "Thinking Skills", "parent_id": "11", "sname": "Th.sk" }] want to build new JSON with parent child relation vm.parentList2 = [{ "s_gid": "10", "m_s_p_id": "1", "subject_group_name": "Foundation of Information Technology", "parent_id": "0", "sname": "" }, { "s_gid": "11", "m_s_p_id": "2", "subject_group_name": "Life Skills", "parent_id": "0", "sname": "", "child": [{ "s_gid": "15", "m_s_p_id": "2", "subject_group_name": "Thinking Skills", "parent_id": "11", "sname": "Th.sk" }, { "s_gid": "15", "m_s_p_id": "2", "subject_group_name": "Thinking Skills", "parent_id": "11", "sname": "Th.sk" }] }]
<javascript>
2016-08-09 19:07:55
LQ_EDIT
38,858,718
npm script, copy package.json to dist when bundling
<p>I am trying to add a second part to my npm bundle script. The first part runs great, however I am trying to copy in 3 files along with the bundle.</p> <p>So right now I have :</p> <pre><code>"bundle": "NODE_ENV=production webpack --output-file bundledFile.js &amp;&amp; cp package.json dist/", </code></pre> <p>The <code>NODE_ENV=production webpack --output-file bundledFile.js</code> works great by itself. The part that is not working is the <code>&amp;&amp; cp package.json dist/</code>, I would like the script to copy my package.json (along with 2 other files actually, but just starting with this one) to the dist folder. Brand new to these scripts, any idea how to fix? Appreciate any advice, thanks!</p>
<javascript><node.js>
2016-08-09 19:13:39
HQ
38,859,145
Detect "Ubuntu on Windows" vs native Ubuntu from bash script
<p>Can a bash script detect if it's running in "Ubuntu on Windows" vs native Ubuntu? If so, how?</p> <p>I ran <code>env</code> on both machines and didn't see any obvious environmental variable differences. I could test for the existence of the <code>/mnt/c</code> directory, but that is not foolproof because that directory could potentially also be present on native Ubuntu.</p>
<bash><windows-subsystem-for-linux>
2016-08-09 19:40:40
HQ
38,859,354
What is the difference between TF Learn (aka Scikit Flow) and TFLearn (aka TFLearn.org)
<p>There are two TFLearn projects</p> <pre><code>TF Learn (aka Scikit Flow) https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/learn/python/learn </code></pre> <p>and</p> <pre><code>TFLearn: Deep learning library featuring a higher-level API for TensorFlow. https://github.com/tflearn/tflearn </code></pre> <p>what is the status of these projects, are they going to stay separate or they going to merged together?</p>
<frameworks><tensorflow><skflow>
2016-08-09 19:54:54
HQ
38,859,593
Installing guppy with pip3 issues
<p>I am trying to install <a href="https://pypi.python.org/pypi/guppy/" rel="noreferrer">guppy</a>. My program uses python3 so I must use pip3 exclusively. When I run:</p> <pre><code>pip3 install guppy </code></pre> <p>I get:</p> <pre><code>src/sets/sets.c:77:1: error: expected function body after function declarator INITFUNC (void) ^ src/sets/sets.c:39:18: note: expanded from macro 'INITFUNC' #define INITFUNC initsetsc ^ 1 error generated. error: command 'clang' failed with exit status 1 </code></pre> <p>I tried doing <a href="https://stackoverflow.com/questions/10238458/cant-install-orange-error-command-clang-failed-with-exit-status-1">this</a>, even thourgh it wasn't the same and exported gcc and g++:</p> <pre><code>➜ ~ export CC=gcc ➜ ~ export CXX=g++ </code></pre> <p>Running again:</p> <pre><code>src/sets/sets.c:77:1: error: expected function body after function declarator INITFUNC (void) ^ src/sets/sets.c:39:18: note: expanded from macro 'INITFUNC' #define INITFUNC initsetsc ^ 1 error generated. error: command 'gcc' failed with exit status 1 </code></pre> <p>Most who had this issue used <code>sudo apt-get python-dev</code> or something of the like to resolve this issue, I couldn't find an equivalent for Mac. Is there a way to resolve this issue?</p>
<python><python-3.x>
2016-08-09 20:11:10
HQ
38,859,883
Difference between else and elsif in this peice of code that hails different results?
in this code here if I put longest_word("my name is bobby li") it returns "bobby" if it is elsif but if i choose else it will return "li". Can someone explain? def longest_word(sentence) words = sentence.split(" ") longest_word = nil word_idx = 0 while word_idx < words.length current_word = words[word_idx] if longest_word == nil longest_word = current_word **elsif** longest_word.length < current_word.length longest_word = current_word end word_idx += 1 end return longest_word end
<ruby>
2016-08-09 20:31:06
LQ_EDIT
38,859,941
Is there a way to reuse enums in other classes?
<p>Is there a way to reuse enums in other classes?</p> <p>For example, I have a class using another class's enums. However, I want to avoid having to type the other class's namespace every time I use that class's enums for my active class.</p>
<c#>
2016-08-09 20:34:33
LQ_CLOSE
38,860,912
Modifying contents of Android .aar file / Converting to and from .zip format
<p>So I have a .aar file which has a file I need to remove from inside it. </p> <p>I am running on mac and changed the extention from .aar to .zip and unzipped the zip file. I then removed the file from the folder, recompressed it back into a .zip and then tried changing the extension from .zip back to .aar. </p> <p>The problem is that the now modified .aar is not recognized as a .aar file. It is still being registered as a .zip and I can no longer use it in my project. </p> <p>So my question is two fold: </p> <p>1) How can one easily modify the contents of a .aar file and 2) How do you properly convert to/from .aar and .zip? </p>
<android><android-studio><zip><binaryfiles><aar>
2016-08-09 21:42:26
HQ
38,861,601
How to ONLY trigger parent click event when a child is clicked
<p>Both child and parent are clickable (child could be a link or div with jQuery click events). When I click on child, how do I only trigger parent click event but not the child event?</p>
<javascript><jquery><css><html>
2016-08-09 22:43:45
HQ
38,862,511
Java code not working? (FileInputStream, StringTokenizer, String to primitive type conversion)
my code is just not working. The text file is in the same folder as my classes. I used the pathname, which worked, but I don't think that would work if I send the file to someone else. And converting the Strings to primitive type using parse methods isn't working, either. Not sure what I'm doing wrong. Can anyone help? Here is my code: import java.util.Scanner; import java.util.StringTokenizer; import java.io.FileNotFoundException; import java.io.FileInputStream; public class TestInventory { public static void main(String[] args) { // TODO Auto-generated method stub Inventory movieList = new Inventory(); Scanner inputStream = null; try{ inputStream = new Scanner(new FileInputStream("movies_db.txt")); } catch(FileNotFoundException e){ System.out.println("File not found or could not be opened"); System.exit(0); } while(inputStream.hasNextLine()){ String s = inputStream.nextLine(); StringTokenizer st = new StringTokenizer(s, " - "); String t1 = st.nextToken(); String t2 = st.nextToken(); String t3 = st.nextToken(); String t4 = st.nextToken(); int y = Integer.parseInt(t2); double r = Double.parseDouble(t4); int d = Integer.parseInt(t3); Movie m = new Movie(t1, y, r, d); movieList.addMovie(m); }
<java><exception><type-conversion><fileinputstream><stringtokenizer>
2016-08-10 00:38:57
LQ_EDIT
38,862,567
gcloud app deploy, flag to automate prompting?
<p>Is it possible to do silent deployment when using <code>gcloud app deploy</code></p> <p>When I run the command <code>gcloud app deploy ./deployment/app.yaml --version v1</code> its always prompting for </p> <p><code>Do you want to continue (Y/n)? Y</code></p> <p>how to automate this? is there any flag that we can pass in to mute this? </p>
<gcloud>
2016-08-10 00:47:06
HQ
38,863,057
SQLAlchemy and Falcon - session initialization
<p>I'm wondering where the best place would be to create a scoped session for use in falcon.</p> <p>From reading the flask-sqlalchemy code, it, in a round about way, does something like this:</p> <pre><code>from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker try: from greenlet import get_current as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident connection_uri = 'postgresql://postgres:@localhost:5432/db' engine = create_engine(connection_uri) session_factory = sessionmaker(bind=engine) session_cls = scoped_session(session_factory, scopefunc=get_ident) session = session_cls() </code></pre> <p>Would this work for falcon? Will the <code>get_ident</code> func "do the right thing" when using gunicorn?</p>
<python><sqlalchemy><flask-sqlalchemy><falconframework>
2016-08-10 01:55:13
HQ
38,864,001
Elixir - how to deep merge maps?
<p>With <code>Map.merge</code> I have:</p> <pre><code>Map.merge(%{ a: %{ b: 1 }}, %{ a: %{ c: 3 }}) # =&gt; %{ a: %{ c: 3 }} </code></pre> <p>but actually I want to:</p> <pre><code>Map.merge(%{ a: %{ b: 1 }}, %{ a: %{ c: 3 }}) # =&gt; %{ a: %{ b: 1, c: 3 }} </code></pre> <p>Is there any native method without writing a recursive boilerplate function for this case?</p>
<elixir>
2016-08-10 04:02:09
HQ
38,864,489
How to Trace CMakeLists.txt
<p>Is there a way to examine what <code>cmake</code> is doing in a failing run? For example, I have a program depending on libbacktrace, which I can link to by <code>gcc foo.c -lbacktrace</code>. But when I write a <code>CMakeLists.txt</code> like</p> <pre><code>cmake_minimum_required(VERSION 2.8) find_library (BACKTRACE_LIBRARY backtrace) message (BACKTRACE_LIBRARY=${BACKTRACE_LIBRARY}) </code></pre> <p>and type <code>cmake &lt;path&gt;</code>, it prints out <code>BACKTRACE_LIBRARY=BACKTRACE_LIBRARY-NOTFOUND</code>.</p> <p>How do I go about figuring out where the problem is? What commands is <code>cmake</code> executing before giving up on finding libbacktrace? Is it executing anything at all? In autoconf, the commands are all recorded in <code>config.log</code>, but <code>CMakeOutput.log</code> in this case is blank. Likewise, <code>cmake --trace</code> only echoes the contents of <code>CMakeLists.txt</code> after a bunch of system cmake files, which is useless in this case.</p> <p>Please note that I'm not looking for a way to make this particular invocation of <code>find_library</code> work - that's just an example. My question is: I have a CMakeLists.txt that isn't working as expected; what tools exist to help me figure out where and why it's failing?</p>
<cmake>
2016-08-10 04:50:21
HQ
38,865,201
Most efficient way to search in list of dicts
<p>I have the following list of dicts.</p> <pre><code>people = [ {'name': "Tom", 'age': 10}, {'name': "Mark", 'age': 5}, {'name': "Pam", 'age': 7} ] </code></pre> <p>Which would be the most optimized way in terms of performance to search in list of dicts. Following are different some methods:</p> <pre><code>next((item for item in dicts if item["name"] == "Pam"), None) </code></pre> <p>OR</p> <pre><code>filter(lambda person: person['name'] == 'Pam', people) </code></pre> <p>OR</p> <pre><code>def search(name): for p in people: if p['name'] == name: return p </code></pre> <p>OR</p> <pre><code>def search_dictionaries(key, value, list_of_dictionaries): return [element for element in list_of_dictionaries if element[key] == value] </code></pre> <p>Any other method is also welcome. Thanks.</p>
<python><list><dictionary>
2016-08-10 05:50:07
HQ
38,865,935
Spriung boot data source initialization error can some help me to resolve the issue, It's little bit urgent
2016-08-10 11:51:29.938 INFO 4336 --- [ main] com.employee.EmployeeApplication : No active profile set, falling back to default profiles: default 2016-08-10 11:51:29.938 DEBUG 4336 --- [ main] o.s.boot.SpringApplication : Loading source class com.employee.EmployeeApplication 2016-08-10 11:51:29.961 DEBUG 4336 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'classpath:/application.yml' 2016-08-10 11:51:29.961 DEBUG 4336 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'classpath:/application.yml' for profile default 2016-08-10 11:51:29.961 INFO 4336 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@17486b3: startup date [Wed Aug 10 11:51:29 IST 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@1cabb2a 2016-08-10 11:51:29.970 DEBUG 4336 --- [ main] ationConfigEmbeddedWebApplicationContext : Bean factory for org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@17486b3: org.springframework.beans.factory.support.DefaultListableBeanFactory@30646a: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,employeeApplication]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@70f8a6 2016-08-10 11:51:41.990 DEBUG 4336 --- [ main] o.s.b.a.AutoConfigurationPackages : @EnableAutoConfiguration was declared on a class in the package 'com.employee'. Automatic @Repository and @Entity scanning is enabled. 2016-08-10 11:51:42.472 WARN 4336 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'. 2016-08-10 11:51:42.785 INFO 4336 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=d17d6c85-cdf2-3621-87fd-0420958f449a 2016-08-10 11:51:42.808 INFO 4336 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2016-08-10 11:51:43.091 INFO 4336 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$12e0b249] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-08-10 11:51:43.233 INFO 4336 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$2efab546] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-08-10 11:51:43.247 INFO 4336 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.RefreshEndpointAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.RefreshEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$d859b73c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-08-10 11:51:43.261 DEBUG 4336 --- [ main] ationConfigEmbeddedWebApplicationContext : Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@e64760] 2016-08-10 11:51:43.261 DEBUG 4336 --- [ main] ationConfigEmbeddedWebApplicationContext : Using ApplicationEventMulticaster [org.springframework.context.event.SimpleApplicationEventMulticaster@5fd2b1] 2016-08-10 11:51:44.354 DEBUG 4336 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Code archive: C:\Users\Shadab%20Ahmed\.m2\repository\org\springframework\boot\spring-boot\1.3.6.RELEASE\spring-boot-1.3.6.RELEASE.jar 2016-08-10 11:51:44.354 DEBUG 4336 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Code archive: C:\Users\Shadab%20Ahmed\.m2\repository\org\springframework\boot\spring-boot\1.3.6.RELEASE\spring-boot-1.3.6.RELEASE.jar 2016-08-10 11:51:44.356 DEBUG 4336 --- [ main] .t.TomcatEmbeddedServletContainerFactory : None of the document roots [src/main/webapp, public, static] point to a directory and will be ignored. 2016-08-10 11:51:44.544 INFO 4336 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8091 (http) 2016-08-10 11:51:44.579 INFO 4336 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2016-08-10 11:51:44.583 INFO 4336 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.36 2016-08-10 11:51:45.030 INFO 4336 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2016-08-10 11:51:45.031 INFO 4336 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 15070 ms 2016-08-10 11:51:45.232 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Added existing Servlet initializer bean 'dispatcherServletRegistration'; order=2147483647, resource=class path resource [org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration$DispatcherServletConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'metricFilter'; order=-2147483648, resource=class path resource [org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'characterEncodingFilter'; order=-2147483648, resource=class path resource [org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'hiddenHttpMethodFilter'; order=-10000, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'httpPutFormContentFilter'; order=-9900, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'requestContextFilter'; order=-105, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'webRequestLoggingFilter'; order=2147483637, resource=class path resource [org/springframework/boot/actuate/autoconfigure/TraceWebFilterAutoConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'applicationContextIdFilter'; order=2147483647, resource=class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration$ApplicationContextFilterConfiguration.class] 2016-08-10 11:51:46.127 INFO 4336 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2016-08-10 11:51:46.142 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'metricFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*] 2016-08-10 11:51:46.225 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.web.OrderedRequestContextFilter : Initializing filter 'requestContextFilter' 2016-08-10 11:51:46.229 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.web.OrderedRequestContextFilter : Filter 'requestContextFilter' configured successfully 2016-08-10 11:51:46.230 DEBUG 4336 --- [ost-startStop-1] iguration$ApplicationContextHeaderFilter : Initializing filter 'applicationContextIdFilter' 2016-08-10 11:51:46.230 DEBUG 4336 --- [ost-startStop-1] iguration$ApplicationContextHeaderFilter : Filter 'applicationContextIdFilter' configured successfully 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] .s.b.c.w.OrderedHttpPutFormContentFilter : Initializing filter 'httpPutFormContentFilter' 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] .s.b.c.w.OrderedHttpPutFormContentFilter : Filter 'httpPutFormContentFilter' configured successfully 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.a.autoconfigure.MetricsFilter : Initializing filter 'metricFilter' 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.a.autoconfigure.MetricsFilter : Filter 'metricFilter' configured successfully 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.w.OrderedHiddenHttpMethodFilter : Initializing filter 'hiddenHttpMethodFilter' 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.w.OrderedHiddenHttpMethodFilter : Filter 'hiddenHttpMethodFilter' configured successfully 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.w.OrderedCharacterEncodingFilter : Initializing filter 'characterEncodingFilter' 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.w.OrderedCharacterEncodingFilter : Filter 'characterEncodingFilter' configured successfully 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.a.trace.WebRequestTraceFilter : Initializing filter 'webRequestLoggingFilter' 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.a.trace.WebRequestTraceFilter : Filter 'webRequestLoggingFilter' configured successfully 2016-08-10 11:51:46.338 WARN 4336 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). 2016-08-10 11:51:46.532 INFO 4336 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat 2016-08-10 11:51:46.734 ERROR 4336 --- [ main] o.s.boot.SpringApplication : Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054) ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:829) ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:760) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:360) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:306) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at com.employee.EmployeeApplication.main(EmployeeApplication.java:11) [classes/:na] Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] ... 26 common frames omitted Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] ... 28 common frames omitted Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] ... 40 common frames omitted Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.getDriverClassName(DataSourceProperties.java:180) ~[spring-boot-autoconfigure-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration.dataSource(DataSourceAutoConfiguration.java:121) ~[spring-boot-autoconfigure-1.3.6.RELEASE.jar:1.3.6.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_11] at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_11] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] ... 41 common frames omitted Application.yml file content is server: port: 8091 debug: true spring: application: name: employee-app --- spring: profiles: local #hibernate config jpa: database-platform: org.hibernate.dialect.Oracle10gDialect hibernate: ddl-auto: update #Spring Boot Config for Oracle datasource: driver-class-name: oracle.jdbc.OracleDriver url: jdbc:oracle:thin:@localhost:1521:xe username: system password: root logging: level: org.springframework.security: INFO --- spring: profiles: default #hibernate config jpa: database-platform: org.hibernate.dialect.Oracle10gDialect #Spring Boot Config for Oracle datasource: driver-class-name: oracle.jdbc.OracleDriver url: jdbc:oracle:thin:@localhost:1521:xe username: system password: root logging: level: org.springframework.security: INFO
<java><spring><hibernate><spring-boot>
2016-08-10 06:37:05
LQ_EDIT
38,866,166
Unable to access application container from iPad running on iOS 10 beta
<p>I am not able to download app container using xcode for my application on iOS 10 beta 4. I am using later xcode (beta 4). When I connect my device and go to <code>Device</code> in xcode, I am able to see my app listed but when I click on download container I get below error:</p> <p><a href="https://i.stack.imgur.com/3u8Dt.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3u8Dt.png" alt="enter image description here"></a></p> <p>Is there anything to do with my app setting or device setting. How can I get my app data for iOS10 beta 4.</p>
<ios10><xcode8-beta4><appcontainer>
2016-08-10 06:49:43
HQ
38,866,192
Dealing with non required forms in mysqli
<p>I am attempting to insert variables from a form into a mySQL database using a mysqli prepared statement. The problem I have run into is that one of my variables is not required and so when i don't enter anything for it in the form I get an error. How do I properly deal with this variable? would i need to use a different prepared statement or could I keep the one I have? </p>
<php><mysqli>
2016-08-10 06:51:05
LQ_CLOSE
38,866,560
Laravel - Lock wait timeout exceeded
<p>I have a lot of transactions in my code, and if an error occurs in executing in one of these transactions that doesn't trigger commit or rollback, then the database is locked and any subsequent attempts to access the database results in this:</p> <p><code>production.ERROR: PDOException: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction in /home/forge/default/vendor/laravel/framework/src/Illuminate/Database/Connection.php:390 </code></p> <p>In the Controller:</p> <pre><code>DB::beginTransaction(); try { //Code that uses exec() to process some images. &lt;-- If code breaks here, then the above error appears on subsequent requests. //Code that accesses the database } catch(\Exception $e){ DB::rollback(); throw $e; } DB::commit(); </code></pre> <p>So even php artisan migrate:refresh or php artisan migrate:reset stops working as well. How should I go about fixing this?</p>
<php><mysql><laravel><transactions>
2016-08-10 07:14:22
HQ
38,867,190
How can I check if my AVPlayer is buffering?
<p>I want to detect if my AVPlayer is buffering for the current location, so that I can show a loader or something. But I can't seem to find anything in the documentation for AVPlayer.</p>
<ios><avplayer><buffering>
2016-08-10 07:45:58
HQ
38,867,905
How to view DNS cache in OSX?
<p>To list the entries of DNS cache in <strong>OSX 10.11.6</strong>, I tried <code>dscacheutil -statistics</code> but that didn't work.</p> <pre><code>$ sudo dscacheutil -statistics Unable to get details from the cache node </code></pre> <p>How can I just print what is there in the DNS cache without flushing it?</p>
<dns><osx-elcapitan><oscache>
2016-08-10 08:22:50
HQ
38,868,495
Can I select values from one column in an php-array?
<p>I need only the values of one column in an array. Without php I would use "SELECT valueX FROM tableY". This does not work with php. I only get one result. This is what I have:</p> <pre><code>$salty = "SELECT salt FROM login"; $salts = mysqli_query($connection, $salty); $validsalts = mysqli_fetch_array($salts); </code></pre>
<php><mysql>
2016-08-10 08:50:44
LQ_CLOSE
38,868,584
What's the replacement of '++' and '--' in swift3?
<p>Since the expression '++' and '--' will be removed in Swift 3, the follow code will be invalid.</p> <pre><code> return i &lt; 0 ? nil : i-- </code></pre> <p>Now I just rewrite it like this</p> <pre><code>if i &lt; 0 { return nil } let res = i i -= 1 return res </code></pre> <p>But it looks too .... cumbersome.</p> <p>How to rewrite this code as short as possible in Swift 3?</p>
<swift><swift3>
2016-08-10 08:55:10
LQ_CLOSE
38,868,620
How to check that an exception is not thrown using mockito?
<p>I have a simple <code>Java</code> method, I would like to check that it does not throw any <code>exceptions</code>. </p> <p>I have already mocked the parameters etc, however I am not sure how to use <code>Mockito</code> to test that no exception has been thrown from the method?</p> <p><strong>Current test code:</strong></p> <pre><code> @Test public void testGetBalanceForPerson() { //creating mock person Person person1 = mock(Person.class); when(person1.getId()).thenReturn("mockedId"); //calling method under test myClass.getBalanceForPerson(person1); //How to check that an exception isn't thrown? } </code></pre>
<java><unit-testing><exception><exception-handling><mockito>
2016-08-10 08:56:51
HQ
38,869,286
Is it possible to connect to a running docker container with Winscp?
<p>I am able to connect to host on which docker system runs. But I cannot find out how to connecting to the docker directly. Does anyone know what I need to adjust in WinSCP added to connect? Sure, I am able to open by putty, but I want to connect by WinSCP. </p>
<docker><amazon-ec2><winscp><docker-image>
2016-08-10 09:25:16
HQ
38,869,345
Java library for encoding/decoding audio files, such as mp3 and mp4
<p>Could you please provide me some non-deprecated java library for usage in maven repository for encoding/decoding audio files, such as mp3 and mp4? </p> <p>What I need exactly is to convert mp3 to mp4 on the fly and vice versa.</p> <p>I've found some JAVE (<a href="http://www.sauronsoftware.it/projects/jave/" rel="nofollow">http://www.sauronsoftware.it/projects/jave/</a>), Xuggler (<a href="http://www.xuggle.com/xuggler/" rel="nofollow">http://www.xuggle.com/xuggler/</a>), but seems these projects are no more alive.</p>
<java><maven><encoding><mp3><mp4>
2016-08-10 09:27:47
LQ_CLOSE
38,869,673
Pod in pending state due to Insufficient CPU
<p>On my GCE Kubernetes cluster I can no longer create pods.</p> <pre><code>Warning FailedScheduling pod (www.caveconditions.com-f1be467e31c7b00bc983fbe5efdbb8eb-438ef) failed to fit in any node fit failure on node (gke-prod-cluster-default-pool-b39c7f0c-c0ug): Insufficient CPU </code></pre> <p>Looking at the allocated stats of that node</p> <pre><code>Non-terminated Pods: (8 in total) Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits --------- ---- ------------ ---------- --------------- ------------- default dev.caveconditions.com-n80z8 100m (10%) 0 (0%) 0 (0%) 0 (0%) default lamp-cnmrc 100m (10%) 0 (0%) 0 (0%) 0 (0%) default mongo-2-h59ly 200m (20%) 0 (0%) 0 (0%) 0 (0%) default www.caveconditions.com-tl7pa 100m (10%) 0 (0%) 0 (0%) 0 (0%) kube-system fluentd-cloud-logging-gke-prod-cluster-default-pool-b39c7f0c-c0ug 100m (10%) 0 (0%) 200Mi (5%) 200Mi (5%) kube-system kube-dns-v17-qp5la 110m (11%) 110m (11%) 120Mi (3%) 220Mi (5%) kube-system kube-proxy-gke-prod-cluster-default-pool-b39c7f0c-c0ug 100m (10%) 0 (0%) 0 (0%) 0 (0%) kube-system kubernetes-dashboard-v1.1.0-orphh 100m (10%) 100m (10%) 50Mi (1%) 50Mi (1%) Allocated resources: (Total limits may be over 100%, i.e., overcommitted. More info: http://releases.k8s.io/HEAD/docs/user-guide/compute-resources.md) CPU Requests CPU Limits Memory Requests Memory Limits ------------ ---------- --------------- ------------- 910m (91%) 210m (21%) 370Mi (9%) 470Mi (12%) </code></pre> <p>Sure I have 91% allocated and can not fit another 10% into it. But is it not possible to over commit resources?</p> <p>The usage of the server is at about 10% CPU average</p> <p><a href="https://i.stack.imgur.com/wBSuc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wBSuc.png" alt="enter image description here"></a></p> <p>Would be a shame if I can not use more ressources.</p>
<kubernetes><google-kubernetes-engine>
2016-08-10 09:41:17
HQ
38,869,913
Combobox Name in Chart
I am trying to build an interactive Chart in excel, what my problem is that i have included an Form Control Combo Box in my chart but I am not able to get get the name of that combobox so that i can access that in my VBA code. I have attached an screenshot of the chart.[![enter image description here][1]][1] What i want to know is that what code i can use to access the selected value of this combobox in the screenshot. [1]: http://i.stack.imgur.com/9R1as.png
<excel><vba><combobox>
2016-08-10 09:51:16
LQ_EDIT
38,870,710
error "Could not get BatchedBridge, make sure your bundle is packaged properly" on start of app
<p>Trying to create a react-native project on Android 4.4.2 I get this error screen</p> <p><a href="https://i.stack.imgur.com/WGu6C.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WGu6C.png" alt="said error"></a></p> <p>and couldn't find any way to resolve it. I tried restarting packager, reconnecting device, even reinstalling react native and starting new project. On 6.0.0 and later versions it works just fine.</p>
<android><react-native>
2016-08-10 10:24:32
HQ
38,871,171
How to call a onclick print funtion and forget it
I wrote a print function and it opening a new tab window for print and then that print button keep active untill I don't close that window by cancel or print. During that I am unable to call my other javascript function on parent page. So my question is , is it possible to open a print window and that print button become inactive again, and windows keep open to print? below is my funtion. function g_print_div(in_div_id) { div_id = in_div_id || 'idprint'; var divElements = document.getElementById(div_id).innerHTML; var oldPage = document.body.innerHTML; var printWindow = window.open(); printWindow.document.write('<html>'); printWindow.document.write("<link rel='stylesheet' type='text/css' href='/static/css/print.css') %]' />"); printWindow.document.write('<body >'); printWindow.document.write(divElements); printWindow.document.write('</body></html>') printWindow.print(); printWindow.document.close(); printWindow.close(); } calling with onclick='g_print_div();' funtion, If there is any other method to accomplish this, then let me know. Thanks
<javascript><jquery>
2016-08-10 10:43:44
LQ_EDIT
38,872,402
Facebook (#32) Page request limited reached
<p>I am getting the following error while I am trying to access my page using Facebook Graph API.</p> <pre><code>{ error: { message: "(#32) Page request limited reached", type: "OAuthException", code: 32, fbtrace_id: "F6d20m1iihx" </code></pre> <p>} }</p> <p>Could not find anything in Facebook API Documentation. Is this related to my API or page?</p>
<facebook><facebook-graph-api>
2016-08-10 11:38:39
HQ
38,872,942
What is the difference between glide and picasso image libraries in android?which is the best?
I am new to this image loading concept.Can u please explain internal implementation of image loading while considering performance issue?
<android>
2016-08-10 12:03:19
LQ_EDIT
38,873,023
React Native and WMS
<p>I am developing a mobile application in React Native requiring the use of Web Map Services. I have not found any library or framework that allows use WMS and react native at same time. In React (Web) I found <a href="https://github.com/PaulLeCam/react-leaflet" rel="noreferrer">one</a>. My question is:</p> <p>Do you know if exists any library or framework that allows me to work with WMS and React Native, or if there is any possibility of integrating a library of React (web) in React native?</p> <p>Thanks!</p>
<reactjs><react-native><wms>
2016-08-10 12:07:05
HQ
38,873,083
NodeJs Express send 403 and render
<p>How can I send a error 403 and render a page with 'you have no rights to visited this page' message?</p> <p>I have now this: </p> <pre><code>res.send(403,"You do not have rights to visit this page"); </code></pre> <p>but I want to render a HTML page instead a basic text</p> <pre><code>res.render('no-rights', {title: 'You have no rights to visit this page', text: 'You are not allowed to visited this page. Maybe you are not logged in?'}); </code></pre> <p>with a 403 status. </p>
<node.js><express>
2016-08-10 12:10:10
HQ
38,873,533
Convert YYYY-MM-DD HH:MM:SS to YYYY-MM-DD python
<p>I'm trying to convert </p> <pre><code>YYYY-MM-DD HH_MM_SS </code></pre> <p>to </p> <pre><code>YYYY-MM-DD </code></pre> <p>example:</p> <pre><code>from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta i=0 var="2016-05-03" while i &lt; 5 new_date = datetime.strptime(var, "%Y-%m-%d") + relativedelta(days=i) i=i+1 print(new_date) </code></pre> <p>in this example I would like to convert new_date to string YYYY-MM-DD. I have tried many option, none of them worked...</p> <p>I thought it will be quite easy but it is not, how to handle with that ? </p>
<python><date>
2016-08-10 12:32:04
LQ_CLOSE
38,873,970
Change service config parameters at runtime
<p>I'm using mailgun to send mails thought Laravel 5.2. It configured on config/services.php like that:</p> <pre><code> 'mailgun' =&gt; [ 'domain' =&gt; env('mailgun_domain','mydomain.com'), 'secret' =&gt; env('mailgin_secret','my-secret-key-132152345423') ], </code></pre> <p>But, I need change that settings in run time, before call Mail::send, to use the correct service parameters. It must be changed many times during runtime.</p> <p>I <strong>cannot configure it by .env file</strong>, because all data will be get from database, where the user setups the domain and secret.</p>
<laravel><laravel-5><laravel-5.2>
2016-08-10 12:50:52
HQ
38,874,080
why only one filename is written in using ls > in shell script
I'm stacked in coding shell script in my RedHatOS. I tried to output filename using Regular expression as below。 #!/bin/bash ls -1r rrr* > /tmp/memo.txt and the result is this /tmp/memo.txt /tmp/rrr1.txt I want to descript all files on txt file like I did same thing in console $ls -1r rrr* > /tmp/memo.txt $cat /tmp/memo.txt and the result of cat command is this /tmp/rrr1.txt /tmp/rrr2.txt I don't understand what is happening,so please tell me why this occur and how to write all result of ls command. thanks.
<linux><bash><shell>
2016-08-10 12:55:40
LQ_EDIT
38,874,760
Why my heroku node.js app is giving at=error code=H10 desc="App crashed" method=GET path="/"?
<p>I am trying to run my simple node app on Heroku. </p> <p>Here is the directory structure</p> <pre><code>β”œβ”€β”€ app.js β”œβ”€β”€ assets β”œβ”€β”€ blog.html β”œβ”€β”€ index.html β”œβ”€β”€ node_modules └── package.json </code></pre> <p>Here is my app.js</p> <pre><code>let express = require('express'), path = require('path'); var app = express(); let server = require('http').Server(app); app.use(express.static(path.join(__dirname))); app.get('/', function(req, res, next){ res.sendStatus(200); }); app.get('/blog.html', function(req, res,next){ res.sendFile(path.join(__dirname+"/blog.html")); }); app.post('/contact', function(req, res, next){ }); server.listen('8000', function() { console.log("App is running on port 8000"); }); </code></pre> <p>Here is the package.json</p> <pre><code>{ "name": "website", "version": "1.0.0", "engines" : { "node" : "6.3.1", "npm" : "3.10.3" }, "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" &amp;&amp; exit 1", "start" : "node app.js" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "express": "^4.14.0" } } </code></pre> <p>When I go to the console it rightly prints app is starting at xxxx port. But then the app crashes with the following message</p> <pre><code>2016-08-10T13:12:49.839138+00:00 app[web.1]: App is running on port xxxx 2016-08-10T13:13:34.944963+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=saras-website.herokuapp.com request_id=28d8705a-d5a4-4aaa-bd8d-4c4c6101fbd4 fwd="106.51.20.181" dyno= connect= service= status=503 bytes= 2016-08-10T13:13:48.295315+00:00 heroku[web.1]: State changed from starting to crashed 2016-08-10T13:13:48.552740+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=saras-website.herokuapp.com request_id=b77e151f-7017-482d-b4ba-15d980534fd7 fwd="106.51.20.181" dyno= connect= service= status=503 bytes= 2016-08-10T13:13:50.163466+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=saras-website.herokuapp.com request_id=1e7b57e5-1056-4cb3-b41f-cd3f11794efe fwd="106.51.20.181" dyno= connect= service= status=503 bytes= </code></pre> <p>I don't know what am I doing wrong here... Help is appreciated</p>
<node.js><heroku>
2016-08-10 13:24:54
HQ
38,874,938
Whats about refs in consrtuctors when collection updates?
I have constructor of some service: public Ctor(List<Items> items) { _items=items; } public void Work() { if(_items.Count()>5) //do some work } `Work` method will be call time by time. So, if outside of object i change items count- what happens? is `_items.Count()` change? Because, at current version i use this: public void Work() { if(StaticClass.Items.Count()>5)//do some work } Where `StaticClass.Items` updates when outside items collection changes. So, if i make this: var service=new Consrtuctor(StaticClass.Items); And then i update `StaticClass.Items` elems - can i use actual _items.Count() value when `Work` method calls (by some timer)? Or, should i use `ref` keyword?
<c#><constructor>
2016-08-10 13:32:40
LQ_EDIT
38,875,051
Declare an array in TypeScript
<p>I'm having trouble either declaring or using a boolean array in Typescript, not sure which is wrong. I get an <code>undefined</code> error. Am I supposed to use JavaScript syntax or declare a new Array object? </p> <p>Which one of these is the correct way to create the array?</p> <pre><code>private columns = boolean[]; private columns = []; private columns = new Array&lt;boolean&gt;(); </code></pre> <p>How would I initialize all the values to be false?</p> <p>How would I access the values, can I access them like, <code>columns[i] = true;</code>..?</p>
<javascript><arrays><typescript>
2016-08-10 13:37:39
HQ
38,875,833
How to use this inside a collection class
<p>How can I use THIS keyword to refer to the collection in a class which inherits from an ArrayList like this. I got an error at design time and IDE doesn't allow me to compile my code. </p> <pre><code>public class Company{ private EmployeeCollection employees; public Company(){ this.employees = new EmployeeCollection(); this.employees.add(new Employee()); this.employees.add(new Employee()); this.employees.add(new Employee()); this.employees.add(new Employee()); this.employees.add(new Employee()); } public void MyMethod(){ Employee fourthEmployee = employees.getFourth(); } } public class EmployeeCollection extends ArrayList&lt;Employee&gt;{ public Employee getFourth(){ return this[3]; //&lt;-- Error } public Employe getEmployee(int id){ for(int i = 0; i&lt; this.size(); i++){ //&lt;-- Error if(id == this[i].id){ //&lt;-- Error return this[i]; //&lt;-- Error } } } } </code></pre> <p>Normally in C# I can do something like this</p> <pre><code> public object test(int id) { for (int i = 0; i &lt; this.Count; i++) { if (this[i].ID == id) { return this[i]; } } return null; } </code></pre>
<java><list><collections><this>
2016-08-10 14:10:28
LQ_CLOSE