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
35,521,589
jQery Toggle onClick Function
$('.myElement').click(function () { $(this).toggleClass('active'); $(this).children('div').toggle(800); }); This is simple Toggle Function while I click on .myElement(height is auto) it's expand my insider div and on 2nd click it is collapse so my problem is wherever I click on the .myElement it is collapse I want it to collapse only while I click on signed field as on my Image file. http://i.imgur.com/zSvGKZB.jpg
<javascript><jquery><css><toggle><toggleclass>
2016-02-20 09:51:55
LQ_EDIT
35,521,682
How to sumplify this json array?
{ "Questions": [{ "Question": "Which is the largest fresh water lake in Kerala?", "CorrectAnswer": 2, "Answers": [{ "Answer": "Vembanad Lake" }, { "Answer": "Pookode Lake" }, { "Answer": "Sasthamcotta Lake" }, { "Answer": "Vellayani Lake" }] }, { "Question": "Chennara, the birth place of Mahakavi Vallathol is in:", "CorrectAnswer": 1, "Answers": [{ "Answer": "Thrissur District" }, { "Answer": "Malappuram District" }, { "Answer": "Palakkad District" }, { "Answer": "Alappuzha District" }] }]}
<json>
2016-02-20 10:03:36
LQ_EDIT
35,521,992
Failed to find DRM Plugin
<p>I'm trying to run my app with Gmail Login on genymotion emulator. But I keep getting a Failed to find DRM plugin error. I have added the ARM translation zip to the emulator and gApps for the given device. The app runs perfectly on real devices(HTC desire 500 and a Nexus 5). The emulator is a Nexus 5 with Lollipop 5.1.</p> <pre><code>02-20 05:27:13.292 1693-2186/? E/Drm: Failed to find drm plugin 02-20 05:27:13.292 3684-3868/? W/DG.WV: Widevine DRM not supported on this device 02-20 05:27:13.292 3684-3868/? W/DG.WV: android.media.UnsupportedSchemeException: Failed to instantiate drm object. 02-20 05:27:13.292 3684-3868/? W/DG.WV: at android.media.MediaDrm.native_setup(Native Method) 02-20 05:27:13.292 3684-3868/? W/DG.WV: at android.media.MediaDrm.&lt;init&gt;(MediaDrm.java:180) 02-20 05:27:13.292 3684-3868/? W/DG.WV: at com.google.android.gms.droidguard.q.run(SourceFile:99) 02-20 05:27:13.292 3684-3868/? W/DG.WV: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 02-20 05:27:13.292 3684-3868/? W/DG.WV: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 02-20 05:27:13.292 3684-3868/? W/DG.WV: at java.lang.Thread.run(Thread.java:818) 02-20 05:27:13.300 2686-3863/? V/BaseAuthAsyncOperation: access token request successful 02-20 05:27:13.301 3684-3735/? I/GoogleURLConnFactory: Using platform SSLCertificateSocketFactory 02-20 05:27:13.742 3471-3471/? I/adfjksf: Status{statusCode=INTERNAL_ERROR, resolution=null} 02-20 05:27:13.814 3471-3492/? W/EGL_emulation: eglSurfaceAttrib not implemented 02-20 05:27:13.814 3471-3492/? W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xf3ee7840, error=EGL_SUCCESS 02-20 05:27:14.837 2279-3867/? W/GLSUser: [AppCertManager] IOException while requesting key: </code></pre>
<android><genymotion><android-drm>
2016-02-20 10:34:09
HQ
35,522,358
I wonder about list of python. two questions
first, I would like to remove the outer list of the doubled lists. [[1,2,3,4,5]] -> [1,2,3,4,5] second, I want to count the elements in the list. [[1,2,3,4,2,1,4]] -> 7 thank you.
<python><list><python-2.7><numpy>
2016-02-20 11:08:00
LQ_EDIT
35,522,423
Can someone explain me what do these operators mean in C#?
<p>Here are operators I need help with:</p> <p>% (for example A%B)</p> <p>!= (a%b != 0)</p> <p>&amp;(&amp;&amp;)</p> <p>I'm very new to C# , so please try to explain me as simple as possible.</p>
<c#>
2016-02-20 11:14:46
LQ_CLOSE
35,522,452
Security project ideas, involving encryption
<p>I am a honours student in Computer Science. I am looking for some ideas to create software dealing with encryption. The software ideas that I am looking for are dealing with confidential data and encrypting such to be stored in a secure remote location. </p> <p>I have done a lot of research and haven't been able to come up with a security encryption software idea that is really unique and out of the ordinary. </p> <p>Please could you give some unique ideas based around encyption.</p> <p>Much appreciated for all your insights and ideas.</p>
<java><security><encryption>
2016-02-20 11:16:32
LQ_CLOSE
35,522,560
What does this javascript syntax mean ? (0, _parseKey2.default)(something)
<p>I find this notation everywhere in Webpack generated libs but I don't understand it :</p> <pre><code>var a = (0, _parseKey2.default)(something) </code></pre> <p>What does the <code>(0, _parseKey2.default)</code> stands for ? I don't remember seeing those coma separated expressions between parenthesis elsewhere that in function parameters, so maybe I am just missing something simple.</p> <p>Thanks for your help.</p>
<javascript><webpack>
2016-02-20 11:26:19
HQ
35,522,698
set active link with jquery in multipage page
i know its not the first question. i try from http://stackoverflow.com/questions/14039968/jquery-make-a-link-in-active-status. but its not working, when i click to go different page the 'a' didnt have class active. here my link. any suggestion thanks. <nav class="main-navi"> <ul> <li> <a href="index.html"> Home <span class="dot"></span> <span class="corner"></span> </a> </li> <li> <a href="portfolio.html"> Portfolio <span class="dot"></span> <span class="corner"></span> </a> </li> <li> <a href="about.html"> About <span class="dot"></span> <span class="corner"></span> </a> </li> <li> <a class="" href="service.html"> services <span class="dot"></span> <span class="corner"></span> </a> </li> <li> <a href="blog.html"> Blog <span class="dot"></span> <span class="corner"></span> </a> </li> <li> <a href="contact.html"> contacts <span class="dot"></span> <span class="corner"></span> </a> </li> </ul> <em id="showHideMenu" class="show-hide-menu fa fa-bars" href="#"></em> </nav> <script> jQuery(function($){ $('.main-navi a').filter(function(){ return $(this).attr('href').toLowerCase() === window.location.pathname.toLowerCase(); }).addClass('active'); }); </script>
<javascript><jquery><html><css>
2016-02-20 11:39:11
LQ_EDIT
35,522,701
How to define a float array in C
I am working a debian 7, using gcc. I initialize a test vector as follows: float test_vec[] = {4.31,3.33,1.58,0.75,7.82,1.85,0.45,0.11,0.98,3.45}; The sizeof() function applied to this vector returns 40. I use a for() to printf each element and most of them are zero or very large positive/negative numbers. How I should define the test_vector in order to get the right size?
<c><arrays><gcc><floating-point>
2016-02-20 11:39:27
LQ_EDIT
35,523,428
Spring JPA Lock
<p>I am really insecure when it comes to locking in spring jpa.<br> So please consider this question as an clarification. I really hope I understood it correct, but my english is not so good for understanding complex blog posts.<br> So this is what I think I got from some articles: </p> <p>There are two basic types of locking: </p> <ul> <li><strong>optimistic</strong> should be used when less write operation are planned. read operation will not lock an object.<br> For example: You have an "money balance" float in an entity with an optimistic lock. Now two processes read this value and use it for calculating and stuff. One of them now changes the value and writes it to the database with an update. No error to this point.<br> But now the other process also changes the value and wants to update it. Now there is an error. This only happened because of the second update.<br> If the second process would have deleted the instance, nothing would have happend. </li> <li><strong>pessimistic</strong> should be used when much write operation are planned. read operation will lock an object.<br> For example: You have an "money balance" float in an entity with an pessimistic lock. One process reads the data/value with "findOne".<br> After this, an other process wants to read the data as well, what would be possible with an optimistic lock, but with the pessimistic lock he must now wait (no error, just wait).<br> When process 1 is ready (changing the value and updating it), process 2 can go on. </li> </ul> <p>First Questions: Is this correct so far? And when I now want to test this knollage, I can choose between this LockModeType's: </p> <ul> <li>OPTIMISTIC </li> <li>OPTIMISTIC_FORCE_INCREMENT </li> <li>PESSIMISTIC_READ </li> <li>PESSIMISTIC_WRITE </li> <li>PESSIMISTIC_FORCE_INCREMENT </li> </ul> <p>Why are there now so many sub-locks and what do they do? When "OPTIMISTIC" is the optimistic lock from the top I tried to understand, then what is "OPTIMISTIC_FORCE_INCEMENT"?<br> And what does an version update has to do with this? (or the <code>@version</code>?) </p> <p>Going on:<br> There are three basic uses of lock in Spring jpa: </p> <ol> <li><p>on a normal column, for example: </p> <pre><code>@Entity public class PersonEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Lock(LockModeType.PESSIMISTIC_WRITE) private String name; } </code></pre></li> <li><p>on a foreign key to an other table, for example: </p> <pre><code>@Entity public class PersonEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Lock(LockModeType.PESSIMISTIC_WRITE) @OneToOne private Group group; } </code></pre></li> <li><p>on a table inside a repository, for example: </p> <pre><code>interface PersonRepository extends Repository&lt;Person, Long&gt; { @Lock(LockModeType.PESSIMISTIC_WRITE) Person findOne(Long id); } </code></pre></li> </ol> <p>Locking a Entity directly with </p> <pre><code>@Entity @Lock(LockModeType.PESSIMISTIC_WRITE) public class PersonEntity { } </code></pre> <p>is not possible. Therefore you can use 3 (locking inside a repository). </p> <p>Second Question: Is this correct? Did I forgot about a use of a locking? </p> <p>Going on:<br> The idea behind locking is, that other methods/processes have to wait until a lock is released (except by the optimistic lock, here a error is thrown).<br> The Lock is there as long as the instance/object is active or until the next commit.<br> There are two main possibilities to unlock an object: </p> <ol> <li><p>Within an transaction: In this full method the lock is active. But when the return comes, the lock will be removed. </p> <pre><code>@Transactional public void test(){ System.out.println("start, but not locked yet"); PersonEntity person1 = personRepository.findOne(1L); // locks this person or must wait, when locked System.out.println("now locked"); // do something return true; // now the lock will be deleted -&gt; unlocked again } </code></pre></li> <li><p>until the object is deleted: The data will be locked when the object is selected, and the data will be unlocked when the object is deleted. </p> <pre><code>public void test(){ System.out.println("start, but not locked yet"); PersonEntity person1 = personRepository.findOne(1L); // locks this person or must wait, when locked System.out.println("now locked"); // do something person1 = null; // now the lock will be deleted -&gt; unlocked again System.out.println("not locked anymore"); // do something more return true; } </code></pre></li> </ol> <p>Third Questions: is this correct so far? Does this function really can wait then the data is locked? Can an lock really be deleted when the object is set to <code>null</code>? </p> <p>Last words:<br> I really hope I will not annoy somebody. But like I said: it is really difficult for me to understand such complex structures in the english language :(<br> So thanks a lot for help in any form :) I really appreciate any little help. regardless of whether you give me links for more understanding or answering my questions directly :)</p>
<java><spring><hibernate><jpa>
2016-02-20 12:44:33
HQ
35,523,819
Simple PHP contact form with Firebase hosting
<p>I'm trying to test out if PHP works from my Firebase hosting using the following:</p> <p>(index.html)</p> <pre><code>&lt;form action="welcome.php" method="post"&gt; &lt;input type="submit"&gt; &lt;/form&gt; </code></pre> <p>(welcome.php)</p> <pre><code>&lt;?php $to = "my@email.com"; $subject = "My subject"; $txt = "Hello world!"; $headers = "From: dummy@email.com"; mail($to,$subject,$txt,$headers); ?&gt; </code></pre> <p>Every time I try this the browser keeps on attempting to open the PHP file rather than processing it. Is simple PHP enabled on the Firebase server hosting to process a simple form like this? If I can get it to work this way, I will be building the form out correctly including validation etc.</p> <p>Thanks,</p>
<php><firebase>
2016-02-20 13:18:58
HQ
35,524,026
React Native - Dynamically Add Element to DOM on button press
<p>In react native i'm trying to dynamically add an element to the DOM on a button click.</p> <p>This is what I have so far in the Render() method:</p> <pre><code>&lt;TouchableHighlight style={styles.button} onPress={this.addAnotherRow}&gt; &lt;Text&gt;Add new row&lt;/Text&gt; &lt;/TouchableHighlight&gt; </code></pre> <p>I'm not sure what to return from the onpress function to add another DOM element:</p> <pre><code>addAnotherRow() { return &lt;Text&gt;New Row&lt;/Text&gt; } </code></pre> <p>Any help please?</p>
<react-native>
2016-02-20 13:37:53
HQ
35,524,259
Selecting specific fields using select_related in Django
<p>I have two models Article and Blog related using a foreign key. I want to select only blog name while extracting the article.</p> <pre><code>articles = Articles.objects.all().select_related('blog__name') </code></pre> <p>The query generated shows that it selected all the fields from the Blog model. I tried using only() and defer() with select_related but both didn't work out.</p> <pre><code>articles = Articles.objects.all().select_related('blog__name').only('blog__name', 'title', 'create_time') </code></pre> <p>The above query resulted in error: Invalid field name(s) given in select_related: Choices are: blog</p> <p>How do i generate a query so that only article fields and blog name is selected?</p>
<django><python-2.7><django-queryset><django-1.8><django-select-related>
2016-02-20 13:57:28
HQ
35,524,386
javascript: else if condition not working
<p>The button that I'm working on, when clicked, pans a div to the left. In the script, the "if" condition works fine but the "if else" condition doesn't.</p> <p>Did I forgot something to include in the script? </p> <p>here's my script: </p> <pre><code>&lt;script&gt; function panleft(el){ var elem = document.getElementById(el); if (elem.style.left = "90%"){ elem.style.transition = "left 0.3s ease-in 0s"; elem.style.left = "70%"; } else if (elem.style.left = "70%"){ elem.style.transition = "left 0.3s ease-in 0s"; elem.style.left = "90%" } } &lt;/script&gt; </code></pre>
<javascript><css><conditional-statements>
2016-02-20 14:08:32
LQ_CLOSE
35,525,291
Convert drawings in instructions for Java Swing paintComponent
<p>Would you know a software able to convert simple drawings (done with simple instructions that can be found in paintComponent like fillRectangle, drawLine... etc) into Java instructions?</p> <p>I ask this question because I'm programming a Pacman game, and i wanted to be able to randomly generate ghosts, with random color, and shapes.</p> <p>Thank you. </p>
<java><swing><drawing><paintcomponent><pacman>
2016-02-20 15:33:11
LQ_CLOSE
35,525,683
Parse error: unexpected end of the file, can't find it
<p>i'm trying to fix a error, i maked a little search and they send that was something because { or } not closed propely, but i can't find it. </p> <p>The code is this one:</p> <p><strong>Parse error: syntax error, unexpected end of file in /movies.php on line 176</strong> the code <a href="https://gist.github.com/anonymous/258531c7a81517c47de5" rel="nofollow">https://gist.github.com/anonymous/258531c7a81517c47de5</a></p>
<php><wordpress><parsing>
2016-02-20 16:12:17
LQ_CLOSE
35,526,181
how to convert .bat file (batch) to .cmd file
i need a convert .bat file to .cmd file i have a file .bat and i want convert it to .cmd ex : rem^ &@echo off rem^ &call :'sub rem^ &exit /b :'sub rem^ &echo begin batch rem^ &cscript //nologo //e:vbscript "%~f0" rem^ &echo end batch rem^ &exit /b That all about It thanks
<batch-file><cmd>
2016-02-20 16:54:10
LQ_EDIT
35,526,532
How to add an elasticsearch index during docker build
<p>I use the official elasticsearch docker image and wonder how can I include also during building a custom index, so that the index is already there when I start the container. </p> <p>My attempt was to add the following line to my dockerfile:</p> <pre><code>RUN curl -XPUT 'http://127.0.0.1:9200/myindex' -d @index.json </code></pre> <p>I get the following error: </p> <pre><code>0curl: (7) Failed to connect to 127.0.0.1 port 9200: Connection refused </code></pre> <p>Can I reach elasticsearch during build with such an API call or is there a complete different way to implement that? </p>
<elasticsearch><docker>
2016-02-20 17:23:05
HQ
35,527,001
How to access node_modules folder from wwwroot in asp.net vnext project
<p>How can I access the node_modules folder which is not included in the visual studio solution file from the wwwroot where my index.html is put. That index.html file need to reference the npm installed packages like angular.js.</p> <p>But how? </p> <p>I do not want to copy the whole node_modules folder into wwwroot. Those are not the files to live there...</p> <p>I do not want to include the node_modules folder to the solution because that will slow down everything and hang up...</p> <p>It seems Frontend development belongs not in VS...</p>
<npm><asp.net-core><asp.net-core-mvc><node-modules><asp.net-core-1.0>
2016-02-20 18:03:45
HQ
35,527,144
How to get bin folder in ASP.NET Core 1.0
<p>With asp.net core 1.0 There are lots of functionality added. But there is not way to get Bin Folder path. </p> <p>Can anyone please know how we can get the bin folder path for asp.net core 1.0 application.</p>
<asp.net><asp.net-mvc><asp.net-core-mvc><asp.net-core-1.0>
2016-02-20 18:16:15
HQ
35,527,500
Angular2: convert array to Observable
<p>I have a component that gets the data from a service via http, the problem is that I don't want to hit the API backend every time I show this component. I want my service to check if the data is in memory, if it is, return an observable with the array in memory, and if not, make the http request.</p> <p>My component</p> <pre><code>import {Component, OnInit } from 'angular2/core'; import {Router} from 'angular2/router'; import {Contact} from './contact'; import {ContactService} from './contact.service'; @Component({ selector: 'contacts', templateUrl: 'app/contacts/contacts.component.html' }) export class ContactsComponent implements OnInit { contacts: Contact[]; errorMessage: string; constructor( private router: Router, private contactService: ContactService) { } ngOnInit() { this.getContacts(); } getContacts() { this.contactService.getContacts() .subscribe( contacts =&gt; this.contacts = contacts, error =&gt; this.errorMessage = &lt;any&gt;error ); } } </code></pre> <p>My service</p> <pre><code>import {Injectable} from 'angular2/core'; import {Http, Response, Headers, RequestOptions} from 'angular2/http'; import {Contact} from './contact'; import {Observable} from 'rxjs/Observable'; @Injectable() export class ContactService { private contacts: Array&lt;Contact&gt; = null; constructor (private http: Http) { } getContacts() { // Check first if contacts == null // if not, return Observable(this.contacts)? &lt;-- How to? return this.http.get(url) .map(res =&gt; &lt;Contact[]&gt; res.json()) .do(contacts =&gt; { this.contacts = contacts; console.log(contacts); }) // eyeball results in the console .catch(this.handleError); } private handleError (error: Response) { // in a real world app, we may send the server to some remote logging infrastructure // instead of just logging it to the console console.error(error); return Observable.throw(error.json().error || 'Server error'); } } </code></pre>
<http><angular><rxjs>
2016-02-20 18:46:32
HQ
35,527,559
Angular2 get window width onResize
<p>Trying to figure out how to get window width on resizing events in Angular2. Here is my code:</p> <pre><code>export class SideNav { innerWidth: number; constructor(private window: Window){ let getWindow = function(){ return window.innerWidth; }; window.onresize = function() { this.innerWidth = getWindow(); console.log(getWindow()); }; } </code></pre> <p>I am importing window provider globally in the bootstrap.ts file using provide to gain access across my app to window. The problem I am having is this does give me a window size, but on resizing the window - it just repeats the same size over and over even if the window changes size. See image for console.log example: <a href="https://i.stack.imgur.com/RtVCD.png" rel="noreferrer">Screenshot image</a></p> <p>My overall goal is to be able to set the window number to a variable onresize so I can have access to it in the template. Any ideas on what I am doing wrong here?</p> <p>Thanks!</p>
<css><typescript><angular><angular2-directives>
2016-02-20 18:51:18
HQ
35,527,655
What are the security risks of using Gitlab CI shared test runners?
<p>I am trying to host a new project with Gitlab. It is a private Python project. I was able to test some initial tests with Gitlab CI.</p> <p>I don't use cache while running tests,</p> <p>While exploring the runner section in settings, there is a warning shown,</p> <blockquote> <p>GitLab Runners do not offer secure isolation between projects that they do builds for. You are TRUSTING all GitLab users who can push code to project A, B or C to run shell scripts on the machine hosting runner X.</p> </blockquote> <p>what are the security risks in using a shared test runner? Is it safe to run private projects on a shared runner? What precautions can be taken while running tests on a shared runner?</p> <p>Thank you for any insight.</p>
<security><testing><continuous-integration><gitlab-ci><test-runner>
2016-02-20 18:59:23
HQ
35,527,688
Why the imageView which is in "userProfilePic" id, changes quickly to the old one stored in database, after selecting a new picture
<p>I want to change the picture in the imageView id "userProfilePic" to the new one selected by the user, and update that picture to the database. But once I choose a new picture, the image under "userProfilePic" id quickly changes to the new one and again it changes to the old one( which is already in the database) so I am unable to upload new pictures for the "userProfilePic" id. I am a beginner to Android development and I know only small amount of android, So please help me to solve this issue. This is my <code>EditUserProfile.java file</code></p> <pre><code> package com.example.kasun.timetable; import android.app.DatePickerDialog; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.provider.MediaStore; import android.support.v7.app.ActionBarActivity; import android.util.Base64; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.ImageView; import android.widget.Toast; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.params.BasicHttpParams; import org.apache.http.params.HttpConnectionParams; import org.apache.http.params.HttpParams; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Locale; public class EditYourProfile extends ActionBarActivity implements View.OnClickListener { private static final int Result_Load_Image=1; private Button bSave2,bBack2,bImageUpload; private EditText etUsernameEdit,etFirstNameEdit,etLastNameEdit,etPasswordEdit,etPositionEdit,etBirthDateEdit,etQualificationEdit,etEmailEdit; private Calendar myCalendar = Calendar.getInstance(); private UserLocalDatabase userLocalDatabase; private ImageView userProfilePic; private static final String SERVER_ADDRESS="http://172.21.18.170/Timetable/"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_edit_your_profile); bBack2=(Button)findViewById(R.id.bBack2); bSave2=(Button)findViewById(R.id.bSave2); etUsernameEdit=(EditText)findViewById(R.id.etUserNameEdit); etFirstNameEdit=(EditText)findViewById(R.id.etFirstNameEdit); etLastNameEdit=(EditText)findViewById(R.id.etLastNameEdit); etPasswordEdit=(EditText)findViewById(R.id.etPasswordEdit); etEmailEdit=(EditText)findViewById(R.id.etEmailEdit); etQualificationEdit=(EditText)findViewById(R.id.etQualificationEdit); etPositionEdit=(EditText)findViewById(R.id.etPositionEdit); etBirthDateEdit=(EditText)findViewById(R.id.etBirthDateEdit); userProfilePic=(ImageView)findViewById(R.id.userProfilePic); bImageUpload=(Button)findViewById(R.id.bImageUpload); bSave2.setOnClickListener(this); bBack2.setOnClickListener(this); userProfilePic.setOnClickListener(this); bImageUpload.setOnClickListener(this); userLocalDatabase = new UserLocalDatabase(this); final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // TODO Auto-generated method stub myCalendar.set(Calendar.YEAR, year); myCalendar.set(Calendar.MONTH, monthOfYear); myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); updateLabel(); } }; etBirthDateEdit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub new DatePickerDialog(EditYourProfile.this, date, myCalendar .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), myCalendar.get(Calendar.DAY_OF_MONTH)).show(); } }); } private void updateLabel() { String myFormat = "MM/dd/yy"; SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.US); etBirthDateEdit.setText(sdf.format(myCalendar.getTime())); } @Override protected void onStart() { super.onStart(); if(authenticate()==true){ showDetails(); } else { startActivity(new Intent(this, MainActivity.class)); finish(); } } public boolean authenticate(){ return userLocalDatabase.getUserStatus(); } public void showDetails(){ User user=userLocalDatabase.getLoggedInUser(); etFirstNameEdit.setText(user.firstName); etLastNameEdit.setText(user.lastName); etUsernameEdit.setText(user.userName); etQualificationEdit.setText(user.qualification); etPositionEdit.setText(user.position); etPasswordEdit.setText(user.password); etEmailEdit.setText(user.email); new downloadImage(etUsernameEdit.getText().toString()).execute(); } @Override public void onClick(View v) { switch(v.getId()){ case R.id.bSave2: break; case R.id.bBack2: startActivity(new Intent(this,SelectTask.class)); break; case R.id.userProfilePic: Intent galleryIntent= new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(galleryIntent,Result_Load_Image); break; case R.id.bImageUpload: Bitmap image=((BitmapDrawable) userProfilePic.getDrawable()).getBitmap(); new uploadImage(image,etUsernameEdit.getText().toString()).execute(); break; } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode==Result_Load_Image &amp;&amp; resultCode==RESULT_OK &amp;&amp; data!=null){ Uri selectedImage= data.getData(); userProfilePic.setImageURI(selectedImage); } } public class uploadImage extends AsyncTask&lt;Void,Void,Void&gt; { private Bitmap image; private String name; public uploadImage(Bitmap image,String name){ this.image=image; this.name=name; } @Override protected Void doInBackground(Void... params) { ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream(); image.compress(Bitmap.CompressFormat.JPEG,100,byteArrayOutputStream); String encodedImage= Base64.encodeToString(byteArrayOutputStream.toByteArray(),Base64.DEFAULT); ArrayList&lt;NameValuePair&gt; dataToSend1= new ArrayList&lt;&gt;(); dataToSend1.add(new BasicNameValuePair("image",encodedImage)); dataToSend1.add(new BasicNameValuePair("name",name)); HttpParams httpRequestParams= getHttpRequestParams(); HttpClient httpClient = new DefaultHttpClient(httpRequestParams); HttpPost post= new HttpPost(SERVER_ADDRESS + "savePicture.php"); try{ post.setEntity(new UrlEncodedFormEntity(dataToSend1)); httpClient.execute(post); } catch(Exception e){ e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void aVoid) { super.onPostExecute(aVoid); Toast.makeText(getApplicationContext(),"Image is uploaded",Toast.LENGTH_SHORT).show(); } } //---------------------------------------------------------------------------------------------- private HttpParams getHttpRequestParams(){ HttpParams httpRequestParams= new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpRequestParams, 1000 * 30); HttpConnectionParams.setSoTimeout(httpRequestParams,1000 * 30); return httpRequestParams; } public class downloadImage extends AsyncTask&lt;Void,Void,Bitmap&gt;{ private String name; public downloadImage(String name){ this.name=name; } @Override protected Bitmap doInBackground(Void... params) { String url= SERVER_ADDRESS+"proPictures/"+name+".JPG"; try{ URLConnection connection= new URL(url).openConnection(); connection.setConnectTimeout(1000*30); connection.setReadTimeout(1000 * 30); return BitmapFactory.decodeStream((InputStream) connection.getContent(), null, null); }catch(Exception e){ e.printStackTrace(); } return null; } @Override protected void onPostExecute(Bitmap bitmap) { super.onPostExecute(bitmap); if(bitmap!=null){ userProfilePic.setImageBitmap(bitmap); } } } } </code></pre> <p>here is my relavant xml file</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" 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" tools:context="com.example.kasun.timetable.EditYourProfile" android:background="#303030"&gt; &lt;ScrollView android:layout_width="match_parent" android:layout_height="1000dp" android:id="@+id/scroll"&gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;ImageView android:layout_width="110dp" android:layout_height="100dp" android:id="@+id/userProfilePic" android:layout_marginTop="34dp" android:background="#c6c4c4" android:layout_marginBottom="10dp"/&gt; &lt;Button android:layout_width="110dp" android:layout_height="wrap_content" android:text="Upload " android:id="@+id/bImageUpload" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/userNameText" android:id="@+id/textView18" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPersonName" android:ems="10" android:id="@+id/etUserNameEdit" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/FirstNameText" android:id="@+id/textView19" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPersonName" android:ems="10" android:id="@+id/etFirstNameEdit" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/LastNameText" android:id="@+id/textView20" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPersonName" android:ems="10" android:id="@+id/etLastNameEdit" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Password" android:id="@+id/textView21" android:layout_marginTop="16dp" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPassword" android:ems="10" android:id="@+id/etPasswordEdit" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Position" android:id="@+id/textView23" android:layout_marginTop="12dp" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPersonName" android:ems="10" android:id="@+id/etPositionEdit" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Email" android:id="@+id/textView24" android:layout_marginTop="12dp" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPersonName" android:ems="10" android:id="@+id/etEmailEdit" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/Telephone" android:id="@+id/textView25" android:layout_marginTop="12dp" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textPersonName" android:ems="10" android:id="@+id/etTelephoneEdit" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/BDate" android:id="@+id/textView26" android:layout_marginTop="16dp" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/etBirthDateEdit" android:textColor="#ffffffff" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:text="@string/qualification" android:id="@+id/textView26" android:layout_marginTop="16dp" android:layout_marginBottom="10dp" android:textColor="#ffffffff" /&gt; &lt;EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/etQualificationEdit"/&gt; &lt;!--&lt;DatePicker--&gt; &lt;!--android:layout_width="wrap_content"--&gt; &lt;!--android:layout_height="wrap_content"--&gt; &lt;!--android:id="@+id/datePicker"--&gt; &lt;!--android:layout_alignBottom="@+id/scroll"--&gt; &lt;!--android:layout_centerHorizontal="true"--&gt; &lt;!--android:layout_marginBottom="85dp" /&gt;--&gt; &lt;/LinearLayout&gt; &lt;/ScrollView&gt; &lt;Button android:layout_width="100dp" android:layout_height="wrap_content" android:text="@string/LogoutButtonText" android:id="@+id/bLogout2" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" android:gravity="center" /&gt; &lt;!--android:layout_alignParentRight="@+id/bBack2"--&gt; &lt;!--android:layout_alignBottom="@+id/scroll"--&gt; &lt;Button android:layout_width="100dp" android:layout_height="wrap_content" android:text="@string/BackButtonText" android:id="@+id/bBack2" android:layout_alignParentLeft="true" android:layout_alignParentBottom="true" android:gravity="center" /&gt; &lt;Button android:layout_width="100dp" android:layout_height="wrap_content" android:text="@string/SaveButtonText" android:id="@+id/bSave2" android:layout_alignTop="@+id/bBack2" android:layout_centerHorizontal="true" android:gravity="center" /&gt; &lt;/RelativeLayout&gt; </code></pre>
<java><android><xml><android-studio>
2016-02-20 19:02:40
LQ_CLOSE
35,528,119
Pandas recalculate index after a concatenation
<p>I have a problem where I produce a pandas dataframe by concatenating along the row axis (stacking vertically). </p> <p>Each of the constituent dataframes has an autogenerated index (ascending numbers). </p> <p>After concatenation, my index is screwed up: it counts up to n (where n is the shape[0] of the corresponding dataframe), and restarts at zero at the next dataframe. </p> <p>I am trying to "re-calculate the index, given the current order", or "re-index" (or so I thought). Turns out that isn't exactly what <code>DataFrame.reindex</code> seems to be doing. </p> <hr> <p>Here is what I tried to do:</p> <pre><code>train_df = pd.concat(train_class_df_list) train_df = train_df.reindex(index=[i for i in range(train_df.shape[0])]) </code></pre> <p>It failed with "cannot reindex from a duplicate axis." I don't want to change the order of my data... just need to delete the old index and set up a new one, with the order of rows preserved. </p>
<python><pandas>
2016-02-20 19:41:46
HQ
35,528,459
Verify container running state
<p>I have a <code>bash</code> script, which I use to run several <code>Docker</code> containers. Initialization time differs on system specifications, so sometimes these cannot be started in specified order. How can I detect with use of <code>bash</code>, that a container is running, so following container can be started. Containers requires previously started containers.</p>
<bash><docker>
2016-02-20 20:14:24
LQ_CLOSE
35,528,966
Use collect_list and collect_set in Spark SQL
<p>According to the <a href="http://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.functions$" rel="noreferrer">docs</a>, the <code>collect_set</code> and <code>collect_list</code> functions should be available in Spark SQL. However, I cannot get it to work. I'm running Spark 1.6.0 using a <a href="https://github.com/sequenceiq/docker-spark" rel="noreferrer">Docker image</a>. </p> <p>I'm trying to do this in Scala: </p> <pre><code>import org.apache.spark.sql.functions._ df.groupBy("column1") .agg(collect_set("column2")) .show() </code></pre> <p>And receive the following error at runtime: </p> <pre><code>Exception in thread "main" org.apache.spark.sql.AnalysisException: undefined function collect_set; </code></pre> <p>Also tried it using <code>pyspark</code>, but it also fails. The docs state these functions are aliases of Hive UDAFs, but I can't figure out to enable these functions.</p> <p>How to fix this? Thanx!</p>
<apache-spark><hive><apache-spark-sql>
2016-02-20 21:01:30
HQ
35,529,401
How to accept Integers or Strings JAVA
<pre><code> private void CreateAccount() { // TODO Auto-generated method stub String firstName, accountType=""; double initialDesposit = 0; boolean valid = false; int Current = 1; int Saving = 2; while (!valid){ //Only can select current or saving account System.out.println("Enter account Type"); System.out.println("1:Current"); System.out.println("2:Saving"); accountType = keyboard.nextLine(); //User Input of the Account Type if (accountType.equalsIgnoreCase("Current") || accountType.equalsIgnoreCase("Saving")|| accountType.equals(1) || accountType.equals(2) ){ valid = true; //If selection is true }else{ System.out.println("Invalid"); } } </code></pre> <p>I am trying to make it that when user is displayed option they can either choose the option by number or letters i.e. instead of typing "Saving" user can simply just press "2" and it is recorded as Saving. </p>
<java>
2016-02-20 21:42:10
LQ_CLOSE
35,529,998
Disable button when input is empty in Angular 2
<p>I want to check whether the input is empty.</p> <ul> <li>If not empty, enable the submit button.</li> <li>If empty, disable the submit button.</li> </ul> <p>I tried <code>(oninput)</code> and <code>(onchange)</code>, but they do not run.</p> <pre><code>&lt;input type="password" [(ngModel)]="myPassword" (oninput)="checkPasswordEmpty()"/&gt; checkPasswordEmpty() { console.log("checkPasswordEmpty runs"); if (this.myPassword) { // enable the button } } </code></pre>
<angular>
2016-02-20 22:42:33
HQ
35,530,051
python logging dictConfig custom formatter is not being called
<p>i have the following ColoeredFormatter in my Module.</p> <p>But The Formatter does not get called. I expect "hi" on the console, but i get "This is an info of the root logger".</p> <p>i've already deleted all .pyc files, but it did not help.</p> <p><strong>MyModule/__init__.py</strong></p> <pre><code>from MyModule.ColoredFormatter import ColoredFormatter __all__ = ('ColoredFormatter') </code></pre> <p><strong>MyModule/ColoredFormatter.py</strong></p> <pre><code>import logging class ColoredFormatter(logging.Formatter): def __init__(self, default): self.default = default def format(self, record): print("hi") record.msg = "hi" return self.default.format(record) </code></pre> <p><strong>My Script</strong></p> <pre><code>import logging, logging.config, yaml conf=""" logging: version: 1 disable_existing_loggers: true root: level: !!python/name:logging.NOTSET handlers: [console] handlers: console: class: logging.StreamHandler stream: ext://sys.stdout formatter: myFormatter level: !!python/name:logging.NOTSET formatters: myFormatter: class: !!python/name:MyModule.ColoredFormatter """ dict = yaml.parse(conf) logging.config.dictConfig(dict["logging"]) logging.info("This is an info of the root logger") </code></pre>
<python><logging><formatter>
2016-02-20 22:47:32
HQ
35,531,080
How do I auto-indent Python code in Visual Studio Code?
<p>I'm using Visual Studio Code (<em>not Visual Studio</em>) on Linux and I can't seem to find out how to turn on auto-indentation for Python. I've looked all over preferences, spent some time on Google, and can't find anything.</p> <p>Does anyone know how to do this?</p>
<visual-studio-code><code-editor>
2016-02-21 01:08:15
HQ
35,531,126
How To Use ScrollMagic with GSAP and Webpack
<p>In order to use <a href="http://scrollmagic.io/examples/basic/simple_tweening.html">ScrollMagic with GSAP</a>, you need to load the <code>animation.gsap.js</code> plugin. With Webpack you would do something like this to accomplish that (assuming you use the CommonJS syntax and installed everything with npm):</p> <pre><code>var TweenMax = require('gsap'); var ScrollMagic = require('scrollmagic'); require('ScrollMagicGSAP'); </code></pre> <p>To make sure that this actually works, you have to add an alias to your Webpack configuration, so that Webpack knows where the plugin lives.</p> <pre><code>resolve: { alias: { 'ScrollMagicGSAP': 'scrollmagic/scrollmagic/uncompressed/plugins/animation.gsap' } } </code></pre> <p><strong>Unfortunately</strong>, ScrollMagic keeps throwing an error, when you are using this configuration and the CommonJS syntax like above.</p> <pre><code>(ScrollMagic.Scene) -&gt; ERROR calling setTween() due to missing Plugin 'animation.gsap'. Please make sure to include plugins/animation.gsap.js </code></pre>
<javascript><webpack><commonjs><gsap><scrollmagic>
2016-02-21 01:14:47
HQ
35,531,500
Whats the longest string i can save and get using firebase?
<p>Whats the max number of characters in a string I can save in firebase? Is it unlimited? At what point will It get too slow?</p>
<firebase>
2016-02-21 02:10:47
HQ
35,531,759
How can I create a new file with a simple way in spacemacs?
<p>Currently, I know that I can create a new file with the following ways:</p> <ul> <li><code>c</code> key in Neotree</li> <li><code>SPC '</code> in shell layer, and use the <code>touch xxx</code> command</li> </ul> <p>I am wondering whether there is a simple way (something like <code>SPC f xxx</code>) or not.</p> <p>Thanks.</p>
<spacemacs>
2016-02-21 02:55:24
HQ
35,532,005
How to print assert statment without the "&&"?
I am printing my assert statement in the following manner: assert(i==0 && i is not zero); Output: Assertion 'i==0 && i is not zero' failed. What I want to be printed: Output: 'i==0, i is not zero failed.
<c><assert>
2016-02-21 03:40:26
LQ_EDIT
35,532,123
comparing two integers and insert a comparison sign <,>= between the two numbers
I would like to compare two integers and add a comparison sign between them. I do not use any logical, relational and bitwise operators and no if then else or while loop . I found the max and min of these two numbers . But how can I preserve the order and still insert the comparison sign. Any ideas ? thanks Eg: 4 6 was entered by user output must be 4 < 6 10 2 was entered by user output must be 10 > 2 2 2 was enetered by user output must be 10=10
<c><math>
2016-02-21 03:57:35
LQ_EDIT
35,532,756
mips assembly code to shift the bit programming
<p>Read in your Student ID and save it to a register, and read in the number “10010000x” as the initial memory address. Then shift your student ID number to the right one bit at a time, and save it to the memory address which is 4 bytes increment from the previous memory address, until your student ID number is smaller than 1, then save your final student ID number which is NOT smaller than 1, and save the last memory address, and how many iterations to 3 different memory addresses. Turn in the hardcopy of the MARS graphic printout which has the MIPS Assembly code showing your student ID, and memory addresses and all registers values, and also answer the following three questions on the hard copy paper :<br> (1) How many shift right you have to do to get your student ID number to be smaller than 1 ? (2) What is your last NOT smaller than 1 binary student id number ? (3) What is the last memory address that saves that last NOT smaller than 1 student ID ? </p>
<assembly><while-loop><bit-shift><mips32><instruction-set>
2016-02-21 05:44:37
LQ_CLOSE
35,533,783
Angular2: unable to navigate to url using location.go(url)
<p>I am trying to navigate to a specific url using location.go service from typescript function. It changes the url in the browser but the component of the url is not reflected in the screen. It stays on the login (actual) screen - say for eg:</p> <pre><code>constructor(location: Location, public _userdetails: userdetails){ this.location = location; } login(){ if (this.username &amp;&amp; this.password){ this._userdetails.username = this.username; this.location.go('/home'); } else{ console.log('Cannot be blank'); } } </code></pre> <p>Is there a compile method or a refresh method I am missing?</p>
<location><angular><angular2-routing>
2016-02-21 08:08:53
HQ
35,534,395
python combinators list with constraints without itertools
<p>suppose I have a list with following elements [a,b,c,d,e]</p> <p>how can I generate all possible combinations in such a way that every value can be moved to right, left or at the same position. For example with the above list all possible required combinations are </p> <pre><code>(a, b, c, d, e) (a, b, c, e, d) (a, b, d, c, e) (a, c, b, d, e) (a, c, b, e, d) (b, a, c, d, e) (b, a, c, e, d) (b, a, d, c, e) </code></pre> <p>One way I can think of is, find all permutations and then filter according to the conditions described above but itertools won't work when the list size is 15 for example. Any idea how can I do this for large list?</p>
<python><combinations><permutation><combinatorics>
2016-02-21 09:24:44
LQ_CLOSE
35,535,255
Xcode Lost connection to iPhone
<p>When running my app on device and than testing offline mode by clicking flight mode on device itself, after 3 seconds i'm getting this message: </p> <blockquote> <p>Restore the connection to "iPhone 6" and run "APP_NAME" again, or if "APP_NAME" is still running, you can attach to it by selecting Debug > Attach to Process > APP_NAME.</p> </blockquote> <ul> <li>iPhone version 9.2.1</li> <li>Xcode version 7.2.1</li> </ul> <p>Does anyone have a clue?</p>
<ios><objective-c><iphone><xcode>
2016-02-21 11:01:50
HQ
35,535,297
How to chake if server connection is exist?
In my app I have asyncTask classes, that connect to the local/remote server to get some data, I want to check the server connection before the asyncTask is run, I got this function: public static boolean checkServerAvailable(String hostURL) { HttpURLConnection connection = null; try { URL u = new URL(hostURL); connection = (HttpURLConnection) u.openConnection(); connection.setConnectTimeout(5000); connection.setRequestMethod("HEAD"); int code = connection.getResponseCode(); System.out.println("" + code); return true; // You can determine on HTTP return code received. 200 is success. } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); return false; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return false; } finally { if (connection != null) { connection.disconnect(); } } } this function using timeout to connect to server, and if the timeout is finish it's mean that there is no server, the problem is that I'm run this code and it's returning "there is no server" if the server is exist too, I'm tried to set a big timeout like 5000ms but it's stop the UI very long time, and somtiems return "there is no server" when the server is exist too. what can I do? Thank you!
<java><android><android-asynctask><server>
2016-02-21 11:07:10
LQ_EDIT
35,535,428
i can add a data and i can only see through phpmyadmin.
<p>here is the front end of it. and this is the back end <a href="http://localhost/phpmyadmin/#PMAURL-6:sql.php?db=bims&amp;table=personal_info&amp;server=1&amp;target=&amp;token=8254c6ededd52ca5284d30cf084621b9" rel="nofollow">http://localhost/phpmyadmin/#PMAURL-6:sql.php?db=bims&amp;table=personal_info&amp;server=1&amp;target=&amp;token=8254c6ededd52ca5284d30cf084621b9</a></p>
<php><html><css>
2016-02-21 11:20:10
LQ_CLOSE
35,535,920
Laravel 5 How to configure the Queue database driver to connect to a non-default database?
<p>In Laravel 5.1, we can set the Queue connection configurations in <code>config/queue.php</code>.</p> <pre><code>QUEUE_DRIVER=database </code></pre> <hr> <pre><code> 'database' =&gt; [ 'driver' =&gt; 'database', 'table' =&gt; 'jobs', 'queue' =&gt; 'default', 'expire' =&gt; 60, ], </code></pre> <hr> <p>However, it will only use the default database connection in <code>config/database.php</code>.</p> <p>If I have 2 database, 1 default database <code>mysql1</code> in localhost, and 1 database <code>mysql2</code> in a remote server, and the Queue <code>jobs</code> table is in the remote database <code>mysql2</code>, how can I configure the Queue database driver to use the remote <code>mysql2</code> database? Please note that the main App is using the default database in localhost.</p>
<database><laravel><laravel-5><queue><laravel-5.1>
2016-02-21 12:11:36
HQ
35,536,011
Is there a declarative way to transform Array to Dictionary?
<p>I want to get from this array of strings</p> <pre><code>let entries = ["x=5", "y=7", "z=10"] </code></pre> <p>to this</p> <pre><code>let keyValuePairs = ["x" : "5", "y" : "7", "z" : "10"] </code></pre> <p>I tried to use <code>map</code> but the problem seems to be that a key - value pair in a dictionary is not a distinct type, it's just in my mind, but not in the Dictionary type so I couldn't really provide a transform function because there is nothing to transform to. Plus <code>map</code> return an array so it's a no go.</p> <p>Any ideas?</p>
<swift><declarative>
2016-02-21 12:18:44
HQ
35,536,552
how to sort the date list in python
<p>I have a list in python as follows..</p> <pre><code>[Timestamp('2016-01-03 10:38:52'), Timestamp('2016-01-18 09:37:29'), Timestamp('2016-02-06 09:44:44'), Timestamp('2016-02-07 11:11:28'), Timestamp('2016-02-15 11:24:41'), Timestamp('2016-02-20 12:46:07'), Timestamp('2016-02-21 11:07:11')] </code></pre> <p>I want to sort this with ascending order</p> <p>I tried with <code>temp_list.sort()</code> but it does not display any output</p>
<python><datetime>
2016-02-21 13:10:32
LQ_CLOSE
35,536,590
Do I need to escape dash character in regex?
<p>I'm trying to understand dash character <code>-</code> needs to escape using backslash in regex?</p> <p>Consider this:</p> <pre><code>var url = '/user/1234-username'; var pattern = /\/(\d+)\-/; var match = pattern.exec(url); var id = match[1]; // 1234 </code></pre> <p>As you see in the above regex, I'm trying to extract the number of id from the url. Also I escaped <code>-</code> character in my regex using backslash <code>\</code>. But when I remove that backslash, still all fine ....! In other word, both of these are fine:</p> <ul> <li><a href="https://regex101.com/r/sJ5mX4/1" rel="noreferrer"><code>/\/(\d+)\-/</code></a></li> <li><a href="https://regex101.com/r/sJ5mX4/2" rel="noreferrer"><code>/\/(\d+)-/</code></a></li> </ul> <p>Now I want to know, which one is correct <em>(standard)</em>? Do I need to escape dash character in regex? </p>
<javascript><regex>
2016-02-21 13:15:08
HQ
35,536,605
EF Core 1.0 - Include() generates more than one queries
<p>I am using EF 7.0.0-rc1-final.</p> <p>The following statement generates multiple queries on the server. Is this normal or I am missing something ?</p> <pre><code>Group myGroup = dbContext_ .Set&lt;Group&gt;() .Include(x =&gt; x.GroupRoles) .ThenInclude(x =&gt; x.Role) .FirstOrDefault(x =&gt; x.Name == "Approver"); </code></pre> <p>I see two separate queries executed on the server:</p> <p><a href="https://i.stack.imgur.com/VD77x.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VD77x.png" alt="Query 1"></a></p> <p>And</p> <p><a href="https://i.stack.imgur.com/RY8de.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RY8de.png" alt="Query 2"></a></p> <p>It's a standard many-to-many scenario. Why is the first query ?</p> <p>Thanks</p>
<entity-framework-core>
2016-02-21 13:16:14
HQ
35,536,848
C++ error: expected unqualified-id @ first bracket "{"
<pre><code>#include &lt;iostream&gt; using namespace std; int main(); { union numbericUnion { int intValue; long longValue; double doubleValue; }; numbericUnion myUnion; myUnion.intValue = 3; cout &lt;&lt; myUnion.intValue &lt;&lt; endl; myUnion.doubleValue = 4.5; cout &lt;&lt; myUnion.doubleValue &lt;&lt; endl; cout &lt;&lt; myUnion.intValue; cout &lt;&lt; endl; } </code></pre> <p>At the first bracket "{", the code is stating "expected unqualified-id". Can you please help? I am a true beginner, learning on my own. </p>
<c++>
2016-02-21 13:39:33
LQ_CLOSE
35,537,323
What is the best common technology to store data locally for mobile apps?
<p>I want to do an app for the three platforms : Android, Apple, Windows and I want to know what is the best choice to store local data on devices, to have a common data base, easily reusable for each platform ? Thanks for your help</p>
<android><ios><database><mobile><windows-phone>
2016-02-21 14:26:15
LQ_CLOSE
35,537,927
Can't remove .I. AND ..I. files
<p>could you suggest any idea how to remove two files from filesystem:<br> <strong>..I.</strong><br> and<br> <strong>.I.</strong><br> ?? <br> While experimenting I created them with command<br> <strong>$ git touch .I.</strong><br> I tried to use these commands:<br> <strong>$ git rm .I.</strong><br> <strong>$ git rm ./.I.</strong><br> <strong>$ git rm ..I.</strong><br> <strong>$ git rm ./..I.</strong><br> but it didn't help. Thank you in advance!</p>
<git>
2016-02-21 15:24:00
LQ_CLOSE
35,538,071
Symfony2, composer, your PHP version (5.6.18) overriden by "config.platform.php" version (5.3.9) does not satisfy requirement
<p>I am trying to install doctrine to my project. I am getting the error about the wrong PHP version. What can be done to remove the real reason for this error? The way to overcome it is to use the option "<code>--ignore-platform-reqs</code>" as described <a href="https://getcomposer.org/doc/03-cli.md#require">https://getcomposer.org/doc/03-cli.md#require</a> .</p> <p>PHP version: PHP 5.6.18</p> <pre><code>PHP 5.6.18 (cli) (built: Feb 3 2016 17:20:21) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies </code></pre> <p>The error: c..>composer require doctrine/data-fixtures</p> <pre><code>Using version ^1.1 for doctrine/data-fixtures ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - doctrine/migrations v1.3.0 requires php ^5.5|^7.0 -&gt; your PHP version (5.6 .18) overriden by "config.platform.php" version (5.3.9) does not satisfy that re quirement. - doctrine/migrations v1.2.2 requires php &gt;=5.4.0 -&gt; your PHP version (5.6.1 8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ irement. - doctrine/migrations v1.2.1 requires php &gt;=5.4.0 -&gt; your PHP version (5.6.1 8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ irement. - doctrine/migrations v1.2.0 requires php &gt;=5.4.0 -&gt; your PHP version (5.6.1 8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ irement. - doctrine/migrations v1.1.0 requires php &gt;=5.4.0 -&gt; your PHP version (5.6.1 8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ irement. - doctrine/migrations v1.0.0 requires php &gt;=5.4.0 -&gt; your PHP version (5.6.1 8) overriden by "config.platform.php" version (5.3.9) does not satisfy that requ irement. - Installation request for doctrine/migrations ~1.0 -&gt; satisfiable by doctri ne/migrations[v1.0.0, v1.1.0, v1.2.0, v1.2.1, v1.2.2, v1.3.0]. Installation failed, reverting ./composer.json to its original content. </code></pre> <p>The content of composer.json</p> <pre><code>"require": { "php": "&gt;=5.3.9", "symfony/symfony": "2.8.*", "doctrine/orm": "^2.4.8", "doctrine/doctrine-bundle": "~1.4", "doctrine/data-fixtures" : "~1.1", "doctrine/doctrine-fixtures-bundle": "dev-master", </code></pre>
<php><symfony><doctrine-orm><composer-php>
2016-02-21 15:38:28
HQ
35,538,726
UIAlertContoller Texfield width iOS 9
I have this problem while running my project that uses PixateFreestyle in iOS 9; As you can see in the image below, for some reason TextField of the UIAlertController loses it's width. [enter image description here][1] [1]: http://i.stack.imgur.com/43VHe.png
<ios9><uialertcontroller><pixate>
2016-02-21 16:35:11
LQ_EDIT
35,538,882
Seaborn boxplot + stripplot: duplicate legend
<p>One of the coolest things you can easily make in <code>seaborn</code> is <code>boxplot</code> + <code>stripplot</code> combination:</p> <pre><code>import matplotlib.pyplot as plt import seaborn as sns import pandas as pd tips = sns.load_dataset("tips") sns.stripplot(x="day", y="total_bill", hue="smoker", data=tips, jitter=True, palette="Set2", split=True,linewidth=1,edgecolor='gray') sns.boxplot(x="day", y="total_bill", hue="smoker", data=tips,palette="Set2",fliersize=0) plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.); </code></pre> <p><a href="https://i.stack.imgur.com/IxAVf.png"><img src="https://i.stack.imgur.com/IxAVf.png" alt="boxplot+stripplot"></a></p> <p>Unfortunately, as you can see above, it produced double legend, one for boxplot, one for stripplot. Obviously, it looks ridiculous and redundant. But I cannot seem to find a way to get rid of <code>stripplot</code> legend and only leave <code>boxplot</code> legend. Probably, I can somehow delete items from <code>plt.legend</code>, but I cannot find it in the documentation.</p>
<python><matplotlib><legend><seaborn>
2016-02-21 16:48:03
HQ
35,538,949
Getting values from JSON
<p>I have the following Json</p> <pre><code>{ "title": "my title", "children": [ { "id":1, "value1": 1 "value2": 2 }, { "id":1, "value1": 1 "value2": 2 }, ] } </code></pre> <p>How can in Angular, iterate trough the values, and get only value1 + value2?</p>
<javascript><angularjs><json>
2016-02-21 16:53:21
LQ_CLOSE
35,539,157
How can i access a method inside the another method in another class?
Whenever I create an Android app. I use a switch statement to access multiple buttons. When I click a button how can I understand which button was pressed., from another class? The other class is not an activity class. can anyone show me the right code.? for better understand. My first class is... public void onClick(View v){ switch (v.getId()){ case R.id.button1 : GifView.mymethod(R.id.button1); final Dialog dialog1=new Dialog(context); dialog1.setContentView(R.layout.dialog); Button finish1= (Button) dialog1.findViewById(R.id.finish); finish1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog1.dismiss(); } }); dialog1.show(); break; I want pass this button id onto another class.. private void init(Context context) { switch(?????){ case R.id.button1: setFocusable(true); gifInputStream = getResources().openRawResource(R.drawable.hen); gifMovie = Movie.decodeStream(gifInputStream); movieWidth = gifMovie.width(); movieHeight = gifMovie.height(); movieDuration = gifMovie.duration(); break; what can i do inside the switch statement? public static int mymethod(int id) { int buttonId=id; return buttonId; }
<android>
2016-02-21 17:09:36
LQ_EDIT
35,539,294
Properly start Activity from Notification regardless of app state
<p>I have an app with a splash screen Activity, followed by a main Activity. The splash screen loads stuff (database, etc.) before starting the main Activity. From this main Activity the user can navigate to multiple other child Activities and back. Some of the child Activities are started using <code>startActivityForResult()</code>, others just <code>startActivity()</code>.</p> <p>The Activity hierarchy are as depicted below. </p> <pre><code>| Child A (startActivityForResult) | / |--&gt; Splash --&gt; Main -- Child B (startActivityForResult) | ^ \ | | Child C (startActivity) | \ | This Activity is currently skipped if a Notification is started | while the app is not running or in the background. </code></pre> <p>I need to achieve the following behavior <strong>when clicking a Notification</strong>:</p> <ol> <li><strong>The state in the Activity must be maintained</strong>, since the user has selected some recipes to create a shopping list. If a new Activity is started, I believe the state will be lost.</li> <li>If the app is in the Main Activity, bring that to the front and let me know in code that I arrived from a Notification.</li> <li>If the app is in a child Activity started with <code>startActivityForResult()</code>, I need to add data to an Intent before going back to the Main Activity so that it can catch the result properly.</li> <li>If the app is in a child Activity started with <code>startActivity()</code> I just need to go back since there is nothing else to do (this currently works).</li> <li>If the app is not in the background, nor the foreground (i.e. it is <em>not</em> running) I must start the Main Activity and also know that I arrived from a Notification, so that I can set up things that are not set up yet, since the Splash Activity is skipped in this case in my current setup.</li> </ol> <p>I have tried lots of various suggestions here on SO and elsewhere, but I have not been able to successfully get the behavior described above. I have also tried reading the <a href="http://developer.android.com/guide/topics/ui/notifiers/notifications.html">documentation</a> without becoming a lot wiser, just a little. My current situation for the cases above when clicking my Notification is:</p> <ol> <li>I arrive in the Main Activity in <code>onNewIntent()</code>. I do not arrive here if the app is not running (or in the background). This seems to be expected and desired behavior.</li> <li>I am not able to catch that I am coming from a Notification in any child Activities, thus I am not able to properly call <code>setResult()</code> in those Activities. <strong>How should I do this?</strong></li> <li>This currently works, since the Notification just closes the child Activity, which is ok.</li> <li>I am able to get the Notification Intent in <code>onCreate()</code> by using <code>getIntent()</code> and <code>Intent.getBooleanExtra()</code> with a boolean set in the Notification. I should thus be able to make it work, but I am not sure that this is the best way. <strong>What is the preferred way of doing this?</strong></li> </ol> <h2>Current code</h2> <p><strong>Creating Notification:</strong></p> <p>The Notification is created when an HTTP request inside a Service returns some data.</p> <pre><code>NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setSmallIcon(getNotificationIcon()) .setAutoCancel(true) .setColor(ContextCompat.getColor(context, R.color.my_brown)) .setContentTitle(getNotificationTitle(newRecipeNames)) .setContentText(getContentText(newRecipeNames)) .setStyle(new NotificationCompat.BigTextStyle().bigText("foo")); Intent notifyIntent = new Intent(context, MainActivity.class); notifyIntent.setAction(Intent.ACTION_MAIN); notifyIntent.addCategory(Intent.CATEGORY_LAUNCHER); notifyIntent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); /* Add a thing to let MainActivity know that we came from a Notification. */ notifyIntent.putExtra("intent_bool", true); PendingIntent notifyPendingIntent = PendingIntent.getActivity(context, 0, notifyIntent, PendingIntent.FLAG_UPDATE_CURRENT); builder.setContentIntent(notifyPendingIntent); NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(111, builder.build()); </code></pre> <p><strong>MainActivity.java:</strong></p> <pre><code>@Override protected void onCreate(Bundle savedInstanceState) { Intent intent = getIntent(); if (intent.getBooleanExtra("intent_bool", false)) { // We arrive here if the app was not running, as described in point 4 above. } ... } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case CHILD_A: // Intent data is null here when starting from Notification. We will thus crash and burn if using it. Normally data has values when closing CHILD_A properly. // This is bullet point 2 above. break; case CHILD_B: // Same as CHILD_A break; } ... } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); boolean arrivedFromNotification = intent.getBooleanExtra("intent_bool", false); // arrivedFromNotification is true, but onNewIntent is only called if the app is already running. // This is bullet point 1 above. // Do stuff with Intent. ... } </code></pre> <p><strong>Inside a child Activity started with <code>startActivityForResult()</code>:</strong></p> <pre><code>@Override protected void onNewIntent(Intent intent) { // This point is never reached when opening a Notification while in the child Activity. super.onNewIntent(intent); } @Override public void onBackPressed() { // This point is never reached when opening a Notification while in the child Activity. Intent resultIntent = getResultIntent(); setResult(Activity.RESULT_OK, resultIntent); // NOTE! super.onBackPressed() *must* be called after setResult(). super.onBackPressed(); this.finish(); } private Intent getResultIntent() { int recipeCount = getRecipeCount(); Recipe recipe = getRecipe(); Intent recipeIntent = new Intent(); recipeIntent.putExtra(INTENT_RECIPE_COUNT, recipeCount); recipeIntent.putExtra(INTENT_RECIPE, recipe); return recipeIntent; } </code></pre> <p><strong>AndroidManifest.xml:</strong></p> <pre><code>&lt;application android:allowBackup="true" android:icon="@mipmap/my_launcher_icon" android:label="@string/my_app_name" android:theme="@style/MyTheme" android:name="com.mycompany.myapp.MyApplication" &gt; &lt;activity android:name="com.mycompany.myapp.activities.SplashActivity" android:screenOrientation="portrait" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="com.mycompany.myapp.activities.MainActivity" android:label="@string/my_app_name" android:screenOrientation="portrait" android:windowSoftInputMode="adjustPan" &gt; &lt;/activity&gt; &lt;activity android:name="com.mycompany.myapp.activities.ChildActivityA" android:label="@string/foo" android:parentActivityName="com.mycompany.myapp.activities.MainActivity" android:screenOrientation="portrait" android:windowSoftInputMode="adjustPan" &gt; &lt;meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.mycompany.myapp.activities.MainActivity" &gt; &lt;/meta-data&gt; &lt;/activity&gt; &lt;activity android:name="com.mycompany.myapp.activities.ChildActivityB" android:label="@string/foo" android:parentActivityName="com.mycompany.myapp.activities.MainActivity" android:screenOrientation="portrait" &gt; &lt;meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.mycompany.myapp.activities.MainActivity" &gt; &lt;/meta-data&gt; &lt;/activity&gt; ... &lt;/manifest&gt; </code></pre>
<android><android-intent><notifications><onactivityresult>
2016-02-21 17:20:07
HQ
35,540,157
Error: Expected a "=" operator in assignment statement
<pre><code>Func trigger_gui_() $guiG = WinGetPos($d3d) If GUICtrlRead($1s) = "On" Then $arr[8] = [$1, $1s, $af, $afs, $ms, $mss, $tk, $tkk] For $i = 0 to 8 + 1 $var = ControlGetPos( "Crypt3x", "", $arr[$i] ) $math = $var[3] - 17 GUICtrlSetPos($arr[$i], 104, $guiG[3] - $math, 80, 17) Next EndIf EndFunc </code></pre> <p>Im getting the above error in this function can someone pls help me :|</p>
<autoit>
2016-02-21 18:30:03
LQ_CLOSE
35,540,159
Nginx : SSL_CTX_use_PrivateKey_file (..) failed
<p>I self generated 2 self-signed certificates with openssl for testing purposes using :</p> <pre><code> $ sudo openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=FR/ST=Charente/L=Mornac/O=Office/CN=api.cockpit.yves" -keyout /usr/local/etc/nginx/ssl/api.cockpit.yves.key -out /usr/local/etc/nginx/ssl/api.cockpit.yves.crt Generating a 4096 bit RSA private key ..........................................................................++ ...................++ writing new private key to '/usr/local/etc/nginx/ssl/api.cockpit.yves.key' ----- $ sudo openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 -subj "/C=FR/ST=Charente/L=Mornac/O=Office/CN=admin.cockpit.yves" -keyout /usr/local/etc/nginx/ssl/admin.cockpit.yves.key -out /usr/local/etc/nginx/ssl/admin.cockpit.yves.crt Generating a 4096 bit RSA private key ..................................................................................................................................................++ ..............................++ writing new private key to '/usr/local/etc/nginx/ssl/admin.cockpit.yves.key' ----- </code></pre> <p>and in my nginx.conf file , I set up the Https servers with :</p> <pre><code>server { listen 8444 ssl; server_name admin.cockpit.yves; ssl_certificate ssl/admin.cockpit.yves.crt; ssl_certificate_key ssl/admin.cockpit.yves.crt; ... } server { listen 8445 ssl; server_name api.cockpit.yves; ssl_certificate ssl/api.cockpit.yves.crt; ssl_certificate_key ssl/api.cockpit.yves.crt; ... } </code></pre> <p>however testing the nginx config, I get the following error :</p> <pre><code> sudo nginx -t nginx: [emerg] SSL_CTX_use_PrivateKey_file("/usr/local/etc/nginx/ssl/admin.cockpit.yves.crt") failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line:Expecting: ANY PRIVATE KEY error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib) nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed </code></pre> <p>what could be wrong ? is it because I try to setup 2 certificates for 2 different subdomains (admin. and api. ) for the same domain cockpit.yves ?</p> <p>thanks for your feedback</p>
<ssl><nginx><ssl-certificate>
2016-02-21 18:30:15
HQ
35,541,374
Why does it take double args when calling my class for my class to work?
I am running Python 3.3.4 on Windows 10 The following is my class Code- class Curl(): def __init__(self): self.file7 = file7 self.Days1 = Days1 def readfile(self): ticknum = 0 read_ticker = [] ins = open(file7, "r" ) for line in ins: if line.endswith('\n'): line=line[:-1] read_ticker.append(line) ticknum =+1 ins.close() return read_ticker def CalcDates(self, Days1): # Determine dates calculated_dates = dict() Run_Time = (time.strftime("%H/%M/%S")) calculated_dates['Run_Time']= Run_Time Today = date.today() calculated_dates['Today'] = Today End_Date = (Today - timedelta(days=Days1)) calculated_dates ['Start_Date'] = Today Start_Day = str(Today.strftime("%d")) calculated_dates['Start_Day'] = Start_Day Start_Month = str(Today.strftime("%m")) calculated_dates['Start_Month'] = Start_Month Start_Year = str(Today.strftime("%Y")) calculated_dates['Start_Year']= Start_Year End_Day = str(End_Date.strftime("%d")) calculated_dates['End_Day'] = End_Day End_Month = str(End_Date.strftime("%m")) calculated_dates['End_Month']= End_Month End_Year = str(End_Date.strftime("%Y")) calculated_dates['End_Year']= End_Year return calculated_dates It runs if i do the following; file7 = 'C:\\...\\file1.txt' fileList = Curl.readfile(file7) print('readTickers is complete') print(fileList) D1= Curl.CalcDates( 90, 90) print(D1) I want it to run if i change the line D1 as follows; D1= Curl.CalcDates(90) but it doesn't- I get the following error; Traceback (most recent call last): File "C:\Users\Edge\Desktop\readTICKR class432.py", line 56, in <module> D1= Curl.CalcDates(90) TypeError: CalcDates() missing 1 required positional argument: 'Days1' Why does it require me to put double arguements when I call Curl.CalcDates ? How can I fix it so that I can use a single arguement?
<python><class><python-3.x><arguments>
2016-02-21 20:08:36
LQ_EDIT
35,541,623
Making A Window With C
<p>I have been using the below code to make a simple window within C. When Compiling a get the error C4133, ive brought up the error in visual online but unable to resolve. (Apologies this is badly written) </p> <pre><code>#include &lt;windows.h&gt; const char g_szClassName[] = "myWindowClass"; // Step 4: the Window Procedure LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { WNDCLASSEX wc; HWND hwnd; MSG Msg; //Step 1: Registering the Window Class wc.cbSize = sizeof(WNDCLASSEX); wc.style = 0; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wc.lpszMenuName = NULL; wc.lpszClassName = g_szClassName; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); if (!RegisterClassEx(&amp;wc)) { MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } // Step 2: Creating the Window hwnd = CreateWindowEx( WS_EX_CLIENTEDGE, g_szClassName, "The title of my window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 240, 120, NULL, NULL, hInstance, NULL); if (hwnd == NULL) { MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); // Step 3: The Message Loop while (GetMessage(&amp;Msg, NULL, 0, 0) &gt; 0) { TranslateMessage(&amp;Msg); DispatchMessage(&amp;Msg); } return Msg.wParam; </code></pre> <p>}</p>
<c>
2016-02-21 20:29:31
LQ_CLOSE
35,541,964
Only if contains >< /!a-zA-Z or some of them with regular expression
<p>I need to check string if contains >&lt; /!a-zA-Z or some of them (Also contains space). The only thing I know is a-zA-Z i need an example in C# or Javascript.</p>
<javascript><c#><regex><contains>
2016-02-21 20:58:58
LQ_CLOSE
35,542,176
Typescript: Property 'src' does not exist on type 'HTMLElement'
<p>I get a error from Typescript and I am not sure how to correct it. The code works fine when "compiled" but I can't correct the error. I have extracted the parts that involve the error from my code. I guess I have to predifine the src but not sure how.</p> <p>Error msg in Editor and on Gulp compile: </p> <p><strong><em>"Property 'src' does not exist on type 'HTMLElement'.at line 53 col 17"</em></strong></p> <pre><code>... element:HTMLElement; /* Defining element */ ''' this.element = document.createElement('img'); /*creating a img*/ ''' </code></pre> <p>This is the method I run to render the element, position, top and left all works with out giving a error. </p> <pre><code>display() { this.element.src = this.file; /*This is the line that gives the error*/ this.element.style.position = "absolute"; this.element.style.top = this.pointX.toString() + "px"; this.element.style.left = this.pointY.toString() + "px"; document.body.appendChild(this.element); }; </code></pre>
<javascript><typescript>
2016-02-21 21:17:21
HQ
35,542,489
How can I find the greatest common divisor of two numbers using a for loop?
<p>I'm a beginner in java and I can't figure out how to find the GCD. I also need to use a for loop and the variables, int one and int two, as the numbers. I'm really lost, any help will be appreciated. This is the method format that I was given.</p> <pre><code>public long getGCD( ) { long gcd=0; return 1; } </code></pre>
<java><for-loop>
2016-02-21 21:43:04
LQ_CLOSE
35,543,185
Amazon S3 - different lifecycle rule for "subdirectory" than for parent "directory"
<p>Let's say I have the following data structure:</p> <ul> <li>/</li> <li>/foo</li> <li>/foo/bar</li> <li>/foo/baz</li> </ul> <p>Is it possible to assign to it the following life-cycle rules:</p> <ul> <li>/ (1 month)</li> <li>/foo (2 months)</li> <li>/foo/bar (3 months)</li> <li>/foo/baz (6 months)</li> </ul> <p>The official documentation is unfortunately self-contradictionary in this regard. It doesn't seem to work with AWS console, which makes me somewhat doubtful that SDKs/REST would be any different ;)</p> <p>Failing at that my root problem is: I have 4 types of projects. The most rudimentary type has a few thousand projects, the other ones have a few dozen. Each type I am obligated to store for a different period of time. Each project contains hundreds of thousands of objects. It looks more or less as:</p> <ul> <li>type A, 90% of projects, x storage required</li> <li>type B, 6% of projects, 2x storage required</li> <li>type C, 3% of projects, 4x storage required</li> <li>type D, 1% of projects, 8x storage required</li> </ul> <p>So far so simple. However. Projects may be upgraded or downgraded from one type to another. And as I said - I have a few thousand instances of the first type so I can't write specific rules for every one of them (remember 1000 rule limit per bucket). And since they may upgrade from one type to another I can't simply insert them in a their own folders as well (ex. only projects from a particular type) or bucket. Or so I think? Are there any other options open to me other than iterating over every object, every time I want to purge expired files - which I would seriously rather not do because of the sheer number of objects?</p> <p>Maybe some kind of file "move/transfer" between buckets that doesn't modify the creation time metadata, and isn't costly for our server to process?</p> <p>Would be much obliged :)</p>
<amazon-web-services><amazon-s3>
2016-02-21 22:54:40
HQ
35,544,364
How to implement these github examples?
<p>All,</p> <p>I am new to github and its a bit confusing to say the least. This link shows a bunch of animated menu styles, but I have no clue how to use their code on my sites. For example the 10th one down "Adrian". Where would I get all the code I need? I just signed up for an account. Thanks </p> <p><a href="http://tympanus.net/Development/LineMenuStyles/" rel="nofollow">http://tympanus.net/Development/LineMenuStyles/</a></p>
<javascript><html><css><github>
2016-02-22 01:21:51
LQ_CLOSE
35,544,871
Batchfile: What's the best way to declare and use a boolean variable?
<p>What's the best way to declare and use a boolean variable in Batch files? This is what I'm doing now:</p> <pre><code>set "condition=true" :: Some code that may change the condition if %condition% == true ( :: Some work ) </code></pre> <p>Is there a better, more "formal" way to do this? (e.g. In Bash you can just do <code>if $condition</code> since <code>true</code> and <code>false</code> are commands of their own.)</p>
<windows><batch-file><cmd><windows-10><command-prompt>
2016-02-22 02:29:28
HQ
35,544,995
How to schedule a eclipse java program to run daily at 8 PM?
<p>Can anyone please help me in scheduling to run a eclipse java program daily at 8 PM?</p> <p>I used various methods such as codepro, quartz but i don't know how it works?</p>
<java>
2016-02-22 02:43:49
LQ_CLOSE
35,545,405
Gradle - add directory to classpath
<p>My application requires that a <code>\config</code> directory be available on the classpath when it looks for configurations files under the directory. I currently have dependencies configured like so, though this is probably not the correct way to make a directory available to my application:</p> <pre><code>dependencies { ... //runtime, compile dependencies pulled from repositories runtime files('config') } </code></pre> <p>I am using the <code>application</code> plugin to create a standalone zip for my project. If my <code>\config</code> directory has <code>\config\subdir</code>, <code>file1</code>, <code>file2</code>, then the plugin produces a <code>build\install</code> directory with the following structure:</p> <pre><code>| build | --|install | ----|bin | ------ projectName | ------ projectName.bat | ----|lib | ------ dependency1.jar | ------ dependency2.jar | ------|subdir | ------ file1 | ------ file2 </code></pre> <p>This does not work for my application because it explicitly expects a <code>\config</code> directory</p> <p>However, this is the directory structure that I need:</p> <pre><code>| build | --|install | ----|bin | ------ projectName | ------ projectName.bat | ----|lib | ------ dependency1.jar | ------ dependency2.jar | ----|config | ------|subdir | ------ file1 | ------ file2 </code></pre> <p>How can I make gradle add another directory to the build and specify it as part of the classpath for the generated startup scripts?</p>
<java><gradle><classpath><build.gradle>
2016-02-22 03:35:38
HQ
35,546,385
Homework help - new programmer! Python calculating minimum max and average of a list
I'm new to python and my professor has not explained this assignment very well, many of my classmates are confused. He is an adjunct so he does not have office hours as well so I would be grateful for any sort of assistance or knowledge on how I can complete this. So, the prompt is "Write, debug, and test a program to calculate and print the minimum, maximum, and average of a list of positive test scores. Prompt the user for how many scores are to be entered. Expect each score will be entered one per line. Provide a prompt for each score." So this what I currently have, but I'm stuck at finding the min, max, and avg. def scores(): print('we are starting') count = int(input('Enter amount of scores: ')) print('Each will be entered one per line') scoreList = [] for i in range(1, count+1): scoreList.append(int(input('Enter score: '))) print(scoreList) print(scoreList) print('thank you the results are:') mysum = sum(count) # mysum needs to be a float average = 1.0*mysum / n print ('Total: ', str(count)) print ('Average: ', str(average)) print ('Minimum: ', str(min(count))) print ('Maximum: ', str(max(count))) scores() I'm not sure if it would be easier to do an elif type statement as I said I'm really new to this and I'm still just trying to understand whats going on in this code. next, I need to "expand the program to generate a score by grade table. For each rank of grade [A,B,C,D,F] the program counts the number of grades in the rank. The program prints a table of count by rank and provides the percentage of total grades in each rank. The ranks are as follows: A = 91 - 100 B = 81 - 90 C = 71 - 80 D = 61 - 70 F = 0 - 60" I understand this is a lot, I would just appreciate some assistance or some input as any and all are very appreciated. Thanks in advance to anyone that responds and I will be updating if I get any further on this on my own.
<python><list><python-3.x><statistics>
2016-02-22 05:31:09
LQ_EDIT
35,546,728
I provide complete path in href tag still it says resource not available. why?
<p><a href="https://i.stack.imgur.com/nTfcN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nTfcN.jpg" alt="enter image description here"></a></p> <p>I give complete from web-Inf path here I don't know why its not working when i click contact it give me error 400 The requested resource () is not available.</p>
<java><servlets><jsp-tags>
2016-02-22 06:02:10
LQ_CLOSE
35,546,906
How a button click can call another class?
So I am trying to create an android app to show some simple battery information. And now I want to take that info and plot a graph inside the app. I have the following codes: public class MainActivity extends ActionBarActivity { private TextView level,voltage, status1,temp,health1,tech,sour,amp; Thread myThread; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); level=(TextView)findViewById(R.id.level); voltage=(TextView)findViewById(R.id.volt); status1=(TextView)findViewById(R.id.stat); temp=(TextView)findViewById(R.id.temp); health1=(TextView)findViewById(R.id.healt); tech=(TextView)findViewById(R.id.tech); sour=(TextView)findViewById(R.id.source); Button b = (Button) findViewById(R.id.ex); Button g = (Button) findViewById(R.id.graphButton); amp=(TextView)findViewById(R.id.current); b.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { // TODO Auto-generated method stub finish(); System.exit(0);} }); g.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { final DynamicGraphActivity test=new DynamicGraphActivity (); } }); this.registerReceiver(this.myBatteryReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); } private BroadcastReceiver myBatteryReceiver = new BroadcastReceiver(){ @SuppressLint("InlinedApi") @Override public void onReceive(Context arg0, Intent arg1) { // TODO Auto-generated method stub if (arg1.getAction().equals(Intent.ACTION_BATTERY_CHANGED)){ int lv = arg1.getIntExtra("level", 0); level.setText("Level: " + String.valueOf(lv) + "%"); voltage.setText("Voltage: " + String.valueOf((float)arg1.getIntExtra("voltage", 0)/1000) + "V"); temp.setText("Temperature: " + String.valueOf((float)arg1.getIntExtra("temperature", 0)/10) + "c"); tech.setText("Technology: " + arg1.getStringExtra("technology")); int status = arg1.getIntExtra("status", BatteryManager.BATTERY_STATUS_UNKNOWN); String strStatus; if (status == BatteryManager.BATTERY_STATUS_CHARGING){ strStatus = "Charging"; } else if (status == BatteryManager.BATTERY_STATUS_DISCHARGING){ strStatus = "Dis-charging"; } else if (status == BatteryManager.BATTERY_STATUS_NOT_CHARGING){ strStatus = "Not charging"; } else if (status == BatteryManager.BATTERY_STATUS_FULL){ strStatus = "Full"; } else { strStatus = "Unknown"; } status1.setText("Status: " + strStatus); //int source=arg1.getIntExtra("source", BatteryManager.BATTERY_STATUS_UNKNOWN); if(Build.VERSION.SDK_INT >= 21){ BatteryManager battery = (BatteryManager)getSystemService(Context.BATTERY_SERVICE); int current=battery.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW); int currentAvg=battery.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_AVERAGE); int energy=battery.getIntProperty(BatteryManager.BATTERY_PROPERTY_ENERGY_COUNTER); int capacity=battery.getIntProperty(BatteryManager.BATTERY_PROPERTY_CHARGE_COUNTER); int bCapacity=battery.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY); String string1 = "Current: "+ current*1000+" uA"+"\n"; string1+="Average Current: "+currentAvg+" uA"+"\n"; string1+="Remaining energy: "+energy+" nWh"+"\n"; string1+="Capacity: "+capacity+" uAh"+"\n\n"; amp.setText(string1); } int health = arg1.getIntExtra("health", BatteryManager.BATTERY_HEALTH_UNKNOWN); String strHealth; if (health == BatteryManager.BATTERY_HEALTH_GOOD){ strHealth = "Good"; } else if (health == BatteryManager.BATTERY_HEALTH_OVERHEAT){ strHealth = "Over Heat"; } else if (health == BatteryManager.BATTERY_HEALTH_DEAD){ strHealth = "Dead"; } else if (health == BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE){ strHealth = "Over Voltage"; } else if (health == BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE){ strHealth = "Unspecified Failure"; } else{ strHealth = "Unknown"; } health1.setText("Health: " + strHealth); } } }; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } 2nd class: public class DynamicGraphActivity extends Activity { private static GraphicalView view; private LineGraph line = new LineGraph(); private static Thread thread; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); thread = new Thread() { public void run() { for (int i = 0; i < 15; i++) { try { Thread.sleep(2000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } Point p = MockData.getDataFromReceiver(i); // We got new data! line.addNewPoints(p); // Add it to our graph view.repaint(); } } }; thread.start(); } @Override protected void onStart() { super.onStart(); view = line.getView(this); setContentView(view); } } import org.achartengine.ChartFactory; import org.achartengine.GraphicalView; import org.achartengine.chart.PointStyle; import org.achartengine.model.TimeSeries; import org.achartengine.model.XYMultipleSeriesDataset; import org.achartengine.renderer.XYMultipleSeriesRenderer; import org.achartengine.renderer.XYSeriesRenderer; import android.content.Context; import android.graphics.Color; public class LineGraph { private GraphicalView view; private TimeSeries dataset = new TimeSeries("Rain Fall"); private XYMultipleSeriesDataset mDataset = new XYMultipleSeriesDataset(); private XYSeriesRenderer renderer = new XYSeriesRenderer(); // This will be used to customize line 1 private XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer(); // Holds a collection of XYSeriesRenderer and customizes the graph public LineGraph() { // Add single dataset to multiple dataset mDataset.addSeries(dataset); // Customization time for line 1! renderer.setColor(Color.WHITE); renderer.setPointStyle(PointStyle.SQUARE); renderer.setFillPoints(true); // Enable Zoom mRenderer.setZoomButtonsVisible(true); mRenderer.setXTitle("Day #"); mRenderer.setYTitle("CM in Rainfall"); // Add single renderer to multiple renderer mRenderer.addSeriesRenderer(renderer); } public GraphicalView getView(Context context) { view = ChartFactory.getLineChartView(context, mDataset, mRenderer); return view; } public void addNewPoints(Point p) { dataset.add(p.getX(), p.getY()); } } import java.util.Random; public class MockData { // x is the day number, 0, 1, 2, 3 public static Point getDataFromReceiver(int x) { return new Point(x, generateRandomData()); } private static int generateRandomData() { Random random = new Random(); return random.nextInt(40); } } public class Point { private int x; private int y; public Point( int x, int y) { this.x = x; this.y = y; } public int getX() { return x; } public int getY() { return y; } } Now inside the button g, I want to call DynamicGraphActivity class so that it calls the class and plots a graph using some random values. but its not working. When i click on the button, it doesnt do anything. How can I fix this? And my another question is, how can I plot the battery info such as voltage, charge or discharge over time using these codes/ Any help would be greatly appreciated. Thank you
<android><android-studio><android-button>
2016-02-22 06:15:19
LQ_EDIT
35,547,298
React-Native: How to wrap Child components under another class component
<p>Let me Explain my question with an example:</p> <p>in SomeComponent.js I have the following</p> <pre><code>export default class SomeComponent extends React.Component { render() { return ( &lt;View style={{flex:1}}&gt; &lt;/View&gt; ) } } </code></pre> <p>and in Root.js it imports 'SomeComponent' as follow</p> <pre><code>import SomeComponent from './SomeCoponent' export default class SomeComponent extends React.Component { render() { return ( &lt;SomeComponent&gt; &lt;Text&gt; hello &lt;/Text&gt; &lt;/SomeComponent&gt; ) } } </code></pre> <p>How does this work?</p> <p>I saw some blog where some people do this:</p> <pre><code>export default class SomeComponent extends React.Component { render() { return ( &lt;View style={{flex:1}}&gt; {/* code added here - start */} {React.Children.map(this.props.children, c =&gt; React.cloneElement(c, { route: this.props.route }))} {/* code added here - end */} &lt;/View&gt; ) } } </code></pre> <p>But this does not work for me. </p> <p>I am getting the following error: </p> <pre><code>Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components) </code></pre> <p>Any help would be appreciated. Thanks</p>
<reactjs><react-native>
2016-02-22 06:44:01
HQ
35,547,343
Error while rendering jsp content
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at iconcept.filter.NavigationFilter.doFilter(NavigationFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at common.util.HibernateSessionRequestFilter.doFilter(HibernateSessionRequestFilter.java:117) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at common.util.DisableUrlSessionFilter.doFilter(DisableUrlSessionFilter.java:57) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190) at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283) at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767) at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697) at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) at java.lang.Thread.run(Thread.java:619) Caused by: Class: java.nio.HeapByteBuffer File: HeapByteBuffer.java Method: put Line: 165 - java/nio/HeapByteBuffer.java:165:-1 at org.apache.struts2.components.UIBean.end(UIBean.java:515) at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42) at org.apache.jsp.admin.snsales.addPurchaseOrderAgrmnt_jsp._jspx_meth_s_005fcomponent_005f0(addPurchaseOrderAgrmnt_jsp.java:7012) at org.apache.jsp.admin.snsales.addPurchaseOrderAgrmnt_jsp._jspx_meth_s_005fif_005f8(addPurchaseOrderAgrmnt_jsp.java:6956) at org.apache.jsp.admin.snsales.addPurchaseOrderAgrmnt_jsp._jspx_meth_s_005fform_005f0(addPurchaseOrderAgrmnt_jsp.java:5227) at org.apache.jsp.admin.snsales.addPurchaseOrderAgrmnt_jsp._jspService(addPurchaseOrderAgrmnt_jsp.java:3178) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) ... 89 more Caused by: java.nio.BufferOverflowException at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:165) at org.apache.struts2.util.FastByteArrayOutputStream.decodeAndWriteOut(FastByteArrayOutputStream.java:161) at org.apache.struts2.util.FastByteArrayOutputStream.writeTo(FastByteArrayOutputStream.java:94) at org.apache.struts2.components.Include.include(Include.java:261) at org.apache.struts2.components.template.JspTemplateEngine.renderTemplate(JspTemplateEngine.java:58) at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:559) at org.apache.struts2.components.UIBean.end(UIBean.java:513) ... 97 more
<struts2>
2016-02-22 06:46:59
LQ_EDIT
35,547,439
insert the values through a stored procedure in oracle
i have the following code in sql server,kindly let me know whats the appropriate code of inserting values through a stored procedure in oracle: CREATE PROCEDURE INSERTPRODUCTRECORD ( @PNAME VARCHAR(5), @CATEGORY VARCHAR(50), @PRICE INT ) AS BEGIN INSERT INTO PRODUCT (PNAME,PRICE,CATEGORY) VALUES(@PNAME, @CATEGORY, @PRICE INT) END
<sql><oracle>
2016-02-22 06:53:45
LQ_EDIT
35,547,787
Convert to base 2 then split in an array
<p>I want to convert my base 10 number to base 2 and then store parts in an array. </p> <p>Here are two examples:</p> <p>my value is 5 so it will be converted to 101 then I have an array like this: {1,0,1}</p> <p>or my value is 26 so it will be converted to 11010 then I will have an array like this: {0,1,0,1,1}</p> <p>Thank you in advance for your time and consideration.</p>
<c#><arrays><base>
2016-02-22 07:15:34
LQ_CLOSE
35,548,434
component data vs its props in vuejs
<p>The official documentation says that there could be a <code>data</code> and a <code>props</code> option in a component.</p> <p>For me it seems a sort of excessive functionality.</p> <p>Why do I need both properties and data in my component? Which goals they are aimed?</p>
<javascript><vue.js>
2016-02-22 07:56:25
HQ
35,549,029
Is it possible to do static partial classes?
<p>I want to take a class I have and split it up into several little classes so it becomes easier to maintain and read. But this class that I try to split using <code>partial</code> is a static class.</p> <p>I saw in an example on Stackoverflow that this was possible to do but when I do it, it keeps telling me that I cannot derive from a static class as static classes must derive from object.</p> <p>So I have this setup:</p> <pre><code>public static class Facade { // A few general methods that other partial facades will use } public static partial class MachineFacade : Facade { // Methods that are specifically for Machine Queries in our Database } </code></pre> <p>Any pointers? I want the <code>Facade</code> class to be static so that I don't have to initialize it before use.</p>
<c#><partial-classes>
2016-02-22 08:34:21
HQ
35,550,819
Need help reading from a file(.dat) doing calculations then outputting into a new file
I need to make a program that reads the marks.dat file, outputs that file onto the screen, marks.dat 23468555 88 55 67 55223344 45 90 78 32321111 67 89 73 77001234 79 59 99 21324354 62 84 88 40450765 34 45 56 26726826 93 69 71 30917823 57 65 80 54277888 87 77 55 The 8-digit number represents the student number and the following 3 2-digit numbers represent the assignment marks, calculate the average of the 3 that contributes 40% of the year mark, find the highest mark that contributes 60% of the year mark, then output the student number, followed by the average, followed by the year mark, i.e yearmark.dat 23468555 70.00 80.80 The average and year mark should be of type *double* and display only 2 digits after the decimal, then output to the file and display the contents on the screen. The problem I have is that trying to output the *double* of the 8-digit number outputs 234686e+007, however if its *int*, it then outputs correctly. Would also like to see how you would tackle this problem, would you try create an array to insert the contents of the file, was thinking 2-d, first student number then the marks in the second dimension. Any advice or help will be appreciated
<c++><multidimensional-array><file-io>
2016-02-22 10:08:28
LQ_EDIT
35,550,981
json data alerting undefined
i have this json via ajax >[{"tid":"1","itemID":"Camry","item_type":"Carf","vendor_id":"ogbueli"},{"tid":"2","itemID":"Samsung","item_type":"Electronics","vendor_id":"Chizoba"},{"tid":"3","itemID":"Panasonic","item_type":"Electronics","vendor_id":"Mourinho"}] i have already parsed it arr = JSON.parse(response); now i want to access it like this for (var i in arr){ newitems=arr[0]; alert(newitems); } the alert is returning 'undefined'. i want to get something like this newitems={'1','camry','carf','ogbueli'}; hope someone can help me out...thanks
<jquery><json>
2016-02-22 10:16:09
LQ_EDIT
35,551,045
59 duplicate symbols for architecture x86_64
<p>I am new to iOS programming.So I am not getting how to fix this error. I am using Xcode 7.2.1.While building my app I am getting this duplicate symbol _OBJC_IVAR_$_ECPercentDrivenInteractiveTransition._transitionContext in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECPercentDrivenInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECPercentDrivenInteractiveTransition.o) duplicate symbol _OBJC_IVAR_$_ECPercentDrivenInteractiveTransition._animationController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECPercentDrivenInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECPercentDrivenInteractiveTransition.o) duplicate symbol _OBJC_CLASS_$_ECPercentDrivenInteractiveTransition in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECPercentDrivenInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECPercentDrivenInteractiveTransition.o) duplicate symbol _OBJC_METACLASS_$_ECPercentDrivenInteractiveTransition in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECPercentDrivenInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECPercentDrivenInteractiveTransition.o) duplicate symbol _OBJC_IVAR_$_ECPercentDrivenInteractiveTransition._isActive in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECPercentDrivenInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECPercentDrivenInteractiveTransition.o) duplicate symbol _OBJC_IVAR_$_ECPercentDrivenInteractiveTransition._percentComplete in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECPercentDrivenInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECPercentDrivenInteractiveTransition.o) duplicate symbol _OBJC_IVAR_$_ECSlidingAnimationController._coordinatorAnimations in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingAnimationController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingAnimationController.o) duplicate symbol _OBJC_CLASS_$_ECSlidingAnimationController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingAnimationController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingAnimationController.o) duplicate symbol _OBJC_METACLASS_$_ECSlidingAnimationController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingAnimationController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingAnimationController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingAnimationController._coordinatorCompletion in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingAnimationController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingAnimationController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingAnimationController._defaultTransitionDuration in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingAnimationController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingAnimationController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingInteractiveTransition._positiveLeftToRight in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingInteractiveTransition.o) duplicate symbol _OBJC_IVAR_$_ECSlidingInteractiveTransition._slidingViewController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingInteractiveTransition.o) duplicate symbol _OBJC_CLASS_$_ECSlidingInteractiveTransition in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingInteractiveTransition.o) duplicate symbol _OBJC_METACLASS_$_ECSlidingInteractiveTransition in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingInteractiveTransition.o) duplicate symbol _OBJC_IVAR_$_ECSlidingInteractiveTransition._fullWidth in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingInteractiveTransition.o) duplicate symbol _OBJC_IVAR_$_ECSlidingInteractiveTransition._currentPercentage in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingInteractiveTransition.o) duplicate symbol _OBJC_IVAR_$_ECSlidingInteractiveTransition._coordinatorInteractionEnded in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingInteractiveTransition.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingInteractiveTransition.o) duplicate symbol _OBJC_IVAR_$_ECSlidingSegue._skipSettingTopViewController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingSegue.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingSegue.o) duplicate symbol _OBJC_IVAR_$_ECSlidingSegue._isUnwinding in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingSegue.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingSegue.o) duplicate symbol _OBJC_CLASS_$_ECSlidingSegue in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingSegue.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingSegue.o) duplicate symbol _OBJC_METACLASS_$_ECSlidingSegue in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingSegue.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingSegue.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._gestureView in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._anchorRightRevealAmount in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._anchorLeftRevealAmount in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._anchorRightPeekAmount in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._preserveRightPeekAmount in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._anchorLeftPeekAmount in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._preserveLeftPeekAmount in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._transitionInProgress in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._coordinatorAnimations in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._customAnchoredGestures in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._underRightViewController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._underLeftViewController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._topViewController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_CLASS_$_ECSlidingViewController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_METACLASS_$_ECSlidingViewController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._currentAnimationController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._defaultAnimationController in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._customAnchoredGesturesViewMap in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._currentTopViewPosition in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._currentInteractiveTransition in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._defaultInteractiveTransition in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._coordinatorCompletion in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._defaultTransitionDuration in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._currentOperation in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._isInteractive in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._animationComplete in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._delegate in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._resetTapGesture in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._panGesture in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._topViewAnchoredGesture in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._currentAnimationPercentage in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._isAnimated in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._transitionWasCancelled in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._coordinatorInteractionEnded in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._underRightViewControllerStoryboardId in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._underLeftViewControllerStoryboardId in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) duplicate symbol _OBJC_IVAR_$_ECSlidingViewController._topViewControllerStoryboardId in: /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Intermediates/iHealApp.build/Debug-iphonesimulator/iHealApp.build/Objects-normal/x86_64/ECSlidingViewController.o /Users/coders/Library/Developer/Xcode/DerivedData/iHealApp-ckstaumxwtiyvpgeursmlweqpdmq/Build/Products/Debug-iphonesimulator/libECSlidingViewController.a(ECSlidingViewController.o) ld: 59 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Please help me how to fix this.</p>
<ios><xcode7>
2016-02-22 10:19:33
LQ_CLOSE
35,551,072
How to find index of a substring?
<p>Looking for Elixir equivalent of Ruby's:</p> <pre><code>"john.snow@domain.com".index("@") # =&gt; 9 "john.snow@domain.com".index("domain") # =&gt; 10 </code></pre>
<elixir>
2016-02-22 10:20:48
HQ
35,551,241
Requirejs : Non amd library
<p>I have a script.js included in the website of my customer. This customer uses requirejs but he append script.js at the end of the body without explicitly using requirejs to load it.</p> <p>In script.js i have libraries that are amd compatible and other not. The problem is that requirejs automatically load library which are amd. And i can't access them in my own library which is not amd compatible.</p> <p>Do you have any idea ? </p> <p>Thanks</p>
<javascript><requirejs><amd>
2016-02-22 10:28:01
LQ_CLOSE
35,551,326
Tensorflow Tensorboard default port
<p>Is there a way to change the default port ("6006") on tensorboard so we could open multiple tensorboard? Maybe an option like --port="8008" ?</p>
<python><tensorflow><tensorboard>
2016-02-22 10:31:45
HQ
35,551,366
What is the defined execution order of ES6 imports?
<p>I've tried searching the internet for the execution order of imported modules. For instance, let's say I have the following code:</p> <pre><code>import "one" import "two" console.log("three"); </code></pre> <p>Where <code>one.js</code> and <code>two.js</code> are defined as follows:</p> <pre><code>// one.js console.log("one"); // two.js console.log("two"); </code></pre> <p>Is the console output guaranteed to be:</p> <pre><code>one two three </code></pre> <p>Or is it undefined?</p>
<javascript><ecmascript-6><es6-module-loader>
2016-02-22 10:33:36
HQ
35,551,668
User control with if/else statment?
So.. I want to include an ascx file with navigator bar. There are two versions, one shows up when user is not logged in and one is for logged user. <div class="navigator"> <uc1:nav runat="server" ID="nav" /> </div> This is how I can link one of the nav... but I have no idea how to make this path into if/else statment Tried to do some things inside of <% %> but.... without any success. Could anyone help me?
<c#><asp.net><session><user-controls><session-variables>
2016-02-22 10:50:21
LQ_EDIT
35,552,016
Generate 6 digits pin code using python
<p>I want to build python algorithm that generates 6 digits pin code. I had many ideas like : based on time, on id .... etc, but non sounded secure once the algorithm is exposed. Now I am trying to generate that using <code>random.randint(a, b)</code>, however I want to know how it really works and python documentation don't provide much about it. So can you please provide more about this or any other suggestions to generate 6 digits pin code.</p>
<python><cryptography>
2016-02-22 11:06:29
LQ_CLOSE
35,552,708
Is Materialize Navbar height adjustment possible?
<p>Is it possible to adjust the height of the Navbar in Materialize?</p> <p>64px is a bit too much for my site. I was going for 30px before I decided to materialize it.</p>
<materialize>
2016-02-22 11:41:51
HQ
35,552,874
Get first letter of a string from column
<p>I'm fighting with pandas and for now I'm loosing. I have source table similar to this:</p> <pre><code>import pandas as pd a=pd.Series([123,22,32,453,45,453,56]) b=pd.Series([234,4353,355,453,345,453,56]) df=pd.concat([a, b], axis=1) df.columns=['First', 'Second'] </code></pre> <p>I would like to add new column to this data frame with first digit from values in column 'First': a) change number to string from column 'First' b) extracting first character from newly created string c) Results from b save as new column in data frame</p> <p>I don't know how to apply this to the pandas data frame object. I would be grateful for helping me with that.</p>
<python><pandas>
2016-02-22 11:50:18
HQ
35,553,526
How to hide Blue line covering views in xib/Storyboard in Xcode 7.2
<p><a href="https://i.stack.imgur.com/bI0ls.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bI0ls.png" alt="enter image description here"></a> I am using xcode 7.2, in xib when i insert any view, label,txtField etc., all are showing this covering blue line. now it is very hard to insert/manage new view or anything in xib due to this line. Does anybody know how to hide these?</p>
<storyboard><xib><xcode7.2>
2016-02-22 12:20:22
HQ
35,553,652
Using moment.js to get number of days in current month
<p>How would one use moment.js to get the number of days in the current month? Preferably without temporary variables.</p>
<javascript><momentjs>
2016-02-22 12:26:27
HQ
35,554,031
How to create customize plot (Figure) in MATLAB?
<p>I want to create plots based on similar values as attached below.</p> <p><a href="https://i.stack.imgur.com/Y2bQw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y2bQw.jpg" alt="Table"></a></p> <p>The figure should look like as shown below. Here, whenever the weight is 1, the index value should be in color, or bold fonts. </p> <p>Though I am good in plotting graphs in MATLAB, this seems quite tricky.</p> <p>How to do this, a little hint will serve the purpose.</p> <p><a href="https://i.stack.imgur.com/LCpdA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LCpdA.jpg" alt="enter image description here"></a></p>
<matlab>
2016-02-22 12:43:38
LQ_CLOSE
35,554,380
OkHTTPClient Proxy authentication how to?
<p><strong>Question:</strong> How do I add a authorization proxy to OkHTTP.</p> <p>I know that OkHTTP's builder <a href="http://square.github.io/okhttp/3.x/okhttp/" rel="noreferrer">does support proxies</a> although I am having a hard time setting one up.</p> <pre><code>/** * Given a Url and a base64 encoded password return the contents of a website. * @param urlString * @param password * @return JSON */ public String getURLJson(String urlString, String password) { OkHttpClient client = new OkHttpClient.Builder() .connectTimeout(60, TimeUnit.SECONDS) .writeTimeout(60, TimeUnit.SECONDS) .readTimeout(60, TimeUnit.SECONDS) .build(); Request request = new Request.Builder() .url(urlString) .get() .addHeader("authorization", "Basic " + password) .addHeader("cache-control", "no-cache") .build(); Response response = null; try { response = client.newCall(request).execute(); String string = response.body().string(); response.body().close(); return string; } catch (IOException e) { System.err.println("Failed scraping"); e.printStackTrace(); } return "failed"; } </code></pre> <p>I have the IP / port / username / password. </p> <p>Although I do not know how to turn those into a <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/reflect/Proxy.html" rel="noreferrer"><code>Proxy proxy</code></a> which can then be used in client.SetProxy().</p> <p>It seems overly complicated and I simply can't seem to figure it out. Any help would be appreciated.</p>
<java><proxy><okhttp><okhttp3>
2016-02-22 12:59:14
HQ
35,554,415
In Ansible, how to combine variables from separate files into one array?
<p>In Ansible, in a role, I have vars files like this:</p> <pre><code>vars/ app1.yml app2.yml </code></pre> <p>Each file contains vars specific to an app/website like this:</p> <pre><code>name: app1 git_repo: https://github.com/philgyford/app1.git # ... </code></pre> <p>Ideally, without the task knowing in advance which apps have variable files, I'd like to end up with an array called <code>apps</code> like this:</p> <pre><code>apps: - name: app1 git_repo: https://github.com/philgyford/app1.git # ... - name: app2 git_repo: https://github.com/philgyford/app2.git # ... </code></pre> <p>ie, that combines the variables from the files into one.</p> <p>I know I can load all the variable files like this:</p> <pre><code>- name: Load var files with_fileglob: - ../vars/*.yml include_vars: '{{ item }}' </code></pre> <p>But given each file has identical variable names, it will overwrite each previous set of variables. I can't see a way to load the variables and put them into an <code>apps</code> array.</p> <p>I'm open to rearranging things slightly if it's the only way to make something like this possible.</p>
<ansible>
2016-02-22 13:01:39
HQ
35,555,322
SQL add columns of each record together
<p>To be blunt I don't know SQL however I don't want the answer, I want to work it out myself.</p> <p>Here's the question:</p> <p>Write a SQL query to calculate the number of goals for each team.</p> <p>players</p> <pre><code>id name team_id goals 1 Joel 1 3 2 Ed 2 1 3 Simon 2 4 </code></pre> <p>teams</p> <pre><code>id name 1 New Zealand 2 London </code></pre> <p>What I'm asking for is an arrow to information that will allow me to solve the question.</p> <p>I've tried looking myself but I don't even know the correct terminology to ask the question, googling 'write sql to add fields for each row' just seems to return about adding columns or inserting.</p>
<sql>
2016-02-22 13:47:21
HQ
35,555,601
didSet in Swift has a weird knock-on effect on mutating func
<p>I just learned that mutating func is just a curried func with first parameter as inout, so the code below will work and change <code>firstName</code> to <code>"John"</code></p> <pre><code>struct Person { var firstName = "Matt" mutating func changeName(fn: String) { firstName = fn } } var p = Person() let changer = Person.changeName changer(&amp;p)("John") p.firstName </code></pre> <p>but the odd thing happend when I add property observer to <code>p</code> like below, you can see <code>firstName</code> is still "Matt", why? <a href="https://i.stack.imgur.com/uLchZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/uLchZ.png" alt="enter image description here"></a></p>
<ios><swift>
2016-02-22 14:01:38
HQ
35,556,016
Power BI architecture
<p>I need your help please .I'm working with Power BI but I haven't undestand how it work exactly and what it is,is power BI just a tool of visualisation or it is a whole plateform BI which contain his ETL,Datawarhouse,Olap engine ?can someone explain to me this point and give me an the equivalence of ETL,Datwaehouse ,olap in Power BI and tell me wehere the Data is stored inside it.Thanks</p>
<powerbi>
2016-02-22 14:20:46
LQ_CLOSE
35,556,197
Prevent zooming out in leaflet R-Map?
<p>I made a leaflet map with the leaflet R-package.</p> <p>This is what the result looks like: <a href="https://i.stack.imgur.com/5MGNd.png"><img src="https://i.stack.imgur.com/5MGNd.png" alt="enter image description here"></a></p> <p>I am very happy with it, but when I embed it into a website and scroll down the article with my laptop I often accidentally zoom out of the map which then looks like this:</p> <p><a href="https://i.stack.imgur.com/M9PCV.png"><img src="https://i.stack.imgur.com/M9PCV.png" alt="enter image description here"></a></p> <p>The user have to zoom back in too have a look at the intersteing part of the map which really annoys me. </p> <p>Is there a way to freeze the part of the map like you can zoom in as usual but can't zoom out more than like on the image? I tried setting the View in my code but you still can zoom out so I deleted that part.</p> <pre><code> mymap &lt;- leaflet() %&gt;% addProviderTiles("Esri.WorldGrayCanvas") %&gt;% addPolygons(data = dortmund, fillColor = ~palette(student1$Anteil), ## we want the polygon filled with ## one of the palette-colors ## according to the value in student1$Anteil fillOpacity = 0.6, ## how transparent do you want the polygon to be? color = "darkgrey", ## color of borders between districts weight = 1.5, ## width of borders popup = popup1, ## which popup? group="&lt;span style='color: #7f0000; font-size: 11pt'&gt;&lt;strong&gt;2000&lt;/strong&gt;&lt;/span&gt;")%&gt;% ## which group? ## the group's name has to be the same as later in "baseGroups", where we define ## the groups for the Layerscontrol. Because for this layer I wanted a specific ## color and size, the group name includes some font arguments. ## for the second layer we mix things up a little bit, so you'll see the difference in the map! addPolygons(data = dortmund, fillColor = ~palette(student2$Anteil), fillOpacity = 0.2, color = "white", weight = 2.0, popup = popup2, group="2014")%&gt;% addLayersControl( baseGroups = c("&lt;span style='color: #7f0000; font-size: 11pt'&gt;&lt;strong&gt;2000&lt;/strong&gt;&lt;/span&gt;", ## group 1 "2014" ## group 2 ), options = layersControlOptions(collapsed = FALSE))%&gt;% ## we want our control to be seen right away addLegend(position = 'topleft', ## choose bottomleft, bottomright, topleft or topright colors = c('#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'), labels = c('0%',"","","","","","",'26%'), ## legend labels (only min and max) opacity = 0.6, ##transparency title = "relative&lt;br&gt;amount") ## title of the legend </code></pre> <p>Forgive my bad english skills. If it's important to answer my question, full code's here: <a href="http://journocode.com/2016/01/28/your-first-choropleth-map/">http://journocode.com/2016/01/28/your-first-choropleth-map/</a>. </p> <p>Thank you very much</p>
<r><zoom><leaflet>
2016-02-22 14:29:43
HQ
35,556,555
how to find edge from data in excel
If I have this data : 'data for id_books that user_id borrowed user_id id_book book 1 55 physic 2 55 physic 2 55 physic 3 55 physic 4 55 physic this is the output is show me the users that borrowed the same book from library : ' nodes(user_id): edges(relation between user_id) source,target 1 1,2 2 1,3 3 1,4 4 2,3 2,4 2,3 2,4 ' is that correct to show me 1,2 just once?
<excel><vba><graph><gephi>
2016-02-22 14:45:56
LQ_EDIT
35,556,649
How can I let the gitlab-ci-runner DinD image cache intermediate images?
<p>I have a Dockerfile that starts with installing the texlive-full package, which is huge and takes a long time. If I <code>docker build</code> it locally, the intermedate image created after installation is cached, and subsequent builds are fast.</p> <p>However, if I push to my own GitLab install and the GitLab-CI build runner starts, this always seems to start from scratch, redownloading the <code>FROM</code> image, and doing the apt-get install again. This seems like a huge waste to me, so I'm trying to figure out how to get the GitLab DinD image to cache the intermediate images between builds, without luck so far.</p> <p>I have tried using the <code>--cache-dir</code> and <code>--docker-cache-dir</code> for the <code>gitlab-runner register</code> command, to no avail.</p> <p>Is this even something the gitlab-runner DinD image is supposed to be able to do?</p> <p>My <code>.gitlab-ci.yml</code>:</p> <pre><code>build_job: script: - docker build --tag=example/foo . </code></pre> <p>My <code>Dockerfile</code>:</p> <pre><code>FROM php:5.6-fpm MAINTAINER Roel Harbers &lt;roel.harbers@example.com&gt; RUN apt-get update &amp;&amp; apt-get install -qq -y --fix-missing --no-install-recommends texlive-full RUN echo Do other stuff that has to be done every build. </code></pre> <p>I use GitLab CE 8.4.0 and gitlab/gitlab-runner:latest as runner, started as</p> <pre><code>docker run -d --name gitlab-runner --restart always \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /usr/local/gitlab-ci-runner/config:/etc/gitlab-runner \ gitlab/gitlab-runner:latest \ ; \ </code></pre> <p>The runner is registered using:</p> <pre><code>docker exec -it gitlab-runner gitlab-runner register \ --name foo.example.com \ --url https://gitlab.example.com/ci \ --cache-dir /cache/build/ \ --executor docker \ --docker-image gitlab/dind:latest \ --docker-privileged \ --docker-disable-cache false \ --docker-cache-dir /cache/docker/ \ ; \ </code></pre> <p>This creates the following <code>config.toml</code>:</p> <pre><code>concurrent = 1 [[runners]] name = "foo.example.com" url = "https://gitlab.example.com/ci" token = "foobarsldkflkdsjfkldsj" tls-ca-file = "" executor = "docker" cache_dir = "/cache/build/" [runners.docker] image = "gitlab/dind:latest" privileged = true disable_cache = false volumes = ["/cache"] cache_dir = "/cache/docker/" </code></pre> <p>(I have experimented with different values for <code>cache_dir</code>, <code>docker_cache_dir</code> and <code>disable_cache</code>, all with the same result: no caching whatsoever)</p>
<docker><gitlab><gitlab-ci><gitlab-ci-runner>
2016-02-22 14:51:09
HQ
35,556,850
How can I do a Swift for-in loop with a step?
<p>With the <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0007-remove-c-style-for-loops.md">removal of the traditional C-style for-loop in Swift 3.0</a>, how can I do the following?</p> <pre><code>for (i = 1; i &lt; max; i+=2) { // Do something } </code></pre> <p>In Python, the for-in control flow statement has an optional step value:</p> <pre><code>for i in range(1, max, 2): # Do something </code></pre> <p>But the Swift range operator appears to have no equivalent:</p> <pre><code>for i in 1..&lt;max { // Do something } </code></pre>
<swift>
2016-02-22 15:00:02
HQ