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
39,576,113
IOS-Charts set maximum visible x axis values
<p>I'm using ios-charts (<a href="https://github.com/danielgindi/Charts" rel="noreferrer">https://github.com/danielgindi/Charts</a>). I have a LineChartView with 12 values in the x axis. This however is far too many to see at the same time, so I want to display only 5 and then let the user drag to the right to see the next.</p> <p><a href="https://i.stack.imgur.com/0GzqD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0GzqD.png" alt="enter image description here"></a></p> <p>I've tried this:</p> <pre><code> let chart = LineChartView() chart.dragEnabled = true chart.setVisibleXRangeMaximum(5) let xAxis = chart.xAxis xAxis.axisMinValue = 0 xAxis.axisMaxValue = 5.0 xAxis.setLabelsToSkip(0) </code></pre> <p>But still see all 11 values at the time. How can I only see 5?</p>
<swift><charts><ios-charts>
2016-09-19 14:51:01
HQ
39,576,170
proper way to run kotlin application from gradle task
<p>I've got simple script</p> <pre><code>package com.lapots.game.journey.ims.example fun main(args: Array&lt;String&gt;) { println("Hello, world!") } </code></pre> <p>And here is <code>gradle</code> task </p> <pre><code>task runExample(type: JavaExec) { main ='com.lapots.game.journey.ims.example.Example' classpath = sourceSets.main.runtimeClasspath } </code></pre> <p>But when I try to run task <code>gradle runExample</code> I get error</p> <p><code>Error: Could not find or load main class com.lapots.game.journey.ims.example.Example</code></p> <p>What is the proper way to run application?</p>
<gradle><kotlin>
2016-09-19 14:53:26
HQ
39,576,689
C++ virtual destructor definitions
<p>I have three classes</p> <pre><code>class A { // pure virtual funcs and member vars virtual ~A(); } class B : public A { // some more pure virtual funcs virtual ~B(); } class C : public B { // concrete implementations ~C() {} } </code></pre> <p>Presently this doesn't compile with an 'undefined reference to `typeinfo' error (~B() is not defined, easily fixable) however I'm wondering if just defining 'virtual ~B {}' is the correct thing to do or whether ~C should be virtual and defined so calls to ~B are dispatched to ~C?</p>
<c++><inheritance><virtual-destructor>
2016-09-19 15:19:13
LQ_CLOSE
39,576,845
How to create a map with zipcode dataset? ( US Zipcode )
<blockquote> <p>How to create a map in R with zipcode dataset?</p> </blockquote> <p><code>data &lt;- c("22313","10100","25001")</code> [example zipcode]</p> <p><strong><em>In this moment, I have a dataset full of zipcode and I would like to print in a map and save it in pdf.</em></strong></p> <p><strong><em>Best regards,</em></strong></p> <p><strong><em>E.P.</em></strong></p>
<r><maps><pdf-generation><zipcode>
2016-09-19 15:29:29
LQ_CLOSE
39,577,044
Select children link with jquery
<p>How should select the link <code>&lt;a&gt;</code> in this structure with jquery</p> <pre><code>&lt;span id="guiaAtencion:ot4"&gt; &lt;p&gt; &lt;a href="http://www.apps.com"&gt;link&lt;/a&gt; &lt;/p&gt; &lt;/span&gt; </code></pre>
<jquery><html><hyperlink><jquery-selectors>
2016-09-19 15:40:53
LQ_CLOSE
39,577,070
Initialize Javascript Select2 controler using HTML5 data-* attributes
i'm trying to manage [select2 library][1] in order to augment the capabilties of natives select html controls. According to the official documentation (very compressed) it says that for using select2 you only need to download they css and javascript files and that is (and also, implicity assumed, that you need Jquery). So, there is a way of initizaliting select using [HTML5 data attributes][2]... but i am not getting it, i'm trying to follow their example.... perpahs i am missing some important note here... hope anyone can help me on this. Here is the HTML i am trying to do <!DOCTYPE html> <html> <head> <script src="https://code.jquery.com/jquery-3.1.0.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css" rel="stylesheet" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js"></script> </head> <body> <h1>Hello Select2</h1> <div> <select multiple id="a_select" data-tags="true" data-placeholder="Select an option" data-allow-clear="true" style="width:100%"> <option value="AL">Alabama</option> <option value="WY">Wyoming</option> </select> </div> </body> </html> Also a link to plunker, to have a live example ready to go. https://plnkr.co/edit/Xk101K3sowAYQwbRCFez?p=preview Thanks. P.D: I can archieve the desired result thought javascript, but is quite annoying to don't know what is not working when i just followed the example on the oficial site. [1]: https://select2.github.io/ [2]: https://select2.github.io/options.html#data-attributes
<javascript><html><jquery-select2>
2016-09-19 15:42:54
LQ_EDIT
39,577,189
VueJS: trigger input file from button
<p>I need to build a custom file uploader to upload a image profile but I don't want to use the original design of input file but hide it and show a button only to upload the picture.</p> <p>And I know how to trigger the input file when a different button is clicked with jQuery and with AngularJS but I cannot find the way to do the same with VueJS, do you have any idea?</p> <p>Kind regards!</p>
<vue.js>
2016-09-19 15:50:29
HQ
39,577,562
python - if item in list does not contain "string" add a "string2" to item
in Python I have a list of that sort: list = ["item.1", "https://sdfhkjdsffs/THIS-STRING", "http://fsdhfjsdhfsdf/THIS-STRING", item4/THIS-STRING, item5] how do i go about adding "some string" for each item in list that does NOT contain "THIS-STRING"? Thanks!
<python><list>
2016-09-19 16:10:33
LQ_EDIT
39,578,389
JS Won't Redirect
<p>I have this code that I have made and have been trying to fix it for days. I am trying to make it redirect to whatever the $link variable is set to. All it does is just give me a blank page. Any answers?</p> <pre><code>&lt;?php $l = $_GET['l']; $db = new mysqli('localhost', 'root', 'password', 'link'); $sql = "SELECT * FROM links WHERE new_url='$l'"; $result = $db-&gt;query($sql); if($result-&gt;num_rows &gt; 0) { $row = $result-&gt;fetch_assoc(); $link = $row['website']; $string = $row['new_url']; echo '&lt;script type="text/javascript"&gt;', 'window.location = $link;', '&lt;/script&gt;'; } else { @include('./error.php'); } ?&gt; </code></pre>
<javascript><php><redirect>
2016-09-19 17:00:53
LQ_CLOSE
39,578,903
How can I parse a string of an array into an array?
<pre><code>{scenarios: "[{purchasePrice:11,downPayment:1,term:30,rate:1}]"} </code></pre> <p>That's my object. I want to turn the value of scenarios into the array its trying to be from the string it is. </p> <p>Is there a quick tool so I don't have to hack it together from .splits?</p>
<javascript><arrays><string><request.querystring>
2016-09-19 17:31:31
LQ_CLOSE
39,579,240
Property `_statusBarTintColorLockingControllers` at `UIApplication` keeping ViewController in memory
<p>Using Xcode 8 new memory debugger I found out there was a ViewController in memory that shouldn't be there and the strong reference that was pointing to it was coming from this mysterious <code>_statusBarTintColorLockingControllers</code> array in UIApplication. Does anybody know where it comes from? And more importantly, how to take my VC out of it?</p> <p><a href="https://i.stack.imgur.com/iiF5S.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iiF5S.png" alt="memory debugger"></a></p>
<ios><objective-c><swift><xcode><xcode8>
2016-09-19 17:51:17
HQ
39,580,088
define BOOST_PP_NODE_13(p) BOOST_PP_IIF(p##(13), 13, 14)
<p>boost auto_rec.hpp</p> <p>What does mean p##(13) here: define BOOST_PP_NODE_13(p) BOOST_PP_IIF(p##(13), 13, 14)</p> <p>In what it translates?</p>
<c++><boost><macros>
2016-09-19 18:47:23
LQ_CLOSE
39,580,321
How to fix error: "class, interface, or enum expected" when defining a Map outside of a class?
<p>For my own <code>Logger</code> class I want to define a map to map the priority number back to a meaningful string like follows: </p> <pre><code>static Map&lt;int, String&gt; map = new HashMap&lt;int, String&gt;(); map.put(2, "VERBOSE"); map.put(3, "DEBUG"); map.put(4, "INFO"); map.put(5, "WARN"); map.put(6, "ERROR"); </code></pre> <p>I wonder if there might be a function that does this automatically? But I do now know every function there is. </p> <p>However, I define the lines just before my class definition, and then I get the error: </p> <pre><code>Error:(14, 8) error: class, interface, or enum expected </code></pre> <p>and not sure what it means (maybe I cannot declare variables outside a class?). I also tried to define the map inside the class, but then the <code>put</code> method cannot be resolved. I also notice, that I have not imported a <code>Map</code> module, and AndroidStudio does not seem to require a <code>Map</code> module (i.e. the name 'Map' is not red and underlined). </p> <p>I am very confused (as usual); I just want to get a String "ERROR" if the priority-value is 6 and so on. </p> <p>What am I doing wrong in my case...?</p>
<java><android><dictionary>
2016-09-19 19:03:52
LQ_CLOSE
39,581,517
How C# handles workload with using statement?
<p>I am currently cleaning up the code for my project and trying to improve its performance. As a part of improvement, I thought of removing unused "using" statements from all files. I would like to figure out if that would indeed improve the performance, so here is my question.</p> <p>Through the "using" statement, is an external library/resource loaded when <strong>any method from the file is executed</strong> (READ: When file itself is loaded) OR the external library is loaded <strong>only when calling a specific method is actually using this library</strong>?</p>
<c#><using-statement>
2016-09-19 20:24:38
LQ_CLOSE
39,581,893
pandas: find percentile stats of a given column
<p>I have a pandas data frame my_df, where I can find the mean(), median(), mode() of a given column:</p> <pre><code>my_df['field_A'].mean() my_df['field_A'].median() my_df['field_A'].mode() </code></pre> <p>I am wondering is it possible to find more detailed stats such as 90 percentile? Thanks!</p>
<python><python-2.7><pandas><statistics>
2016-09-19 20:50:57
HQ
39,582,318
Export const arrow function or basic function?
<p>Which is better to do: export a <code>const</code> arrow function, like so:</p> <pre><code>export const foo = () =&gt; 'bar' </code></pre> <p>or export a regular function, like so:</p> <pre><code>export function baz() { return 'bar'; } </code></pre> <p>They compile like so:</p> <pre><code>exports.baz = baz; function baz() { return 'bar'; } var foo = exports.foo = function foo() { return 'bar'; }; </code></pre> <p>It looks like using the const/arrow function combination declares an extra variable (<code>foo</code>), which seems to be an unnecessary extra step over the simple function declaration.</p>
<ecmascript-6><babeljs>
2016-09-19 21:21:37
HQ
39,582,951
Angular 2 Set focus on first field of form on component load
<p>In my app I want to automatically set focus on first field of form on component load. Can anyone please guide how to achieve this without any repetition as I want this on every form (Reactive Forms) in my app.</p>
<angular><angular2-template><angular2-directives><angular2-forms>
2016-09-19 22:18:33
HQ
39,582,984
pandas - Merging on string columns not working (bug?)
<p>I'm trying to do a simple merge between two dataframes. These come from two different SQL tables, where the joining keys are strings:</p> <pre><code>&gt;&gt;&gt; df1.col1.dtype dtype('O') &gt;&gt;&gt; df2.col2.dtype dtype('O') </code></pre> <p>I try to merge them using this:</p> <pre><code>&gt;&gt;&gt; merge_res = pd.merge(df1, df2, left_on='col1', right_on='col2') </code></pre> <p>The result of the inner join is empty, which first prompted me that there might not be any entries in the intersection:</p> <pre><code>&gt;&gt;&gt; merge_res.shape (0, 19) </code></pre> <p>But when I try to match a single element, I see this really odd behavior.</p> <pre><code># Pick random element in second dataframe &gt;&gt;&gt; df2.iloc[5,:].col2 '95498208100000' # Manually look for it in the first dataframe &gt;&gt;&gt; df1[df1.col1 == '95498208100000'] 0 rows × 19 columns # Empty, which makes sense given the above merge result # Now look for the same value as an integer &gt;&gt;&gt; df1[df1.col1 == 95498208100000] 1 rows × 19 columns # FINDS THE ELEMENT!?! </code></pre> <p>So, the columns are defined with the 'object' dtype. Searching for them as strings don't yield any results. Searching for them as integers does return a result, and I think this is the reason why the merge doesn't work above..</p> <p>Any ideas what's going on?</p> <p>It's almost as thought Pandas converts <code>df1.col1</code> to an integer just because it can, even though it <em>should</em> be treated as a string while matching. </p> <p>(I tried to replicate this using sample dataframes, but for small examples, I don't see this behavior. Any suggestions on how I can find a more descriptive example would be appreciated as well.)</p>
<python><mysql><pandas><merge>
2016-09-19 22:23:30
HQ
39,583,500
Node.js Server Side applications written in Typescript vs JS (ES5)
<p>Note: By regular js I refer to the <strong>ES5</strong> version of js. </p> <p>I am currently setting up the foundation to a project. The tech stack that I currently have choosen to go with is <strong>Node.js</strong> for the back-end w/ <strong>Angular2</strong> for the front-end/client-side and I am using Gulp as my build tool. In addition I have chosen to use <strong>Typescript</strong> for Angular. </p> <p>I have already set up the gulpfile to do everything necessary for an optimal Typescript build. In fact the way I set everything up gulp can handle all the Typescript in the application, which led me to the realization it might be useful to write the whole application in Typescript vs regular (Node.js - Server) js. Although, when looking for pros and cons of doing so I have been unable to find any real references and instances where people recommend doing so or if it is better to just write the server side of the application without utilizing TS.</p> <p><strong>In short my question</strong>: Is it optimal to write the back and front end utilizing the Javascript superset Typescript? Are there any real Pros or Cons? I would appreciate any 'real' experiences. For example if there where any hurdles/workarounds that occurred or what made TS in server and client optimal in your case?</p> <p>Thank you in advance, have a great day!</p>
<javascript><angularjs><node.js><angular><typescript>
2016-09-19 23:21:57
LQ_CLOSE
39,584,061
Is it safe to iterate a dereferenced vector?
<pre><code>std::vector&lt;int&gt;* someVector; // Initialize vector here and add elements //**** // Now loop vector after initializing it for (int val : *someVector) { doSomething(val); } </code></pre> <p>In the above example, is it safe to iterate a vector like that?</p>
<c++><c++11>
2016-09-20 00:41:39
LQ_CLOSE
39,584,258
My program crashes when i rotate my phone.
Im building a simple app, when the program starts the text blink and the song is played. when i rotate my phone it should change the landscape and restart the song. Im able to do the first part but it crashes when i change the landscape. It works if i remove the onPause method but when i do that music keeps on playing in the background and it also starts from the beginning. There is two songs playing at the same time import android.media.MediaPlayer; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; public class MainActivity extends AppCompatActivity { MediaPlayer ourSong; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ourSong = MediaPlayer.create(this,R.raw.fixyou); ourSong.start(); blinkText(); } @Override protected void onPause(){ super.onPause(); ourSong.release(); finish(); } private void blinkText() { // TODO Auto-generated method stub final Handler handler = new Handler(); new Thread(new Runnable() { @Override public void run() { int timeToBlink = 500; //in ms try{ Thread.sleep(timeToBlink); }catch (Exception e) { } handler.post(new Runnable() { @Override public void run() { TextView txt = (TextView) findViewById(R.id.tv); if(txt.getVisibility() == View.VISIBLE){ txt.setVisibility(View.INVISIBLE); }else{ txt.setVisibility(View.VISIBLE); } blinkText(); } }); }}).start(); } }
<java><android><media-player>
2016-09-20 01:09:07
LQ_EDIT
39,584,707
NSLog on devices in iOS 10 / Xcode 8 seems to truncate? Why?
<p>Why the console output shows incomplete in Xcode 8 / iOS 10?</p> <p><a href="https://i.stack.imgur.com/2s0Uj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2s0Uj.png" alt="enter image description here"></a></p>
<ios><objective-c><xcode><ios10><xcode8>
2016-09-20 02:12:43
HQ
39,584,913
Can't access open cart Admin from iphone
<p>I have installed opencart on my server and everything seems to be working fine except for the fact that I can't access the admin dashboard through my iphone. It works fine on my PC, on a Mac, and on an android Phone like a Galaxy note 4.</p> <p>I can't seem to find any information on this. It doesn't generate any errors. the only thing it does is reload the admin sign in screen. If the password is incorrect it displays the error message but if the username and password are correct it doesn't go in.</p> <p>Any ideas as to what might be happening?</p>
<iphone><opencart>
2016-09-20 02:42:51
HQ
39,585,130
CPP - End While loop for character substitution
This is taken out from Keyshanc Encryption Algorithm. https://github.com/Networc/keyshanc My question is: How can I possibly manipulate this main method for having multiple encryption outputs with the keys chosen from the password array? I am not able to break out of the encoding loop right at the end. int main() { string password[]={"JaneAusten","MarkTwain","CharlesDickens","ArthurConanDoyle"}; for(int i=0;i<4;++i) { char keys[95]; keyshanc(keys, password[i]); char inputChar, trueChar=NULL; cout << "Enter characters to test the encoding; enter # to quit:\n"; cin>>inputChar; for (int x=0; x < 95; ++x) { if (keys[x] == inputChar) { trueChar = char(x+32); break; } } while (inputChar != '#') { cout<<trueChar; cin>>inputChar; for (int x=0; x < 95; ++x) { if (keys[x] == inputChar) { trueChar = char(x+32); break; } } } return 0; }
<c++><for-loop><encryption>
2016-09-20 03:10:56
LQ_EDIT
39,585,311
Parsing in Java
<p>I have a few, theoretical ideas, but I don't know the language well. We basically need to make a rudimentary lexical analyzer. I have most of the bits, but here's the context. The straight-forward question is at the end.</p> <p>I need to read in a line from the console, then see if parts match up with a symbol table, which includes the keywords: <code>"print [variable]"</code>, <code>"load [variable]"</code>, <code>"mem [variable]"</code>, <code>"sqrt"</code> and <code>"stop"</code>, as well as mathematical symbols.</p> <p>It also needs to recognise the variables on their own (such as <code>"c = a + b"</code> as well.)</p> <p>So...it's not that hard, in theory. You'd check the first character of the string matched up with keywords or variables. If they do, keep looping through that keyword or variable to check if it's the same string, up until you hit a space.</p> <p>To summarize: How do I check the characters of a read in string to compare to stuff in Java? </p>
<java>
2016-09-20 03:35:15
LQ_CLOSE
39,585,342
Node, when I run package.json `bin` `command` , give me `syntax error near unexpected token `(' `
<p>when I run package.json <code>bin</code> <code>command</code> , give me <code>syntax error near unexpected token</code>(' ` .</p> <p><code>package.json</code>:</p> <pre><code> "bin": { "grabfilenames": "./index.js" } </code></pre> <p><code>npm link</code>:</p> <pre><code>/usr/local/bin/grabfilenames -&gt; /usr/local/lib/node_modules/grabfilename/index.js /usr/local/lib/node_modules/grabfilename -&gt; /Users/dulin/workspace/grabfilename </code></pre> <p>when I run my <code>cli</code>:</p> <p><code>grabfilenames -p /Users/dulin/workspace/learn-jquery</code></p> <p>give me an error: </p> <pre><code>/usr/local/bin/grabfilenames: line 1: syntax error near unexpected token `(' /usr/local/bin/grabfilenames: line 1: `const fs = require('fs');' </code></pre> <p>How to solve it? Thanks!</p>
<node.js>
2016-09-20 03:40:03
HQ
39,586,104
change password user laravel 5.3
<p>I want to create form with 3 field (old_password, new_password, confirm_password) with laravel 5.</p> <p><strong>View</strong></p> <p>old password : <code>{!! Form::password('old_password',['class' =&gt; 'form-control']) !!}</code></p> <p>New Password : <code>{!! Form::password('password',['class' =&gt; 'form-control']) !!}</code></p> <p>Confirm New Password : <code>{!! Form::password('verify_password',['class' =&gt; 'form-control']) !!}</code></p> <p><strong>Controller when user register</strong></p> <pre><code>public function postRegister(Request $request) { $rules = [ 'email' =&gt; 'required|email|unique:users', 'confirm_email' =&gt; 'required|same:email', 'password' =&gt; 'required|min:8|regex:/^(?=\S*[a-z])(?=\S*[!@#$&amp;*])(?=\S*[A-Z])(?=\S*[\d])\S*$/', 'verify_password' =&gt; 'required|same:password', ]; $messages = [ 'email.required' =&gt; 'email tidak boleh kosong', 'password.required' =&gt; 'password tidak boleh kosong', 'password.min' =&gt; 'Password harus minimal 8 karakter', 'password.regex' =&gt; 'Format password harus terdiri dari kombinasi huruf besar, angka dan karakter spesial (contoh:!@#$%^&amp;*?&gt;&lt;).', 'verify_password.required' =&gt; 'Verify Password tidak boleh kosong', 'email.email' =&gt; 'Format Email tidak valid', 'email.unique' =&gt; 'Email yang anda masukkan telah digunakan', 'verify_password.same' =&gt; 'Password tidak sama!', ]; $this-&gt;validate($request,$rules,$messages); $newUser = $this-&gt;user-&gt;create([ 'email' =&gt; $request-&gt;email, 'password' =&gt; \Hash::make($request-&gt;password), ]); $this-&gt;activationService-&gt;sendActivationMail($newUser); return redirect('/account/login')-&gt;with('success', 'Check your email'); } </code></pre> <p>I'm new in laravel, i've read some similar problem to change password in stackoverflow but it didn't help me.</p> <p>How should I write code in my controller for change password user?. Thanks in Advance.</p>
<php><forms><laravel><laravel-5>
2016-09-20 05:09:19
HQ
39,587,020
Retrireving data fro shared prefrences
I am saving some data in shared prefrences, but when i press back button and again go to profile, the data clears. What can i keep data stored with the help of shared pref package www.edukeen.in.eduaspire; public class Profile extends AppCompatActivity { EditText editTextName, editDOB, editphone, editcity, editclass, editboard, editschool, edithobbies, editachievements; Button buttonSave; public static final String MyPREFERENCES = "MyPrefs" ; public static final String Name = "nameKey"; public static final String DOB = "DOBKey"; public static final String Phone = "phoneKey"; public static final String City = "cityKey"; public static final String Class = "classKey"; public static final String Board = "boardKey"; public static final String School = "schoolKey"; public static final String Hobbies = "hobbiesKey"; public static final String Achievements = "achievementsKey"; SharedPreferences sharedpreferences; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); editTextName = (EditText) findViewById(R.id.editTextName); editDOB = (EditText) findViewById(R.id.editDOB); editphone = (EditText) findViewById(R.id.editphone); editcity = (EditText) findViewById(R.id.editcity); editclass = (EditText) findViewById(R.id.editclass); editboard = (EditText) findViewById(R.id.editboard); editschool = (EditText) findViewById(R.id.editschool); edithobbies = (EditText) findViewById(R.id.edithobbies); editachievements = (EditText) findViewById(R.id.editachievements); buttonSave=(Button)findViewById(R.id.buttonSave); sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE); buttonSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String Name = editTextName.getText().toString(); String DOB = editDOB.getText().toString(); String Phone = editphone.getText().toString(); String City = editcity.getText().toString(); String Class = editclass.getText().toString(); String Board = editboard.getText().toString(); String School = editschool.getText().toString(); String Hobbies = edithobbies.getText().toString(); String Achievements = editachievements.getText().toString(); SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(Name, Name); editor.putString(DOB, DOB); editor.putString(Phone, Phone); editor.putString(City, City); editor.putString(Class, Class); editor.putString(Board, Board); editor.putString(School, School); editor.putString(Hobbies, Hobbies); editor.putString(Achievements, Achievements); editor.commit(); Toast.makeText(Profile.this,"Data saved",Toast.LENGTH_LONG).show(); } }); } } Also if I want to get this data in my database what should I do, I have already signed in user, using firebase.
<android><database><sharedpreferences>
2016-09-20 06:21:15
LQ_EDIT
39,587,382
how to use phpexcel in yii2
<p>I have a excel file with the extension .xlsx. I need to read this file and save into database. how to do this. I have no idea about this. plese guide me how to do step by step. Im using yii2 basic version.</p>
<php><yii2>
2016-09-20 06:45:03
LQ_CLOSE
39,587,655
What are the errors inside this random walking code?
<p>I am having unexpected outputs with the following code:</p> <pre><code>import random N = 30 # number of steps n = random.random() # generate a random number x = 0 y = 0 z = 0 count = 0 while count &lt;= N: if n &lt; 1/3: x = x + 1 # move east n = random.random() # generate a new random number if n &gt;= 1/3 and n &lt; 2/3: y = y + 1 # move north n = random.random() # generate a new random number if n &gt;= 2/3: z = z + 1 # move up n = random.random() # generate a new random number print("(%d,%d,%d)" % (x,y,z)) count = count + 1 </code></pre> <p>When I run the code, the problem is:</p> <ul> <li>Code output displays 31 coordinates, 1 more than the number of steps (N) variable.</li> <li>Each iteration for 1 step should take only 1 step but it sometimes take multiple steps.</li> </ul> <p>When I tested the code, the problem is ensured. To test the code, I assigned N = 1, and saw the following output:</p> <ul> <li><p>(-1,0,1) This should be the initial step, but it took multiple steps (both x-1 and z+1), how could this happen?</p></li> <li><p>(-2,0,1) Number of step variable (N) = 1 but this is the second output, why was it displayed? Thanks for helping</p></li> </ul>
<python><debugging><random-walk>
2016-09-20 07:00:59
LQ_CLOSE
39,588,478
I don't understand this concept. In ruby what do you mean when you say multi line comment using this symbol <<?
I don't understand this concept. In ruby what do you mean when you say multi line comment using this symbol << ?
<ruby><multilinestring>
2016-09-20 07:48:07
LQ_EDIT
39,589,638
How to transfer selected text from input textbox to textarea box?
I have no idea how to transfer text from each input textbox to text area line by line in JavaScript. Please help me! I'm beginner to programming and this is my first question :) [form design click here][1] [1]: http://i.stack.imgur.com/oKv5p.png
<javascript>
2016-09-20 08:51:20
LQ_EDIT
39,589,830
I need help on script which will find particular value from one file and replace it in another file( very urgent)
I have 2 files. (file ABC and file XYZ). Few contents of ABC: X_deb: step # : 9 X_deb: in : 4'b0000 X_deb: out : 4'b1110 X_deb: load (4 , 4'b1010) X_deb: MK : 4'b1111 X_deb: step # : 10 X_deb: in : 4'b0100 X_deb: out : 4'b1001 X_deb: load (4 , 4'b1100) X_deb: step # : 11 X_deb: in : 4'b0001 X_deb: out : 4'b1100 X_deb: load (4 , 4'b1011) X_deb: MK : 4'b1110 ------------------------------ Contents of file XYZ: X_step_9 4 4'b1010 ( 4'b1110) X_step_10 4 4'b1100 (4'b1001) X_step_11 4'b1011 (4'b1100) ------------- Format syntax of file XYZ X_step_# <load value for the step from ABC file> (if MK is present for the step then mk value for the step otherwise out value for that step from ABC file. ) .. But whatever scripts I am using, it is having some issues and not able to grep MK value for the step and put it in XYZ file instead of that it is putting "out" value for all the steps. And unfortunately I deleted that script. NOTE: in ABC file, not all steps have MK value.(in above example only step 9 and 11 have MK value). Now I need to create one generic script for all the steps (in any language) which can do below things:( there are many steps, not only 9,10,11) -it will grep MK value for particular step from ABC file. -after that it will grep for that step in XYZ file (X_step_#) and replace "out" value with MK value. . For example :. Script will find MK value for step 9 from ABC and then it will search for X_step_9 in XYZ file and replace "out" value with MK value. Someone please help me on this. It is very very critical and urgent.
<regex><perl><shell><sed><tcl>
2016-09-20 09:00:21
LQ_EDIT
39,589,841
Configuration `locale` variable is deprecated - Android
<p>I use this code to set the default language manually in multiple languages app:</p> <pre><code>public static void setLanguage(Context context, String languageCode){ Locale locale = new Locale(languageCode); Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; // Deprecated !! context.getApplicationContext().getResources().updateConfiguration(config, context.getResources().getDisplayMetrics()); } </code></pre> <p>so now we cant set locale by config.locale is deprecated because the variable is going to be removed in API 24.</p> <p>So i saw that the alternative is to set:</p> <p>config.setLocales();</p> <p>locale</p> <blockquote> <p>Added in API level 1 </p> <p><strong>Locale</strong> locale</p> <p>This field was deprecated in API level 24. Do not set or read this directly. Use getLocales() and setLocales(LocaleList). If only the primary locale is needed, getLocales().get(0) is now the preferred accessor.</p> <p>Current user preference for the locale, corresponding to locale resource qualifier.</p> </blockquote> <p>I noticed also that there is <code>setLocale(Locale)</code> as well but for api 17 and above</p> <p>I checked the setLocales(LocalList) documentation and it is marked in grey as if it is also deprecated !</p> <p>so what can be solution for this !?</p>
<android>
2016-09-20 09:00:56
HQ
39,590,187
In requirements.txt, what does tilde equals (~=) mean?
<p>In the <code>requirements.txt</code> for a Python library I am using, one of the requirements is specified like:</p> <pre><code>mock-django~=0.6.10 </code></pre> <p>What does <code>~=</code> mean?</p>
<python><requirements.txt>
2016-09-20 09:18:05
HQ
39,590,256
Xamarin.IOS Error - Can not resolve reference: C:/Program Files (x86)/../Xamarin.iOS/v1.0/Facades/System.Private.CoreLib.InteropServices.dll
<p>I working on Cross-platform PCL Xamarin Forms (Android,IOS) Project.</p> <p>I am using Visual Studio 2015 and Window 10 OS to make xamarin project. I have installed Xamarin studio in MAC PC to run IOS project.</p> <p>My IOS and android project was successfully running but when I update the Xamarin studio in MAC PC it started giving error in ios project:</p> <p><strong>Can not resolve reference: C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/Xamarin.iOS/v1.0/Facades/System.Private.CoreLib.InteropServices.dll</strong> </p> <p>Please suggest me what to do to solve this error.</p> <p>Thanks in advance</p>
<android><ios><xamarin.ios>
2016-09-20 09:21:01
HQ
39,590,309
Error inflating class for NavigationView
java.lang.RuntimeException Unable to start activity ComponentInfo, android.view.InflateException: Binary XML file line #17: Error inflating class android.support.design.widget.NavigationView
<android><android-layout><android-navigationview>
2016-09-20 09:22:51
LQ_EDIT
39,591,277
react, differences between component create with extend class and simple const = function
<p>In react tutorial:</p> <p><a href="https://egghead.io/lessons/javascript-redux-react-todo-list-example-filtering-todos" rel="noreferrer">https://egghead.io/lessons/javascript-redux-react-todo-list-example-filtering-todos</a></p> <p>there is main component create with extends:</p> <pre><code>class TodoApp extends Component { render() { const visibleTodos = getVisibleTodos( this.props.todos, this.props.visibilityFilter ); . . // Input and Button stuff . </code></pre> <p>and another components just create like a const that hold a function:</p> <pre><code>const FilterLink = ({ filter, children }) =&gt; { return ( &lt;a href='#' onClick={e =&gt; { e.preventDefault(); store.dispatch({ type: 'SET_VISIBILITY_FILTER', filter }); }} &gt; {children} &lt;/a&gt; ) } </code></pre> <p>the difference i see, first created with class use a render function, and the another a return function to send back the template.</p> <p>What are the differences? I've heard components in the future only will be allowed with extend Component ?</p>
<reactjs>
2016-09-20 10:06:24
HQ
39,591,740
html center align the button on media screen
i want to align the button horizontally in same line which is divided in columns in blue color called "Läs mer" in media screen. following is the link http://www.visbyhemtjanst.se/ i added the following media query: @media only screen and (max-width: 1450px) { .home-page-content{ min-height: 260px; } } when i reduce the screen button doesn't align in same line what needs to add more in media query.
<html><css>
2016-09-20 10:27:05
LQ_EDIT
39,592,440
Regular Expression specific to a particular message pattern
As I'm pretty new to Regular Expression, I'm looking for a regular expression which will validate whether entire string is separated by '|' and there will be values with '$' followed by an integer. Valid Values: ABC=$2|CDE=$1|Msg=$4|Ph.No=$3|TIME=$5 ABC=$2|CDE=$1|Msg123=$4|Ph.No=$3|TIME_23=$5 abc=$2|123=$1|cfg=$4|Ph.No=$3 Invalid Values: ABC=$2CDE=$1Msg=$4 ABC=2|CDE=1|Msg123=$4|Ph.No=$3|TIME_23=$5 abc$2|123$1|cfg$4|Ph.No=$3 Msg123=$ |Ph.No=$ |TIME_23=5 abcdefgh|1234|eghjik Msg123=$*|Ph.No=$()|TIME_23=$5 Msg123=$a|Ph.No=$b|TIME_23=$c
<regex><regex-greedy>
2016-09-20 11:05:34
LQ_EDIT
39,592,474
Add all items in model class
I need to add all items in the arraylist **Logcat:** E/BUSINESS_STR: fuflfilled E/itemsaArrayList: [com.model.CommonListItems@307c24ff, com.model.CommonListItems@307c24ff] **Code:** if(BUSINESS_STR != null){ Log.e("BUSINESS_STR", "" + BUSINESS_STR); CommonListItems commonListItems = new CommonListItems(); for(int i = 0; i <= 1 ; i++) { commonListItems.setName("My Business"); commonListItems.setName("Search Business"); commonListItems.setImage(String.valueOf(R.drawable.business_icon)); commonListItems.setImage(String.valueOf(R.drawable.search_business_icon)); itemsaArrayList.add(commonListItems); } tvTitle.setText("Business"); } Finally it is adding the last item Search Business twice.I need to add My business first and then search business.
<java><android>
2016-09-20 11:07:19
LQ_EDIT
39,593,392
How to find if users exist in firebase
I am using Firebase web sdk, and know methods to check wether a child in a collection exists or not. However I can't find a concise example checking the existance of an user, without trying to sign him/her in. Do you have any piece of code we could reuse?
<reactjs><firebase><react-native><firebase-realtime-database><firebase-authentication>
2016-09-20 11:54:22
LQ_EDIT
39,593,489
Getting Error when installing app from Googl play store
Running app from Android studio on my device for testing working fine. But when i am trying to install same app from google plays store which is published under beta version getting error. I have uninstalling unsigned apk from the device but still not able to install from google play. Even cleared phone cache same result. Please help me out . Find attached Screen shot. [enter image description here][1] [1]: http://i.stack.imgur.com/Fepad.jpg
<android><google-play>
2016-09-20 11:58:56
LQ_EDIT
39,594,063
sql query taking so much time, need optimization
SELECT LM.user_id,LM.users_lineup_id, min( LM.total_score ) AS total_score FROM vi_lineup_master LM JOIN vi_contest AS C ON C.contest_unique_id=LM.contest_unique_id join ( SELECT min( total_score ) as total_score FROM vi_lineup_master GROUP BY group_unique_id ) as preq ON LM.total_score = preq.total_score WHERE LM.contest_unique_id = 'iledhSBDO' AND C.league_contest_type=1 GROUP BY group_unique_id Above query is to find the loser per group of game, query return accurate result but its not responding with large data.Needed optimization please share your solution. Thanks in advance.
<mysql><sql>
2016-09-20 12:26:06
LQ_EDIT
39,594,157
Using Javacode to get the actual name of the Program that is top
<p>I am currently writing a Java Application, that needs to filter the name of the Program whichs UI is front. Sorry for my bad english. So let's say the Java App is running in Background and I open Windows -> Games -> Minesweeper then i want the App to only tell me "Active: Minesweeper". Without any additional information. Just the name "Minesweeper"</p> <p>I already tried using JavaNativeAccess but I'm still unfamiliar with it.</p> <p>Thanks you all in advance</p>
<java><windows><java-native-interface><jna>
2016-09-20 12:30:16
LQ_CLOSE
39,594,317
Use a specific minSdkVersion only in a Debug mode
<p>How can I use a specific minSdkVersion only in a debug mode? I want to use the minSdkVersion 21 for debug mode, but minSdkVersion 15 for the release. I don't wanna use flavors for this because will give troubles.</p> <p>I think the could be like this (but don't work):</p> <pre><code>defaultConfig { applicationId "blacktoad.com.flapprototipo" minSdkVersion 15 debug{ minSdkVersion 21 } targetSdkVersion 23 versionCode 42 versionName "1.72" multiDexEnabled true } </code></pre>
<android><gradle><android-min-sdk>
2016-09-20 12:37:11
HQ
39,594,375
-[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x7aa78d20
I got Json response from server as json array. but if i am accessing element of that array using indexpath.row in didselectrowatindexpath, I am getting error as *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x7aa78d20'
<ios><objective-c>
2016-09-20 12:40:02
LQ_EDIT
39,594,478
Do not have permission to access app while deploying google service account
<p>After creating google service account with permission as shown below - deployment fails with message . I am failing to understand where this is going wrong.</p> <p>====</p> <pre><code>$ gcloud iam service-accounts get-iam-policy cdemail@appid.iam.gserviceaccount.com bindings: - members: - serviceAccount:cdemail@appid.iam.gserviceaccount.com role: roles/owner etag: Bxxxxxxxxg= </code></pre> <p>====</p> <pre><code>$ gcloud auth activate-service-account --key-file ../a.json Activated service account credentials for: [cdemail@appid.iam.gserviceaccount.com] $ gcloud app deploy ERROR: (gcloud.app.deploy) You do not have permission to access app [appid]. </code></pre>
<google-app-engine><deployment><service-accounts>
2016-09-20 12:44:54
HQ
39,594,588
Laravel eloquent multiple WHERE with OR AND OR and LIKE?
<p>I have ( or am trying to make ) this query in Laravel</p> <p>The problem I have is with the <code>$orThose</code><br> I want to query <code>LIKE</code>. </p> <p>The data in that field can be many things, but there will always be a key work like "L3" or "ICU" in the field.</p> <p>Can you do a <code>LIKE</code> query in this case</p> <pre><code>$matchThese = ['link.hos_id' =&gt; $hos_id, 'outcome.otc_otrdischargedate' =&gt; $td]; $orThose = ['outcome.otc_outcome' =&gt; '@ICU@', 'outcome.otc_outcome' =&gt; '@I.C.U@']; $todaysReferrals = DB::table('link') -&gt;join('daily_link', 'link.lnk_id', '=', 'daily_link.dlk_lnkid') -&gt;join('demographic', 'link.lnk_dmgid', '=', 'demographic.dmg_id') -&gt;join('admission', 'link.lnk_admid', '=', 'admission.adm_id') -&gt;join('or_call', 'admission.adm_calid', '=', 'or_call.cal_id') -&gt;join('admission_score', 'admission.adm_scoreid', '=', 'admission_score.ascore_id') -&gt;join('diagnosis', 'link.lnk_dgnid', '=', 'diagnosis.dgn_id') -&gt;join('outcome', 'link.lnk_otcid', '=', 'outcome.otc_id') -&gt;where($matchThese) -&gt;orWhere($orThose) -&gt;get(); </code></pre>
<laravel><eloquent>
2016-09-20 12:49:28
HQ
39,594,665
whay do i get error with edit.php in new modul Vtiger?
Hay I have create a new modul and then i did not have in ther a directory "view", so i copy that directory from other modul and paste that in my modul but then i have problem with "Edit.php". than my page is completey white it dosent wont it load but when i change the name of edit.php than works. can anywhan explan to me what do i need to do to modify my modul or to do something with my problem. thanks in advance !! eidit file <?php Class Products_Edit_View extends Vtiger_Edit_View { public function process(Vtiger_Request $request) { $moduleName = $request->getModule(); $recordId = $request->get('record'); $recordModel = $this->record; if(!$recordModel){ if (!empty($recordId)) { $recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName); } else { $recordModel = Vtiger_Record_Model::getCleanInstance($moduleName); } } $baseCurrenctDetails = $recordModel->getBaseCurrencyDetails(); $viewer = $this->getViewer($request); $viewer->assign('BASE_CURRENCY_NAME', 'curname' . $baseCurrenctDetails['currencyid']); $viewer->assign('BASE_CURRENCY_ID', $baseCurrenctDetails['currencyid']); $viewer->assign('BASE_CURRENCY_SYMBOL', $baseCurrenctDetails['symbol']); $viewer->assign('TAXCLASS_DETAILS', $recordModel->getTaxClassDetails()); $viewer->assign('IMAGE_DETAILS', $recordModel->getImageDetails()); parent::process($request); } /** * Function to get the list of Script models to be included * @param Vtiger_Request $request * @return <Array> - List of Vtiger_JsScript_Model instances */ function getHeaderScripts(Vtiger_Request $request) { $headerScriptInstances = parent::getHeaderScripts($request); $jsFileNames = array( 'libraries.jquery.multiplefileupload.jquery_MultiFile' ); $jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames); $headerScriptInstances = array_merge($headerScriptInstances, $jsScriptInstances); return $headerScriptInstances; } }
<javascript><php><vtiger>
2016-09-20 12:53:03
LQ_EDIT
39,594,855
Xcode 8 return height= 1000 and Width =1000 for UIview (actual size is (328,40))
<p>Since i installed Xcode 8, i am in trouble. I didnt get the correct value for each or any UIView.</p> <p>I also got the constraint alert for UIView. So i update it. But view returns 1000 as width or height. I tried or search a lot. But didnt got any proper solution. pls help me.</p>
<uiview><height><width>
2016-09-20 13:01:31
HQ
39,595,308
Not able to checkboxes for ListViewItems in WPF
I want to display checkboxes alongside text in ListView .And I have multiple ListViews in my WPF window, hence I want to specify this behavior as style in resources.But,the checkboxes are nnot displayed, only text is displayed.So,please, find below my code and suggests edits. <Window.Resources> <Style TargetType="ListView" x:Key="ListViewTemplate"> <Setter Property="Background" Value="Transparent"></Setter> <Setter Property="BorderBrush" Value="Transparent"></Setter> <Setter Property="ItemTemplate"> <Setter.Value> <DataTemplate> <StackPanel Orientation="Horizontal"> <CheckBox IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}" Content=""></CheckBox> <Separator Width="5"></Separator> <TextBlock Text="{Binding Text}"></TextBlock> </StackPanel> </DataTemplate> </Setter.Value> </Setter> </Style> </Window.Resources> <Grid> <ListView Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="8" Grid.RowSpan="5" x:Name="listViewDocTypes" Style="{DynamicResource ListViewTemplate}" > </ListView> </Grid>
<c#><wpf><listview><checkbox>
2016-09-20 13:21:01
LQ_EDIT
39,595,394
Search for a specific value inside a Generic list
<p>The purpose of the below code is to find a specific value within a generic list using List.Find() method . I am pasting a code below : </p> <pre><code>class Program { public static List&lt;Currency&gt; FindItClass = new List&lt;Currency&gt;(); public class Currency { public string Country { get; set; } public string Code { get; set; } } public static void PopulateListWithClass(string country, string code) { Currency currency = new Currency(); currency.Country = country; currency.Code = code; FindItClass.Add(currency); } static void Main(string[] args) { PopulateListWithClass("America (United States of America), Dollars", "USD"); PopulateListWithClass("Germany, Euro", "EUR"); PopulateListWithClass("Switzerland, Francs", "CHF"); PopulateListWithClass("India, Rupees", "INR"); PopulateListWithClass("United Kingdom, Pounds", "GBP"); PopulateListWithClass("Canada, Dollars", "CAD"); PopulateListWithClass("Pakistan, Rupees", "PKR"); PopulateListWithClass("Turkey, New Lira", "TRY"); PopulateListWithClass("Russia, Rubles", "RUB"); PopulateListWithClass("United Arab Emirates, Dirhams", "AED"); Console.Write("Enter an UPPDERCASE 3 character currency code and then enter: "); string searchFor = Console.ReadLine(); Currency result = FindItClass.Find(delegate(Currency cur) { return cur.Code == searchFor; }); Console.WriteLine(); if (result != null) { Console.WriteLine(searchFor + " represents " + result.Country); } else { Console.WriteLine("The currency code you entered was not found."); } Console.ReadLine(); } } </code></pre> <p>My query is why List is static , what is the purpose of using static over there.</p> <pre><code> public static List&lt;Currency&gt; FindItClass = new List&lt;Currency&gt;(); </code></pre> <p>Another query is why a delegate is used over there inside the find method. </p> <pre><code>Currency result = FindItClass.Find(delegate(Currency cur) { return cur.Code == searchFor; }); </code></pre>
<c#><generics><delegates>
2016-09-20 13:24:52
LQ_CLOSE
39,595,441
Android Studio 2.2 Google play services sync Error
<p>I have update to android studio 2.2</p> <p>I started a new project and i included </p> <pre><code>compile 'com.google.android.gms:play-services-vision:9.4.0+' </code></pre> <p>in my dependencies.</p> <p>I am getting this Error when im launching the gradle sync.</p> <p>Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies] Error:com.android.builder.internal.aapt.AaptException: Failed to crunch file D:\Android\cloned apps\android-vision-master\android-vision-master\visionSamples\barcode-reader\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\9.4.0\res\drawable-xhdpi-v4\common_google_signin_btn_text_dark_pressed.9.png into D:\Android\cloned apps\android-vision-master\android-vision-master\visionSamples\barcode-reader\app\build\intermediates\res\merged\debug\drawable-xhdpi-v4\common_google_signin_btn_text_dark_pressed.9.png Error:Execution failed for task ':app:mergeDebugResources'.</p> <blockquote> <p>Error: com.android.builder.internal.aapt.AaptException: Failed to crunch file D:\Android\cloned apps\android-vision-master\android-vision-master\visionSamples\barcode-reader\app\build\intermediates\exploded-aar\com.google.android.gms\play-services-base\9.4.0\res\drawable-xhdpi-v4\common_google_signin_btn_text_dark_pressed.9.png into D:\Android\cloned apps\android-vision-master\android-vision-master\visionSamples\barcode-reader\app\build\intermediates\res\merged\debug\drawable-xhdpi-v4\common_google_signin_btn_text_dark_pressed.9.png Information:BUILD FAILED Information:Total time: 2.132 secs Information:2 errors Information:0 warnings Information:See complete output in console</p> </blockquote>
<android><android-studio><android-gradle-plugin><google-play-services>
2016-09-20 13:26:36
HQ
39,596,519
How to convert a float into int using round method in ms sql?
<p>I tried with </p> <p><code> select ROUND(1235.53)<br> --(It can contain "n" digit of scale)</code></p> <p>But got error</p> <p><strong>The round function requires 2 to 3 arguments. </strong></p> <p>I am not sure what is the use of other parameters. </p>
<sql-server><database>
2016-09-20 14:15:18
HQ
39,596,625
Nested objects in mongoose schemas
<p>i've seen many answers to this question here, but i still don't get it (maybe because they use more "complex" examples)... So what im trying to do is a schema for a "Customer", and it will have two fields that will have nested "subfields", and others that may repeat. here is what i mean:</p> <pre><code>let customerModel = new Schema({ firstName: String, lastName: String, company: String, contactInfo: { tel: [Number], email: [String], address: { city: String, street: String, houseNumber: String } } }); </code></pre> <p><strong>tel</strong> and <strong>email</strong> might be an array. and address will not be repeated, but have some sub fields as you can see.</p> <p>How can i make this work?</p>
<node.js><mongodb><mongoose-schema>
2016-09-20 14:20:31
HQ
39,597,007
How do you enable word-wrap by default in Eclipse?
<p>Simple question: how do you enable word-wrap by default in Eclipse? I looked at <a href="http://dev.cdhq.de/eclipse/word-wrap/" rel="noreferrer">this plugin</a> but it only goes up to Luna. In addition, <a href="https://marketplace.eclipse.org/content/markdown-text-editor" rel="noreferrer">this plugin</a> is a separate text editor and does not have syntax highlighting or validation. I'm open to other suggestions.</p>
<eclipse><ide><text-editor><word-wrap><eclipse-neon>
2016-09-20 14:37:48
HQ
39,597,804
How I can use refs to change styling class in ReactJS?
<p>I'm trying to change background of a <code>div</code> when color value changes. Here is my function which receives color value:</p> <pre><code>ChangeColor(oColor) { this.props.ChangeColor(oColor); console.log("Refs: ", this.refs.colorPicker.className); }, </code></pre> <p>Here is css class</p> <pre><code>.colorPicker { padding-right: 25px; background: #000; display: inline; margin-right: 5px; } </code></pre> <p>and here is my div element whose background needs to update on run-time.</p> <pre><code>&lt;div ref='colorPicker' className={this.GetClass("colorPicker")} /&gt; </code></pre> <p>I'm not sure about refs synatx so please help to fix this issue. Thanks.</p>
<javascript><css><reactjs><css-modules><refs>
2016-09-20 15:14:51
HQ
39,598,030
Alamofire 4.0 RequestRetrier should(_,retry,with,completion) not being called
<p>I am using the <code>RequestRetrier</code> of Alamofire 4.0 to control the retrying of requests for expired access token. I am following the documentation <a href="https://github.com/Alamofire/Alamofire#adapting-and-retrying-requests" rel="noreferrer">here</a>.</p> <p>I have a very similar implementation to the example available in the documentation <code>OAuth2Handler</code> which implements <code>RequestAdapter</code> and <code>RequestRetrier</code>. </p> <p>The issue I am encountering is that <code>func should(_ manager: SessionManager, retry request: Request, with error: Error, completion: @escaping RequestRetryCompletion)</code> is never being called. The <code>adapt</code> method of the <code>RequestAdapter</code> implementation does get called though.</p> <p>Debugging, I see that <code>SessionDelegate</code> only calls <code>should(_,retry,with,completion)</code> when there is an error, but requests that return status codes related to Authorization issues, don't seem to generate errors, so that method never gets called.</p> <p>Am I missing something here?</p>
<ios><swift><alamofire>
2016-09-20 15:24:26
HQ
39,598,346
Differences between Flash and HTML5
<p>Since Youtube has dropped flash for HTML5, what exactly are the qualities/utilities that HTML5 possesses that makes it different than flash? </p> <p>Also, I wish to know something more interesting(conceptually/technically) about the same (apart from what the normal google search is showing).</p>
<html><flash><adobe>
2016-09-20 15:38:39
LQ_CLOSE
39,598,359
how to get values from string
I have a huge string, that is devided to two parts that looks like this: {\"Query\":\"blabla"","\"Subject\":\"gagaga"}"," {\"Query\":\"lalala\"","\"Subject\":\"rarara\"}"," and so on... (thousends of lines) I need that in the end I will have a var that holds these values- data= "blabla,gagaga","lalala,rarara",.... tryied to do this like this- not working var contentss = JSON.stringify(allFileGenesDetails1); data=""; var Query1=""; var Subject1=""; // Parse the data var contentEachLines = contentss.split("\n"); for (var jj = 0; jj < contentEachLines.length; jj++) { var lineContent = contentEachLines[jj].split("\t"); var divided = lineContent[jj].split(","); Query1= Query1+ [divided[0]]; Query1 = Query1.replace(/Query|:|{|"|\|/gi, ""); Subject1=Subject1+ divided[1]; Subject1 = Subject1.replace(/Subject|:|{|"|\|/gi, ""); data=data+"'"+ Query1+","+Subject1 +" ' " +"," ;
<javascript><string>
2016-09-20 15:39:26
LQ_EDIT
39,598,440
Android Studio pref Editor.putString identifier expected
<p>Getting a - cannot resolve symbol "putString" "putInt" "commit" - in the code below.Help please.</p> <pre><code> public class Alpha extends Activity { public static final String GAME_PREFERENCES = "GamePrefs"; SharedPreferences settings =getSharedPreferences(GAME_PREFERENCES,MODE_PRIVATE); SharedPreferences.Editor prefEditor = settings.edit(); prefEditor.putString("Gama x","Blue Spec"); prefEditor.putInt("Wave",292); prefEditor.commit(); } </code></pre>
<java><android><android-studio><sharedpreferences>
2016-09-20 15:43:16
LQ_CLOSE
39,598,645
Count all amount from object in a List
<p>I have this Java object stored in a List:</p> <pre><code>public class ExpressCheckout { String currency; float amount; int quantity; String name; String description; ....... } </code></pre> <p>How I can count all amount value into List from every Object?</p>
<java>
2016-09-20 15:52:13
LQ_CLOSE
39,599,177
Print everything in column of file bash
<p>My file looks like this </p> <pre><code>ID Done Have ETA Up Down Ratio Status Name 2 100% 858.1 MB Done 56.0 0.0 1.2 Seeding lubuntu-16.04.1-desktop-i386.iso </code></pre> <p>What I need to do is write a grep/awk string that will give me everything under the last column "Name"</p> <p>Any ideas?</p>
<linux><bash><ubuntu><awk><grep>
2016-09-20 16:19:14
LQ_CLOSE
39,599,374
Plotting data R
<p>I have a simple tasks I would like to do. Using an RODBC connection I have connected R to a SQL server database. There are four tables in the database and they are tenors of Libor rates</p> <pre><code>Libor_1_mos Libor_3_mos Libor_6_mos Libor_12_mos </code></pre> <p>Each table has two columns. The first column shows dates and the second column shows rates. </p> <p>I would like a simple chart that plots the rates based on the dates in column 1. Straightforward - that is all that needs to be done. The x-axis should be dates (column 1) and the y axis should be rates (column 2). Note it is 5 years worth of data so showing every possible date on the x-axis may not be feasible. </p> <p>Here is my work so far I am using the Libor_3_mos as an example</p> <pre><code>threemosdata &lt;- sqlQuery(con,"select * from Libor_3_mos) </code></pre> <p>Using that line I can read the data from the table. So for instance </p> <pre><code>colnames(threemosdata) </code></pre> <p>will give me the names of the column in the table.</p>
<sql><r><plot><rodbc>
2016-09-20 16:29:38
LQ_CLOSE
39,600,082
One activity and one layout with different content
This might be an example of how I want it : Click on one of these items in the list view : http://imgur.com/a/bhWhR And get content (content differs based on click on list view) in an activity (same layout) : http://imgur.com/a/agGma I did explore for quite some time and I could not find any solution that helped me .
<android><android-layout>
2016-09-20 17:12:05
LQ_EDIT
39,600,504
Appending lists according to a per of lists (IndexError: list index out of range)
I have these lists: n_crit = [[1, 2, 3, 4, 5, 6], [1, 1, 1, 1, 1, 1], [-1, 1, -1, -1, -1, 1], [2, 3, 5, 4, 1, 6], [10, 0, 0.5, 1, 0, 0], [0, 30, 5, 6, 0, 0], [0, 0, 0, 0, 0, 5]] crit = [[80, 90, 6, 5.4, 8, 5], [65, 58, 2, 9.7, 1, 1], [83, 60, 4, 7.2, 4, 7], [40, 80, 10, 7.5, 7, 10], [52, 72, 6, 2, 3, 8], [94, 96, 7, 3.6, 5, 6]] and i have these code: DivMatrix = [] for x in range(len(crit)): subList1 = [] for y in range(len(crit[x])): subList2 = [] if (n_crit[2][x]>0): for z in range(len(crit[x])): subList2.append(crit[y][x] - crit[z][x]) elif (n_crit[2][x]<0): for z in range(len(crit[x])): subList2.append(-(crit[y][x] - crit[z][x])) subList1.append(subList2) DivMatrix.append(subList1) Now i want to use the same code for another per of lists that are: n_crit = [[1, 2, 3, 4, 5], [0.23, 0.15, 0.15, 0.215, 0.255], [-1, -1, 1, 1, 1], [2, 6, 5, 4, 1], [4000, 0, 20, 0, 0], [0, 0, 40, 2, 0], [0, 1.5, 0, 0, 0]] crit = [[15000, 7, 60, 3, 3], [27000, 9, 120, 7, 7], [19000, 8.5, 90, 4, 5], [36000, 10, 140, 8, 7]] But instead i get this error message: subList2.append(-(crit[y][x] - crit[z][x])) IndexError: list index out of range I really dont know what is wrong but i want to use this code for any per of lists i want.
<python><list><for-loop><append>
2016-09-20 17:40:48
LQ_EDIT
39,600,939
Invalid configuration object. Webpack has been initialised using a configuration
<p>As of this morning, with Angular CLI <code>1.0.0-beta.14</code> I <code>ng new try3</code> and <code>ng serve</code> and get the following error:</p> <pre><code>Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration has an unknown property 'tslint'. These properties are valid: object { amd?, bail?, cache?, context?, devServer?, devtool?, entry, externals?, loader?, module?, name?, dependencies?, node?, output?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? } - configuration.module has an unknown property 'preLoaders'. These properties are valid: object { rules?, loaders?, noParse?, unknownContextRequest?, unknownContextRegExp?, unknownContextRecursive?, unknownContextCritical?, exprContextRequest?, exprContextRegExp?, exprContextRecursive?, exprContextCritical?, wrappedContextRegExp?, wrappedContextRecursive?, wrappedContextCritical? } Options affecting the normal modules (`NormalModuleFactory`). - configuration.node.global should be a boolean. - configuration.resolve has an unknown property 'root'. These properties are valid: object { modules?, descriptionFiles?, plugins?, mainFields?, aliasFields?, mainFiles?, extensions?, enforceExtension?, moduleExtensions?, enforceModuleExtension?, alias?, symlinks?, unsafeCache?, cachePredicate?, fileSystem?, resolver? } - configuration.resolve.extensions[0] should not be empty. WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration has an unknown property 'tslint'. These properties are valid: object { amd?, bail?, cache?, context?, devServer?, devtool?, entry, externals?, loader?, module?, name?, dependencies?, node?, output?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? } - configuration.module has an unknown property 'preLoaders'. These properties are valid: object { rules?, loaders?, noParse?, unknownContextRequest?, unknownContextRegExp?, unknownContextRecursive?, unknownContextCritical?, exprContextRequest?, exprContextRegExp?, exprContextRecursive?, exprContextCritical?, wrappedContextRegExp?, wrappedContextRecursive?, wrappedContextCritical? } Options affecting the normal modules (`NormalModuleFactory`). - configuration.node.global should be a boolean. - configuration.resolve has an unknown property 'root'. These properties are valid: object { modules?, descriptionFiles?, plugins?, mainFields?, aliasFields?, mainFiles?, extensions?, enforceExtension?, moduleExtensions?, enforceModuleExtension?, alias?, symlinks?, unsafeCache?, cachePredicate?, fileSystem?, resolver? } - configuration.resolve.extensions[0] should not be empty. at webpack (/home/jan/src/fm-repos/try3/node_modules/webpack/lib/webpack.js:16:9) at Class.run (/home/jan/src/fm-repos/try3/node_modules/angular-cli/tasks/serve-webpack.js:23:27) at /home/jan/src/fm-repos/try3/node_modules/angular-cli/commands/serve.js:84:26 at process._tickCallback (internal/process/next_tick.js:103:7) </code></pre> <p>The last time I <code>ng new</code> a project was a few days ago -- at that point it worked file. Here's my environment:</p> <pre><code>angular-cli: 1.0.0-beta.14 node: 6.5.0 os: linux x64 </code></pre>
<angular><angular2-cli>
2016-09-20 18:08:53
HQ
39,601,345
Calculating the shortest distance between n GPS points
<p>I have for example 4 points: A (latitute1, longitude1), B (latitute2, longitude2), C (latitute3, longitude3), D (latitute4, longitude4).</p> <p>If I am a driver and I go from point A, I need an algorithm that calculates the most efficient way for me to visit all the points B, C, D starting from A. So that the distance is the smallest possible.</p> <p>The algorithm should tell me the most effective order: A --> C --> B --> D (for example).</p> <p>What matters is the total distance traveled is the lowest possible.</p> <p>Thanks so much!!! :)</p>
<math><gps><geolocation><geometry><geography>
2016-09-20 18:31:57
LQ_CLOSE
39,601,420
cannot resolve constructor 'class_name(java.lang.String)'
<p>I'm trying to store data in database when clicking add button but an error appears when I created an object in MainActivity.java class with database class as shown <a href="http://i.stack.imgur.com/FTJt0.jpg" rel="nofollow">enter image description here</a> </p>
<java><android>
2016-09-20 18:36:47
LQ_CLOSE
39,601,502
What exactly is a Set in COQ
<p>I'm still puzzled what the sort <strong>Set</strong> means in COQ. When do I use <strong>Set</strong> and when do I use <strong>Type</strong>?</p> <p>In Hott a <strong>Set</strong> is defined as a type, where identity proofs are unique. But I think in Coq it has a different interpretation. </p>
<coq><type-theory>
2016-09-20 18:41:28
HQ
39,602,114
C++ I want to do something like Class1.Class2.Fct()
<p>I am new to C++ programming and I need your help:</p> <p>Let's say I have a class - Class1. Is it possible to have another class (Class2) with (at least) one function that returns (for example) an integer? Here is an example with I want to achive:</p> <pre><code>std::cout &lt;&lt; "I did it: " &lt;&lt; Class1.Class2.ReturnINTEGER() &lt;&lt; std::endl; </code></pre> <p>I need the code to be compatible with GNU G++ compiler. Thanks :).</p>
<c++>
2016-09-20 19:15:15
LQ_CLOSE
39,602,137
How to serialize into Json C# DateTime value?
<p>I have an object <strong>model</strong> that contains <strong>DateTime</strong> property. This object is being serialized into Json format by calling</p> <blockquote> <p>return Json(model);</p> </blockquote> <p>as a result, I am getting this string </p> <blockquote> <p>"/Date(1474398517910)/"</p> </blockquote> <p>instead of DateTime. That's because Json doesnt support DateTime format, instead it uses a string.</p> <p><strong>Question - how to make this string to look like real date, something like</strong> </p> <blockquote> <p>"2016-10-22 12:20 PM"</p> </blockquote> <p>Thanks?</p>
<c#><json>
2016-09-20 19:16:25
LQ_CLOSE
39,602,525
Does Realm models actually require getters and setters?
<p>I cannot find it clearly documented anywhere if getters and setters are actually required for fields in a Realm Model. For example, the documentation at <a href="https://realm.io/docs/java/latest/api/io/realm/RealmObject.html" rel="noreferrer">https://realm.io/docs/java/latest/api/io/realm/RealmObject.html</a> says</p> <blockquote> <p>The only restriction a RealmObject has is that fields are not allowed to be final, transient' or volatile. Any method as well as public fields are allowed. When providing custom constructors, a public constructor with no arguments must be declared and be empty.</p> <p>Fields annotated with Ignore don't have these restrictions and don't require either a getter or setter.</p> </blockquote> <p>Which seems to hint that it is required with getters and setters for non-ignored fields. Yet, the documentation at <a href="https://realm.io/docs/java/latest/#customizing-objects" rel="noreferrer">https://realm.io/docs/java/latest/#customizing-objects</a> says</p> <blockquote> <p>It is possible to use RealmObjects almost like POJOs. Extending from RealmObject, you can let the fields be public, and use simple assignments instead of setters and getter.</p> </blockquote> <p>and then show the code for a Realm Model that does not have any getters and setters and instead have public fields we should use. Really? I thought Realm didn't even store any values in the actual fields, so reading and writing from them is probably a bad idea? I mean their debugging docs <a href="https://realm.io/docs/java/latest/#debugging" rel="noreferrer">https://realm.io/docs/java/latest/#debugging</a> state:</p> <blockquote> <p>Unfortunately these values are wrong because the field values are not used. Realm creates a proxy object behind the scenes and overrides the getters and setters in order to access the persisted data in the Realm</p> </blockquote> <p>So could someone please enlighten me? Can I skip getters and setters and just stick with public fields? Is there any thorough docs on this?</p>
<android><realm>
2016-09-20 19:41:40
HQ
39,603,120
How to check if Apple Maps is installed
<p>Anyone aware how to check whether Apple Maps is installed or not? I could not find anything in the docs.</p> <p>With iOS10 users can delete the Apple Maps application. While for Google Maps we can use <code>UIApplication.shared.canOpenURL()</code> to check if it's installed. I am not aware of such a thing exists to check for Apple Maps.</p> <p>Of course one can check if opening a <code>MKMapItem</code> with <code>mapItem.openInMaps()</code> fails - but that does not help for checking in advance.</p>
<ios><mapkit><ios10>
2016-09-20 20:21:53
HQ
39,605,182
What is the best way to add strings to a textview in a for loop. I am using textview.settext and it overwrites the previous string
What is the best way to add strings to a textview in a for loop? I am using the method "setText and it's overwriting the previous string rather than adding to. Here is my code below: List<PlaceLikelihood> placeLikelihoodList = placesResult.getPlaceLikelihoods(); int hospitalType = Place.TYPE_HOSPITAL; if (placeLikelihoodList != null) { for (int i = 0; i <placeLikelihoodList.size(); i++){ PlaceLikelihood p = placeLikelihoodList.get(i); List<Integer> types = p.getPlace().getPlaceTypes();} if (types.get(0).equals(hospitalType)) { groceryStoreTextView.setText(p.getPlace().getName().toString()); } } }
<java><android><textview>
2016-09-20 23:20:35
LQ_EDIT
39,605,583
Makeing anonymous scipts in pl/sql
I need to build an anonymous script to insert values in a table of configuration whit this columns: config and value this is what i need to insert Config: ‘country’ Value: ‘Argentina’ Config: ‘moneysign’ Value: ‘$’ Config: ‘dateformat’ Value: ‘DD/MM/YYYY’ I have to validate that the 3 insertions are correct. In case of failure, identify which failed and return the DB to the consistent state it was before starting the script.
<sql><oracle><plsql>
2016-09-21 00:10:50
LQ_EDIT
39,606,263
There's a favicon on my site and I don't know why?
So recently I bought a domain and set it up with Wordpress. I then uninstalled Wordpress because I just wanted a static landing page. However, for some reason there seems to be this favicon that I didn't add. So I delete all my files on the site and IT'S STILL THERE! I don't know what to do.[ Here is a screenshot of it.][1] [1]: http://i.stack.imgur.com/uNN3k.jpg
<html><wordpress>
2016-09-21 01:45:32
LQ_EDIT
39,606,339
(Android) How can I make a message bubble in list view just like Whatsapp do
I am doing a chat app. When I long click a message, then show up some choices. I don't have any idea to do this. Hope some people can help me, please. [enter image description here][1] [1]: http://i.stack.imgur.com/Qnue7.jpg
<android><listview><popup>
2016-09-21 01:56:12
LQ_EDIT
39,606,744
How to consume basic-authentication protected Restful web service via feign client
<p>Thank you for your time. To make it simple, I created a example service like below:</p> <pre><code>@RestController @RequestMapping("/") public class ComputeController { @GetMapping("/add") public int add(@RequestParam("left") int left, @RequestParam("right") int right) { return left + right; } } </code></pre> <p>To protected this url, I config spring-security like this:</p> <pre><code>management.security.enabled=true security.user.name=admin security.user.password=admin </code></pre> <p>When I startup this service and access like this:</p> <pre><code>GET /add?left=100&amp;right=11 HTTP/1.1 Authorization: ***** Hidden credentials ***** Host: localhost:7777 Connection: close </code></pre> <p>Everythis is going fine.</p> <p>In other node, I created a "service-comsumer" by netflix feign. It's a Java Interface.</p> <pre><code>@FeignClient(name = "API-GATEWAY", path = "/compute-service", fallback = ComputeServiceCircuitBreaker.class) public interface ComputeServiceClient { @RequestMapping(path = "/add", method = RequestMethod.GET) public Integer add(@RequestParam("left") Integer left, @RequestParam("right") Integer right); } </code></pre> <p>But I DO NOT know how to config the request header "Authorization".</p> <p>Any idea? Thanks again.</p>
<spring-security><spring-cloud><spring-cloud-netflix>
2016-09-21 02:49:45
HQ
39,608,002
How is rancher different from Kubernetes
<p>I have been trying to wrap my head around how Rancher (or DC/OS) is different from Kubernetes. Both of them say they are Container management tools. Why we do we need both? How are they different?</p>
<kubernetes><rancher>
2016-09-21 05:10:21
HQ
39,608,119
High CPU and RAM usage, how to know what is the cause?
<p>I am maintaining a cloud server (ubuntu 14, webuzo) on Amazon (AWS). Recently the usage of CPU and RAM are increasing high which cause the server going down.</p> <p>i thought there is an attact to the server, then i try to modify the security from the AWS console. I block all the ports, except for accessing the control panel of my hosting panel which i set it to only accept from my ip address.</p> <p>But still, the CPU and RAM usage is still high.</p> <p>I guess this is not caused from the outside(attact/flood), but it comes from inside the server.</p> <p>So the question is how to know or determine what is the cause?</p> <p>Regards</p>
<linux><ubuntu><amazon-ec2><server>
2016-09-21 05:21:14
LQ_CLOSE
39,608,362
Custom grafana datasource plugin to wrap external REST API
<p>I'm trying to figure out a way to create a data-source plugin which can communicate with an external REST API and provide relevant data to draw a panel.</p> <p>Anyone with previous experience?</p>
<grafana>
2016-09-21 05:42:30
HQ
39,608,565
I am trying to pass images from drawable in intent but not able to do .please help me out
Sender Activity: `enter code here`public class ShowSquadAdapter extends `enter code here`RecyclerView.Adapter<ShowSquadAdapter.ViewHolder> { `enter code here`Context con; `enter code here`Bitmap `enter code here`bmp,bmp1,bmp2,bmp3,bmp4,bmp5,bmp6,bmp7,bmp8,bmp9,bmp10,bmp11,bmp12,bmp13,`enter code here`bmp14,bmp15; `enter code here`public ArrayList<SquadModel> squad=new ArrayList<SquadModel>(); `enter code here`public ShowSquadAdapter(Context con,ArrayList<SquadModel> data) { `enter code here`this.con=con; `enter code here`this.squad=data; } `enter code here` @Override `enter code here` public ShowSquadAdapter.ViewHolder `enter code here`onCreateViewHolder(ViewGroup parent, int viewType) { `enter code here`View view = `enter code here`LayoutInflater.from(con).inflate(R.layout.card_squad,parent,false); `enter code here`ViewHolder vh = new ViewHolder(view); `enter code here`return vh; } `enter code here`@Override `enter code here` public void onBindViewHolder(ShowSquadAdapter.ViewHolder holder, int position) { `enter code here`final SquadModel squadModel = squad.get(position); `enter code here`if(holder==null) { `enter code here` Log.e("tag","null"); `enter code here`} `enter code here`ImageView imageView=holder.imvplayer; `enter code here`imageView.setImageResource(squadModel.getIconid()); `enter code here`if(holder.equals(null)) `enter code here`{ `enter code here` Log.e("tag","null"); `enter code here`} `enter code here`TextView textView = holder.tvplayername; `enter code here`textView.setText(squadModel.getName()); `enter code here`holder.linearLayout.setOnClickListener(new View.OnClickListener() { `enter code here`@Override `enter code here`public void onClick(View v) { `enter code here`Intent j = new Intent(con,ShowSquad.class); `enter code here`j.putExtra("Juan Calatayud",squadModel.getIconid()); `enter code here`Log.e("tag", String.valueOf(squadModel.getIconid())); `enter code here`j.putExtra("Amrinder Singh",squadModel.getIconid()); `enter code here`j.putExtra("Kunzang Bhutia",squadModel.getIconid()); `enter code here`j.putExtra("Nallappan Mohanraj",squadModel.getIconid()); `enter code here`j.putExtra("Arnab Mondal",squadModel.getIconid()); `enter code here`j.putExtra("Denzil Franco",squadModel.getIconid()); `enter code here`j.putExtra("Syed Rahim Nabi",squadModel.getIconid()); `enter code here`j.putExtra("Rino Anto",squadModel.getIconid()); `enter code here`j.putExtra("Augustin Fernandes",squadModel.getIconid()); `enter code here`j.putExtra("Jaime Gavilán",squadModel.getIconid()); `enter code here`j.putExtra("Borja Fernández",squadModel.getIconid()); `enter code here`j.putExtra("Clifford Miranda",squadModel.getIconid()); `enter code here`j.putExtra("Arata Izumi",squadModel.getIconid()); `enter code here`j.putExtra("Sameehg Doutie",squadModel.getIconid()); `enter code here`j.putExtra("Ofentse Nato",squadModel.getIconid()); `enter code here`j.putExtra("Jorge Alonso",squadModel.getIconid()); `enter code here`Reciever Activity: `enter code here`public class ShowSquad extends AppCompatActivity { `enter code here`public ArrayList<SquadModel> squad=new ArrayList<SquadModel>(); `enter code here`@Override `enter code here`protected void onCreate(@Nullable Bundle savedInstanceState) { `enter code here`ImageView imageView; `enter code here`TextView textView; `enter code here`super.onCreate(savedInstanceState); `enter code here`setContentView(R.layout.activity_showsquad); `enter code here`imageView=(ImageView)findViewById(R.id.imvshowsquad); `enter code here`textView=(TextView)findViewById(R.id.tvshow); `enter code here`Bundle bundle = getIntent().getExtras(); //SquadModel squadModel = squad. `enter code here`if(bundle!=null) { `enter code here`byte arr[] = getIntent().getByteArrayExtra("Juan Calatayud"); `enter code here`Bitmap bmp = BitmapFactory.decodeByteArray(arr,0,arr.length); `enter code here`imageView.setImageBitmap(bmp); //SquadModel squadModel = squad.get(i); `enter code here`imageView.setImageResource(bundle.getInt("Juan Calatayud",R.drawable.p_juan)); `enter code here`imageView.setImageResource(bundle.getInt("Amrinder Singh")); `enter code here`imageView.setImageResource(bundle.getInt("Kunzang Bhutia")); imageView.setImageResource(bundle.getInt("Nallappan Mohanraj")); imageView.setImageResource(bundle.getInt("Arnab Mondal")); imageView.setImageResource(bundle.getInt("Denzil Franco")); imageView.setImageResource(bundle.getInt("Syed Rahim Nabi")); imageView.setImageResource(bundle.getInt("Rino Anto")); imageView.setImageResource(bundle.getInt("Augustin Fernandes")); imageView.setImageResource(bundle.getInt("Jaime Gavilán")); imageView.setImageResource(bundle.getInt("Borja Fernández")); imageView.setImageResource(bundle.getInt("Clifford Miranda")); imageView.setImageResource(bundle.getInt("Arata Izumi")); imageView.setImageResource(bundle.getInt("Sameehg Doutie")); imageView.setImageResource(bundle.getInt("Ofentse Nato")); imageView.setImageResource(bundle.getInt("Jorge Alonso"));
<java><android><android-intent><android-drawable>
2016-09-21 05:59:39
LQ_EDIT
39,608,736
Docker-in-Docker with Gitlab Shared runner for building and pushing docker images to registry
<p>Been trying to set-up Gitlab CI which can build a docker image, and came across that DinD was enabled initially only for separate runners and <a href="https://about.gitlab.com/2016/05/23/gitlab-container-registry/" rel="noreferrer">Blog Post</a> suggest it would be enabled soon for shared runners, </p> <p>Running DinD requires enabling privileged mode in runners, which is set as a flag while registering runner, but couldn't find an equivalent mechanism for Shared Runners</p>
<docker><gitlab-ci><gitlab-ci-runner>
2016-09-21 06:14:22
HQ
39,608,747
Javascript Password
I need the password to fulfil these requirements 1. Password must contain at least 8 word characters 2. Must have at least 1 numeric (i.e. digit) 3) 3. At least 2 uppercase characters but not in one consecutive sequence It doesn't seems to work with this var pos = myPass.value.search(/^([\w.-]{8,})(?=.*\d)((.*?[A-Z]){2,})$/); No.3 is the hardest. help much appreciated
<javascript><regex><passwords>
2016-09-21 06:14:57
LQ_EDIT
39,609,255
How can I check whether the protocol is implemented?
<p>I wonder if there any way to ask Elixir whether <em>this object implements that protocol</em>, something like <code>obj |&gt; implements(Enumerable)</code>?</p> <p>Basically, I have to distinguish structs and maps. The solution I currently have is kinda ugly:</p> <pre><code>try obj |&gt; Enum.each ... rescue e in Protocol.UndefinedError -&gt; obj |&gt; Maps.keys ... end </code></pre> <p>The above works, but I would prefer to use pattern matching like:</p> <pre><code>cond do obj |&gt; is_implemented(Enumerable) -&gt; ... _ -&gt; ... end </code></pre> <p>Am I missing something? <strong>Can one explicitly check whether the desired protocol is implemented by the object?</strong></p>
<elixir>
2016-09-21 06:46:42
HQ
39,609,530
An empty snapshotView on iPhone 7/7plus
<p>My first question here:) Recently I update my Xcode to 8, and the <code>resizableSnapshotView</code> method doesn't work properly on some simulators. The snapshotView works well on all testing devices with iOS9/10 and simulators under iPhone6s, but it is empty on iPhone7/7p simulators. I think 7/7p may need some authorities for accessing snapshot, but I have no idea what they are.</p> <pre><code>let cell = self.tableView.cellForRow(at: IndexPath(row: 0, section: 0)) as! CalendarCell var topFrame = cell.frame topFrame.origin.y = tableView.contentOffset.y topFrame.size.height -= tableView.contentOffset.y topSnapshotView = tableView.resizableSnapshotView(from: topFrame, afterScreenUpdates: false, withCapInsets: UIEdgeInsets.zero) </code></pre>
<ios><iphone><swift3><ios10>
2016-09-21 07:01:34
HQ
39,609,819
Difference between React-native and Electron
<p>I want to build a simple read-only app which should run on Android, iOS, Windows, OSX and Linux. Does electron support mobile platform? I couldn't figure out which one should I go for.</p>
<react-native><electron>
2016-09-21 07:16:28
HQ
39,609,833
org.json.JSONException: Value <br><table of type java.lang.String cannot be converted to JSONObject?
I know there a lot of people with the same problem but any answers can help me. And all just confuse me. I'm trying to do a Login/Register on Android Studio. The problem display is the follow. W/System.err: org.json.JSONException: Value <br><table of type java.lang.String cannot be converted to JSONObject W/System.err: at org.json.JSON.typeMismatch(JSON.java:111) W/System.err: at org.json.JSONObject.<init>(JSONObject.java:160) W/System.err: at org.json.JSONObject.<init>(JSONObject.java:173) ... This is my code. final Button bRegister = (Button) findViewById(R.id.rButton); bRegister.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { final String name = etName.getText().toString(); final String username = etUsername.getText().toString(); final String password = etPassword.getText().toString(); Response.Listener<String> responseListener = new Response.Listener<String>() { @Override public void onResponse(String response) { try { JSONObject jsonResponse = new JSONObject(response); boolean success = jsonResponse.getBoolean("success"); if (success) { Intent intent = new Intent(RegisterActivity.this, LoginActivity.class); RegisterActivity.this.startActivity(intent); } else { AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this); builder.setMessage("Register Failed") .setNegativeButton("Retry", null) .create() .show(); } } catch (JSONException e) { e.printStackTrace(); } } }; RegisterRequest registerRequest = new RegisterRequest(name, username, password, responseListener); RequestQueue queue = Volley.newRequestQueue(RegisterActivity.this); queue.add(registerRequest); } }); } } And of course the php one. <?php $con = mysqli_connect("host", "user", "password", "database"); $name = $_POST["name"]; $username = $_POST["username"]; $password = $_POST["password"]; $statement = mysqli_prepare($con, "INSERT INTO user (name, username, password) VALUES (?, ?, ?)"); mysqli_stmt_bind_param($statement, "sss", $name, $username, $password); mysqli_stmt_execute($statement); $response = array(); $response["success"] = true; echo json_encode($response); Thanks in advance for the help and sorry for the trouble.
<java><php><android><json>
2016-09-21 07:17:10
LQ_EDIT
39,609,988
Visual Studio shows warning in vctmp file
<p>I have a C# project opened in visual studio. We are using TFS to manage our projects. In one source code file of the project I have configured a warning in the following way:</p> <pre><code>#warning expand for all properties </code></pre> <p>When I compile my project the warning is shown in the error list twice. Once in the original file, and once in a file called <code>vctmp2984_94722.cs</code>. I can open the temporary file in visual studio and it has a previous state of the file. Opening the file in explorer is not possible, cause the path of the temporary file points to a place that does not exist: C:\Users\developer\AppData\Local\Temp\TFSTemp\vctmp2984_94722.cs</p> <p>Does anybody nows how to solve this?</p>
<c#><visual-studio><visual-studio-2015><warnings>
2016-09-21 07:24:20
HQ
39,610,294
Import two exported classes with the same name
<p>In typescript, using Angular 2, I need to import two classes with the same name, but lying in different paths.</p> <p>The project is quite too big that I find it hard to change the exported class names.</p> <p>Is there any way to alias the imported classes,</p> <pre><code>import {Class1} from '../location1/class1' import {Class1} from '../location2/class1' </code></pre>
<angular><typescript><ionic2>
2016-09-21 07:38:56
HQ
39,610,495
Spring boot - number of backup log files restricted to 7
<p>In our <strong>spring-boot</strong> project we are using <strong>slf4j</strong> for logging purpose. Below are configuration which we have added in <strong>application.properties</strong> file</p> <pre><code>logging.file=/opt/logs/my_log.log logging.level.org.springframework.web=INFO logging.level.org.hibernate=INFO logging.level.nl.yestelecom.boss=DEBUG logging.level.com.github.isrsal.logging.LoggingFilter=DEBUG </code></pre> <p>It <strong>generates only 7 backup files</strong> (my_log.log.1, my_log.log.2 ..., my_log.log.7) with each file of size <strong>10.5MB</strong> and after that logging is not happening at all. </p> <p>Is there any way to change this behavior? </p> <p>We looked into available properties of spring-boot but, didn't find anything. Any suggestion is appreciated.</p>
<java><spring><spring-boot><logback><slf4j>
2016-09-21 07:49:31
HQ
39,612,022
APNs push notification with macOS Sierra
<p>I'm trying to send my phone a push notification using the simple PHP tool which connects to <code>ssl://gateway.push.apple.com:2195</code>, but the connection fails with the following errors:</p> <pre><code>Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in &lt;Users/.../file.php&gt; on line 30 Warning: stream_socket_client(): Failed to enable crypto in &lt;Users/.../file.php&gt; on line 30 Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in &lt;Users/.../file.php&gt; on line 30 Failed to connect: 0 </code></pre> <p>This all started since I upgraded to the GM Seed of macOS Sierra. What's new in macOS Sierra that affects SSL connections? How do I resolve this?</p>
<ios><apple-push-notifications><apns-php><macos-sierra>
2016-09-21 09:03:09
HQ
39,612,207
to write a python code that that takes a positive integer argument and returns True if the integer is square free, and False otherwise
enter code here def squarefree(n): for i in range (2,n-1): if n%(i**2)==0: return False else: return True
<python>
2016-09-21 09:11:42
LQ_EDIT
39,612,354
When not to use mobile-web-app-capable
<p>I've <a href="http://www.html5rocks.com/en/mobile/fullscreen/#toc-launch" rel="noreferrer">read</a> on how adding</p> <pre class="lang-html prettyprint-override"><code>&lt;meta name="apple-mobile-web-app-capable" content="yes"&gt; &lt;meta name="mobile-web-app-capable" content="yes"&gt; </code></pre> <p>to your HTML will allow users to add that page to their home screen and use it as an App. So I'm wondering whether it would make sense to add these meta tags to pretty much all the HTML I generate. After all, the user doesn't <em>have</em> to install them as apps, but if they choose to do so, why should I prevent that?</p> <p>I'm mostly thinking about unauthenticated content here which is static from a HTML server perspective, although it may well be interctive thanks to client-side JavaScript. To give you an idea, think about single-page tutorials, perhaps with some interactive code demo in it. Something like that.</p> <ul> <li>Am I making any promises by adding these tags?</li> <li>In what situations should I avoid adding them?</li> </ul>
<html><mobile><web-applications><iphone-standalone-web-app>
2016-09-21 09:18:08
HQ
39,612,755
how to find the week which secured highest sales ..using map and reducer
how to find the week which secured highest sales ..using map and reducer this is my sample .csv file how can i find the week that has the highest sale train.csv Store,Dept,Date,Weekly_Sales,IsHoliday 1,1,2010-02-05,24924.5,FALSE 1,1,2010-02-12,46039.49,TRUE 1,1,2010-02-19,41595.55,FALSE 1,1,2010-02-26,19403.54,FALSE 1,1,2010-03-05,21827.9,FALSE 1,1,2010-03-12,21043.39,FALSE 1,1,2010-03-19,22136.64,FALSE 1,1,2010-03-26,26229.21,FALSE 1,1,2010-04-02,57258.43,FALSE thanks in Advance
<hadoop><mapreduce><bigdata>
2016-09-21 09:34:43
LQ_EDIT
39,612,874
How can I remove Description Label in ios-chart?
<p>I am trying to remove <code>Description Label</code> in <code>ios-chart</code> library. You can see it on the image below:</p> <p><a href="https://i.stack.imgur.com/FWEK1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FWEK1.png" alt="enter image description here"></a></p> <p>And I know that, on Android (<code>MPAndroidChart</code> library which is the predecessor of ios-chart), I can do the following:</p> <pre><code>barchart.setDescription(" "); </code></pre> <p>but I am trying to do the same on Swift:</p> <pre><code>barchart.description = "" </code></pre> <p>and I am getting the following error:</p> <blockquote> <p>Cannot assign to property: 'description' is immutable</p> </blockquote> <p>I have looked on the Internet and here in StackOverflow but could not see anything to remove it. </p> <p>Is it possible to remove that <code>Description Label</code> on <code>ios-chart</code> library?</p> <p>Thanks in advance!</p>
<ios><swift><ios-charts>
2016-09-21 09:40:03
HQ
39,612,943
How do I run code multiple times in a sing run?
I am working in java using eclipse. Here i am calculating average utilization of machines. I want to run this code 20 time and then need to take average of this code. Is it possible to do the same. I am using simple formula for calculations: AU=ActCPUtime/(max*3); I need to run this program for different values of ActCPUtime and max which i can get in different run. Please help me out with this. Thank You
<java><eclipse>
2016-09-21 09:43:47
LQ_EDIT
39,613,375
Android Studio 2.2 : I keep seeing "GPU tools not installed, install now"
<p>I've just downloaded the latest Android Studio 2.2 and I'm trying to use the GPU profiling tools. On my LG G4 phone I've enabled up USB debugging &amp; Profile GPU rendering (In adb shell dumpsys gfxinfo).</p> <p>When using the Android Monitor (GPU) launching a GFX Trace gives me the message "GPU tools not installed, install now?". If I go to the Configuration and enable 'Capture GPU Commands' it asks me the same.</p> <p>I've checked in the SDK Manager and I have the Tools installed (3.1.0 &amp; 1.3.0).</p> <p>I've tried uninstalling, and reinstalling Android Studio. I've tried a couple of different phones. I've tried different combinations of settings on the phones. </p> <p>I'm out of ideas. Does anyone know what situation might mean GPU Tools are not recognised as installed?</p>
<android><gpu><android-studio-2.2>
2016-09-21 10:01:42
HQ