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,821,614 | Typescript compile error: error TS1109: Expression expected | <p>I have this very simple typescript file:</p>
<pre><code>export default const VERSION: number = 2016030600;
</code></pre>
<p>Then I run:</p>
<pre><code>tsc version.ts
</code></pre>
<p>typescript compiler (Version 1.8.7, OS X) complains:</p>
<pre><code>version.ts(1,16): error TS1109: Expression expected.
</code></pre>
<p>How can I fix this error? Thank you.</p>
| <typescript> | 2016-03-06 00:24:51 | HQ |
35,822,195 | where should i place data base file to run example project | i m new in PHP programing. i copy some project form github https://github.com/puttyvikas/shopping this is screen shot project
containing thi file [githum PHP project files][1] i extract project
place in my wamp www folder. and access by using
http://localhost /shopping-master/index.php its show me not connect error. help me how do i connect with database where should i place sample code
database to run project easily ??
this is screen shot
enter code here
//connect.php file
<?php
$server_name = "localhost";
$user_name = "root";
$pass = "";
//$db = "easygaadi";
$db = "shopping";
$conn_error = "not connected";
if(@!mysql_connect($server_name,$user_name,$pass) || @!mysql_select_db($db))
{
die($conn_error);
} //else {
//echo "<span style='background-color:yellow'>Connected to Database
Successfully!!</span><br>";
//}
//this is index.php file
<!DOCTYPE html>
<html>
<?php require 'connect.php';
ob_start();
session_start();
?>
<head>
| <php> | 2016-03-06 01:57:51 | LQ_EDIT |
35,822,249 | Firebase - How to write/read data per user after authentication | <p>I have tried to understand but not able to see how and where might be the data I am storing after login is going.</p>
<pre><code>public static final String BASE_URL = "https://xyz.firebaseio.com";
Firebase ref = new Firebase(FirebaseUtils.BASE_URL);
ref.authWithPassword("xyz@foo.com", "some_password", new Firebase.AuthResultHandler() {
@Override
public void onAuthenticated(AuthData authData) {
Toast.makeText(LoginActivity.this, "Login Successful", Toast.LENGTH_SHORT).show();
startActivity(new Intent(LoginActivity.this, MainActivity.class));
}
@Override
public void onAuthenticationError(FirebaseError firebaseError) {
}
}
</code></pre>
<p>At this point I am successfully authenticated and landed onto <code>MainActivity</code>. Next in <code>onCreate</code> of <code>MainActivity</code>. I initialize <code>Firebase</code></p>
<pre><code>firebase = new Firebase(FirebaseUtils.BASE_URL).child("box");
// adapter below is an ArrayAdapter feeding ListView
firebase.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
if (dataSnapshot.getValue(Box.class) instanceof Box)
adapter.add(dataSnapshot.getValue(Box.class).getName());
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
adapter.remove(dataSnapshot.getValue(Box.class).getName());
}
// other callbacks
}
</code></pre>
<p>There is a add button that I used to push new records from Android to <code>Firebase</code>.</p>
<pre><code>final Button button = (Button) findViewById(R.id.addButton);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Box box = new Box("Box " + System.currentTimeMillis(), "Location " + System.currentTimeMillis());
Firebase fbBox = firebase.child("" + System.currentTimeMillis());
fbBox.setValue(box);
}
});
</code></pre>
<p>But above code doesn't add any record (evident from <code>ListView</code> that is not updated) or atleast I might not know where to look for the data. I checked opening <code>Firebase</code> in browser, but I am not sure how to check for user specific data?</p>
<p>I modified my <code>Firebase Rules</code> like </p>
<pre><code>{
"rules": {
"users": {
"$uid": {
".write": "auth != null && auth.uid == $uid",
".read": "auth != null && auth.uid == $uid"
}
}
}
}
</code></pre>
<p>I tried to open URLs such as <a href="https://xyz.firebaseio.com/xxxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxxxxx">https://xyz.firebaseio.com/xxxxxx-xxxxx-xxxx-xxxxx-xxxxxxxxxxxx</a> but it wouldn't show any data.</p>
<p>I would like to have some information on:</p>
<ol>
<li><p>How to add user specific data after authentication. Can't it be seamless like when we don't have any restriction on read/write on user basis, because I could easily read/write data.</p></li>
<li><p>Is there any <code>Firebase</code> web view to visualize the database or see JSON data, where I can see/modify the data to/from Android device?</p></li>
</ol>
| <android><firebase><firebase-security> | 2016-03-06 02:07:11 | HQ |
35,822,822 | Parse a single CSV string? | <p>Is there a way that I can parse a single comma delimited string without using anything fancy like a csv.reader(..) ? I can use the <code>split(',')</code> function but that doesn't work when a valid column value contains a comma itself. The csv library has readers for parsing CSV files which correctly handle the aforementioned special case, but I can't use those because I need to parse just a single string. However if the Python CSV allows parsing a single string itself then that's news to me.</p>
| <python><python-2.7><parsing><csv> | 2016-03-06 03:37:09 | HQ |
35,822,838 | Get the referer link using PHP or any other language | <p>I am presently working on a project that requires us been able to know the url which our visitors are redirected from.</p>
<p>For Example, If we send out newsletters and a visitor clicks the link and get redirected to our website. We want to know what url he was redirected from.</p>
<p>Is this possible? </p>
| <php><redirect><referer> | 2016-03-06 03:40:15 | LQ_CLOSE |
35,822,965 | How to get exact output? | <p>I wrote a program to get words from user and get plural of those words as output. Now I couldn't do following two things</p>
<p>1 - How to restrict only string input i.e if user input integer then program must throw error.</p>
<p>2 - Input - cat mat bat output-> cats mats bats
input - cat, mat, bat output -> cat,s mat,s bat,s ( I want to avoid this i.e when user separates the words by comma then i should get bats not bat,s)</p>
<p>please guide me here and please watch out for indentation. </p>
<p>Thank you</p>
<pre><code>`(def plural(user_input):
# creating list
List_of_word_ends = ['o','ch', 's', 'sh', 'x', 'z']
words = user_input.split()
ws = "";
# setting loop to for words
for word in words:
if len(word)>0 :
if word.endswith("y"):
word = word[:-1]
word += "ies"
else:
isSomeEs = False;
for suffix in List_of_word_ends:
if word.endswith(suffix):
word += "es"
isSomeEs = True;
break
if not isSomeEs:
word += "s"
ws += word+" "
print ws
# taking input from user
singular = raw_input("Please enter the words whose plural you want:")
# returns a list of words
x = singular.split(" ")
x = singular.split(",")
#calculate the length of object
y = len(x)
print "The no. of words you entered is :", y
#function call
plural(singular))`
</code></pre>
| <python> | 2016-03-06 04:02:56 | LQ_CLOSE |
35,823,116 | Displaying error message | How to display error messgae using javascript or jquery only when both the feilds are empty. For example a user can either enter Zipcode or select a state from dropdown. If the user doesnot select any one of those then the error should be displayed. | <javascript><jquery> | 2016-03-06 04:30:08 | LQ_EDIT |
35,823,169 | What is the use of autoscroll to source and and autoscroll from source features in Intellij IDEs? | <p>I was looking for how to show the open files in project view and found theses two features, I want to know what does the above mentioned features do?</p>
| <intellij-idea><autoscroll> | 2016-03-06 04:37:53 | HQ |
35,824,075 | Cannot display Toast because of a runtime error. please help me |
badd.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String s1 = e1.getText()+"hi".toString();
Log.i("add",s1);
if(e1.getText()==null)
{
Toast.makeText(getApplicationContext(), "Please Enter A Number First", Toast.LENGTH_SHORT).show();
}
else
{
num1 = Float.parseFloat(e1.getText()+"");
i=1;
e1.setText(null);
}
}
});
I am making a simple calculator app, there is a Button badd(button to perform addition) and an EditText e1. when this button is clicked; first it'll be checked if the textbox is empty or not if it is empty it'll display a Toast telling user to enter a number. if the number is already entered that number will be stored in a variable num1 and textbox will get empty so that user can input another number and addition will be performed on the two numbers.
When i entered a number and pressed badd addition was done successfully. But my problem is that when i leave the edit text box empty (null) i get a runtime error and instead of displaying toast it shows an error "your application is unfortunately closed".
I created a string variable s1 also that takes the string entered in e1 and concate that string with another string "hi" so that if the string is empty it'll at least display a hi message in log cat. It is to check if there is some error in anonymous inner class. but it is cleared that there is no problem the anonymous inner class and else block.
I think the bug is in the if block. Please Help Me! Following are my LogCat errors that will help you to find the bug.
03-05 16:37:00.601: I/add(1569): hi
03-05 16:37:00.663: E/AndroidRuntime(1569): FATAL EXCEPTION: main
03-05 16:37:00.663: E/AndroidRuntime(1569): java.lang.NumberFormatException: Invalid float: ""
03-05 16:37:00.663: E/AndroidRuntime(1569): at java.lang.StringToReal.invalidReal(StringToReal.java:63)
03-05 16:37:00.663: E/AndroidRuntime(1569): at java.lang.StringToReal.parseFloat(StringToReal.java:289)
03-05 16:37:00.663: E/AndroidRuntime(1569): at java.lang.Float.parseFloat(Float.java:300)
03-05 16:37:00.663: E/AndroidRuntime(1569): at com.example.mycalculator.MainActivity$13.onClick(MainActivity.java:171)
03-05 16:37:00.663: E/AndroidRuntime(1569): at android.view.View.performClick(View.java:4202)
03-05 16:37:00.663: E/AndroidRuntime(1569): at android.view.View$PerformClick.run(View.java:17340)
03-05 16:37:00.663: E/AndroidRuntime(1569): at android.os.Handler.handleCallback(Handler.java:725)
03-05 16:37:00.663: E/AndroidRuntime(1569): at android.os.Handler.dispatchMessage(Handler.java:92)
03-05 16:37:00.663: E/AndroidRuntime(1569): at android.os.Looper.loop(Looper.java:137)
03-05 16:37:00.663: E/AndroidRuntime(1569): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-05 16:37:00.663: E/AndroidRuntime(1569): at java.lang.reflect.Method.invokeNative(Native Method)
03-05 16:37:00.663: E/AndroidRuntime(1569): at java.lang.reflect.Method.invoke(Method.java:511)
03-05 16:37:00.663: E/AndroidRuntime(1569): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-05 16:37:00.663: E/AndroidRuntime(1569): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-05 16:37:00.663: E/AndroidRuntime(1569): at dalvik.system.NativeStart.main(Native Method)
| <java><android> | 2016-03-06 06:56:28 | LQ_EDIT |
35,824,291 | Need Python Help.. I am very new to python | ******* <br>
PYTHON guruz Please Help! I am writing a program to get an output for a user input .. User inputs IP address.. I need to display a specific part of the above line. <br> <br>
THANKS IN ADVANCE <br><br>
********/ Got this file /******** <br>
mot physical /ABC-RD0.CLD/CPQSCWSSF001f1-V.80 { <br>
poolcoin /ABC-RD0.CLD/123.45.67.890:88 <br>
ip-protocol tcp <br>
mask 255.255.255.255 <br>
/Common/source_addr { <br>
default yes <br>
mot physical /ABC-RD0.CLD/CPQSCWSSF001f1-V.80 { <br>
profiles { <br>
/Common/http { } <br>
/Common/webserver-tcp-lan-optimized { <br>
context serverside <br>
} <br>
mot physical /ABC-RD0.CLD/BBQSCPQZ001f1-V.80 { <br>
poolcoin /ABC-RD0.CLD/123.45.67.890:88 <br>
ip-protocol tcp <br>
mask 255.255.255.255 <br>
********/ Want the below output for user input /******** <br>
User inputs the IP and output should be: <br> <br>
user input: 123.45.67.890<br>
output: CPQSCWSSF001f1 <---------------------------- <br><br>
user input: 123.45.67.890 <br>
output: BBQSCPQZ001f1 <---------------------------- <br> <br>
********/ This is what i have tried /******** <br>
#!/usr/bin/env python <br> <br>
import re <br> <br
ip = raw_input("Please enter your IP: ") <br>
with open("test.txt") as open file: <br>
for line in open file: <br>
for part in line.split(): <br>
if ip in part: <br>
print part -1 <br>
| <python><regex><python-2.7><python-3.x> | 2016-03-06 07:29:57 | LQ_EDIT |
35,825,802 | What is the difference between NumPy array and simple python array? | <p>Why do we use numpy arrays in place of simple arrays in python? What is the main difference between them?</p>
| <python><arrays><numpy> | 2016-03-06 10:34:59 | HQ |
35,826,286 | Bootstrap input tags | <p>I have used Bootstrap tag inputs on email field in my application .Am getting as below (Whenever i hit enter , entered values went out of input field)</p>
<p><a href="https://i.stack.imgur.com/K0kWh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K0kWh.png" alt="Tag Input output"></a></p>
<p>But i want my input field as like ,(It should accommodate all inputs in text box itself)</p>
<p><a href="https://i.stack.imgur.com/WNZum.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WNZum.png" alt="Tag Input Expected"></a></p>
<p>I have added bootstrap and bootstrap taginput js in my code.</p>
<p>Can anyone please help me out to achieve this.</p>
| <javascript><jquery><html><twitter-bootstrap> | 2016-03-06 11:25:30 | LQ_CLOSE |
35,826,635 | CLion - GDB: current version is GNU gdb (GDB) (Cygwin 7.10.1-1) 7.10.1; supported version is 7.8.x | <p>I am trying to use CLion on Windows and I installed my environment using cygwin but I'm getting this warning in the settings. Moreover, it's almost impossible to debug because the debugger just stops showing debugger info in the middle.</p>
| <windows><gdb><cygwin><clion><jetbrains-ide> | 2016-03-06 12:05:01 | HQ |
35,826,654 | Best way to display animated image (HTML/CSS/JS) | <p>On my website I'm trying to display the animation of a coin being flipped multiple times in the air and coming back to the surface. When the animation is over it should become a static image of the side the coin landed on.
I've found multiple ways to do this such as CSS animations, sprites,... but the options with CSS animations seem to be very limited if I want a rather advanced animation and others seem to have some flaws aswell.
What is the best method of displaying an animated image for a certain amount of time and then becoming a static image?</p>
| <javascript><html><css><image><animation> | 2016-03-06 12:06:50 | LQ_CLOSE |
35,827,012 | Matter.js calculating force needed | <p>Im trying to apply a force to an object. To get it to move in the angle that my mouseposition is generating relative to the object.</p>
<p>I have the angle</p>
<pre><code> targetAngle = Matter.Vector.angle(myBody.pos, mouse.position);
</code></pre>
<p>Now I need to apply a force, to get the body to move along that angle.
What do I put in the values below for the applyForce method?</p>
<pre><code> // applyForce(body, position, force)
Body.applyForce(myBody, {
x : ??, y : ??
},{
x:??, y: ?? // how do I derive this force??
});
</code></pre>
<p>What do I put in the x and y values here to get the body to move along the angle between the mouse and the body.</p>
| <javascript><vector><matter.js> | 2016-03-06 12:49:38 | HQ |
35,827,062 | How to force Laravel Project to use HTTPS for all routes? | <p>I am working on a project that requires a secure connection.</p>
<p>I can set the route, uri, asset to use 'https' via:</p>
<pre><code>Route::get('order/details/{id}', ['uses' => 'OrderController@details', 'as' => 'order.details', 'https']);
url($language.'/index', [], true)
asset('css/bootstrap.min.css', true)
</code></pre>
<p>But setting the parameters all the time seems tiring.</p>
<p>Is there a way to force all routes to generate HTTPS links?</p>
| <php><ssl><https><routes><laravel-5.2> | 2016-03-06 12:54:39 | HQ |
35,827,268 | How to change the line color in seaborn lmplot | <p>We can get a plot as bellow</p>
<pre><code>import numpy as np, pandas as pd; np.random.seed(0)
import seaborn as sns; sns.set(style="white", color_codes=True)
tips = sns.load_dataset("tips")
g = sns.lmplot(x="total_bill", y="tip", data=tips)
sns.plt.show()
</code></pre>
<p><a href="https://i.stack.imgur.com/5kLUv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5kLUv.png" alt="enter image description here"></a></p>
<p>But when we have a lot of data points the regression line is not visible anymore. How can I change the line's color? I couldn't find anymore command</p>
| <python><colors><seaborn> | 2016-03-06 13:15:44 | HQ |
35,827,787 | Convert photo (jpg or any format) to .rda | <p>Hi: Is there any way i can convert any photo (preferably jpg format) to .rda file so that I can do PCA analysis? My objective is to convert photo to rda. Take first few components of from pca do the similar operation to another photo file so that i can compare them..</p>
| <r> | 2016-03-06 14:01:58 | LQ_CLOSE |
35,828,972 | What IDE is good to use for developing angularJS SPA with authentication form (windows 8.1) | <p>Im trying to create SPA with angularJS and sass what would be a good IDE to work with ?</p>
<p>Thanks</p>
| <html><angularjs><sass> | 2016-03-06 15:49:59 | LQ_CLOSE |
35,829,083 | Can I inspect a sqlalchemy query object to find the already joined tables? | <p>I'm trying to programmatically build a search query, and to do so, I'm joining a table.</p>
<pre><code>class User(db.Model):
id = db.Column(db.Integer(), primary_key=True)
class Tag(db.Model):
id = db.Column(db.Integer(), primary_key=True)
user_id = db.Column(db.Integer(), db.ForeignKey('user.id'))
title = db.Column(db.String(128))
description = db.Column(db.String(128))
</code></pre>
<p>This is a bit of a contrived example - I hope it makes sense.</p>
<p>Say my search function looks something like:</p>
<pre><code>def search(title_arg, desc_arg):
query = User.query
if title_arg:
query = query.join(Tag)
query = query.filter(Tag.title.contains(title_arg))
if desc_arg:
query = query.join(Tag)
query = query.filter(Tag.description.contains(desc_arg))
return query
</code></pre>
<p>Previously, I’ve kept track of what tables that have already been joined in a list, and if the table is in the list, assume it’s already joined, and just add the filter.</p>
<p>It would be cool if I could look at the query object, see that <code>Tag</code> is already joined, and skip it if so. I have some more complex query building that would really benefit from this.</p>
<p>If there’s a completely different strategy for query building for searches that I’ve missed, that would be great too. Or, if the above code is fine if I join the table twice, that's great info as well. Any help is incredibly appreciated!!!</p>
| <python><join><sqlalchemy><flask-sqlalchemy> | 2016-03-06 16:01:34 | HQ |
35,829,897 | Is c1.equals(c2) true or false? | <p>I have to guess the output for this code sequence:</p>
<pre><code>Circle c1 = new Circle(5);
Circle c2 = new Circle(5);
Circle c3 = new Circle(15);
Circle c4 = null;
System.out.println(c1==c1);
System.out.println(c1==c2);
System.out.println(c1==c3);
System.out.println(c1.equals(c1));
System.out.println(c1.equals(c2));
System.out.println(c1.equals(c3));
System.out.println(c1.equals(c4));
</code></pre>
<p>If I guess it by head I get:</p>
<blockquote>
<p>true false false false true true false false</p>
</blockquote>
<p>If I cheat and compile it I get:</p>
<blockquote>
<p>true false false false true false false false</p>
</blockquote>
<p>So my question is, is </p>
<blockquote>
<p>System.out.println(c1.equals(c2));</p>
</blockquote>
<p>true or false?</p>
| <java><equals> | 2016-03-06 17:15:18 | LQ_CLOSE |
35,830,305 | Fatal error running local project with Xampp | Warning: require(C:\app-isw\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\app-isw\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\app-isw\bootstrap/../vendor/autoload.php' (include_path='.;C:\xampp\php\PEAR') in C:\app-isw\bootstrap\autoload.php on line 17
Any solution ? , I've update composer and the problem presist. | <php><laravel><laravel-5><composer-php> | 2016-03-06 17:50:29 | LQ_EDIT |
35,830,670 | NullPointerException error Array | <p>Trying to create a basic program, in which an object Swimmer and its data are created and stored to a file (simple database for swimmers). However, I am experiencing numerous run time errors, many of which are classified as NullPointerExceptions. I have a Swimmer class w/o a Constructor with methods that get names, ages, genders, etc. This class also has methods to return all this information. In my Tester class, I have created a switch that prompts the user to either Show Swimmers, Add Swimmer, Edit Swimmer, Delete Swimmer, and Exit the Program. My current error appears when adding a swimmer, specifically when setting a name. There is a Null Pointer Exception at myList[maxIndex].setName(a). </p>
<p>This is my code for my Swimmer class:
import java.io.<em>;
import java.util.</em>;</p>
<pre><code>public class Swimmer
{
private String name;
private int age;
private int gradeLevel;
private String gender;
private int grade;
private double fiftyFree;
private double hundredFree;
private double twoFree;
private double fiveFree;
private double hundredBack;
private double hundredBreast;
private double hundredFly;
private double twoIM;
Scanner kbReader = new Scanner(System.in);
public void setName(String a)
{
name = a;
}
public String getName()
{
return name;
}
public void setAge(int a)
{
age = a;
}
public int getAge()
{
return age;
}
public void setGender(String a)
{
gender = a;
}
public String getGender()
{
return gender;
}
public void setGrade(int a)
{
grade = a;
}
public int getGrade()
{
return grade;
}
public void setFiftyFree(double a)
{
fiftyFree = a;
}
public double getFiftyFree()
{
return fiftyFree;
}
public void setHundredFree(double a)
{
hundredFree = a;
}
public double getHundredFree()
{
return hundredFree;
}
public void setTwoFree(double a)
{
twoFree = a;
}
public double getTwoFree()
{
return twoFree;
}
public void setFiveFree(double a)
{
fiveFree = a;
}
public double getFiveFree()
{
return fiveFree;
}
public void setHundredBack(double a)
{
hundredBack = a;
}
public double getHundredBack()
{
return hundredBack;
}
public void setHundredBreast(double a)
{
hundredBreast = a;
}
public double getHundredBreast()
{
return hundredBreast;
}
public void setTwoIM(double a)
{
twoIM = a;
}
public double getTwoIM()
{
return twoIM;
}
public void setHundredFly(double a)
{
hundredFly = a;
}
public double getHundredFly()
{
return hundredFly;
}
public void getInfo()
{
System.out.println("Name: " + name + "\n" + "Age: " + age + "/n" + "Grade enter code here`Level: " + gradeLevel + "\n" + "Gender: " + gender);
}
}
</code></pre>
<p>And this is the code for my Main class:
import java.io.<em>;
import java.util.</em>;
import java.util.Arrays;</p>
<pre><code>public class Tester
{
public static Swimmer[] myList = new Swimmer[1000];
public static int maxIndex = 0;
public static void main(String args[]) throws IOException
{
Scanner kbReader = new Scanner(System.in);
int choice;
String swimmerName = "Default";
boolean condition = true;
while(condition)
{
System.out.println("Which of the following would you like to do?");
System.out.println("1. Show Swimmers" + "\n" + "2. Add Swimmer" + "\n" + "3. Edit Swimmer" + "\n" + "4. Delete Swimmer" + "\n" + "5. Exit");
choice = kbReader.nextInt();
switch (choice)
{
case 1:
showSwimmer();
break;
case 2:
addSwimmer();
break;
case 3:
editSwimmer();
break;
case 4:
deleteSwimmer();
break;
case 5:
condition = false;
break;
}
}
FileWriter();
}
public static void FileWriter() throws IOException
{
FileWriter fw = new FileWriter("database.txt");
PrintWriter output = new PrintWriter(fw);
for(int j = 0; j<=maxIndex; j++)
{
output.println(myList[j].getName() + " ~ " + myList[j].getAge() + " ~ " + myList[j].getGender() + " ~ " + myList[j].getGrade() + " ~ " + myList[j].getFiftyFree() + " ~ " + myList[j].getHundredFree() + " ~ " + myList[j].getTwoFree() + " ~ " + myList[j].getFiveFree() + " ~ " + myList[j].getHundredBack() + " ~ " + myList[j].getHundredBreast() + " ~ " + myList[j].getHundredFly() + myList[j].getTwoIM());
}
output.close();
fw.close();
}
public static void FileReader() throws IOException
{
Scanner sf = new Scanner(new File("database.txt"));
String s, sp[];
while(sf.hasNext())
{
maxIndex++;
s = sf.nextLine();
sp = s.split("~");
myList[maxIndex] = new Swimmer();
}
sf.close();
}
public static void swap(int a, int b)
{
Swimmer temp = myList[a];
myList[a] = myList[maxIndex];
myList[maxIndex] = temp;
}
public static void showSwimmer()
{
for(int j = 1; j < maxIndex; j++)
{
System.out.println( (j) + ". " + myList[j].getName());
}
}
public static void addSwimmer()
{
Scanner kbReader = new Scanner (System.in);
System.out.println("What is the swimmer's name? ");
String a = kbReader.nextLine();
myList[maxIndex].setName(a);
System.out.println("Is the swimmer male or female? Please enter \"m\" for male and \"f\" for female. ");
String b = kbReader.nextLine();
System.out.println("How old is he/she? ");
int c = kbReader.nextInt();
myList[maxIndex].setAge(c);
System.out.println("What is the numerical value of the swimmer's grade?");
int d = kbReader.nextInt();
myList[maxIndex].setGrade(d);
System.out.println("How many minutes does it take for this swimmer to complete the 50 Freestyle?");
double e = kbReader.nextDouble();
System.out.println("How many additional seconds does it take for this swimmer to complete the 50 freestyle?");
double f = kbReader.nextDouble();
double g = (e*60.0) + f;
myList[maxIndex].setFiftyFree(g);
System.out.println("How many minutes does it take for this swimmer to complete the 100 Freestyle?");
double h = kbReader.nextDouble();
System.out.println("How many additional seconds does it take for this swimmer to complete the 100 Freestyle?");
double i = kbReader.nextDouble();
double j = (h*60.0) + i;
myList[maxIndex].setHundredFree(j);
System.out.println("How many minutes does it take for this swimmer to complete the 200 Freestyle?");
double k = kbReader.nextDouble();
System.out.println("How many additional seconds does it take for this swimmer to complete the 200 Freestyle?");
double l = kbReader.nextDouble();
double m = (k*60.0) + l;
myList[maxIndex].setTwoFree(k);
System.out.println("How many minutes does it take for this swimmer to complete the 500 Freestyle?");
double n = kbReader.nextDouble();
System.out.println("How many additional seconds does it take for this swimmer to complete the 200 Freestyle?");
double o = kbReader.nextDouble();
double p = (n*60.0) + o;
myList[maxIndex].setFiveFree(p);
System.out.println("How many minutes does it take for this swimmer to complete the 100 Backstroke?");
double q = kbReader.nextDouble();
System.out.println("How many additional seconds does it take for this swimmer to complete the 100 Backstroke?");
double r = kbReader.nextDouble();
double s = (q*60.0) + r;
myList[maxIndex].setHundredBack(s);
System.out.println("How many minutes does it take for this swimmer to complete the 100 Breastroke?");
double t = kbReader.nextDouble();
System.out.println("How many additional seconds does it take for this swimmer to complete the 100 Breastroke?");
double u = kbReader.nextDouble();
double v = (t*60.0) + u;
myList[maxIndex].setHundredBreast(v);
System.out.println("How many minutes does it take for this swimmer to complete the 100 Butterfly?");
double w = kbReader.nextDouble();
System.out.println("How many additional seconds does it take for this swimmer to complete the 100 Butterfly?");
double x = kbReader.nextDouble();
double y = (w*60.0) + x;
myList[maxIndex].setHundredFly(y);
System.out.println("How many minutes does it take for this swimmer to complete the 200 IM?");
double z = kbReader.nextDouble();
System.out.println("How many additional seconds does it take for this swimmer to complete the 200 IM?");
double aa = kbReader.nextDouble();
double bb = (z*60.0) + aa;
myList[maxIndex].setTwoIM(bb);
maxIndex++;
}
public static void editSwimmer()
{
Scanner kbReader = new Scanner(System.in);
System.out.println("Which swimmer would you like to edit? Please enter the corresponding number.");
System.out.println(Arrays.toString(myList));
int choice = kbReader.nextInt();
}
public static void deleteSwimmer()
{
int a;
Scanner kbReader = new Scanner(System.in);
System.out.println("Which swimmer would you like to delete? Please enter the corresponding number.");
System.out.println(Arrays.toString(myList));
a = kbReader.nextInt();
swap(a-1, maxIndex);
maxIndex--;
}
}
</code></pre>
<p>I just need help with the Null Pointer Exception. Any help with backing up to a file would also be great. I have a Mac, I don't think this should alter the code too much. (Maybe just the file extension)</p>
| <java><arrays><file><nullpointerexception> | 2016-03-06 18:20:25 | LQ_CLOSE |
35,830,987 | Fused Location Provider: Is there a way to check if a location update failed? | <p><strong>Introduction</strong></p>
<p>In my app I want to get a one-off accurate location of where the user currently is. When I used <code>FusedLocationProviderApi.getLastLocation</code> sometimes this would be null or out of date location because I found out this just gets a cached location and does not request a new location update.</p>
<p>The solution was to request a location update only once as seen below.</p>
<pre><code> LocationRequest locationRequest = LocationRequest.create()
.setNumUpdates(1)
.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
.setInterval(0);
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient,locationRequest,this)
</code></pre>
<p>Now I get a more accurate location all the time.</p>
<p><strong>My Question</strong></p>
<p>How can I determine if a location update failed? Since I am only requesting 1. </p>
<p>When a location update is obtained this callback is invoked</p>
<pre><code> @Override
public void onLocationChanged(Location location) {
}
</code></pre>
<p>However this does not get called if a location update failed.</p>
<p><strong>What I have tried</strong></p>
<p>I saw there was a ResultCallback. However, onSuccess seems to be always called even if the one-off location update failed. </p>
<pre><code>LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient,locationRequest,this).setResultCallback(new ResultCallbacks<Status>() {
@Override
public void onSuccess(@NonNull Status status) {
DebugUtils.log("requestLocationUpdates ResultCallback onSuccess + " + status.toString(),true,true);
}
@Override
public void onFailure(@NonNull Status status) {
DebugUtils.log("requestLocationUpdates ResultCallback onFailure + " + status.toString(),true,true);
}
});
</code></pre>
<p><strong>Other</strong></p>
<p>Using <code>com.google.android.gms:play-services-location:8.4.0</code></p>
<p>Thanks for reading, please help me out.</p>
| <java><android><google-maps><fusedlocationproviderapi> | 2016-03-06 18:48:15 | HQ |
35,832,000 | Is their a better way to write this code? | <p>I know that this code does what I need it to do for my assignment but I can't help but feel like there is a much more...refined way to get the same results. Note that the last few outputs should only display if there have been at least 1 number(s) that are greater or less than 0</p>
<pre><code>//This program will take an unspecified number of
//integers, determine how many of those integers are
//positive and how many are negative, and finally
//compute the total and average of the integers.
import java.util.Scanner;
public class exampleWork {
public static void main(String[] args) {
//create a scanner
Scanner input = new Scanner(System.in);
//create a variable to hold the positive integers
int pos = 0;
//create a variable to hold the negative integers
int neg = 0;
//create a variable to hold the total number of entries
int total = 0;
//create a variable to hold the average
float avg = 0;
//create a counter variable
int count = 0;
//prompt user to enter integer
System.out.println("Enter an integer, the input ends if it is 0: ");
int usrInput = input.nextInt();
//determine if the number is positive, negative,
//or zero, and either place in relative variables,
//or end the loop.
if (usrInput == 0)
System.out.print("Only zero was entered");
while (usrInput != 0) {
if (usrInput > 0){
pos++;
total += usrInput;
count++;
System.out.println("Enter an integer, the input ends if it is 0: ");
usrInput = input.nextInt();
} if (usrInput < 0){
neg++;
total += usrInput;
count++;
System.out.println("Enter an integer, the input ends if it is 0: ");
usrInput = input.nextInt();
}
}
if (count > 0){
avg = (total / count);
System.out.println("The number of positives is " + pos);
System.out.println("The number of negatives is " + neg);
System.out.println("The total is " + total);
System.out.println("The average is " + avg);
}
</code></pre>
<p>}</p>
<p>}</p>
| <java> | 2016-03-06 20:15:42 | LQ_CLOSE |
35,832,105 | Access AWS from bash by IP address | <p>Do anyone possibly know how to access AWS having only server IP (239.255.255.255 for example) and .pem file from bash console in Ubuntu?</p>
| <amazon-web-services><ssh><ip> | 2016-03-06 20:25:37 | LQ_CLOSE |
35,832,355 | How to solve unhandled NameError in Python | <p>So while running the codes on the following error is generated.
It says that the NameError is left unhandled by the user code.</p>
<p>The error:</p>
<pre><code>Traceback (most recent call last):
File "D:\3rd sem\Object Oriented Programming\Lab\VS\PythonApplication1\PythonApplication1\PythonApplication1.py", line 50, in <module>
main()
File "D:\3rd sem\Object Oriented Programming\Lab\VS\PythonApplication1\PythonApplication1\PythonApplication1.py", line 10, in main
grade=str(input("Enter the grade: "))
File "<string>", line 1, in <module>
NameError: name 'a' is not defined
</code></pre>
<p>The code goes like this:</p>
<pre><code>classnum=int(input("Enter the num of classes: "))
def main():
totalcredit=0
totalgpa=0
for i in range(1,classnum+1):
print "class", i
credit=int(input("Enter the credit: "))
grade=str(input("Enter the grade: "))
totalgpa+=coursePoints(credit,grade)
totalcredit+=credit
totalcourse=classnum
semestergpa=totalgpa/totalcredit
print("Semester summary")
print("courses taken: ", classnum)
print("credits taken: ", totalcredit)
print("GPA points: ", totalgpa)
print("Semester GPA: ", semestergpa)
def coursePoints(Credit,Grade):
if Grade == 'A+' or Grade == 'a+':
return 4*Credit
elif Grade == 'A' or Grade == 'a':
return 4*Credit
elif Grade == 'A-' or Grade == 'a-':
return 3.67*Credit
elif Grade == 'B+' or Grade == 'b+':
return 3.33*Credit
elif Grade == 'B' or Grade =='b':
return 3*Credit
elif Grade == 'B-' or Grade == 'b-':
return 2.67*Credit
elif Grade == 'C+' or Grade == 'c+':
return 2.33*Credit
elif Grade == 'C' or Grade == 'c':
return 2*Credit
elif Grade == 'C-' or Grade == 'c-':
return 1.67*Credit
elif Grade =='D+' or Grade == 'd+':
return 1.33*Credit
elif Grade == 'D' or Grade == 'd':
return 1*Credit
elif Grade == 'D-' or Grade == 'd-':
return 0.33*Credit
else:
return 0
main()
</code></pre>
<p>Can anyone help for solutions.</p>
<p>Thanks in advance.</p>
| <python> | 2016-03-06 20:47:59 | LQ_CLOSE |
35,832,425 | can not found ip address from other network (iis) | I'm attempting to create a server using IIS.
I created a site. Configured the firewall. It's available in the browser as localhost(http://localhost:8555/) and static IP(http://10.12.66.79:8555/) too
But from another network like my phone. I tried accessing using the static ip but it failed. then i tried using the virtual ip then it show me the login page of my service provider.
what I can do next ? | <iis><iis-7><windows-server-2008><windows-server-2012><iis-8> | 2016-03-06 20:54:25 | LQ_EDIT |
35,832,461 | javascript cofirm not working in php file | <pre><code><script type="text/javascript">
var r = confirm("Press a button");
if (r == true) {
<?php header('location:index.php');?>
}</script>
</code></pre>
<p>//Its redirect in index.php without conformation dialog and below code execute properly no any code contain simple navigation code..</p>
<pre><code><script type="text/javascript">
var r = confirm("Press a button");
if (r == true) {
x = "You pressed OK!";
}</script>
</code></pre>
| <javascript><php> | 2016-03-06 20:57:12 | LQ_CLOSE |
35,833,332 | What are the industry standard breakpoints in Responsive Design based on the most popular devices TODAY 2016? | <p>What are the most popular breakpoints used in responsive design today? My interest is mainly mobile > tablet > desktop.</p>
<p>No opinions solicited, just hoping for concrete answers</p>
| <html><css><responsive-design> | 2016-03-06 22:20:00 | LQ_CLOSE |
35,834,165 | What is the difference between .nextLine() and .next()? | <p>I am making a program and am using user input. When I am getting a String I have always used .nextLine(), but I have also used .next() and it does the same thing. What is the difference? </p>
<pre><code>Scanner input = new Scanner(System.in);
String h = input.nextLine();
String n = input.next();
</code></pre>
<p>What is the difference? </p>
| <java><string><java.util.scanner><user-input> | 2016-03-07 00:00:29 | LQ_CLOSE |
35,834,277 | *Urgent* Why won't null GameObjects be removed from List? | for some reason my code at the bottom of function TargetEnemy() doesn't work. I try to remove the null GameObjects from the List, but they remain in the list. Any help would be appreciated. Thanks in advance!
<!-- begin snippet: js hide: false -->
<!-- language: lang-js -->
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class TurretController : MonoBehaviour {
public Transform turretBulletSpawn;
public GameObject turretBullet;
public List <GameObject> storedEnemies = new List <GameObject>();
void Start ()
{
}
void Update ()
{
TargetEnemy();
}
public void OnTriggerEnter (Collider enemyTriggered)
{
if (enemyTriggered.tag == "Enemy")
{
storedEnemies.Add(enemyTriggered.gameObject);
}
}
public void OnTriggerExit (Collider enemyTriggered)
{
storedEnemies.Remove(enemyTriggered.gameObject);
}
void TargetEnemy()
{
for (int i = 0; i < storedEnemies.Count; i++)
{
Quaternion rotate = Quaternion.LookRotation(storedEnemies[i].transform.position - transform.position);
transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * 2);
Instantiate (turretBullet, turretBulletSpawn.position, turretBulletSpawn.rotation);
if (storedEnemies[i].gameObject == null)
{
storedEnemies.RemoveAt(i);
}
}
}
}
<!-- end snippet -->
| <c#><unity3d><unityscript> | 2016-03-07 00:16:05 | LQ_EDIT |
35,834,410 | (HTML, Visual Studio) How to access an SQL server and use it as a data source in a Master Page (Markup) | I have been working on a web page in Visual Studio that allows the user to select data for an invoice. One of the areas of my page consists of a button, that when clicked, adds a drop down box as well as several text boxes in a table in the same row, every time the button is clicked, a new row is added with the same set of elements. This serves to allow the user to add several products to the invoice, which can be selected with the drop down box in each row. This is all done within the Main.Master file, through the markup section of code.
My problem however, is that I only know how to add options for the drop down box that consist of a text value. More so, I don't know how to create and reference an SQL Data source in the markup file, and use the "ProductID" field within said database as the main data for my drop down box. I'll post a summary of my questions below, then my code, any help would be much appreciated please.
**Summary**
1. How can you Connect to an SQL Server in the Main.Master file through the markup code and use it as a Data Source?
2. How would I use one of the fields within the data source as the main field for my drop down box?
**Code**
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Main.master.cs" Inherits="DatabaseDrivenWebsite.Main" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>My Website!</title>
<script type="text/javascript">
//~Function That adds the separate elements~
function addRow(btn) {
var parentRow = btn.parentNode.parentNode;
var table = parentRow.parentNode;
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
//~Product Dropdown~
var cell1 = row.insertCell(0);
var element1 = document.createElement("select");
element1.type = "select";
element1.style.width = "140px";
element1.style.zIndex = "100";
element1.style.marginLeft = "-1060px";
element1.style.position = "relative";
element1.dataset = HTMLSourceElement
cell1.appendChild(element1);
var option1 = document.createElement("option");
option1.innerHTML = "Option1";
option1.value = "1";
element1.add(option1, null);
var option2 = document.createElement("option");
option2.innerHTML = "Option2";
option2.value = "2";
element1.add(option2, null);
cell1.appendChild(element1);
//~Description Textbox~
var cell2 = row.insertCell(1);
var element2 = document.createElement("input");
element2.type = "text";
element2.style.width = "220px";
element2.style.zIndex = "100";
element2.style.marginLeft = "-1678px";
element2.style.position = "relative";
cell2.appendChild(element2);
//~Quantity Textbox~
var cell3 = row.insertCell(2);
var element3 = document.createElement("input");
element3.type = "text";
element3.style.width = "85px";
element3.style.zIndex = "100";
element3.style.marginLeft = "-1352px";
element3.style.position = "relative";
cell3.appendChild(element3);
//~List Price Textbox~
var cell4 = row.insertCell(3);
var element4 = document.createElement("input");
element4.type = "text";
element4.style.width = "82px";
element4.style.zIndex = "100";
element4.style.marginLeft = "-1165px";
element4.style.position = "relative";
cell4.appendChild(element4);
//~Sell Price Textbox~
var cell5 = row.insertCell(4);
var element5 = document.createElement("input");
element5.type = "text";
element5.style.width = "88px";
element5.style.zIndex = "100";
element5.style.marginLeft = "-972px";
element5.style.position = "relative";
cell5.appendChild(element5);
//~Total GST Textbox~
var cell6 = row.insertCell(5);
var element6 = document.createElement("input");
element6.type = "text";
element6.style.width = "90px";
element6.style.zIndex = "100";
element6.style.marginLeft = "-770px";
element6.style.position = "relative";
cell6.appendChild(element6);
//~Fuel Levy Textbox~
var cell7 = row.insertCell(6);
var element7 = document.createElement("input");
element7.type = "text";
element7.style.width = "100px";
element7.style.zIndex = "100";
element7.style.marginLeft = "-550px";
element7.style.position = "relative";
cell7.appendChild(element7);
//~Total Price Textbox~
var cell8 = row.insertCell(7);
var element8 = document.createElement("input");
element8.type = "text";
element8.style.width = "98px";
element8.style.zIndex = "100";
element8.style.marginLeft = "-325px";
element8.style.position = "relative";
cell8.appendChild(element8);
}
</script>
<link href="Style/Main.css" rel="stylesheet" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div id="MainData">
<div id="Header">This is the header</div>
<div id="Menu">
<asp:Panel ID="pnMenu" runat="server">
<a href="Home.aspx">Home</a> | <a href="Orders.aspx">Orders</a> | <a href="Finances.aspx">Finances</a>
<table style="margin-top:179px; margin-left:109px; width:999px; line-height:25px;">
<tr>
//~When clicked, this button calls the AddRow Function~
<td><button type="button" onclick ="addRow(this)" style="margin-top:-70px; margin-right:960px; position: relative; z-index: 100;">Add</button></td>
</tr>
</table>
</asp:Panel>
</div>
<div id="Content">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="Footer">Copyright 2016 DBS</div>
</div>
</form>
</body>
</html>
Here is the JSFiddle, its very rough and the formatting isn't how it looks on my official web page, but it demonstrates the code in action and how it functions.
Any help would be beyond appreciated, I couldn't find anything online that would help me out with this, it seems to be too specific.
*P.S. Scroll to the right of the preview to find the "Add" Button, click that too see the functionality of the code*
https://jsfiddle.net/5170hLsh/1/
~ Luke | <html><sql><asp.net> | 2016-03-07 00:33:56 | LQ_EDIT |
35,834,526 | How does asterisk affect expressions in Ruby? | <p>I'm confused about why does asterisk have an impact on the regular expressions results in Ruby? Example codes are below:</p>
<pre><code>2.3.0 :001 > "abbcccddddeeeee"[/z*/]
=> ""
2.3.0 :002 > "abbcccddddeeeee"[/z/]
=> nil
</code></pre>
<p>Why the first one with <code>*</code> returns an empty string, while the other one returns <code>nil</code>?</p>
<p>Thanks!</p>
| <ruby><regex><asterisk> | 2016-03-07 00:48:55 | LQ_CLOSE |
35,834,927 | Sorting through list and storing different variables | So I'm using pandas to read from a row of data that looks like this:
0 overcast
1 overcast
2 overcast
3 overcast
4 rainy
5 rainy
6 rainy
7 rainy
8 rainy
9 sunny
10 sunny
11 sunny
12 sunny
13 sunny
And I wish to store overcast (first entry) as a variable, and then iterate through the list until there is a contrasting variable, and store that one also. This should assign any other contrasting variables along the way until until the end of the list.
So in this case, I should end up with 3 variables. 0 = overcast, 1 = rainy, 2 = sunny but I want this to work just as well if there are five different conditions in a classifier, not just two or three.
I'm having a hard time figuring out the best way to do this or maybe there is something in pandas that does this for me that I'm missing? | <python><pandas> | 2016-03-07 01:42:34 | LQ_EDIT |
35,835,081 | Spring Swagger UI: what is difference between io.swagger, io.springfox, and com.mangofactory | <p>I am working on integrating the swagger UI with a spring boot MVC app and I am curious as to the differences between these libraries. </p>
<p>I looked at each on mvnrepository.com and they are all done by different groups but seem to do the same thing. I am hoping to get a clear idea of the differences between these and if one is recommended over the others. I notice the swagger-core module by io.swagger has the most usages. </p>
<p>Thanks!</p>
| <spring-mvc><swagger><swagger-ui><swagger-2.0> | 2016-03-07 02:06:32 | HQ |
35,835,371 | Is the call to super(props) in an ES6 class important? | <p>Suppose I've the following class:</p>
<pre><code>class Tabs extends React.Component {
displayName: Tabs;
static propTypes = {
selected: React.PropTypes.number,
children: React.PropTypes.oneOfType([
React.PropTypes.array,
React.PropTypes.element
]).isRequired
};
constructor() {
super();
this.state = {
selected: 0,
maxSelected: 0
};
render() {
return(
<div>
{this.props.selected}
{this.props.children}
</div>
);
}
};
</code></pre>
<p>I want to know that if passing the following constructor is important:</p>
<pre><code>constructor(props) {
super(props);
}
</code></pre>
<p>My current code works just fine but I wanted to know if this is a good practice.</p>
| <reactjs><ecmascript-6> | 2016-03-07 02:45:27 | HQ |
35,835,566 | How can I find the credit card balance regarding my code? | <pre><code>def balance (p, apr, mo):
mpr = 0.01*apr/12
for month in range(int(mo)):
p= p+p*mpr
return p
</code></pre>
<p>I'm a beginner trying to create a function that will return the balance on a credit card starting balance p and interest rate apr after mo months. When I run my code, it seems like the loop will not work.</p>
| <python> | 2016-03-07 03:10:24 | LQ_CLOSE |
35,835,649 | reading a file in hdfs from pyspark | <p>I'm trying to read a file in my hdfs. Here's a showing of my hadoop file structure.</p>
<pre><code>hduser@GVM:/usr/local/spark/bin$ hadoop fs -ls -R /
drwxr-xr-x - hduser supergroup 0 2016-03-06 17:28 /inputFiles
drwxr-xr-x - hduser supergroup 0 2016-03-06 17:31 /inputFiles/CountOfMonteCristo
-rw-r--r-- 1 hduser supergroup 2685300 2016-03-06 17:31 /inputFiles/CountOfMonteCristo/BookText.txt
</code></pre>
<p>Here's my pyspark code:</p>
<pre><code>from pyspark import SparkContext, SparkConf
conf = SparkConf().setAppName("myFirstApp").setMaster("local")
sc = SparkContext(conf=conf)
textFile = sc.textFile("hdfs://inputFiles/CountOfMonteCristo/BookText.txt")
textFile.first()
</code></pre>
<p>The error I get is: </p>
<pre><code>Py4JJavaError: An error occurred while calling o64.partitions.
: java.lang.IllegalArgumentException: java.net.UnknownHostException: inputFiles
</code></pre>
<p>Is this because I'm setting my sparkContext incorrectly? I'm running this in a ubuntu 14.04 virtual machine through virtual box. </p>
<p>I'm not sure what I'm doing wrong here....</p>
| <apache-spark><hdfs><pyspark> | 2016-03-07 03:22:15 | HQ |
35,835,670 | React router and this.props.children - how to pass state to this.props.children | <p>I'm using React-router for the first time and I don't know how to think in it yet. Here's how i'm loading my components in nested routes.</p>
<p><strong>entry point .js</strong></p>
<pre><code>ReactDOM.render(
<Router history={hashHistory} >
<Route path="/" component={App}>
<Route path="models" component={Content}>
</Route>
</Router>,
document.getElementById('app')
);
</code></pre>
<p><strong>App.js</strong></p>
<pre><code> render: function() {
return (
<div>
<Header />
{this.props.children}
</div>
);
}
</code></pre>
<p>So the child of my App is the Content component I sent in. I'm using Flux and my App.js has the state and listens for changes, but I don't know how to pass that state down to this.props.children. Before using react-router my App.js defines all children explicitly, so passing state was natural but I don't see how to do it now.</p>
| <reactjs><react-router> | 2016-03-07 03:24:47 | HQ |
35,835,747 | What are equality operators and how many are there in python | Are these all the operators in python or are there more?
Need help!
==, !=, >=, <=
| <python><operators><equality> | 2016-03-07 03:34:58 | LQ_EDIT |
35,835,950 | JavaScript Boolean Values | <p>Am I setting up the boolean values right? Because it's not working for me. Basically, on my website, I only want one alert message popping up (starting with the earliest pop up to the later one) until all fields have been checked.</p>
<hr>
<p>Example:</p>
<p>1) Validate Pizza Size (user selected a pizza size)</p>
<p>2) Validate Toppings (user did not select a pizza size)</p>
<p>3) Validate Text Area (user did not select a pizza size)</p>
<p>Result: Only pop up #2 comes up stating "Select Jalapeno!" and not pop up #3 (if that makes any sense)</p>
<hr>
<p>Here is my JavaScript:</p>
<p><a href="http://pastebin.com/6c2cxU5X" rel="nofollow">http://pastebin.com/6c2cxU5X</a></p>
| <javascript> | 2016-03-07 03:56:52 | LQ_CLOSE |
35,836,302 | Simple syntax PHP error | <p>I'm getting a syntax error </p>
<blockquote>
<p>Parse error: syntax error, unexpected 'text' (T_STRING) in C:... line 18.</p>
</blockquote>
<p>I don't exactly know why I am getting this error. The sooner the response the better. Thank you very much.</p>
<pre><code><?php
session_start();
?>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Login</title>
</head>
<body>
<div align="center">
<img src="logo.png" alt="school logo">
<h2>login</h2>
<?php
$form="<form action='./login.php' method='post'>
<table>
<tr>
<td>Email:</td>
<td>input type="text" name:"Email"/></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="text" name:"Password"/></td>
</tr>
<tr>
<td><</td>
<td><input type="submit" name="loginbtn" value="login"/></td>
</tr>
</table>
</form>";
if ($_POST['loginbtn']){
$email=$_POST["email"];
$Password=$_POST["Password"];
if($email){
if($Password){
}
else
echo"you must enter your password .$form";
}
else
echo "you must enter your email .$form";
}
else
echo"";
?>
</div>
</body>
</html>
</code></pre>
| <php><syntax-error> | 2016-03-07 04:43:25 | LQ_CLOSE |
35,838,156 | angular bootstrap dropdown to open on left | <p>I have used angular bootstrap dropdown successfully <a href="https://angular-ui.github.io/bootstrap/">link</a>.
But the problem it that the dropdown opens on the right side.
How can i make it to open on left?
Here is the markup and js i used from the given link.</p>
<p>Markup:</p>
<pre><code><div ng-controller="DropdownCtrl">
<!-- Single button with keyboard nav -->
<div class="btn-group" uib-dropdown keyboard-nav>
<button id="simple-btn-keyboard-nav" type="button" class="btn btn-primary" uib-dropdown-toggle>
Dropdown with keyboard navigation <span class="caret"></span>
</button>
<ul uib-dropdown-menu role="menu" aria-labelledby="simple-btn-keyboard-nav">
<li role="menuitem"><a href="#">Action</a></li>
<li role="menuitem"><a href="#">Another action</a></li>
<li role="menuitem"><a href="#">Something else here</a></li>
<li class="divider"></li>
<li role="menuitem"><a href="#">Separated link</a></li>
</ul>
</div>
</div>
</code></pre>
<p>js:</p>
<pre><code>angular.module('ui.bootstrap.demo').controller('DropdownCtrl', function ($scope, $log) {
$scope.items = [
'The first choice!',
'And another choice for you.',
'but wait! A third!'
];
$scope.status = {
isopen: false
};
$scope.toggled = function(open) {
$log.log('Dropdown is now: ', open);
};
$scope.toggleDropdown = function($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.status.isopen = !$scope.status.isopen;
};
$scope.appendToEl = angular.element(document.querySelector('#dropdown-long-content'));
});
</code></pre>
<p>please help</p>
| <css><angularjs><twitter-bootstrap><angular-bootstrap> | 2016-03-07 07:16:29 | HQ |
35,838,565 | How to make a picture(.png) act as a button? | I am using dreamweaver for the first time to code. I am intermediate in HTML. I've been trying to use a .png file as a button. I've found some sources stating that a
<button src=Home_button> </button>
will work, but I have tried it, and to no avail, it does not work. Any suggestions. NOTE: I am also using a CSS to build this *Very* basic website.
Cheers guys! And many thanks! | <javascript><html><css><image><button> | 2016-03-07 07:44:01 | LQ_EDIT |
35,838,829 | Looping through HTML table with javascript/jquery | I am struggling to figure out how to loop through a table in HTML.
I have a 2D javascript object that I would like to populate cells with `index i,j` from `myObject[i][j]`. I have a basic html table template but with blank `<td></td>` tags. I have looked at ways to do it in jquery and javascript, but to no avail.
Any help would be greatly appreciated. | <javascript><jquery><html><html-table> | 2016-03-07 08:02:09 | LQ_EDIT |
35,839,184 | how to solve the ` Component should be written as a pure function ` error in eslint-react? | <pre><code>class Option extends React.Component {
constructor(props) {
super(props);
this.handleClickOption = this.handleClickOption.bind(this);
}
handleClickOption() {
// some code
}
render() {
return (
<li onClick={this.handleClickOption}>{this.props.option}</li>
);
}
}
</code></pre>
<p>I use <a href="https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb" rel="noreferrer">eslint-config-airbnb</a> to check the above code and it show me an error msg like <code>Component should be written as a pure function</code> .</p>
<p>So how to change the above component to pure function?</p>
<p>Thanks for your help.</p>
| <reactjs><eslint> | 2016-03-07 08:26:16 | HQ |
35,839,247 | Java string repalceAll method | hi i want to use Java string repalceAll() method to replace "x3" with "multiplied by 3" in my text file. But there is a string occurence "xxx3" which i do not want to replace. how can I do it | <java><string><replace> | 2016-03-07 08:30:25 | LQ_EDIT |
35,839,885 | Embedding SSRS 2016 reports into another webpage without iFrame? | <p>Reporting-services 2016 (currently only available as a technical preview) comes with big-upgrades including HTML5 rendering and compliance. See: <a href="https://msdn.microsoft.com/en-us/library/ms170438.aspx" rel="noreferrer">https://msdn.microsoft.com/en-us/library/ms170438.aspx</a></p>
<p>My desire is to embed SSRS 2016 reports into another webpage using native mode (no Sharepoint or aspx, just pure HTML5).
The traditional fashion to do this is to use an iFrame.
This is an half-way okay method as it's possible to remove the toolbar, hide parameters etc but still you end up losing a lot of control over the document. This is a cross-site implementation from a different domain so I can't manipulate the contained iFrame document as I please.</p>
<p><strong>Does there exist an official way to embed the report element 'natively'?</strong>
I could envision a URL parameter option like <code>rs:Format=REPORTDIV</code> which serves me a html element.</p>
<p>I also tried fetching the report as an image (<code>rs:Format=IMAGE&rc:OutputFormat=PNG</code>) but the resulting PNG has a huge white frame (even when setting background to transparent in Report Builder) around the report element which is a no-go.</p>
| <reporting-services><ssrs-2016> | 2016-03-07 09:13:14 | HQ |
35,839,913 | Does the C# compiler treat a lambda expression as a public or private method? | <p>Internally, the compiler should be translating lambda expressions to methods. In that case, would these methods be private or public (or something else) and is it possible to change that?</p>
| <c#><compiler-optimization> | 2016-03-07 09:14:19 | HQ |
35,840,546 | get value from JavaScript object, if first 8 digits of property matched with argument? | <p>Here i need get a value from JavaScript object, if the first 8 digits of property is matched with argument.</p>
<p>Here is what I'm tried...</p>
<pre><code>var input = { 4546546512349: {}, 7200000000007: {}, 9399543200000: {} }
function find_key(query){
$.each(input, function(k, v) {
if (k.substring(0,8) == query){
console.log(k);
return k
}
});
}
find_key(45465465);
</code></pre>
<p>Is there any best solution for this. Thanks in advance.</p>
| <javascript><object> | 2016-03-07 09:49:29 | LQ_CLOSE |
35,840,688 | Xcode 7 and openCV (no Swift): Core.hpp header must be compiled as C++ | <p>I have followed the <a href="http://docs.opencv.org/2.4/doc/tutorials/ios/video_processing/video_processing.html#example-video-frame-processing-project" rel="noreferrer">instructions</a> on how to install OpenCV on an iOS project. However when using Xcode 7 I had to add manually a prefix header. Doing this unfortunately did not help and I was still getting compile errors. I then read another post suggesting that is best to add manually the imports and not use prefix headers in Xcode 7, so I did.</p>
<p>Here is my code:</p>
<pre><code>#import "ViewController.h"
#import <opencv2/opencv.hpp>
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <opencv2/highgui/cap_ios.h>
//using namespace cv;
@interface ViewController ()
{
IBOutlet UIImageView* imageView;
IBOutlet UIButton* button;
}
- (IBAction)actionStart:(id)sender;
@end
</code></pre>
<p>However I still get the following errors. </p>
<p><a href="https://i.stack.imgur.com/7AN4B.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7AN4B.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/rqCoT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rqCoT.png" alt="enter image description here"></a></p>
<p>When I uncomment the using namespace cv; I get the following:</p>
<p><a href="https://i.stack.imgur.com/VyUDH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VyUDH.png" alt="enter image description here"></a></p>
<p>I found some complex solutions talking about exposing headers to Swift etc.. I just want my project to work on Objective-C with Xcode 7 ... </p>
| <c++><ios><objective-c><xcode><opencv> | 2016-03-07 09:58:36 | HQ |
35,840,991 | ListView OnItemClick Listner does not work? | Am trying to call the fragment from the fragment, on a list view OnItemClick Listner. But the click listner does not work for me.
I have set the list items by using the adapter.
Here is my code.
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
FragmentTransaction xfragmentTransaction = mFragmentManager.beginTransaction();
xfragmentTransaction.replace(R.id.containerView,new ProductFragment()).commit();
}
}); | <android><listview><android-fragments> | 2016-03-07 10:13:25 | LQ_EDIT |
35,841,158 | *ngIf for html attribute in Angular2 | <pre><code><ion-navbar hideBackButton >
<ion-title> </ion-title>
...
...
</code></pre>
<p>I want <code>hideBackButton</code> to be there conditionally and I don't want to repeat the whole ion-navbar element with *ngIf.
Is it possible to to apply *ngIf for hideBackButton attribute? </p>
| <angular> | 2016-03-07 10:20:41 | HQ |
35,841,624 | Android Studio - Assigning multiple value to ManifestPlaceholders in Gradle | <p>I have two environment of my project one <strong>Prod</strong> another one is <strong>Staging</strong>. So whenever I have to build any of the environment, I have to change multiple keys like map key, label name and other things in manifest. So I have searched and find out some of the solutions and <strong>manifestPlaceholders</strong> is one of them. </p>
<p>Now what I want to do is to assign multiple value in <strong>manifestPlaceholders</strong>. So can I put multiple values in it and yes then how to put multiple values in it. Here is the code for the <strong>manifestPlaceholders</strong></p>
<pre><code>buildTypes {
debug {
manifestPlaceholders = [ google_map_key:"your_dev_key"]
}
release {
manifestPlaceholders = [ google_map_key:"prod_key"]
}
}
</code></pre>
| <android><android-studio><android-gradle-plugin><android-manifest> | 2016-03-07 10:41:19 | HQ |
35,841,681 | How to filter array of dictionaries using nspredicate | <p>I am having an array of dictionaries with keys "name", "image", "email" and "phone" as keys. I want to filter the dictionaries containing email and phones separately using nspredicate, passing the dictionary key as search string. How can I achieve this. </p>
| <ios><objective-c><nsdictionary><nspredicate> | 2016-03-07 10:43:51 | LQ_CLOSE |
35,841,690 | need help in jqurry | I had made a small form with no.of checkboxes..When I click on Check all checkbox then all the checkbox gets checked automatically....Following is my code....
But I have taken the following code from internet only.Although its working but as I am new to jqurry I am not able to understand the script...Please help..
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#checkAll").change(function () {
$("input:checkbox").prop('checked', $(this).prop("checked"));
alert("Yoy have checked all");
});
});
</script>
</head>
<body>
<form>
<p><label><input type="checkbox" id="checkAll"/> Check all</label></p>
<fieldset>
<legend>All Checkboxes</legend>
<p><label><input type="checkbox" /> Option 1</label></p>
<p><label><input type="checkbox" /> Option 2</label></p>
<p><label><input type="checkbox" /> Option 3</label></p>
<p><label><input type="checkbox" /> Option 4</label></p>
</fieldset>
</form>
</body>
</html> | <jquery><html> | 2016-03-07 10:44:35 | LQ_EDIT |
35,841,903 | Images are not showing good in a div | <p>I am making a wordpress website with the theme Zerif Pro. The website is <a href="http://www.solids-solutions.com/zerif/" rel="nofollow">http://www.solids-solutions.com/zerif/</a>
Under the header images you have the our foucus sections. In that sections are the images not that great. It is only good in google chrome because i use the zoom: 0.64; in css. But it only works in chrome. Can someone please help me.</p>
| <html><css><wordpress><image> | 2016-03-07 10:54:57 | LQ_CLOSE |
35,842,040 | Add border for dots in UIPageControl | <p>I want to add border color for dots in UIPageControl. Here is the small picture of it:</p>
<p><a href="https://i.stack.imgur.com/hE07m.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hE07m.png" alt="enter image description here"></a></p>
<p>I am able to put second dot by configuring it from XCode but I cannot make the first and third circles' inside empty. Is there a simple way to achieve that?</p>
<p>Thanks :)</p>
| <ios><uipagecontrol> | 2016-03-07 11:02:23 | HQ |
35,842,751 | Lombok not working with STS | <p>Although I love lombok, it gives too much problems while configuring sometimes, specially in Linux. When I was trying to install it, I was getting the following error:<a href="https://i.stack.imgur.com/5cWwl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5cWwl.png" alt="enter image description here"></a></p>
<p>I tried to set it up manually,as suggested here
<a href="https://github.com/rzwitserloot/lombok/issues/95" rel="noreferrer">https://github.com/rzwitserloot/lombok/issues/95</a>
but that didn't work out either. Any suggestions?</p>
| <spring-tool-suite><lombok> | 2016-03-07 11:38:51 | HQ |
35,843,371 | How to add random value in Json Body in Gatling? | <p>I need to create a random positive integer each time and send it to Json body in Gatling.</p>
<p>I used the below code to create a random positive ineger:</p>
<pre><code>val r = new scala.util.Random;
val OrderRef = r.nextInt(Integer.MAX_VALUE);
</code></pre>
<p>but, How can I feed the randomly generated value into the json body?</p>
<p>I tried:</p>
<pre><code>.exec(http("OrderCreation")
.post("/abc/orders")
.body(StringBody("""{ "orderReference": "${OrderRef}"}""").asJson)
</code></pre>
<p>But, this doesn't seem to work. Any clues please.</p>
<p>Thanks!</p>
| <json><gatling> | 2016-03-07 12:08:57 | HQ |
35,844,263 | Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener | <p>I have a spring project and try to make it use spring boot and to run at embadded tomcat following :</p>
<p><a href="https://spring.io/guides/gs/rest-service/" rel="noreferrer">https://spring.io/guides/gs/rest-service/</a></p>
<p>This is my Application</p>
<pre><code>//@Configuration
//@EnableAspectJAutoProxy
@SpringBootApplication
@ComponentScan(basePackages = "gux.prome")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
</code></pre>
<p>If I use maven command: <code>mvn spring-boot:run</code>, the project starts fine, but I need to debug , so I run this main method at InteliJ, exception occurs:</p>
<pre><code>Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationListener : org.springframework.boot.logging.ClasspathLoggingApplicationListener
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:414)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:394)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:385)
at org.springframework.boot.SpringApplication.initialize(SpringApplication.java:263)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at gux.prome.config.Application.main(Application.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/event/GenericApplicationListener
....
</code></pre>
<p>This is the pom:</p>
<pre><code><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>gux</groupId>
<artifactId>prome-data</artifactId>
<version>1.0-SNAPSHOT</version>
<name>prome-data Maven Webapp</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<!-- end of guava -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.2</version>
</dependency>
</dependencies>
<properties>
<java.version>1.7</java.version>
</properties>
<build>
<finalName>prome-data</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--<plugin>-->
<!-- use java 7 -->
<!--<artifactId> maven-compiler-plugin</artifactId>-->
<!--<version>3.1</version>-->
<!--<configuration>-->
<!--<source> 1.7</source> -->
<!--<target> 1.7</target>-->
<!--</configuration>-->
<!--</plugin>-->
</plugins>
</build>
<!--<repositories>-->
<!--<repository>-->
<!--<id>spring-releases</id>-->
<!--<url>http://repo.spring.io/libs-release</url>-->
<!--</repository>-->
<!--</repositories>-->
<!--<pluginRepositories>-->
<!--<pluginRepository>-->
<!--<id>spring-releases</id>-->
<!--<url>http://repo.spring.io/libs-release</url>-->
<!--</pluginRepository>-->
<!--</pluginRepositories>-->
</project>
</code></pre>
| <java><spring><maven><spring-mvc> | 2016-03-07 12:52:55 | HQ |
35,844,572 | refer to the month and year in postgresql | Hi all I'm trying to pass a script that is in mysql to PostgrSQL, but there is a sentancia this in mysql that generates me problems
is this:
$q1="select * from noticias where month(fecha)='".$elmes."' and year(fecha)='".$elanio."'";
I get the following error:
> Warning: pg_query(): Query failed: ERROR: no existe la función
> month(date) LINE 1: select * from noticias where month(fecha)='03' and
> year(fech... ^ HINT: Ninguna función coincide en el nombre y tipos de
> argumentos. Puede ser necesario agregar conversión explÃcita de
> tipos. in C:\xampp\htdocs\calendario\index.php on line 131
How do you see the month and year with postgresql? | <php><postgresql> | 2016-03-07 13:07:02 | LQ_EDIT |
35,845,039 | how base option affects gulp.src & gulp.dest | <p>I encountered an issue trying to copy a set of files and when calling .dest('some folder') the entire folder structure was lost.</p>
<p>I searched and found an answer suggesting that I should provide <code>{base:'.'}</code> as an option on my call to <code>gulp.src(...)</code> to resolve this issue.</p>
<p>The <a href="https://github.com/arvindr21/gulp/blob/master/docs/API.md#options" rel="noreferrer">documentation for gulp.src options</a> only says that its options are:</p>
<blockquote>
<p>Options to pass to node-glob through glob-stream.</p>
</blockquote>
<p>Looking into <a href="https://github.com/isaacs/node-glob#options" rel="noreferrer">node-glob documentation for its options</a> base is not listed there at all.<br>
And the <a href="https://github.com/gulpjs/glob-stream#options" rel="noreferrer">glob-stream options documentation</a> only states that </p>
<blockquote>
<p>"the Default is everything before a glob starts (see glob-parent)"</p>
</blockquote>
<p>So no much help here either.</p>
<p>So, what effect does the <code>base</code> option passed to <code>gulp.src</code> have on the viny6l files in the created stream and how does it effect the <code>gulp.dest</code> command ?</p>
| <gulp> | 2016-03-07 13:27:55 | HQ |
35,846,154 | Git rebase interactive drop vs deleting the commit line | <p>What is the difference from <code>drop</code> in the Git interactive rebase and just deleting the line of the commit?</p>
| <git><git-rebase> | 2016-03-07 14:23:57 | HQ |
35,846,258 | I need to check Date Range entered by user is overlapping dates already present in datatable C# | I have a data table with column From Date and To Date.
User entered date using two date time picker dtFrom and dtTo.
I need to check if date entered by user is overlapping From Date and To Date column present in data table. e.g.
columns in data table
FromDate ToDate
01/07/2012 30/06/2013
01/07/2013 30/06/2014
01/07/2015 30/06/2016
Now if user enter
From Date ToDate
01/07/2012 30/06/2017
I wanted to check if these dates entered by user are overlapping with dates present in data table.
Please guide and suggest me a solution for c# desktop application | <c#><date> | 2016-03-07 14:28:50 | LQ_EDIT |
35,846,986 | Android Studio not committing to GitHub | <p>I am trying to use git in Android Studio. If I choose commit changes, it says that it has successfully committed the changed files but those changes do not appear on the GitHub. Instead, if I delete the repository from GitHub and choose Share Project on GitHub, it successfully creates a new repository and uploads the files into it. This means that the connection is fine. Also, I have checked the gitignore file, the java files are not in that list. What could be the problem? </p>
| <android><git><android-studio><github> | 2016-03-07 15:02:25 | HQ |
35,848,802 | How to include JSON response body in Spring Boot Actuator's Trace? | <p>Spring Boot Actuator's <code>Trace</code> does a good job of capturing input/output HTTP params, headers, users, etc. I'd like to expand it to also capture the body of the HTTP response, that way I can have a full view of what is coming in and going out of the the web layer. Looking at the <code>TraceProperties</code>, doesn't look like there is a way to configure response body capturing. Is there a "safe" way to capture the response body without messing up whatever character stream it is sending back?</p>
| <json><spring><spring-boot><trace><spring-boot-actuator> | 2016-03-07 16:23:58 | HQ |
35,849,007 | Essence of Laziness. Haskell | <p>I am learning a haskell for a few days and the laziness is something like buzzword. Because of the fact I am not familiar with laziness ( I have been working mainly with non-functional languages ) it is not easy concept for me.</p>
<p>So, I am asking for any excerise / example which show me what laziness is in the fact. </p>
<p>Thanks in advance ;)</p>
| <haskell> | 2016-03-07 16:33:02 | LQ_CLOSE |
35,849,944 | Postgresql: SERIAL incremented on failed constraint INSERT | <p>Having a simple table structure like this:</p>
<pre><code>CREATE TABLE test (
id INT PRIMARY KEY,
sid SERIAL
);
</code></pre>
<p>I noticed if I attempt to insert a row but it fails a constraint test (i.e. PRIMARY KEY constraint), the <code>SERIAL</code> counter will increment anyway, so the next successful insert, <code>sid</code> will be <code>sid + 2</code> instead of <code>sid + 1</code>.</p>
<p>Is this normal behavior? Any way to prevent this?</p>
| <sql><postgresql> | 2016-03-07 17:19:32 | HQ |
35,850,118 | Setting state on componentDidMount() | <p>I know that it is an anti-pattern to set state on <code>componentDidMount</code> and a state should be set on <code>componentWillMount</code> but suppose I want to set the length of the number of <code>li</code> tags as a state. In that case, I can't set the state on <code>componentWillMount</code> since the <code>li</code> tags might not have been mounted during that phase. So, what should be the best option here? Will it be fine if I set the state on <code>componentDidMount</code>?</p>
| <reactjs> | 2016-03-07 17:29:13 | HQ |
35,850,685 | How to change the label from back button in Ionic 2? | <p>With the code:</p>
<pre><code><ion-navbar *navbar>
</ion-navbar>
</code></pre>
<p>the back button is enabled. But I need to customize it (the icon or the label). Is it possible?
Can't find anything in the docs/api.</p>
| <javascript><ionic-framework><ionic2> | 2016-03-07 18:00:52 | HQ |
35,851,129 | HTML form posting default values | <p>I have a HTML form in which for some fields the user will enter the values and for some some fields i want to pass some default values, is there a way to do it?</p>
| <html> | 2016-03-07 18:26:05 | LQ_CLOSE |
35,851,315 | how to send a list in python requests GET | <p>I'm trying to GET some data from the server. I'm doing a GET with the python requests library:</p>
<pre><code>my_list = #a list ['x', 'y', 'z']
payload = {'id_list': my_list}
requests.get(url, params=payload)
</code></pre>
<p>my server accepts a url: <code>https://url.com/download?id_list</code></p>
<p>but when I send this get request, I get an error:</p>
<blockquote>
<p><code><h1>400 Bad Request</h1>
The server cannot understand the request due to malformed syntax.
<br /><br /> Got multiple values for a parameter:<br />
<pre>id_list</pre></code></p>
</blockquote>
<p>I saw the log and the request looks like this:</p>
<p><code>url/download?id_list=x&id_list=y&id_list=z</code></p>
<p>how can I fix this?</p>
| <python><python-requests> | 2016-03-07 18:36:00 | HQ |
35,851,374 | Using CloudFormation to configure CloudFront with an S3 origin | <p>I am trying to use CloudFormation for the first time to configure a CloudFront distribution that uses an S3 bucket as its origin.</p>
<p>However I am receiving the error <code>One or more of your origins do not exist</code> when the template is run. I have assumed it is down to the origin DomainName being configured incorrectly, however have not been able to find a configuration that works.</p>
<p>I currently have the following template:</p>
<pre><code>{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"AssetBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": "cdn-assets",
"AccessControl": "PublicRead",
"CorsConfiguration": {
"CorsRules": [
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET"
],
"AllowedOrigins": [
"*"
],
"Id": "OpenCors",
"MaxAge": "3600"
}
]
}
}
},
"AssetCDN": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"Origins": [
{
"DomainName": {
"Fn::GetAtt": [
"AssetBucket",
"DomainName"
]
},
"Id": "AssetBucketOrigin",
"S3OriginConfig": {}
}
],
"Enabled": "true",
"DefaultCacheBehavior": {
"Compress": true,
"AllowedMethods": [
"GET",
"HEAD",
"OPTIONS"
],
"TargetOriginId": "origin-access-identity/cloudfront/AssetCDN",
"ForwardedValues": {
"QueryString": "false",
"Cookies": {
"Forward": "none"
}
},
"ViewerProtocolPolicy": "allow-all"
},
"PriceClass": "PriceClass_All",
"ViewerCertificate": {
"CloudFrontDefaultCertificate": "true"
}
}
},
"DependsOn": [
"AssetBucket"
]
}
}
}
</code></pre>
<p>I have not been able to find much advice on this, so hoping someone can point me in the right direction.</p>
| <amazon-cloudformation> | 2016-03-07 18:39:34 | HQ |
35,851,504 | top: 'include' filter delimiter is missing | <p>I'm trying to filter top's output by command, but when I type <code>O</code>, then</p>
<pre><code>COMMAND?apache2
</code></pre>
<p>I get the following error:</p>
<pre><code>'include' filter delimiter is missing
</code></pre>
<p>I've looked at the top man page, but can't seem to work out what's going on.</p>
| <linux> | 2016-03-07 18:46:17 | HQ |
35,851,650 | Starting Activity Performs onResume? | <p>Ok so I have this code in onCreate and onResume</p>
<pre><code>@Override
public void onResume()
{ // After a pause OR at startup
super.onResume();
Intent intent = getIntent();
String name2 = intent.getStringExtra(MyAdapter.KEY_VNAME);
if (name2 == null){
name2 = intent.getStringExtra(MainVoterView.KEY_VNAME2);
}
String Simage = intent.getStringExtra(MyAdapter.KEY_SUGGEST_IMAGE);
if (Simage == null){
Simage = intent.getStringExtra(MainVoterView.KEY_SUGGEST_IMAGE2);
}
layoutManager = new LinearLayoutManager(Suggestion.this);
recyclerView.setLayoutManager(layoutManager);
recyclerView.setHasFixedSize(true);
suggestList = new ArrayList<>();
requestQueue = Volley.newRequestQueue(Suggestion.this);
getData();
adapter = new SuggestListAdapter(suggestList, Suggestion.this, name2, Simage);
recyclerView.setAdapter(adapter);
}
</code></pre>
<p>When I start the activity my suggestion feed is doubled.. and when I Pause the Application and then resumes it. The suggestion feed is fixed. What I'd like to ask is does onResume Activates when starting activity. </p>
<p>And if yes What method should I use ? </p>
<p>Why would they call it onResume if every time the Activity is called the onResume executes. For what I know that's not resuming.</p>
<p>Please do enlighten me</p>
| <java><android> | 2016-03-07 18:53:47 | LQ_CLOSE |
35,851,651 | Content-Security-Policy in ASP.NET WebForms | <p>I'm looking for a good way to implement a relatively strong Content-Security-Policy header for my ASP.NET WebForms application. I'm storing as much JavaScript as possible in files instead of inline, but by default, WebForms injects <em>a lot</em> of inline script for things as simple as form submission and basic AJAX calls. </p>
<p>MVC has some simple ways to implement nonces, especially with the help of third party libraries like NWebsec, but I can't seem to find any methods of implementing them with WebForms. I wouldn't even have a problem using hashes if there were a way to predict and retrieve the hash for each .NET injected script tag. </p>
<p>I hate allowing the 'unsafe-inline' value. It feels wrong needing to turn off such a powerful security feature. Is there a reasonable way to implement it in WebForms?</p>
| <asp.net><webforms><content-security-policy> | 2016-03-07 18:53:53 | HQ |
35,851,660 | multer - req.file always undefined | <p>I've looked at a lot of answer for this same question, but I haven't found a working solution yet. I am trying to make a web app that you can upload files to using express and multer, and I am having a problem that no files are being uploaded and req.file is always undefined.</p>
<p>My code below</p>
<pre><code>'use strict';
var express = require('express');
var path = require('path');
var multer = require('multer')
var upload = multer({ dest: 'uploads/' })
var app = express();
require('dotenv').load();
app.use(express.static(path.join(__dirname, 'main')));
app.post('/upload', upload.single('upl'), function (req, res, next) {
// req.file is the `avatar` file
// req.body will hold the text fields, if there were any
console.log(req.file);
res.status(204).end();
})
var port = process.env.PORT || 8080;
app.listen(port, function () {
console.log('Node.js listening on port ' + port + '...');
});
</code></pre>
<p>The form</p>
<pre><code> <form class="uploadForm" action="/upload" method="post" enctype="multipart/formdata">
<label class="control-label">Select File</label>
<input name="upl" id="input-1" type="file" class="file">
<input type="submit" value="submit" />
</form>
</code></pre>
<p>Help very much appreciated, this is driving me crazy.</p>
| <javascript><node.js><express><multer> | 2016-03-07 18:54:26 | HQ |
35,851,719 | How to compare classes and interfaces? | <p>Can anybody explain me how to compare KClasse-s and interfaces among yourselves? I known how to check that classes or interfaces are equal but I don't understand how to check that A class is superclass of B class, etc.</p>
<pre><code>interface IB {}
interface IC : IB {}
open class A {}
open class B : A() {}
open class C : B(), IC {}
fun main(args: Array<String>) {
if (B::class == B::class) { println("B class is equal to B class") }
if (IB::class == IB::class) { println("IB interface is equal to IB interface") }
if (A::class ??? B::class) { println("A class is parent of B class") }
if (A::class ??? C::class) { println("A class is superclass of C class") }
if (C::class ??? IC) { println("C class is implement IC interface") }
if (IC ??? IB) { println("IC interface is implement IB interface") }
}
</code></pre>
| <kotlin> | 2016-03-07 18:57:18 | HQ |
35,851,788 | Include local web app into react native webview | <p>Within my react-native app I want to show a webview, that loads a local html5 web application (single page app, SPA).</p>
<p>I am able to load an html file, that is located within the relative folder <code>webapp</code> using</p>
<pre><code>var webapp = require('./webapp/index.html');
</code></pre>
<p>and</p>
<pre><code><WebView source={webapp}></WebView>
</code></pre>
<p>as I have stated in this thread: <a href="https://stackoverflow.com/questions/33506908/react-native-webview-load-from-device-local-file-system">react native webview load from device local file system</a></p>
<p>Unfortunately, the assets of this local webapp like the .js and .css files, aren't loaded by the webapp.</p>
<p>During development of the react-native app, these files are available via the development server. Though, when the app is packed and run on an iOS device, the assets aren't available (I get a 404 error in Safari developer tools).</p>
<p>How can I make sure, that all of the assets (JS, CSS, etc.) within the <code>webapp</code> folder are available in the packaged app local.</p>
| <javascript><css><webview><react-native><single-page-application> | 2016-03-07 19:00:39 | HQ |
35,851,837 | Redux and within a reducer accessing a different reducer, how? | <p>So, I have an app that has multiple reducers, and thus multiple action creators associated.</p>
<p>There is a time in which one of my reducers updates the state (because of an edit), and as such, I have to then make sure the other reducers see this update and adjust their state accordingly. </p>
<p>think of it as if a user selects "sneakers", and this state management is in a reducer called productsReducer. As such, as a user moves thru the app process, they get couponsReducer associated with it... but the user can "edit" at any time, so if they then edit "sneakers" and say, choose another producer, I have to be able to alter the couponsReducer in real time, because a progress modal needs to reflect this. I can do this via going thru the flow to the coupon page, because on that page I just reconcile the data on componentWillMount... but the rub is I have a progress modal, and prior to getting to the coupons page, a user can open the progress modal... and there will be a missmatch here...</p>
<p>long winded I know, I just wanted to explain my situation.</p>
<p>so, I want to be able to call "other reducers" or their action creators from within the productsReducer. </p>
<p>Would a middleware be appropriate here, in which I sniff for a certain "action.type" and if I see it, I can dispatch other action.type's or is there a way to call action creators from within the productsReducer?</p>
<p>importing: import * as coupons from './couponsActions' and any other actions I need seem inappropriate.</p>
| <redux><react-redux> | 2016-03-07 19:03:00 | HQ |
35,851,949 | How to load chosen alternative css as default css? | <p>I made a light and dark css for my web. Light css as default and dark css as alternative. It works perfectly with the help of JavaScript. Now the problem is, if a user select dark version and refresh the page or go to next page, it goes back to light css again. I need my web to load dark css as default css if a user select dark css. How will be it made? Is it with the help of JavaScript? If yes please give the codes too.</p>
<p>Thanks</p>
| <javascript><css><web> | 2016-03-07 19:09:40 | LQ_CLOSE |
35,852,273 | Why thos for loop isnt working? | Hello i have loop like this:
char word[10];
word[0] = 'a';
word [1] = 'b';
word[2] = 'c';
word[3] = '\0';
char* ptr = word;
int x = 0;
int counter = 0;
for ( char c = *(ptr + x); c == '\0'; c = *(ptr + x))
{
counter++;
x++;
}
After execution of this loop counter is equal to 0. I dont know why.
Any ideas why this loop exits? | <c><for-loop> | 2016-03-07 19:27:29 | LQ_EDIT |
35,852,577 | I am building a child control application in php and an android app to track the device down? | <p>Any advice on should I go about linking a parent to certain child a mysql database.
I don't have any code for just yet I would like some more experienced advise.</p>
| <php><mysql><json><html><phpmyadmin> | 2016-03-07 19:43:43 | LQ_CLOSE |
35,852,675 | Python 3 - convert mathematical action to integer | <p>I have a string with a formula <i>5 - 3</i>, and I need to get the result in integer. How could I do that?</p>
| <python><string><python-3.x> | 2016-03-07 19:48:29 | LQ_CLOSE |
35,852,722 | How do you read a password protected excel file into r? | <p>How do you read a password protected excel file into r? </p>
<p>I have tried excel.link but its not available for R version 3.2.3 (My version)</p>
<p>I also tried RDCOMClient but it is also not available for R version 3.2.3</p>
| <r><excel> | 2016-03-07 19:51:21 | HQ |
35,853,179 | How to remove duplicates from an unordered Immutable.List()? | <p>How would one remove duplicates from an unordered Immutable.List()?
(without using toJS() or toArray())</p>
<p>e.g.</p>
<pre><code>Immutable.List.of("green", "blue","green","black", "blue")
</code></pre>
| <immutable.js> | 2016-03-07 20:17:36 | HQ |
35,853,593 | Minify android app but do not obfuscate it | <p>When I do not minify my app I reach the maximum method count and building the dex file fails. This can be avoided by enabling <code>minify</code> in <code>build.gradle</code>. The downside, however, is that now the code gets obfuscated. This is OK for the Release build but it is problematic for a Debug build.</p>
<p>Is there a way to tell gradle to minify a Debug build but not obfuscate it?</p>
| <android><gradle><proguard> | 2016-03-07 20:41:33 | HQ |
35,853,958 | C++ Why int r = (int, int, int); doesn't give error and r has the value of the last integer? | I faced this question, r always has the las integer between the ().
What is the output of the following program?
#include<isotream>
using namespace std;
main() {
int i = 1, j = 2, k = 3, r;
r = (i, j, k);
cout<<r<<endl;
}
A - 1
B - 2
C - 3
D - Compile Error
What I wanna know is why it is happening. | <c++><comma> | 2016-03-07 21:02:32 | LQ_EDIT |
35,853,986 | Easiest way to reset git config file | <p>I am finally getting around to learning git. However, I unwisely started messing around with it awhile back (before I really knew what I was doing) via Sourcetree. Now that I'm trying to go through it, I have a pretty large list of settings. When I input: </p>
<pre><code>git config --list
</code></pre>
<p>I get the following result:</p>
<pre><code>core.excludesfile=~/.gitignore
core.legacyheaders=false
core.quotepath=false
core.pager=less -r
mergetool.keepbackup=true
push.default=simple
color.ui=auto
color.interactive=auto
repack.usedeltabaseoffset=true
alias.s=status
alias.a=!git add . && git status
alias.au=!git add -u . && git status
alias.aa=!git add . && git add -u . && git status
alias.c=commit
alias.cm=commit -m
alias.ca=commit --amend
alias.ac=!git add . && git commit
alias.acm=!git add . && git commit -m
alias.l=log --graph --all --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset'
alias.ll=log --stat --abbrev-commit
alias.lg=log --color --graph --pretty=format:'%C(bold white)%h%Creset -%C(bold green)%d%Creset %s %C(bold green)(%cr)%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
alias.llg=log --color --graph --pretty=format:'%C(bold white)%H %d%Creset%n%s%n%+b%C(bold blue)%an <%ae>%Creset %C(bold green)%cr (%ci)' --abbrev-commit
alias.d=diff
alias.master=checkout master
alias.spull=svn rebase
alias.spush=svn dcommit
alias.alias=!git config --list | grep 'alias\.' | sed 's/alias\.\([^=]*\)=\(.*\)/\1\ => \2/' | sort
include.path=~/.gitcinclude
include.path=.githubconfig
include.path=.gitcredential
diff.exif.textconv=exif
credential.helper=osxkeychain
core.excludesfile=/Users/myusername/.gitignore_global
difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"
difftool.sourcetree.path=
mergetool.sourcetree.cmd=/Applications/SourceTree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"
mergetool.sourcetree.trustexitcode=true
user.name=My Name
user.email=myemail@email.com
</code></pre>
<p>And that seems like more than what I want to start with since the tutorial that I'm working through doesn't pull all of that up.</p>
<p>Is there a way to "Reset" the config file to a default state?</p>
| <git> | 2016-03-07 21:05:04 | HQ |
35,854,197 | How to use openCV's connected components with stats in python? | <p>I am looking for an example of how to use OpenCV's ConnectedComponentsWithStats() function in python, note this is only available with OpenCV 3 or newer. The official documentation only shows the API for C++, even though the function exists when compiled for python. I could not find it anywhere online.</p>
| <python><opencv><connected-components> | 2016-03-07 21:16:44 | HQ |
35,855,028 | PHP form posting blank data in to mysql table | <p>I've created a form in order to post data in to a mysql database but when I submit the form it just enters blank data. I'm fairly new to PHP and mysql so if you can help using the simplest explanation, not assuming any great in depth knowledge that would be really appreciated.</p>
<pre><code> <?php
DEFINE('DB_USERNAME', 'root');
DEFINE('DB_PASSWORD', 'root');
DEFINE('DB_HOST', 'localhost');
DEFINE('DB_DATABASE', 'users');
$con = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE);
if(!$con) {
echo 'not connected to server';
}
if (!mysqli_select_db($con, 'users'))
{
echo 'no database selected';
}
$name = $_POST["name"];
$email = $_POST["email"];
$band = $_POST["band"];
$sql = "INSERT INTO users (Names, Emails, BandName) VALUES ('$name', '$email', '$band')";
if (!mysqli_query($con, $sql))
{
echo 'Not worked';
} else {
echo 'worked';
}
?>
</code></pre>
| <php><mysql> | 2016-03-07 22:05:13 | LQ_CLOSE |
35,855,781 | Having services in React application | <p>I'm coming from the angular world where I could extract logic to a service/factory and consume them in my controllers.</p>
<p>I'm trying to understand how can I achieve the same in a React application.</p>
<p>Let's say that I have a component that validates user's password input (it's strength). It's logic is pretty complex hence I don't want to write it in the component it self.</p>
<p>Where should I write this logic? In a store if I'm using flux? Or is there a better option?</p>
| <reactjs><reactjs-flux> | 2016-03-07 22:53:47 | HQ |
35,856,013 | Rotate all html element (whole page) 90 degree with CSS? | <p>I want to display every thing in the page rotated consistently and dependently 90 degree, I tried to do it but the result was inaccurate and each element rotated independently.</p>
| <html><css><rotation><htmlelements> | 2016-03-07 23:12:52 | HQ |
35,856,261 | Haskell. Why is :info (:) returns the definition twice? | <p>I'm new to haskell.</p>
<p>If I type in GHCi (7.10.3):</p>
<pre><code>:info (:)
</code></pre>
<p>I get result:</p>
<pre><code>*** Parser:
data [] a = ... | a : [a] -- Defined in ‘GHC.Types’
infixr 5 :
data [] a = ... | a : [a] -- Defined in ‘GHC.Types’
infixr 5 :
</code></pre>
<p>Does it means that operator is defined twice?
I didn't find any suspicious things in the source =/</p>
| <haskell><types><infix-notation> | 2016-03-07 23:34:48 | HQ |
35,856,911 | How can I set breakpoints by the sourcefile line number in Delve? | <p>The title pretty much says it all. </p>
<p>The only way I know how to set one is either during the runtime of the program or just before with <code>breakpoint main.main</code></p>
<p>Is there a way I can do this by line number like <code>breakpoint ./otherfile.go:200</code>?</p>
| <debugging><go><delve> | 2016-03-08 00:43:20 | HQ |
35,857,271 | Get current filename in Babel Plugin? | <p>I'm attempting to write a plugin for babel, and am needing the filename of the current file that is being parsed. I know the lines of the code are passed in, but I haven't managed to find a reference to the filename. Any help??</p>
<p>For instance given this code what could I do</p>
<pre><code>export default function({ types: t }) {
return {
visitor: {
Identifier(path) {
// something here??
}
}
};
}
</code></pre>
| <babeljs> | 2016-03-08 01:23:58 | HQ |
35,857,653 | two tiny python questions | <pre><code>fn = raw_input("Enter file to open: ")
fileObject = open(fn,'r+')
dictionary = {}
for line in fileObject:
x = line.split(":")
a = x[0]
b = x[1]
c = len(b)-1
b = b[0:c]
dictionary[a] = b
print dictionary
</code></pre>
<p>After I tested my program, I found out everything were perfect except for 2 tiny issues. Can you please tell me what is wrong?</p>
<p>My text file has the following in it:</p>
<p>username1:password1</p>
<p>username2:password2 </p>
<p>username3:password3</p>
<p>username4:password4</p>
<p>username5:password5</p>
<p>(This is an empty line in the actual text file)</p>
<p>First problem:
My program reads the file into a dictionary perfectly but it is reading <strong>out of order</strong>, i tried to print the dictionary after the reading into the dictionary part and below is what I got.</p>
<pre><code> {'username1': 'password1', 'username3': 'password3', 'username2': 'password2', 'username5': 'password5', 'username4': 'password4'}
</code></pre>
<p>Second problem:</p>
<p>for the text file, after password5, I have to hit enter and save the text file to get this:</p>
<pre><code> {'username1': 'password1', 'username3': 'password3', 'username2': 'password2', 'username5': 'passwor**d5'**, 'username4': 'password4'}
</code></pre>
<p>if I don't hit enter at the end of the text file, then it will become this:</p>
<pre><code> {'username1': 'password1', 'username3': 'password3', 'username2': 'password2', 'username5': 'passwo**rd'**, 'username4': 'password4'}
</code></pre>
| <python><python-2.7><python-3.x> | 2016-03-08 02:10:41 | LQ_CLOSE |
35,857,918 | HOW CAN I DO A RECURSIVE PRINT USING CLASS LINKED LIST | //PROTOYPE
void Display();
//CALL
list.Display();
/***********************************
* Print the contents of the list *
***********************************/
void EmployeeList::Display()
{
// Temporary pointer
newEmployee * tmp;
tmp = head;
// No employees in the list
if(tmp == NULL )
{
cout << "\n\n\t\t***THERE IS NO EMPLOYEE INFORMATION STORED YET***\n";
return;
}
cout << "\n\n"
<< "\t\t************************************************\n"
<< "\t\t* Employee IDs and Yearly Salary DataBase *\n"
<< "\t\t************************************************\n\n";
cout << "\t\t\tEmployee IDs" << setw(20) << right << "Yearly Salaries\n";
// One employee in the list
if(tmp->Next() == NULL )
{
cout << "\t\t\t " << tmp->empID() << setw(13) << right << " "
<< "$" << setw(2) << tmp->ySalary() << endl;
}
else
{
do
{
cout << "\t\t\t " << tmp->empID() << setw(13) << " "
<< right << "$" << setw(2) << tmp->ySalary() << endl;
tmp = tmp->Next();
}while(tmp != NULL );
cout << "\n\t\t\t ***Thank You***" << endl;
}
}
I NEED HELP ON WHAT TO WRITE IN ORDER TO DO A RECURSIVE function call FOR Display function.
I need to display the list in reverse order from last to first.
HOW CAN I DO A RECURSIVE PRINT USING CLASS LINKED LIST
I NEED HELP ON WHAT TO WRITE IN ORDER TO DO A RECURSIVE function call FOR Display function.
I need to display the list in reverse order from last to first. | <c++><linked-list><abstract-class> | 2016-03-08 02:39:02 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.