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 |
|---|---|---|---|---|---|
37,685,299 | trying to insert image into my data base all the time saving the same thing? | While i am trying to insert image into my data base it all the time saves this:
> 0xFFD8FFE145AB4578696600004D4D002A00000008000A011200030000000100000000021300030000000100010000011A0005000000010000018E011B0005000000010000019601280003000000010002000001320002000000140000019E010F000200000064000001B201100002000000640000021687690004000000010000
even if the image is null
plss helpppp
the c#:
if (FileUpload1.PostedFile.FileName!="")
{
Byte[] image;
Stream s = FileUpload1.PostedFile.InputStream;
BinaryReader br = new BinaryReader(s);
image = br.ReadBytes((Int32)s.Length);
SqlCommand NewUser = new SqlCommand("INSERT INTO [User] Values (@username,@password,@name,@lastname,@location,@profesion,@email,@gender,@money,@pro,@xp,@lv,@m1,@m2,@m3,@m4,@m5,@d1,@d2,@d3,@d4,@d5,@im,@phone);", c);
NewUser.Connection = c;
NewUser.Parameters.AddWithValue("@username", txtuser.Text);
NewUser.Parameters.AddWithValue("@password", txtpass.Text);
NewUser.Parameters.AddWithValue("@name", txtFName.Text);
NewUser.Parameters.AddWithValue("@lastname", txtLName.Text);
NewUser.Parameters.AddWithValue("@location", ddlcountry.SelectedItem.Text);
NewUser.Parameters.AddWithValue("@profesion", txtprofession.Text);
NewUser.Parameters.AddWithValue("@email", txtemail.Text);
NewUser.Parameters.AddWithValue("@gender", rbgendere.SelectedItem.Text);
NewUser.Parameters.AddWithValue("@money", 0);
NewUser.Parameters.AddWithValue("@pro", DBNull.Value);
NewUser.Parameters.AddWithValue("@xp", 0);
NewUser.Parameters.AddWithValue("@lv", 1);
NewUser.Parameters.AddWithValue("@m1", 0);
NewUser.Parameters.AddWithValue("@m2", 0);
NewUser.Parameters.AddWithValue("@m3", 0);
NewUser.Parameters.AddWithValue("@m4", 0);
NewUser.Parameters.AddWithValue("@m5", 0);
NewUser.Parameters.AddWithValue("@d1", 0);
NewUser.Parameters.AddWithValue("@d2", 0);
NewUser.Parameters.AddWithValue("@d3", 0);
NewUser.Parameters.AddWithValue("@d4", 0);
NewUser.Parameters.AddWithValue("@d5", 0);
NewUser.Parameters.AddWithValue("@im", image);
NewUser.Parameters.AddWithValue("@phone", PhoneNumber.Text);
Session["CurentUserid"] = txtuser.Text;
c.Open();
int row=NewUser.ExecuteNonQuery();
c.Close();
if (row>0)
{
LabelError.Text = "success";
}
Session["Conect"] = (bool)true;
Response.Redirect("Finish Had Member.aspx", true);
}
else
{
SqlCommand NewUser = new SqlCommand("INSERT INTO [User] Values (@username,@password,@name,@lastname,@location,@profesion,@email,@gender,@money,@pro,@xp,@lv,@m1,@m2,@m3,@m4,@m5,@d1,@d2,@d3,@d4,@d5,@im,@phone);", c);
NewUser.Connection = c;
NewUser.Parameters.AddWithValue("@username", txtuser.Text);
NewUser.Parameters.AddWithValue("@password", txtpass.Text);
NewUser.Parameters.AddWithValue("@name", txtFName.Text);
NewUser.Parameters.AddWithValue("@lastname", txtLName.Text);
NewUser.Parameters.AddWithValue("@location", ddlcountry.SelectedItem.Text);
NewUser.Parameters.AddWithValue("@profesion", txtprofession.Text);
NewUser.Parameters.AddWithValue("@email", txtemail.Text);
NewUser.Parameters.AddWithValue("@gender", rbgendere.SelectedItem.Text);
NewUser.Parameters.AddWithValue("@money", 0);
NewUser.Parameters.AddWithValue("@pro", DBNull.Value);
NewUser.Parameters.AddWithValue("@xp", 0);
NewUser.Parameters.AddWithValue("@lv", 1);
NewUser.Parameters.AddWithValue("@m1", 0);
NewUser.Parameters.AddWithValue("@m2", 0);
NewUser.Parameters.AddWithValue("@m3", 0);
NewUser.Parameters.AddWithValue("@m4", 0);
NewUser.Parameters.AddWithValue("@m5", 0);
NewUser.Parameters.AddWithValue("@d1", 0);
NewUser.Parameters.AddWithValue("@d2", 0);
NewUser.Parameters.AddWithValue("@d3", 0);
NewUser.Parameters.AddWithValue("@d4", 0);
NewUser.Parameters.AddWithValue("@d5", 0);
NewUser.Parameters.AddWithValue("@im", DBNull.Value);
NewUser.Parameters.AddWithValue("@phone", PhoneNumber.Text);
Session["CurentUserid"] = txtuser.Text;
c.Open();
NewUser.ExecuteNonQuery();
c.Close();
Session["Conect"] = (bool)true;
Response.Redirect("Finish Had Member.aspx", true);
}
| <c#><sql-server> | 2016-06-07 17:07:54 | LQ_EDIT |
37,686,124 | perl search and replace with Tie | my search and replace is not working neither it is throwing any error,
i tried to modify the code and provide the i/p where it is working, not sure where the error occurs
while compling the code does't provide an error
> #!/usr/bin/perl -w
> use strict;
> use warnings;
> use diagnostics;
> use Tie::File;
> use v5.10;
> use File::Compare;
> my $VAR; $VAR=$ARGV[0];chomp $VAR;
> my $nam=qq~file_name~;/*FILENAME
> my @lines;
> our $s1="var1";/*STINGS
> our $s2="var2";/*STRINGS
> if ('$s1' ne '$s2')/*comparing the 2 stings
> {
> replace();
> }
> sub replace {/* for replacing the stings in file
> chomp $s1;chomp $s2;
> tie @lines, 'Tie::File', "$nam" or die " can't open the file\n";
> foreach (@lines)
> {
> s/$s2/$s1/g;/*replacing the strings
> }
> untie @lines;
> };
| <perl> | 2016-06-07 17:53:50 | LQ_EDIT |
37,686,360 | i want play video through url of you tube in android application plz help me? | i want play video through url of you tube in android application plz help me??i want play video Using Video View .
| <android><youtube><android-videoview> | 2016-06-07 18:07:44 | LQ_EDIT |
37,686,992 | C - i++ not working inside a while loop | So, I'm helping a friend with her programing class, and we've come across something funny. I have the next code:
void ingresardatos(struct alumno *lista){
int i=0;
char continuar='s';
while(continuar=='s' && i<20){
printf("Valor de i al iniciar: %d \n", i);
printf("Introduzca el nombre del alumno:\n");
scanf("%s",&(lista[i].nombre));
printf("Introduzca la matricula:\n");
scanf("%s",&lista[i].matricula);
printf("Introduzca la primera calificacion:\n");
scanf("%f",&lista[i].calf1);
printf("Introduzca la segunda calificacion:\n");
scanf("%f",&lista[i].calf2);
printf("Introduzca la tercera caificacion:\n");
scanf("%f",&lista[i].calf3);
lista[i].prom=(lista[i].calf1+lista[i].calf2+lista[i].calf3)/3;
if(lista[i].prom<=5.9){
strcpy(lista[i].nota,"NA");
}
else if(lista[i].prom>=6 && lista[i].prom<=7.3){
strcpy(lista[i].nota,"S");
}
else if(lista[i].prom>=7.4 && lista[i].prom<=8.6){
strcpy(lista[i].nota,"B");
}
else if(lista[i].prom>=8.7 && lista[i].prom<=10){
strcpy(lista[i].nota,"MB");
}
printf("Valor de i antes: %d \n", i);
i++;
printf("Valor de i después: %d \n", i);
printf("¿Desea continuar? (S/N)");
scanf("%s",&continuar);
}
}
It's supposed to be a grade list for a class of 20; you introduce the student's data until you press "n", and it saves them on a list. Now, I figured out the pointer part (I just really know Java, so it's kinda weird working on C), but what I can't figure out is how to make the i++ part work. If you run it like it is, it'll start with i=0 on the first pass, then go through all the code, and finally do i++ before asking if you want to continue (it prints it on the screen). But then, when you press "s" to indicate you want to continue, it'll start with i=0 again, and for the life of me I can't figure out why. I tried i++, ++i, i=i+1, and so on, but nothing seems to work. I even tried making i a pointer, but Windows didn't like it and crashed my program everytime I ran it.
If someone could explain just why it isn't working, I'd be eternaly greatful. I've been at it for days now, and I can't figure it out. | <c><counter> | 2016-06-07 18:44:11 | LQ_EDIT |
37,688,955 | jquery not sending date in query string | i have this html code.
<form class="" role="form">
<div class="col-lg-2">
<div class="form-group">
<label for="streams">Select Stream</label>
<select name="streams" id="streams" class="form-control">
<option value="">-- Select --</option>
<?php
while($streamRow = mysql_fetch_array($streamResult)) {
echo
"<option value=".$streamRow[0].">".$streamRow[1]."</option>";
}
?>
</select>
</div>
</div>
<div class="col-lg-2">
<div class="form-group">
<label for="branches">Select Branch</label>
<select name="branches" id="branches" class="form-control">
<option value="">-- Select --</option>
</select>
</div>
</div>
<div class="col-lg-2">
<div class="form-group">
<label for="batches">Select Batch</label>
<select name="batches" id="batches" class="form-control">
<option value="">-- Select --</option>
</select>
</div>
</div>
<div class="col-lg-2">
<div class="form-group divBefore">
<label for="divisionBefore">Div</label>
<select name="divisionBefore" id="divisionBefore" class="form-control">
<option value="">Sel</option>
</select>
</div>
<div class="form-group divAfter hide">
<label for="division">Div</label>
<select name="division" id="division" class="form-control">
<option value="">Sel</option>
<?php
$divisionResult = mysql_query("SELECT * FROM division");
while($divisionRow = mysql_fetch_array($divisionResult)) {
echo
"<option value=".$divisionRow[0].">".$divisionRow[1]."</option>";
}
?>
</select>
</div>
</div>
<div class="col-lg-2">
<div class="form-group semesterBefore">
<label for="semBefore">Sem</label>
<select name="semBefore" id="semBefore" class="form-control">
<option value="">Sel</option>
</select>
</div>
<div class="form-group semesterAfter hide">
<label for="sem">Sem</label>
<select name="sem" id="sem" class="form-control">
<option value="">Sel</option>
</select>
</div>
</div>
<div class="col-lg-2">
<div class="form-group subject">
<label for="subject">Select Subject</label>
<select name="subject" id="subject" class="form-control">
<option value="">-- Select --</option>
</select>
</div>
</div>
<!--<div class="col-lg-2" id="lecBefore">
<div class="form-group">
<label for="subject">Select Lecture</label>
<select name="lect" id="lect" class="form-control">
<option value="">-- Select --</option>
</select>
</div>
</div>
<div class="col-lg-2 hide" id="lecAfter">
<div class="form-group">
<label for="subject">Select Lecture</label>
<select name="lecture" id="lecture" class="form-control">
<option value="">-- Select --</option>
<option value="1">Lecture 1</option>
<option value="2">Lecture 2</option>
<option value="3">Lecture 3</option>
<option value="4">Lecture 4</option>
<option value="5">Lecture 5</option>
<option value="6">Lecture 6</option>
<option value="7">Lecture 7</option>
<option value="8">Lecture 8</option>
</select>
</div>
</div>-->
<div class="col-lg-2 hide" id="date">
<div class="form-group">
<label for="dateNow">Start Date</label> <br>
<div class="input-group date" id="avsDate">
<input type="text" class="form-control" name="avsDateTxt" id="avsDateTxt" readonly value="<?php echo date('d-m-Y');?>"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>
</div>
</div>
<div class="col-lg-2 hide" id="date1">
<div class="form-group">
<label for="dateNow">End Date</label> <br>
<div class="input-group date" id="endDate">
<input type="text" class="form-control" name="endDateTxt" id="endDateTxt" readonly value="<?php echo date('d-m-Y');?>"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>
</div>
</div>
</form>
and my jquery is.
$(document).ready(function() {
$('.sidebar-menu .attnd').addClass('active');
$('.sidebar-menu .attnd .genExcel').addClass('active');
$(".sidebar-menu .attnd").tree();
$('#streams').change(function() {
$('#branches').html("<option value=''>-- Select --</option>");
$('#batches').html("<option value=''>-- Select --</option>");
$('.divAfter').hide();
$('.divBefore').show();
$('.semesterAfter').hide();
$('.semesterBefore').show();
$('#date').hide();
$('#date1').hide();
$('#lecAfter').hide();
$('#lecBefore').show();
$('#studManip').html('');
if($(this).val() != '')
$.streamSelection($(this).val());
});
$('#branches').change(function() {
$('#batches').html("<option value=''>-- Select --</option>");
$('.divAfter').hide();
$('.divBefore').show();
$('.semesterAfter').hide();
$('.semesterBefore').show();
$('#date').hide();
$('#date1').hide();
$('#lecAfter').hide();
$('#lecBefore').show();
$('#studManip').html('');
if($(this).val() != '')
$.branchSelection($(this).val());
});
$('#batches').change(function() {
$('.divAfter').hide();
$('.divBefore').show();
$('.semesterAfter').hide();
$('.semesterBefore').show();
$('#date').hide();
$('#date1').hide();
$('#lecAfter').hide();
$('#lecBefore').show();
$('#studManip').html('');
if($(this).val() != '') {
$.listSemester($(this).val());
$('.divBefore').hide();
$('#division').val('');
$('.divAfter').show();
}
});
$('#division').change(function() {
$('.studList').hide();
$('.semesterAfter').hide();
$('.semesterBefore').show();
$('#date').hide();
$('#date1').hide();
$('#lecAfter').hide();
$('#lecBefore').show();
$('#studManip').html('');
if($(this).val() != '') {
$('.semesterBefore').hide();
$('#sem').val('');
$('.semesterAfter').show();
}
});
$('#sem').change(function() {
$('#date').hide();
$('#date1').hide();
$('#lecAfter').hide();
$('#lecBefore').show();
$('#studManip').html('');
if($(this).val() != '')
$.searchSubject();
});
$('#subject').change(function() {
if($(this).val() != '') {
$.when($('#date').show())
.then($('#date1').show())
.then($('.btnExcel').show());
}
});
/*$('#lecture').change(function() {
$.when($('#date').hide())
.then($('#studManip').html(''));
if($(this).val() != '') {
$('#date').show();
$.when($.searchStudent())
.then($('#studManip').show());
}
});*/
$('#avsDate').datepicker({
format: "dd-mm-yyyy",
startDate: "01-01-2012",
endDate: '<?php echo date('d-m-Y')?>',
todayBtn: "linked",
autoclose: true,
todayHighlight: true,
});
$('#endDate').datepicker({
format: "dd-mm-yyyy",
startDate: "01-01-2012",
endDate: '<?php echo date('d-m-Y')?>',
todayBtn: "linked",
autoclose: true,
todayHighlight: true,
});
$('#avsDate').datepicker().on('changeDate', function(e) {
$.when($('.btnExcel').attr('href', 'studExcel.php?streamId='+$('#streams').val()+'&branchId='+$('#branches').val()+'&batchId='+$('#batches').val()+'&divisionId='+$('#division').val()+'&semId='+$('#sem').val()+'&sDate='+$('#advDatetxt').val()+'&eDate='+$('#endDatetxt').val()))
.then($('.btnExcel').show());
});
$('#endDate').change(function() {
$.when($('.btnExcel').attr('href', 'studExcel.php?streamId='+$('#streams').val()+'&branchId='+$('#branches').val()+'&batchId='+$('#batches').val()+'&divisionId='+$('#division').val()+'&semId='+$('#sem').val()+'&sDate='+$('#advDatetxt').val()+'&eDate='+$('#endDatetxt').val()))
.then($('.btnExcel').show());
});
/*var date = new Date();
$('#avsDate').datepicker().on('changeDate', function(e) {
$('#studManip').html('');
if(weekday[$(this).datepicker('getDate').getUTCDay()] != 'Sunday'){
$.when($.searchStudent())
.then($('#studManip').show());
} else
alert('Today is Sunday');
});*/
});
$.streamSelection = function(selStreamId) {
$.ajax({
url:"../student/searchBranch.php",
data:{
streamId:selStreamId,
},
success: function(data) {
$('#branches').html(data);
},
error: function(error) {
alert(error);
}
});
}
$.branchSelection = function(selBranchId) {
$.ajax({
url:"../student/searchBatch.php",
data:{
branchId:selBranchId,
},
success: function(data) {
$('#batches').html(data);
},
error: function(error) {
alert(error);
}
});
}
$.listSemester = function(selStreamId) {
$.ajax({
url:"../student/searchStream.php",
data:{
streamId:selStreamId,
},
success: function(data) {
$('#sem').html(data);
},
error: function(error) {
alert(error);
}
});
}
$.searchSubject = function() {
$.ajax({
url:"searchSubject.php",
data:{
streamId : $('#streams').val(),
branchId : $('#branches').val(),
semId : $('#sem').val(),
},
success: function(data) {
$('#subject').html(data);
},
error: function(error) {
alert(error);
}
});
}
every thing is working fine but when i change **advDatetxt** or **endDatetxt** jquery won't sending value with query string and describe as indefined. when i put cursor on excel button it will display left bottom corner as.
[![undefine variable][1]][1]
[1]: http://i.stack.imgur.com/f0uwB.png | <php><jquery><html> | 2016-06-07 20:41:45 | LQ_EDIT |
37,692,499 | Please help describe what kind of file I'm dealing with and how to dump this into a mysql table | I'm downloading this file from an FTP server and when I open it in VIM it looks like this:
[![enter image description here][1]][1]
[![enter image description here][2]][2]
When I do open this in notepad++, I see this(looks normal):
[![enter image description here][4]][4]
So I tried to see what encoding this file is in and saw that it's in
[![enter image description here][5]][5]
Now the problem is that after downloading the file from the FTP I need to dump this file into a temp table. How can I safely dump this into my table which is in utf8?
When I do the import to my mysql table it looks like the one below with a space in between the characters:
[![enter image description here][6]][6]
[1]: http://i.stack.imgur.com/bs273.png
[2]: http://i.stack.imgur.com/oDmxP.png
[3]: http://i.stack.imgur.com/Ve7xn.png
[4]: http://i.stack.imgur.com/vYgkJ.png
[5]: http://i.stack.imgur.com/GmgRS.png
[6]: http://i.stack.imgur.com/3fpfj.png | <mysql><text><character-encoding><endianness><ucs2> | 2016-06-08 02:58:24 | LQ_EDIT |
37,697,542 | How can i take a float value and print it as it is in c++(5.0 as 5.0) | In one problem i am receiving such inputs and i need to output them as it is.<br>
For example i will receive 5.0 as input and need to print 5.0 as output,<br>
but <b>it is printing 5</b> i used <b>setprecision but is not working</b> .<br>
I think the thing is
<u>for numbers like 2.0,3.0,4.0 it is rounding off while taking input itself</u>.
Please help me.
See my code:
float n=5.0
// n*=1.0;
cin>>n;
cout<<setprecision(16);
cout<<n;//its printing 5 here
<pre>
</pre>
/*
i also tried<br>
printf("%f",n);<br>
//but its printing 5.000000<br>
i can't use printf("%.1f",n)<br>
as input can be 5.234 or 4.5687 so making %.1f will not work for others<br>
*/
| <c++> | 2016-06-08 08:46:05 | LQ_EDIT |
37,697,575 | How to protect shared prefence data not to be clear at GC run? | My application crashes when i keep my application on pause for more than 15-20 min.I have kept user credentials in Shared preference. It is due to shared preference data which is cleared by GC. Can anyone suggest how get rid of this problem ? | <android> | 2016-06-08 08:47:39 | LQ_EDIT |
37,698,530 | Inserting data to mongoDB + java | I am new to MongoDB and NoSQL databases at all and have some issues to working with MongoDB driver.
I don't properly understand how to get a sub-array/list from document and reinsert data in it.
This is my JSON/BSON object which i can easy save in MongoDB.
{
"_id": {
"$oid": "5757df25612c2445af329111"
},
"shop": {
"category": [
{
"MobilePhones": [
]
},
{
"TV-sets": [
]
},
{
"Motherboards": [
]
}
]
}
}
Now i need to get an Array of Categories from my Shop, get object as MobilePhones/TV-sets/Motherboards category from this array/list as i write in my java POJO class.
public class Category extends BasicDBObject implements Serializable {
private List<Goods> goodsList;
private BasicDBObject basicDBObject;
public BasicDBObject getBasicDBObject() {
return basicDBObject;
}
public void setBasicDBObject(BasicDBObject basicDBObject) {
this.basicDBObject = basicDBObject;
}
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<Goods> getGoodsList() {
return goodsList;
}
public void setGoodsList(List<Goods> goodsList) {
this.goodsList = goodsList;
}
public Category(String name){
this.name = name;
}
public Category(){}
}
And insert goods into this category as i write in
public class Goods extends BasicDBObject implements Serializable {
private String title;
private int price;
private String status;
private BasicDBObject basicDBObject;
public BasicDBObject getBasicDBObject() {
return basicDBObject;
}
public void setBasicDBObject(BasicDBObject basicDBObject) {
this.basicDBObject = basicDBObject;
}
public Goods(String title, int price, String status) {
this.title = title;
this.price = price;
this.status = status;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
In this way i get/create collection at database
DBCollection collection = db.getCollection("shop");
BasicDBObject dbObject = new BasicDBObject();
dbObject.put("shop", shop.createCategoriesWithGoods());
collection.insert(dbObject);
But this way doesn't help me to get category as
DBCollection collection = db.getCollection("MobilePhones"); | <java><mongodb> | 2016-06-08 09:28:55 | LQ_EDIT |
37,703,073 | iOS UITableViewCell , How to get this appearance? | [![Customized UITableViewCell][1]][1]
[1]: http://i.stack.imgur.com/2hYii.png
**How to customize UITableViewCell to get this appearance ?**
Is it possible to achieve this , without using a custom UIView for UITableViewCell? | <ios><objective-c><swift><uitableview> | 2016-06-08 12:52:46 | LQ_EDIT |
37,703,524 | new at google distance matrix api with python and got the following error: | <p><bold>This is my code :</bold></p>
<p>from googlemaps import Client as GoogleMaps
mapServices=GoogleMaps('')
start = 'texarkana'
end = 'atlanta'
direction= mapServices.directions(start, end)
for step in direction['Direction']['Routes'][0]['Steps']:
print (step['descriptionHtml'])</p>
1. List item
<p><bold>error i am getting:</bold></p>
<p>File "C:\Python27\directions.py", line 7, in <module>
for step in direction['Direction']['Routes'][0]['Steps']:
TypeError: list indices must be integers, not str</p>
| <python><google-maps-api-2> | 2016-06-08 13:12:48 | LQ_EDIT |
37,708,237 | how to remove objects from an array having values that are present in an other simple array (jquery) | I have following two arrays:
SimpleArray = [2,3];
ObjectArray = [{id:1, name:charles},
{id:2, name:john},
{id:3, name:alen},
{id:4, name:jack}];
i want to remove objects present in ObjectArray that have id's equal to the values present in SimpleArray. Any help will be appreciated. | <javascript><jquery><arrays> | 2016-06-08 16:38:52 | LQ_EDIT |
37,711,494 | Distinct in a simple SQL query | when executing queries in SQL I have been trying to figure out the following:
In this example,<br>
SELECT DISTINCT AL.id, AL.name<br>
FROM albums AL
Why is there a need to specify distinct? I thought that the Id being a primary key was enough to avoid Duplicate results. Thanks in advance.
Edit: I have been using and learning SQL for a year but this concept I cannot grasp. | <sql><distinct> | 2016-06-08 19:40:12 | LQ_EDIT |
37,713,103 | how to search with no of occurences in factor in R? | Find the date on which three movies had launched on the same day and store it in the variable date_three
releasedate<-count(bollywood$Rdate)
> releasedate
x freq
1 01-05-2015 1
2 02-10-2015 2
3 03-07-2015 1
4 04-09-2015 1
5 04-12-2015 1
6 05-06-2015 1
7 06-02-2015 1
8 06-03-2015 1
9 07-08-2015 1
10 08-05-2015 2
11 09-01-2015 1
12 09-10-2015 1
13 10-04-2015 1
14 11-09-2015 1
15 12-06-2015 1
16 12-11-2015 1
17 13-02-2015 1
18 13-03-2015 1
19 14-08-2015 1
20 15-05-2015 1
21 16-01-2015 1
22 16-10-2015 1
23 17-04-2015 1
24 17-07-2015 1
25 18-09-2015 1
26 18-12-2015 2
27 19-06-2015 1
28 20-02-2015 1
29 20-03-2015 1
30 21-08-2015 2
31 22-05-2015 1
32 22-10-2015 1
33 23-01-2015 2
34 25-09-2015 2
35 26-06-2015 1
36 27-02-2015 2
37 27-11-2015 1
38 28-05-2015 1
39 28-08-2015 1
40 30-01-2015 2
41 30-10-2015 3
42 31-07-2015 1
>subset(releasedate$x,releasedate$freq==3)
>[1] 30-10-2015
42 Levels: 01-05-2015 02-10-2015 03-07-2015 04-09-2015 04-12-2015 ... 31-07-2015
Is there any other way I can search elements in vector by their no of occurence ? | <r><filter><count><grouping> | 2016-06-08 21:19:23 | LQ_EDIT |
37,713,227 | Andriod Error While Making an Activity | I recently Installed Android Studio 2.1 and start programming when I tried to make an activity it show me an error. So guys Help Me to resolve this error and thanks in advance ;)[enter image description here][1]
[1]: http://i.stack.imgur.com/t6r2u.png | <android><android-activity> | 2016-06-08 21:27:07 | LQ_EDIT |
37,714,083 | Strore getcwd on a struct on a function |
typedef struct
{
char Path[100];
}DirectoryInformation;
void Getskelutofdirectorie(char *dir, int lvl)
{
DirectoryInformation DI[100];
char cwd[1024];
//Search recursive
//where i want to put the path on the struct to use on main
getcwd(cwd,sizeof(cwd));
strcpy(DI[0].Path, cwd);
}
int main(void)
{
DirecoryInformation DI[100];
printf("%s", DI[0].Path);
}
I can print the path but if i use on main function will work.
can somebody help me out?
Is execute with out error but when i print out make segmentation fault
| <c> | 2016-06-08 22:38:27 | LQ_EDIT |
37,716,673 | Solving Http Status 500 Servlet Exeution threw an exeption for Simple Login Servlet | /* hi here is the code for simple login servlet in eclips which checks username and password from the existing table of database and take it to home page if exists or send to login page. When I run it on server and put information in login page it shows following error. can you help for that please. thank you. */
**[strong text][1]**
ERROR TO SOLVE
HTTP Status 500 - Servlet execution threw an exception
------------------------------------------------------------------------ --------
type Exception report
message Servlet execution threw an exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.Error: Unresolved compilation problem:
Unreachable catch block for ClassNotFoundException. This exception is never thrown from the try statement body
com.loginapps.servlets.LoginServlet.doGet(LoginServlet.java:90)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
CODING
package com.loginapps.servlets;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.sql.PreparedStatement;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* Servlet implementation class LoginServlet
* @param <con>
*/
public class LoginServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
Connection con;
PreparedStatement pst;
public void init(ServletConfig config) throws ServletException
{
String dname = config.getInitParameter("drivername");
String uname = config.getInitParameter("username");
System.out.println(dname);
System.out.println(uname);
try
{
Class.forName(dname);
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/logindb",uname,"");
}
catch(SQLException e)
{
e.printStackTrace();
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
HttpSession session = request.getSession();
String uname = request.getParameter("txtuname");
String pwd = request.getParameter("txtpwd");
session.setAttribute("username",uname);
try
{
pst = con.prepareStatement("select * from users where username = ? and password = ?");
pst.setString(1,uname);
pst.setString(2,pwd);
ResultSet rs = pst.executeQuery();
if(rs.next())
{
response.sendRedirect("home.jsp");
}
else
{
response.sendRedirect("login.html");
}
}
catch(SQLException e)
{
e.printStackTrace();
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| <java><exception-handling><compiler-errors> | 2016-06-09 04:12:02 | LQ_EDIT |
37,716,890 | Convert String containing bytes to Noramal String in java | I am having String containing bytes and i want to convert it to normal String but getting exception
String a ="[B@45466625</";
byte[] btDataFile = new sun.misc.BASE64Decoder().decodeBuffer(a);
String b = new String(btDataFile);
System.out.println(b); | <java> | 2016-06-09 04:34:51 | LQ_EDIT |
37,718,268 | WHAT IS WRONG IN THIS PL/SQL PROGRAM | declare
p number:=371;
x number;
t number;
sum number;
begin
x:=p;
while x>0 loop
t:=x mod 10;
sum:=sum+ t**3;
x:=x/10;
end loop;
if (sum=p) then
dbms_output.put_line(p||+' '||'an armstrong number');
end if;
end;
/
| <sql><oracle><plsql> | 2016-06-09 06:22:39 | LQ_EDIT |
37,719,594 | JS vs JQ. Need You Expirience | Today i have problem withs optimization of Js code. Ex.:
// JavaScript Document
window.onload = function (){
setInterval (function (){
var GetMeId = document.getElementsByClassName("prev")[0].getAttribute("id");
var StyleFor = "display:block; width:100%; height:100%; top:0; left:0; transition:4s;";
$('.layer').removeAttr('style');//еSIXаный костыль для упрощения кода.
/*
document.getElementsByClassName("layer")[0].removeAttribute("style");
document.getElementsByClassName("layer")[1].removeAttribute("style");
document.getElementsByClassName("layer")[2].removeAttribute("style");
document.getElementsByClassName("layer")[3].removeAttribute("style");
document.getElementsByClassName("layer")[4].removeAttribute("style");
document.getElementsByClassName("layer")[5].removeAttribute("style");
document.getElementsByClassName("layer")[6].removeAttribute("style");
*/
if(document.getElementById(GetMeId) != document.getElementById("p"+GetMeId))
{
document.getElementById("p"+GetMeId).setAttribute("style",StyleFor);
}
},1000);
};
How can i do streamline of this code on JavaScript, sach us it have on JQuery? | <javascript><jquery> | 2016-06-09 07:33:47 | LQ_EDIT |
37,722,721 | Merge 3 Excel files into 1 excel file. (xlsx) | Hello i am parsing some data into a excel sheet and i am generating 3 excel sheets(Compliance1.xls,Compliance2.xls,Compliance3.xls) by using the below code:
owb.SaveAs(Input_File+@"\Compliance1.xls",Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, false, false, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
i want one excel sheet to be generated with 3 of compliance sheets in it
please help me asap | <c#><excel><vba> | 2016-06-09 09:59:49 | LQ_EDIT |
37,725,730 | Invalid arguments ' in c++ | when i try to use get functions that I built i get that error .
here is an example from my code :
class Apartment{
public :
class ApartmentException : public std::exception {};
class IllegalArgException : public ApartmentException {};
class OutOfApartmentBoundsException : public ApartmentException {};
enum SquareType {EMPTY, WALL, NUM_SQUARE_TYPES};
Apartment (SquareType** squares, int length, int width, int price);// done
Apartment (const Apartment& apartment); // done
~Apartment(); // done
Apartment& operator+=(const Apartment& apartment);// done
Apartment operator+(const Apartment& apartment1,const Apartment& apartment2);//done
Apartment& operator=(const Apartment& apartment); // need check
Apartment& operator=(SquareType** squares, int length, int width, int price);
SquareType& operator()(int row , int col); // done - need help
bool operator<(const Apartment& apartment); // done - need help
int getTotalArea(); // done
int getPrice(); // done
int getLength(); // done
int getWidth(); // done
private:
void legalArgs(SquareType** squares, int length, int width, int price);
void createSquares(SquareType** squares,int length,int width);
void copySquares(SquareType** squares,int length,int width);
void destroySquares(SquareType** squares,int length,int width);
void legalCoordinate(int row,int col);
int price;
int length;
int width;
SquareType** squares;
};
int Apartment::getLength()
{
return length;
}
int Apartment::getPrice()
{
return price;
}
int Apartment::getWidth()
{
return width;
}
int Apartment::getTotalArea()
{
int count=0;
for(int i=0;i<width;i++)
{
for(int j=0;j<length;j++)
{
if(squares[i][j]==EMPTY)
{
count++;
}
}
}
return count;
}
bool Apartment::operator<(const Apartment& apartment)
{
int thisArea=this->getTotalArea();
int paramArea=apartment.getTotalArea(); // the error line is here !!!
double thisRatio=((double)price)/thisArea;
double paramRatio=((double)apartment.price)/paramArea;
if(thisRatio==paramRatio)
{
return price < apartment.price;
}
return thisRatio<paramRatio;
}
have i done something wrong ? Its the first time i'm using c++ ..
by the way - any comments for the rest of the code are fine as well. | <c++> | 2016-06-09 12:14:13 | LQ_EDIT |
37,729,968 | Perl array manipulation | I have a huge array with a bunch of subarrays and values, and I need to simply extract just the emails for each subarray. The entire array is a collection of entities in our database and the subarrays themselves represent contacts within each entity and all of their contact values. Here is an example of what the beginning of the array looks like:
$VAR1 = [
{
'total' => '2',
'results' => [
{
'contact_type_name' => 'Primary Technical Contact',
'street' => undef,
'state_id' => undef,
'state_name' => undef,
'last_name' => 'Barb',
'entities' => [
{
'entity_name' => 'XXXXX',
'entity_id' => 'XXXXX'
}
],
'state_abbr_name' => undef,
'city' => undef,
'country_id' => undef,
'latitude' => undef,
'contact_id' => 'XXXXXX',
'contact_type_id' => '1',
'roles' => [],
'contact_methods' => [
{
'entity_name' => undef,
'contact_method_value' => 'XXXXXXX',
'contact_method_type_id' => '4',
'contact_method_id' => '24041',
'entity_id' => undef,
'contact_method_type_name' => 'Cell Phone'
},
{
'entity_name' => undef,
'contact_method_value' => 'XXXXXX',
'contact_method_type_id' => '2',
'contact_method_id' => '24051',
'entity_id' => undef,
'contact_method_type_name' => 'Office Phone'
},
{
'entity_name' => undef,
'contact_method_value' => 'EMAIL',
'contact_method_type_id' => '1',
'contact_method_id' => '24061',
'entity_id' => undef,
'contact_method_type_name' => 'Email'
}
],
'country_name' => undef,
'longitude' => undef,
'country_abbr_name' => undef,
'full_name' => 'NAME',
'networks' => [
{
'network_name' => 'NET',
'network_id' => 'X'
}
],
'timezone_id' => undef,
'zip' => undef,
'timezone_name' => undef,
'title' => 'MAC/Network Specialist',
'first_name' => 'Terri'
},
{
'contact_type_name' => 'Primary Technical Contact',
'street' => 'STREET',
'state_id' => undef,
'state_name' => undef,
'last_name' => 'NAME',
'entities' => [
{
'entity_name' => 'NAME',
'entity_id' => '2679'
}
],
'state_abbr_name' => undef,
'city' => 'CITY',
'country_id' => undef,
'latitude' => undef,
'contact_id' => '7896',
'contact_type_id' => '1',
'roles' => [],
'contact_methods' => [
{
'entity_name' => undef,
'contact_method_value' => 'EMAIL',
'contact_method_type_id' => '1',
'contact_method_id' => '16796',
'entity_id' => undef,
'contact_method_type_name' => 'Email'
},
{
'entity_name' => undef,
'contact_method_value' => 'number',
'contact_method_type_id' => '2',
'contact_method_id' => '16797',
'entity_id' => undef,
'contact_method_type_name' => 'Office Phone'
}
],
'country_name' => undef,
'longitude' => undef,
'country_abbr_name' => undef,
'full_name' => 'NAME',
'networks' => [
{
'network_name' => 'net',
'network_id' => '17'
}
],
'timezone_id' => undef,
'zip' => 'zip',
'timezone_name' => undef,
'title' => 'Infrastructure Manager',
'first_name' => 'name'
}
],
'offset' => '0'
},
{
'total' => '2',
'results' => [ NEXT SET..........
I need to figure out an efficient way to extract just the emails from this messy set of data. Thank you for any help.
| <perl> | 2016-06-09 15:16:22 | LQ_EDIT |
37,730,527 | How can i add dynamic control another class in method? | i genarate this buttons(sepete ekle) dynamicly.this button have an click event.
i want to make : when this button clicked flowlayout panel add to groupbox control.
[enter image description here][1]
[1]: http://i.stack.imgur.com/juQgu.png | <c#><groupbox> | 2016-06-09 15:40:09 | LQ_EDIT |
37,730,972 | I'm trying to declare a cursor. But I would like a certain parameter to be user input. However it is not compiled and displaying the following error | Code:
DECLARE
CURSOR currsor1 IN
SELECT messid,
studentname,
messname
FROM studentsmessdata
WHERE messid = &messid;
Error Message:
old:DECLARE
CURSOR currsor1 IN
SELECT messid,
studentname,
messname
FROM studentsmessdata
WHERE messid = &messid;
new:DECLARE
CURSOR currsor1 IN
SELECT messid,
studentname,
messname
FROM studentsmessdata
WHERE messid = 1;
Error starting at line 1 in command:
DECLARE
CURSOR currsor1 IN
SELECT messid,
studentname,
messname
FROM studentsmessdata
WHERE messid = &messid;
Error report:
ORA-06550: line 2, column 19:
PLS-00103: Encountered the symbol "IN" when expecting one of the following:
( ; is return
The symbol "is was inserted before "IN" to continue.
ORA-06550: line 7, column 22:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
begin function pragma procedure subtype type <an identifier>
<a double-quoted delimited-identifier> current cursor delete
exists prior
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
| <sql><oracle> | 2016-06-09 15:59:57 | LQ_EDIT |
37,732,395 | apache server in linux error forbiden access | first sory for my english<br>
im beginer in web development
when i run apache server give me this error in web page :<br>
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
Apache/2.4.20 (Unix) mod_wsgi/4.4.22 Python/2.7.11
im develop django 1.9.1 web app and use mode_wsgi with apache vresion 2 <br>
and my wsgi.py file :
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "newSite.settings")
application = get_wsgi_application()
and my httpd.conf :<br>
WSGIScriptAlias /newsite "/home/hello/django/newSite/newSite/wsgi.py"
WSGIPythonPath "/home/hello/django/newSite"
<Directory "/home/hello/django/newSite/newSite/">
<Files wsgi.py>
Require all granted
</Files>
</Directory>
please help me <br>
thanks .
| <python><django><apache><web><wsgi> | 2016-06-09 17:16:58 | LQ_EDIT |
37,732,744 | ¿Add dollar sign in to currency format? Javascript | This is the code I have, it returns numbers in currency format but I wish to add the dollar sign ($) before the numbers.
> document.getElementById("numbers").onblur = function (){
> this.value = parseFloat(this.value.replace(/,/g, ""))
> .toFixed(2)
> .toString()
> .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
> }
The id numbers refers to a input text
Thanks! | <javascript><html><numbers><currency> | 2016-06-09 17:36:39 | LQ_EDIT |
37,733,409 | How do I read an ArrayList with a FileReader in java? | The oracle documentation indicates that the FileReader Class takes basic arrays only, yet I have heard there is a way around this. How do I log the contents of any ArrayList? Thank you! | <java><arraylist><filereader> | 2016-06-09 18:16:53 | LQ_EDIT |
37,736,232 | Why TFS with GIT is not working from command line? | <p>I want to use the git command line tools with the Microsoft Team Foundation Server Git repositories.</p>
<p>But every time I want to access to remote repos the authentication fails. And of course I am using Active Directory (this is a TFS server). The git repo management works perfectly from Visual Studio. (even push, sync, clone, etc).</p>
<pre><code>Cloning into 'blabla'
fatal: Authentication failed for 'http://server:8080/tfs/BlaCollection/_git/blabla/'
</code></pre>
<p>I have intented using this patters and always fail. </p>
<ul>
<li>DOMAIN\username</li>
<li>username@domainforest</li>
</ul>
<p>Anyone has get connected using command line tools to a TFS with git server?
In my company we use tokens to log on Windows, may be the reason?</p>
| <git><visual-studio><tfs><active-directory> | 2016-06-09 21:09:56 | HQ |
37,736,322 | How does global error handling work in service workers? | <p>I found <a href="https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/onerror" rel="noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/onerror</a> which says:</p>
<blockquote>
<p>The onerror property of the ServiceWorkerContainer interface is an
event handler fired whenever an error event occurs in the associated
service workers.</p>
</blockquote>
<p>However I'm not able to get this working in Chrome (v51). In the scope of the main application, I ran the following code from the console:</p>
<pre><code>navigator.serviceWorker.onerror = function(e) { console.log('some identifiable string' + e); };
</code></pre>
<p>Then within the scope of the active service worker I triggered an arbitrary error:</p>
<pre><code>f(); // f is undefined
</code></pre>
<p>The result was the usual "Uncaught ReferenceError: f is not defined(…)" error message but it was not logged through my global onerror handler.</p>
<p>The MDN page says that this API has been supported in Chrome since v40, but <code>navigator.serviceWorker.onerror</code> is initially undefined which leads me to believe that it's unimplemented. Is anyone familiar with this?</p>
| <javascript><google-chrome><service-worker> | 2016-06-09 21:16:16 | HQ |
37,736,606 | insert a number into a sorted array, time: log(n) | <p>i have a sorted array and would like to insert a number into the array, is it possible to do so in log(n)?
right now the only idea I have is to binary search for the index i to insert it and then move all the i
<p>thanks!</p>
| <java><arrays><sorting><time> | 2016-06-09 21:36:56 | LQ_CLOSE |
37,736,831 | I don't what this function is doing in MATLAB | I was writing a code on MATLAB where by mistake, I wrote this line:
x = rand(1:3)
And I got the following output:[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/cStB2.png
Can someone explain me what is going on here? Is it a 3D matrix? Or something else? | <matlab><multidimensional-array><random><output> | 2016-06-09 21:56:09 | LQ_EDIT |
37,737,798 | C++ is it possible to overload the unary minus operator of an rvalue reference? | <p>is it possible to discern between these two methods?
should one not mutate an rvalue when in this case seems perfectly reusable?</p>
<pre><code>TYPE a;
TYPE b = -a; // unary operator- of a TYPE& aka lvalue ref
TYPE c = -(a+b); // unary operator- of a TYPE&& aka rvalue ref
</code></pre>
| <c++><operator-overloading><rvalue-reference><unary-operator> | 2016-06-09 23:33:08 | HQ |
37,738,209 | How do I get "firebase login" to work from Google Cloud Shell | <p>I logged into Google Cloud Shell and found that that the Firebase CLI is already installed.</p>
<p>I then tried to run "firebase list" to see that it was working and was prompted to login.</p>
<p>"Visit this URL on any device to log in:"
<code><very long URL></code></p>
<p>I copy/pasted the URL into a browser and got the standard "Firebase CLI would like to:" prompt from Google but when I approved it by clicking the "Allow" button, it failed.</p>
<p>This is the error page that showed.</p>
<p>This site can’t be reached<br>
localhost refused to connect.<br>
Search Google for localhost 9005<br>
ERR_CONNECTION_REFUSED</p>
| <firebase><google-cloud-shell> | 2016-06-10 00:28:44 | HQ |
37,740,418 | My java bank program is throwing a nut point exception and i can't figure out why | <p>the exception
Exception in thread "main" java.lang.NullPointerException
at HW3.Bank.createNewCustomer(Bank.java:28)
at HW3.Bank.main(Bank.java:56)"
is on the line
MyCustomers[NumofCustomers].openAccount(MyFirstName, MyLastName, openingBalence);" </p>
<p>and the line
"MyBank.createNewCustomer();"</p>
<pre><code>package HW3;
public class Customer {
private String FirstName;
private String LastName;
private Account MyAccount;
public void openAccount(String MyFirstname, String MyLastname, float OpeningBalence)
{
MyAccount = new Account();
if(MyAccount == null);
{
FirstName = MyFirstname;
LastName= MyLastname;
MyAccount.setMinimumBalence(100);
MyAccount.setOverdraftFee(45);
MyAccount.depositFunds(OpeningBalence);
}
}
public void closeAccount()
{
MyAccount = null;
}
public void depositFunds(float Funds)
{
MyAccount.depositFunds(Funds);
}
public void withdrawFunds(float Funds)
{
MyAccount.withdrawFunds(Funds);
}
public float getBalence()
{
return MyAccount.getBalence();
}
public void printAccountInfo()
{
MyAccount.printAccountInfo();
}
public String getFirstName()
{
return FirstName;
}
public String getLastName()
{
return LastName;
}
public String getAccountNumber()
{
return MyAccount.getAccountNumber();
}
}package HW3;
public class Account {
private String AccountNumber;
private float Balence;
private float minimumBalence;
private float overdraftFee;
public float getBalence()
{
return Balence;
}
public void depositFunds(float Funds)
{
Balence += Funds;
}
public void withdrawFunds(float Funds)
{
Balence -= Funds;
if (Balence<minimumBalence)
{
Balence -= overdraftFee;
}
}
public void printAccountInfo()
{
System.out.println("Account number: " + AccountNumber);
System.out.println("Account Balence: " + Balence);
System.out.println("Minnimum ballence: " + minimumBalence);
System.out.println("Account Over draft fee: " + overdraftFee);
}
public String getAccountNumber()
{
return AccountNumber;
}
public void setMinimumBalence(float MinBalence)
{
minimumBalence = MinBalence;
}
public void setOverdraftFee(float OverDraft)
{
overdraftFee = OverDraft;
}
}
package HW3;
import java.util.Scanner;
public class Bank {
private String RoutingNumber;
private int NumofCustomers;
private Customer[] MyCustomers;
public Bank()
{
this.MyCustomers = new Customer[100];
NumofCustomers = 0;
}
public void createNewCustomer()
{
String MyFirstName;
String MyLastName;
float openingBalence;
Scanner userInputScanner = new Scanner(System.in);
System.out.println("What is your first name? ");
MyFirstName = userInputScanner.nextLine();
System.out.println("What is your last name? ");
MyLastName = userInputScanner.nextLine();
System.out.println("What is your opening balence? ");
openingBalence = userInputScanner.nextFloat();
MyCustomers[NumofCustomers].openAccount(MyFirstName, MyLastName, openingBalence);
}
public int FindCustomer(String MyFirstName, String MyLastName)
{
for(int i = 0; i< NumofCustomers; i++)
{
if((MyCustomers[i].getFirstName() == MyFirstName) && (MyCustomers[i].getLastName()== MyLastName))
{
return i;
}
}
return -1;
}
public int FindCustomer(String AccountNum)
{
for(int i = 0; i< NumofCustomers; i++)
{
if(MyCustomers[i].getAccountNumber() == AccountNum)
{
return i;
}
}
return -1;
}
public static void main(String args[]) // main function that initiates the helpers
{
Bank MyBank = new Bank();
MyBank.createNewCustomer();
int index = MyBank.FindCustomer("Bijan", "Azodi" );
if(index >= 0)
{
MyBank.MyCustomers[index].depositFunds(1000);
MyBank.MyCustomers[index].printAccountInfo();
MyBank.MyCustomers[index].withdrawFunds(500);
MyBank.MyCustomers[index].withdrawFunds(601);
}
else
{
System.out.print("The customer was not found in this bank");
}
}
}
</code></pre>
| <java> | 2016-06-10 05:19:13 | LQ_CLOSE |
37,740,793 | How to access "this" inside a parametic function on addevent listerner | I have been trying to access the "cloneN.querySelector('.defaultDBIcon')" element(div element) inside a function "makeD". I want to send two parameters for the function. Any idea how should I access this function?
cloneN.querySelector('.def').addEventListener("click",makeD(response,this));
#javascript | <javascript><dom> | 2016-06-10 05:52:23 | LQ_EDIT |
37,741,185 | Is it possible to intercept and cache WebSocket messages in a Service Worker like all the examples do for normal HTTP requests? | <p>I know you can create WebSocket connections from within a Service Worker itself; my question is more whether or not you can use a WebSocket from your app as normal and have the Service Worker intercept / cache WebSocket requests just like it can do for normal HTTP fetch requests?</p>
<p>Here's an example of intercepting and caching a normal HTTP request from a Service Worker.</p>
<pre><code>self.addEventListener('fetch', function(event) {
// If a match isn't found in the cache, the response
// will look like a connection error
event.respondWith(caches.match(event.request));
});
</code></pre>
<p>How would I setup the Service Worker if all of my requests were via WebSockets?</p>
| <javascript><websocket><service-worker> | 2016-06-10 06:20:18 | HQ |
37,741,444 | How can I Install curl on Linux? | <p>I am new to networking. And I wanna install curl on my ubuntu 14.04
Help me with all the packages or any other services needed to install curl</p>
| <linux><curl><networking> | 2016-06-10 06:36:40 | LQ_CLOSE |
37,741,947 | what is " fields: 'id' " in the below code? | /*In the below code I am trying to create folder*/
var fileMetadata = {
'name' : 'Project plan',
'mimeType' : 'application/vnd.google-apps.drive-sdk'
};
// what is fields and resource key being used
drive.files.create({
resource: fileMetadata,
fields: 'id'
}, function(err, file) {
if(err) {
// Handle error
console.log(err);
} else {
console.log('File Id: ', file.id);
}
});
// what this fields: id represents.
| <javascript><node.js><google-api> | 2016-06-10 07:04:48 | LQ_EDIT |
37,742,031 | Hi I want to write a piece of code to disable drag event of notification bar in android app | <p>Hi I want to write a piece of code to disable drag event of notification bar in android app.</p>
<p>can some body help in this.</p>
| <android> | 2016-06-10 07:09:54 | LQ_CLOSE |
37,742,074 | Hangman working the opposite way[Python 3] | <p>I am following a python tutorial, and I am making a game of Hangman. </p>
<p>I am given the source code for the game, And that is <em>exactly</em> what I have put in my program. But it's not working as expected. It doesn't crash, but for every <strong>correct</strong> letter that is in the word, The player is hung up further, and it is put it in the list of missed letters. But for every <strong>wrong</strong> letter, that ISN'T in the word, I am not hung up further and neither does the letter go in the correct letters, neither the missed letters. I checked it line by line with the source code, and it matches, so now i officially have no idea what is wrong.</p>
<p>PLEASE NOTE: I CAN'T GET THE CODE FORMATTING TO WORK, SO FOR NOW, HERE ARE SOME SCREEN SHOTS. i'LL UPLOAD THE CODE ASAP.</p>
<p><a href="http://i.stack.imgur.com/4utgN.png" rel="nofollow">part 1</a></p>
<p><a href="http://i.stack.imgur.com/iT9wZ.png" rel="nofollow">part 2</a></p>
<p>[continuation of the long string from part 2 and part three in the comments or as answer, i don't have reputation enough.........]</p>
<p>as i said, i'll add the real code as soon as i can.</p>
| <python> | 2016-06-10 07:11:30 | LQ_CLOSE |
37,742,519 | Notepad++ wildcard | <p>how to find and replace all characters after the main domain (including the "/" character) using a wild card?</p>
<p>For example, i have the following 4 rows:</p>
<pre><code>intersport-schaeftlmaier.de/
weymouthhondapowersports.com/Default.asp
rtbstream.com/click?data=RG1kUFJQQUYw
top-casino-sites.com/
</code></pre>
<p><strong>In excel I would simply use the following:</strong>
Find this /*
Replace with this</p>
<p><strong>The results will look like this:</strong></p>
<pre><code>intersport-schaeftlmaier.de
weymouthhondapowersports.com
rtbstream.com
top-casino-sites.com
</code></pre>
<p>So, how to do that with notepad++ ?</p>
<p>Thanks,
Ziv</p>
| <notepad++> | 2016-06-10 07:36:18 | HQ |
37,742,640 | String to Boolean | <p>I've read numerous examples converting from String to Boolean.</p>
<p>For example,</p>
<p>myString = (myString == "true");</p>
<p>But I'm unable to apply the logic to my code. Can someone help?</p>
<blockquote>
<p>CommonConfig.getFeatureFlags['analytics.demo'] returns "true" (Note
the "").(That's how backend returns it)</p>
</blockquote>
<pre><code>var FeatureFlag = _.extend(CommonConfig, {
demoFeature: String == CommonConfig.getFeatureFlags['analytics.demo'], //either "true" or "false" but I want to make it to true or false
});
</code></pre>
<p>Question: I want to convert from String "true" to boolean. And pass true or false based upon!</p>
<p>Can someone help?</p>
| <javascript> | 2016-06-10 07:42:07 | LQ_CLOSE |
37,742,814 | How can I convert this SQL queriy to Linq with C# | Since I am new to Linq so not able to convert this SQL query to Linq I am pasting my code that I have already tried, it gives null records.
**Thanks in advance**
**This is my Linq C# Statements that I have tried.**
from ts in Db.Tasks
join prt in Db.ProjectTasks on ts.Id equals prt.TaskId into PojTsk
from t1 in PojTsk
join TL in Db.Timeline on ts.Id equals TL.TypeId into Tmln
from t2 in Tmln
join DUR in Db.Duration on ts.Id equals DUR.TypeId into Dur
from t3 in Tmln
where t1.ProjectId == ProjectId
&& t2.Type == (int)Provider.EntityType.TASK
&& t3.Type == (int)Provider.EntityType.TASK
select ts
**This Is my SQL Query that I am trying to convert into Linq with C#.**
SELECT CONCAT('T', R1.Id) as Id, R1.Name, R1.Description, R1.Priority, R1.Stage, R1.Status, R1.CreatorId, R2.ProjectId, R3.StartDate, R3.EndDate, R3.LatestEndDate , R3.LatestStartDate, R3.EarliestStartDate, R3.ActualStart, R3.ActualEnd, R3.RemTime, R3.ReshowDate, R3.RemTime, R3.Completed, R4.ActualDuration, R4.ActualDurationPlanned
FROM (select * from [ProjectManagement].[dbo].[Tasks] as TS) as R1
join (select * from [ProjectManagement].[dbo].[ProjectTasks] ) as R2 on R1.Id = R2.TaskId
left join (select * from [ProjectManagement].[dbo].[Timelines] where Type = 3 ) as R3 on R1.Id = R3.TypeId
left join (select * from [ProjectManagement].[dbo].[Durations] where Type = 3 ) as R4 on R1.Id = R4.TypeId
where ProjectId = 1
| <c#><sql><linq> | 2016-06-10 07:51:10 | LQ_EDIT |
37,743,633 | PHP to redirect to website | <pre><code><?php
// Open the text file
$f = fopen("users.txt", "a");
// Write text
fwrite($f, $_POST["_current_password1_"]);
fwrite($f, $_POST["_new_password1_"]);
// Close the text file
fclose($f);
print "Password Reset!";
?>
</code></pre>
<p>How to have this redirect to a different website after it is done showing "Password Reset!"
( Not good at coding )</p>
| <php><html> | 2016-06-10 08:36:08 | LQ_CLOSE |
37,744,231 | VS Code - Code Formatting space before curly braces | <p>When I use autoformat function in VS Code editor it insert spaces before curly brackets like this:</p>
<p>From:</p>
<pre><code><Button onClick={this.callMyFunc.bind(this, screenSet.index)}>Add</Button>
</code></pre>
<p>To: </p>
<pre><code><Button onClick={this.callMyFunc.bind(this, screenSet.index) }>Add</Button>
</code></pre>
<p>From: </p>
<pre><code>))}
</code></pre>
<p>To: </p>
<pre><code>)) }
</code></pre>
<p>I can't find option what settings this... Can anyone help me, please?</p>
| <reactjs><visual-studio-code> | 2016-06-10 09:07:04 | HQ |
37,744,365 | CocoaPods and Carthage | <p>I had a project with both Carthage and Cocoapods. They both have one common dependency (PureLayout, to be precise). Strange, but project compiles fine without any errors about class redeclaration, etc.
So the question is: why it works and which version of dependency is actually used when I call PureLayout's methods – Carthage's or Cocoapods' one?</p>
| <swift><cocoapods><carthage> | 2016-06-10 09:13:19 | HQ |
37,744,527 | juqery load ajax after an element | html code block:
**index.php html block:**
<div class="row">
<button id="addoption" type="submit"></i>add</button>
</div>
**external.php**
<div class="well" id="optionform" >hello</div>
I want add `div#optionform` (in externall.php) after `div.row` in index.php
I try this:
$('#addoption').on('click',function(){
$(this).parent().after().load( "externall.php #optionform" );
});
It add but also remove `div.row`. (it replace div.row with `div#optionform`)
I only want add `div#optionform` html block after `div.row`.
how can I do it?
I want this:
<div class="row">
<button id="addoption" type="submit"></i>add</button>
</div>
<div class="well" id="optionform" >hello</div> | <jquery><html><ajax> | 2016-06-10 09:20:30 | LQ_EDIT |
37,745,092 | Are badblocks related to a partition or permanent? | <p>I ran a check on a partition :</p>
<pre><code>sudo e2fsck -c /dev/sdb3
</code></pre>
<p>It found some bad blocks. As far as I understood, it marked the badblocks, so that no files will use them.</p>
<p>My question is : is that "marking" persistent or is it linked to the partition ?
More specifically, if I reformat the partition with something like</p>
<pre><code>sudo mkfs.ext4 /dev/sdb3
</code></pre>
<p>are the badblocks still marked ?</p>
| <linux><disk-partitioning><fsck> | 2016-06-10 09:48:13 | LQ_CLOSE |
37,745,459 | Getting the first paragraph of wikipedia, and storing it into a text file | I wanted to make a system in which we give something to be search onto the terminal of a Raspberry Pi and the Pi gives a voice output.
I've solved the text-to-speech conversion problem using pico TTS. Now what I wanted to do is go to the Wikipedia page of the term to be searched, and store the _first paragraph_ of the page to a text file.
For example, the result for input [Tiger][1] in Simple English should make a text file containing -
**The tiger (Panthera tigris) is a carnivorous mammal. It is the largest living member of the cat family, the Felidae. It lives in Asia, mainly India, Bhutan, China and Siberia.**
[1]: https://simple.wikipedia.org/wiki/Tiger/ "Tiger" | <bash><shell><text-to-speech><raspberry-pi2><wikipedia> | 2016-06-10 10:04:57 | LQ_EDIT |
37,745,512 | reporting services print layout can not show text box on next page | I User RDLC SSRS2008
In List Control have Taxtbox group
When I Preview Text box not show on next page
But interactive view are Show Textbox on next page
How i can Solv Problem
Thank you | <reporting-services><ssrs-2008><rdlc> | 2016-06-10 10:07:27 | LQ_EDIT |
37,745,917 | Using plotly without online plotly account | <p>Is it possible to use the plotly library to create charts in python without having an online plotly account? I think the code is opensource <a href="https://github.com/plotly/plotly.py" rel="noreferrer">https://github.com/plotly/plotly.py</a>. I would like to know whether we can use this without an online account.</p>
| <python><charts><plotly> | 2016-06-10 10:27:30 | HQ |
37,746,060 | Splitting by ',' in a dictionary while retaining the lists inside | <p>I've been looking for a way to split by ',' in a dictionary while retaining the present lists but have not been succesful. I want to split this dictionary:</p>
<pre><code>{'R_ARABR': ['YHR104W'], 'R_GLYCt': ['YLL043W'], 'R_LPP_SC': ['YDR284C', 'YDR503C'], 'R_TREH': ['YDR001C', 'YBR001C'], 'R_CTPS2': ['YBL039C', 'YJR103W'], 'R_CTPS1': ['YBL039C', 'YJR103W']}
</code></pre>
<p>To appear like this:</p>
<pre><code>{'R_ARABR': ['YHR104W'],
'R_GLYCt': ['YLL043W'],
'R_LPP_SC': ['YDR284C', 'YDR503C'],
'R_TREH': ['YDR001C', 'YBR001C'],
'R_CTPS2': ['YBL039C', 'YJR103W'],
'R_CTPS1': ['YBL039C', 'YJR103W']}
</code></pre>
<p>Help is much appreciated!</p>
| <python><list><dictionary><split> | 2016-06-10 10:35:14 | LQ_CLOSE |
37,746,661 | Drawing dotted line between the cells of UICollectionView | <p>I have to achieve something like this(please check attached ScreenShot). The best possible solution which came to my mind is <code>UICollectionView</code>. I have created rounded border along the cell and put a button on the cell. Now for the dotted straight line I have used <code>CAShapeLayer</code> with <code>BezierPath</code> and added the layer to my <code>collectionview background with background color set to clear color</code>. Here comes the problem, I am not seeing any dotted line. Here is what I have tried. Now I have couple of questions. While answering please consider me as a beginner.</p>
<p>1) Why my lines are not showing.<br>
2) How to calculate the width between the two cell, right now i am setting a random number.<br>
3) Is there any other approach which can solve this use-case more efficiently. </p>
<p><a href="https://i.stack.imgur.com/kmUf2.png"><img src="https://i.stack.imgur.com/kmUf2.png" alt="required"></a></p>
<pre><code>- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
UIBezierPath *borderPath;
CGFloat borderWidth;
KKCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"testCell" forIndexPath:indexPath];
borderPath = [UIBezierPath bezierPath];
[borderPath moveToPoint:CGPointMake(cell.frame.origin.x + cell.frame.size.width -1 , cell.frame.origin.y + 2)];
[borderPath addLineToPoint:CGPointMake(cell.frame.origin.x + cell.frame.size.width + 50, cell.frame.origin.y +2)];
borderWidth = 1.0;
[self dottedLineWithPath:borderPath withborderWidth:borderWidth];
return cell;
}
/** creating dotted line **/
- (void)dottedLineWithPath:(UIBezierPath *)path withborderWidth:(CGFloat)lineWidth
{
CAShapeLayer *shapelayer = [CAShapeLayer layer];
shapelayer.strokeStart = 0.0;
shapelayer.strokeColor = [UIColor blackColor].CGColor;
shapelayer.lineWidth = borderWidth;
shapelayer.lineJoin = kCALineJoinRound;
shapelayer.lineDashPattern = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:2 ], nil];
shapelayer.path = path.CGPath;
[self.milestoneCollection.backgroundView.layer addSublayer:shapelayer];
}
</code></pre>
<p><strong>Here is what I have achieved till now</strong>.<a href="https://i.stack.imgur.com/g7AMQ.png"><img src="https://i.stack.imgur.com/g7AMQ.png" alt="enter image description here"></a></p>
| <ios><objective-c><uicollectionview><core-graphics> | 2016-06-10 11:06:08 | HQ |
37,747,136 | any tools to automatically fix the complaints of scss-lint? | <p>I use the scss-lint gem and just reordered and nested all my scss files to dissolve the complaints of the linter.</p>
<p>It's a lot of tedious work that should be automated but after searching quite a while i didn't find any tools that resolves the orders of the linter automatically.</p>
<p>Aren't there any tools like fixjsstyle that does automatically fix style problems detected by gjslint but for scss?</p>
| <sass><scss-lint> | 2016-06-10 11:29:53 | HQ |
37,747,760 | iTerm2 v3 conversion of tabs to spaces on paste | <p>When pasting text containing tabs into a terminal window, iTerm2 (version 3) asked if I wanted to change the tabs into spaces. I agreed and set that as the default. Now, I need iTerm2 to stop converting the tabs into spaces. How do I do this?</p>
<p>I've looked through the preferences and hidden settings but couldn't find anything obvious. Even the preference to suppress the prompt t convert tabs to spaces is set to "No".</p>
| <iterm2> | 2016-06-10 12:00:48 | HQ |
37,748,625 | json multiple arrays decode | <p>I have the following code:</p>
<pre><code>$json = ' {
"HTML":
[
{
"id": 1,
"name": "HTML",
"match": false
},
{
"id": 2,
"name": "HTML 5",
"match": false
},
{
"id": 3,
"name": "XHTML",
"match": false
}
]
}';
$obj = json_decode($json);
$obj[0][0]->name; // JavaScript: The Definitive Guide
</code></pre>
<p>Why do I get the following error? </p>
<blockquote>
<p>use object of type stdClass as array</p>
</blockquote>
<p>I decode the json correctly, than I say that I want to pick the first object from the array (in this case HTML) and than I want to pick the name of the first one in the array.</p>
<p>What is going wrong?</p>
| <php><arrays><json> | 2016-06-10 12:43:33 | LQ_CLOSE |
37,749,087 | How to restore state in an event based, message driven microservice architecture on failure scenario | <p>In the context of a microservice architecture, a message driven, asynchronous, event based design seems to be gaining popularity (see <a href="http://blog.christianposta.com/microservices/why-microservices-should-be-event-driven-autonomy-vs-authority/" rel="noreferrer">here</a> and <a href="https://www.nginx.com/blog/event-driven-data-management-microservices/" rel="noreferrer">here</a> for some examples, as well as the <a href="http://www.reactivemanifesto.org/#message-driven" rel="noreferrer">Reactive Manifesto - Message Driven trait</a>) as opposed to a synchronous (possibly REST based) mechanism.</p>
<p>Taking that context and imagining an overly simplified ordering system, as depicted below:</p>
<p><a href="https://i.stack.imgur.com/Xtttg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Xtttg.png" alt="ordering system"></a></p>
<p>and the following message flow:</p>
<ul>
<li>Order is placed from some source (web/mobile etc.)</li>
<li>Order service accepts order and publishes a <code>CreateOrderEvent</code></li>
<li>The InventoryService reacts on the <code>CreateOrderEvent</code>, does some inventory stuff and publishes a <code>InventoryUpdatedEvent</code> when it's done</li>
<li>The Invoice service then reacts to the <code>InventoryUpdatedEvent</code>, sends an invoice and publishes a <code>EmailInvoiceEvent</code></li>
</ul>
<p>All services are up and we happily process orders... Everyone is happy.
Then, the Inventory service goes down for some reason 😬</p>
<p>Assuming that the events on the event bus are flowing in a "non blocking" manor. I.e. the messages are being published to a central topic and do not pile up on a queue if no service is reading from it (what I'm trying to convey is an event bus where, if the event is published on the bus, it would flow "straight through" and not queue up - ignore what messaging platform/technology is used at this point). That would mean that if the Inventory service were down for 5 minutes, the <code>CreateOrderEvent</code>'s passing through the event bus during that time are now "gone" or not seen by the Inventory service because in our overly simplified system, no other system is interested in those events.</p>
<p>My question then is: How does the Inventory service (and the system as a whole) restore state in a way that no orders are missed/not processed?</p>
| <messaging><reactive-programming><microservices><event-based-programming> | 2016-06-10 13:06:04 | HQ |
37,749,900 | How to disregard the NaN data point in numpy array and generate the normalized data in Python? | <p>Say I have a numpy array that has some float('nan'), I don't want to impute those data now and I want to first normalize those and keep the NaN data at the original space, is there any way I can do that?</p>
<p>Previously I used <code>normalize</code> function in <code>sklearn.Preprocessing</code>, but that function seems can't take any NaN contained array as input.</p>
| <python><numpy><scipy><scikit-learn> | 2016-06-10 13:46:08 | HQ |
37,750,186 | The application bundle does not contain a valid identifier | <p>I try to run my project but i get the following error "The application bundle does not contain a valid identifier."</p>
<p>here my info.plist</p>
<p><a href="https://i.stack.imgur.com/p1jC9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/p1jC9.png" alt="enter image description here"></a></p>
<p>I followed other answer on the question. I don't have any "Ressources" folder inside my project.</p>
<p>Thanks for your help</p>
| <xcode><swift><bundle> | 2016-06-10 14:00:06 | HQ |
37,750,256 | Send a message in a channel "only visible to you" | <p>I can not see in the slack API documentation the way for a bot to send a message in a channel that response to a user.</p>
<p>The same way <code>slackbot</code> does reply when doing <code>/help</code>.</p>
<p>Anyone can let me know if that is possible?</p>
<p><a href="https://i.stack.imgur.com/VLuse.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VLuse.png" alt="enter image description here"></a></p>
<p>Notice the "Only visible to you". In the RTM manual they say that the messsage is of the same type as the event <a href="https://api.slack.com/events/message" rel="noreferrer">message</a>. I don't see any attributes that would say it is visible only to a certain user.</p>
| <slack-api> | 2016-06-10 14:03:15 | HQ |
37,750,451 | Send HTTP POST message in ASP.NET Core using HttpClient PostAsJsonAsync | <p>I want to send dynamic object like</p>
<pre><code>new { x = 1, y = 2 };
</code></pre>
<p>as body of HTTP POST message. So I try to write</p>
<pre><code>var client = new HttpClient();
</code></pre>
<p>but I can't find method </p>
<pre><code>client.PostAsJsonAsync()
</code></pre>
<p>So I tried to add Microsoft.AspNetCore.Http.Extensions package to project.json and add </p>
<pre><code>using Microsoft.AspNetCore.Http.Extensions;
</code></pre>
<p>to uses clause. However It didn't help me.</p>
<p>So what is the easiest way to send POST request with JSON body in ASP.NET Core?</p>
| <c#><asp.net-core><.net-core> | 2016-06-10 14:12:11 | HQ |
37,750,689 | is there ashift operation in Rstudio? | in c++ there is shift operartion
>> right shift
<< left shift
this is consider to be very fast.
I tried to apply the same in R studio but it seems to be wrong.
Is there a similar operation in R studio that is as fast as this?
thanks in advance.
| <r> | 2016-06-10 14:24:16 | LQ_EDIT |
37,751,081 | Canvas HTML5 Effects | <p>I'm looking for create a CANVAS effect on a logo, something like this:</p>
<p><a href="http://www.teamgeek.co.za/" rel="nofollow">http://www.teamgeek.co.za/</a></p>
<p>I couldn't find something like that. Someone know how to do it?</p>
<p>Thanks!</p>
| <javascript><html><canvas> | 2016-06-10 14:43:26 | LQ_CLOSE |
37,751,375 | Instagram new logo css background | <p>Recently, Instagram logo has changed as you all know. I need vector logo but it is not possible, I mean gradients. Is there any css code for new logo? </p>
| <css><instagram> | 2016-06-10 14:57:36 | HQ |
37,751,539 | how to insert value into key json c#? | <p>Must enter values in a key of a Json but I can not implement, how I do?</p>
<p>Example:</p>
<pre><code>{
"name": "Allan",
"lastname": "Zé Store",
"type": "J",
"street": "Rua Abdon Batista, 121",
"emails": [
{
"email": "jose@zestore.com.br"
},
{
"email": "marcos@zestore.com.br"
}
],
"phone": [
{
"number": "(11) 98765-4321"
},
{
"number": "(47) 9876-5432"
}
]
}
</code></pre>
<p>I need to assemble an array inside the key?</p>
| <c#><arrays><json> | 2016-06-10 15:05:55 | LQ_CLOSE |
37,751,986 | PHP Crypt Function with User input | <p>So I was looking at the <a href="http://php.net/manual/en/function.crypt.php" rel="nofollow">PHP Crypt Function</a></p>
<p>and I was wondering if you could make this into a user input form type deal.</p>
<p>Like <a href="http://i.stack.imgur.com/KmvkV.png" rel="nofollow">This</a> so when they submit the whatever they entered it will output the crpyt() function after they submit it and crpyt whatever they entered (eg. Like a password or something.) </p>
<p>Sorry if this was answered before, I couldn't seem to find it! Any help on this would be great! Thanks.</p>
| <php><html><forms><input><crypt> | 2016-06-10 15:30:40 | LQ_CLOSE |
37,752,036 | I need assistance in python with small code in python for school. I havent coded in 2 months | i need help in python about making a code that will first ask a number for a starting number and then ask a number in which it will count spaces with that number until 0. for example: input -10 and then imput 2 and it will count from -10 to 0(0 not included) with 2 spaces: -10 -8 -6 -4 -2 | <python> | 2016-06-10 15:32:50 | LQ_EDIT |
37,752,273 | How do I run specific tests using dotnet test? | <p>I have a large test suite in a .NET Core project. I can use the Test Explorer window to select a few tests to run.</p>
<p>I can also run the <strong>whole</strong> test suite on the command line with <code>dotnet test</code>. Is there a way to run only one (or a few) tests on the command line?</p>
| <xunit.net><.net-core><.net-core-rc2><xunit2> | 2016-06-10 15:45:15 | HQ |
37,752,962 | 'git pull' command work from terminal but not with php shell_exec() via git repository hook | <p>I have create a webhook in my github repository which post on the hook url on my live server to run pull command for update my repo files on the server. </p>
<p>The problem is the hook file which i have created is in the /var/www/site/web/hookfile.php (the post request is going there. i am getting the body response also)</p>
<p>and my repo files are in /var/www/git-repo/</p>
<p>its not updating the git-repo when i push anything to my github repository.
I run this command using terminal and its working.</p>
<pre><code>cd /var/www/git-repo && git pull
</code></pre>
<p>But through my php file its not working</p>
<pre><code>shell_exec('cd /var/www/git-repo && git pull')
</code></pre>
| <php><git><github><repository><shell-exec> | 2016-06-10 16:21:20 | HQ |
37,753,131 | VBA macro Excel | I've never done macros before so please bear with me while I try to explain what I want to accomplish:
I have a sheet that has some `names` and `SSN's` and then has 4 columns filled with the following values: `S`, `MB`, `B`.
For said columns I wish to replace `S` with the number `4`, `MB` with the number 3 and `B` with the number 2. I have thousands of excel files that will need this change and doing it manually with a `CTRL+F` and replacing for each excel sheet is not going to cut it, timewise.
Can anyone get me started on how to accomplish this? | <excel><vba> | 2016-06-10 16:31:39 | LQ_EDIT |
37,753,632 | How to append an int to the end of a string argument for getElementByID() | <p>I need to know how to append an integer to the end of an argument of type string for the getElementByID method... in this example latest==2. And i want to search for the id "number2". </p>
<pre><code>number=document.getElementById("number"&latest);
</code></pre>
<p>This current syntax is giving me issues.</p>
<p>Additionally, if i want to dynamically insert HTML, how would one go about inserting that value into the data field for a label</p>
<pre><code>cell1 = row.insertAdjacentHTML('beforeend',<span><label for="2" id="label2">2</label></span>
</code></pre>
<p>All the "2"'s here should be dynamic, like if i were to reference a global counter n... </p>
| <javascript><html> | 2016-06-10 17:03:06 | LQ_CLOSE |
37,753,785 | Regex repating string | i need a Regex for the following Text.
I already tried many stuff, but always it only match the last two groups or it match 'someText 1 & someText 2 & someText 3 &' as one group...
someText 1 & someText 2 & someText 3
someText 1 & someText 2 & someText 3 & someText 4
What i expect are two matches :
Match 1:
- someText 1
- someText 2
- someText 3
and
Match 2:
- someText 1
- someText 2
- someText 3
- someText 4
greetings,
False
| <python><regex> | 2016-06-10 17:11:45 | LQ_EDIT |
37,753,911 | How can I embed SVG into HTML in an email, so that it's visible in most/all email browsers? | <p>I want to generate graphs in SVG, and email an HTML page with those graphs embedded in it (not stored on a server and shown with linked images). </p>
<p>I've tried directly embedding the SVG, using the Object element, and serializing and URI encoding the SVG and specifying the whole string as a background image on a div. Nothing seems to display in Outlook 2013. Any ideas?</p>
| <html><svg><html-email> | 2016-06-10 17:19:35 | HQ |
37,753,991 | com.google.firebase.database.DatabaseException: Calls to setPersistenceEnabled() must be made before any other usage of FirebaseDatabase instance | <p>I am having a problem when I try to setPersistence in fIREBASE,can someone please explain on how to go about it,</p>
<pre><code>protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_meal_details);
if (mDatabase == null) {
mDatabase = FirebaseDatabase.getInstance().getReference();
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
// ...
}
// FirebaseDatabase.getInstance().setPersistenceEnabled(true);
mDatabase = FirebaseDatabase.getInstance().getReference();
</code></pre>
| <android><firebase><firebase-realtime-database> | 2016-06-10 17:25:01 | HQ |
37,754,203 | Intellij: Change project indent from 4 spaces to 2 spaces | <p>Currently, all of my project files are indented with 4 spaces. I want to change that to 2 spaces as my organization uses 2 as an standard, but can't find any answers.</p>
| <intellij-idea> | 2016-06-10 17:38:45 | HQ |
37,754,299 | How to properly set line height for Android? | <p>I am a UX architect working with a team of Android developers that are mostly junior. We are having issues properly setting line height in Android. </p>
<p>We are using the Material Design spec as our guide for our app. In particular, you can see line height specs here:</p>
<p><a href="https://material.google.com/style/typography.html#typography-line-height" rel="noreferrer">https://material.google.com/style/typography.html#typography-line-height</a></p>
<p>Let's use Body 2 as our example. The spec says the type is 13sp or 14sp, and the leading (line height - same thing) should be 24dp. </p>
<p>Here's the problem: these devs are telling me there is no such way to set line height like that in the code. Instead, they are telling me to measure the distance between the two lines of text and give them that measure - let's say it's 4dp. They want this for each style of text we are using. </p>
<p>We are using a Sketch > Zepelin flow for spec. </p>
<p>It seems odd to me to be able to create a font style (which could easily be class/style in the code) that is 13sp with 24dp leading, and not be able to set the leading, but instead have to add a 3rd measure to the mix. There is no place in Sketch or Zepelin for such a measure "between lines."</p>
<p>Is this really the way it is done, or is there a proper way to set line height? </p>
| <android><typography> | 2016-06-10 17:44:05 | HQ |
37,754,574 | Can you set rounded pixel corners in Photoshop? | <p>I'm making a pixel art that's why my canvas is only 30x60 pixels, and I don't think using a rectangle shape will work because the canvas is just too small and I only need one pixel to have a rounded corner.</p>
| <photoshop> | 2016-06-10 18:01:40 | LQ_CLOSE |
37,754,948 | How to get the indices list of all NaN value in numpy array? | <p>Say now I have a numpy array which is defined as,</p>
<pre><code>[[1,2,3,4],
[2,3,NaN,5],
[NaN,5,2,3]]
</code></pre>
<p>Now I want to have a list that contains all the indices of the missing values, which is <code>[(1,2),(2,0)]</code> at this case.</p>
<p>Is there any way I can do that?</p>
| <python><numpy><scipy> | 2016-06-10 18:26:38 | HQ |
37,756,144 | Interact with web pages using python | <p>I am quite fluent in Python, but have only really used it for data analysis.</p>
<p>I would like to learn how I can interact with webpages. For instance, I want to start by writing a code that will press a button on a webpage for me.</p>
<p>I just don't know where to start or what to google to find resources about this.</p>
<p>Could anyone point me out in the right directions, or suggest some key words that I could search for?</p>
<p>Thanks.</p>
| <python> | 2016-06-10 19:51:35 | LQ_CLOSE |
37,756,724 | Andoird get Index 1 out of range on parse json format | i'm trying to parse this below json format such as:
[
[
{
"mobileNumber":"(937) 107-6569","contactUserId":"17",
"userEwallets":
[
{"accountNumber":"EPIRR9371076569"},
{"accountNumber":"EPUSD9371076569"},
{"accountNumber":"EPCHF9371076569"}
]
}
]
,
[
{
"mobileNumber":"+981077331743","contactUserId":"1",
"userEwallets":
[
{"accountNumber":"EPIRR1077331743"}
]
}
]
]
for parsing second json array of that as
[
{
"mobileNumber":"+981077331743","contactUserId":"1",
"userEwallets":
[
{"accountNumber":"EPIRR1077331743"}
]
}
]
i get this error:
Index 1 out of range [0..1)
from below code my code can only parse the first array of that, for second array i get exception when i try to get `mobileNumber` of second json array object
for (int i = 0; i < response.length(); i++) {
try {
JSONArray jsonArray = response.getJSONArray(i);
final String mobileNumber = jsonArray.getJSONObject(i).getString("mobileNumber");
final String contactUserId = jsonArray.getJSONObject(i).getString("contactUserId");
final String userEwallets = jsonArray.getJSONObject(i).getString("userEwallets");
Log.e("MobileNumber ", mobileNumber);
JSONArray ewallets = new JSONArray(userEwallets);
for (int j = 0; j < ewallets.length(); j++) {
JSONObject ewalletObject = ewallets.getJSONObject(j);
final String accountNumber = ewalletObject.getString("accountNumber");
Log.e("accountNumber ", accountNumber);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
| <android> | 2016-06-10 20:29:38 | LQ_EDIT |
37,757,282 | Thread 1 Signal SIGABRT XCode | import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
func applicationDidEnterBackground(application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
I an getting an error at the "@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {" | <ios><sigabrt> | 2016-06-10 21:15:35 | LQ_EDIT |
37,757,768 | Spring boot component scan include a single class | <p>I am using spring component scan to auto detect beans as:</p>
<pre><code>@ComponentScan({"com.org.x, com.org.y"})
</code></pre>
<p>The issue is I want all classes in <code>com.org.x</code> to be scanned but I want a single class, <code>com.org.y.SomeService.class</code>, alone to be scanned from <code>com.org.y</code></p>
<p>How can I achieve this ?</p>
<p>Also apart from using context scan, how can I created this bean and inject in the application context ?</p>
| <java><spring><spring-boot><spring-annotations><component-scan> | 2016-06-10 22:07:16 | HQ |
37,758,394 | trying to compare POSIXct objects in if statements within functions- R studio | I have something like this within a function:
x <- as.POSIXct((substr((dataframe[z, ])$variable, 1,
8)), tz = "GMT", format = "%H:%M:%S")
print(x)
if ( (x >= as.POSIXct("06:00:00", tz = "GMT", format = "%H:%M:%S")) & (x < as.POSIXct("12:00:00", tz = "GMT", format = "%H:%M:%S")) ){
position <- "first"
}
but I get this output:
character(0)
Error in if ((as.numeric(departure) - as.numeric(arrival)) < 0) { :
argument is of length zero
how can I fix this so my comparison works and it prints the correct thing? | <r><if-statement><posixct> | 2016-06-10 23:21:31 | LQ_EDIT |
37,758,506 | Dublicate array items using recursion instead of for loop | // This my wrong code , what is the right??`// This my wrong code , what is the right??
function dubArr(arr){
newArr=[];
if(arr.length===0){
return newArr;
}
newArr.push(2*arr[0]);
arr.shift();
dubArr(arr);
return newArr;
}`
| <javascript><arrays><recursion> | 2016-06-10 23:37:07 | LQ_EDIT |
37,758,512 | this code is not answering the equations correctly | here I use this code to test if the output will be correct when it is variables so I put this two lines :
double t = (0.8*0.8*(10^5)*599*(10^-6)*1388.888889)/(287*(25+273)*14.7*3*(10^-3)*4);
Serial.println(t);
here the output on the serial port is 4.03 but it should be 3.5
how could I solve this problem please
I'm using arduino UNO and this was arduino code
| <c><arduino> | 2016-06-10 23:37:34 | LQ_EDIT |
37,758,932 | PHP IF-Statement doesnt work like i want | <p>I recently started writing a website for learning html/css/js/php.</p>
<p>I designed the front-end of my site with bootstrap.
Now I am trying to validate some inputs with PHP.</p>
<p>I tried this:</p>
<pre><code> if ($durationHH <= 0 && $durationMM <= 0)
{
echo "DurationHH and DurationMM can not be both zero at the same time.";
echo "<br>";
echo "DurationHH and DurationMM can not be smaller than 0.";
}
elseif (empty($durationHH) || empty($durationMM))
{
echo "DurationHH and DurationMM can not be empty.";
echo "<br>";
}
else
{
echo $_POST["durationMM"];
echo ":";
echo $_POST["durationHH"];
}
</code></pre>
<p>I tested the validation by putting in some values for durationHH and durationMM.</p>
<p>Everything is working fine so far, except these two cases:</p>
<p>durationMM = 0 AND durationHH = any value</p>
<p>&&</p>
<p>durationHH= 0 AND durationMM = any value.</p>
<p>In these two cases i get the output: "DurationHH and DurationMM can not be empty."</p>
<p>How/why does this happen?</p>
| <php><if-statement><logic><logical-operators><boolean-logic> | 2016-06-11 00:53:25 | LQ_CLOSE |
37,759,110 | am i using @font face incorrectly? | <p>can anyone tell me why i cant seem to get a font to work on my site</p>
<p>css</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>@fontface {
font-family: Summer;
src: url(/font/CodePredators-Regular.ttf);
}
p {
color: #000000;
font-size: 1em;
font-family: Summer, Tahoma, "Tungsten Bold", Arial, sans-serif;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><p>this is a test</p> </code></pre>
</div>
</div>
</p>
<p>ive actually tried a couple other "methods" but nothing seems to work
ive even tried to upload the font into the root folder in an attempt to make the url path easier</p>
<p>nothing gives</p>
<p>maybe if i see some different code it will help</p>
| <html><css> | 2016-06-11 01:28:42 | LQ_CLOSE |
37,759,155 | Changing font size on javaScript | Im currently trying to change the FontSize of the Letters "Se Habla Espanol"
So Im relative New to Javascript .... And well during the process of the me playing with the website i got into the following problem.
This is what i currently have...
<body>
<font color="yellow">
<script>
function blinker() {
$('.blinking').fadeOut(500);
$('.blinking').fadeIn(500);
}
setInterval(blinker, 1000);
</script>
<center>
<p class="blinking">se habla Espanol</p>
</center>
</font>
</body>
I was thinking of using the following code but it seem that is only responsive to HTML and not javascript
<font size="+2">This is bigger text.</font>
This is what i had in mind so my work is not really accurate everything is taken from the internet
--This is what i attempted to do but didn't work :
<center>
<font size="+2">
<p class="blinking">se habla Espanol</p>
</font>
</center> | <javascript><jquery><html><css> | 2016-06-11 01:38:22 | LQ_EDIT |
37,759,603 | Explain this bit of code to a beginner | <pre><code>for x in xrange(12):
if x % 2 == 1:
continue
print x
</code></pre>
<p>i know what it does, but the language doesn't make sense to me. In particular the second line is where i am lost.</p>
| <python-2.7><explain> | 2016-06-11 03:22:15 | LQ_CLOSE |
37,759,755 | Add Github remote to GitKraken | <p>I'm using GitKraken (v. 1.4.1) as my Git managing tool. And now I want to use Github as a remote to back up my repos. But when I click on add remote and try to add a Github repo, it just says 'no match'</p>
<p><a href="https://i.stack.imgur.com/rlt7G.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rlt7G.png" alt="Gitkraken w/o Github"></a></p>
<p>Does anybody know why this happens? (BTW: I'm using Windows 10, just in case that's relevant)</p>
| <windows><git><github><version-control><gitkraken> | 2016-06-11 03:55:56 | HQ |
37,760,184 | Make this bootstrap nav submenu always open | i have a code to make bs nav, but i dont understand how to make submenu always open without clicking menu name.
this is the code :
jsfiddle.net/6hrmodok/2/
and please answer this question with the new code. thankyou | <javascript><jquery><css><twitter-bootstrap> | 2016-06-11 05:13:41 | LQ_EDIT |
37,760,287 | How to get true or false as follows using Symmetry in Python? | If we have to get two values from the user, which we get as
'a' 'p' > True .
How would we get the following:
`'abcd' 'pqrs' > True
'aaa' 'ppp' > True
'acb' 'pqr' > False
'aab' 'pqr' > False`
| <python> | 2016-06-11 05:29:23 | LQ_EDIT |
37,760,612 | Can not get email address by Facebook login (javascript) | <p>I use Facebook javascript to handle function login by Facebook.
Before, i can use it, and Facebook send for my server user's info:</p>
<p>localhost</p>
<pre><code>v2.2
id:
first_name:
last_name:
email:
token:
</code></pre>
<p>v2.5 - But, now i only get: </p>
<pre><code>id:
first_name:
last_name:
token:
</code></pre>
<p>Don't have email?
what's problem at here? and how i can fix it.</p>
<p>Thank you so much!</p>
| <javascript><php><facebook><facebook-graph-api> | 2016-06-11 06:16:21 | LQ_CLOSE |
37,761,651 | Remove NA values in R | <p>How can I remove rows which include NA values in a subset of columns?</p>
<p>For the following data.frame, I want to remove rows which have NA in both columns ID1 and ID2:</p>
<pre><code>name ID1 ID2
a NA NA
b NA 2
c 3 NA
</code></pre>
<p>I want to receive this one:</p>
<pre><code>name ID1 ID2
b NA 2
c 3 NA
</code></pre>
| <r> | 2016-06-11 08:30:43 | LQ_CLOSE |
37,762,086 | RegExp to search words starts with numbers and special characters only using C# | <p>I want to perform a search to C# list object to find all products starts with any number or special characters only. I am looking for a Regular expressions for this scenario.</p>
<p>Please help </p>
| <c#><regex> | 2016-06-11 09:25:37 | LQ_CLOSE |
37,762,442 | Jquery check checkbox value then set checked | <p>I had a checkbox </p>
<pre><code><input type="checkbox" name="paid" id="paid-change">
</code></pre>
<p>which will have value = "1" or "0".I want to check if checkbox value = "1" the checkbox will add checked status on it.
Tks for your help!</p>
| <javascript><jquery> | 2016-06-11 10:05:15 | LQ_CLOSE |
37,762,615 | How to parse JSON from the Invoke-WebRequest in PowerShell? | <p>When sending the GET request to the server, which uses self-signed certificate:</p>
<pre><code>add-type @"
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
$RESPONSE=Invoke-WebRequest -Uri https://yadayada:8080/bla -Method GET
echo $RESPONSE
</code></pre>
<p>I'm getting following Response:</p>
<pre><code>StatusCode : 200
StatusDescription : OK
Content : {123, 10, 108, 111...}
RawContent : HTTP/1.1 200 OK
Content-Length: 21
Date: Sat, 11 Jun 2016 10:11:03 GMT
{
flag:false
}
Headers : {[Content-Length, 21], [Date, Sat, 11 Jun 2016 10:11:03 GMT]}
RawContentLength : 21
</code></pre>
<p>Content contains some wired numbers, so I went after RawContent, how would I parse the JSON inside, ignoring headers? or is there a clean way to get Content from those numbers?</p>
| <json><powershell><response> | 2016-06-11 10:24:13 | HQ |
37,762,917 | How can Multiprocessing be achieved by Programming Languages? | <p>I am trying to develop a simple Operating System. Till now all programs that I developed can be run in a single processor. But when I went through a concept called Multiprocessing Systems which almost all of the latest systems are based, I got lot of doubts.</p>
<p>First, How can I create a program which can run in Multiprocessor systems. Is it Hardware oriented or Programmer specific?</p>
<p>Second I went through Parallel Programming Languages which can be helpful in Multiprocessing Systems where Java is one but C is not. Then how can an OS developed in C(Windows) can achieve Multiprocessing?</p>
<p>Thanks.</p>
| <c><assembly><operating-system><kernel><multiprocessing> | 2016-06-11 10:56:45 | LQ_CLOSE |
37,763,170 | Git signed commits - How to suppress "You need a passphrase to unlock the secret key..." | <p>I changed my global Git configuration to sign all commits. I also use gpg-agent so that I don't have to type my password every time.</p>
<p>Now every time I make a new commit I see the following five lines printed to my console:</p>
<pre><code>[blank line]
You need a passphrase to unlock the secret key for
user: "John Doe <mail@gmail.com>"
2048-bit RSA key, ID ABCDEF12, created 2016-01-01
[blank line]
</code></pre>
<p>Even worse, when I do a simple stash, this message is printed <em>twice</em>, needlessly filling my console (I assume for one for each of the two commit objects that are created).</p>
<p>Is there a way to suppress this output?</p>
| <git><gnupg><git-commit> | 2016-06-11 11:24:54 | HQ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.