Id int64 34.6M 60.5M | Title stringlengths 15 150 | Body stringlengths 33 36.7k | Tags stringlengths 3 112 | CreationDate stringdate 2016-01-01 00:21:59 2020-02-29 17:55:56 | Y stringclasses 3 values |
|---|---|---|---|---|---|
38,393,292 | include common headers and footers django | I am working with Django templates, most of the templates have common header and footer like CSS, scripts etc,
so instead of writing them in every template, how can I attach templates with common header and footer files. | <python><django> | 2016-07-15 10:02:39 | LQ_EDIT |
38,393,918 | What is the difference between struct complex (*ptr1)[4] and struct complex *ptr1 ?? which is better to use? | 1. struct complex *ptr1=(struct complex*)malloc(4*sizeof(struct complex));
2. struct complex (*ptr1)[4]=(struct complex*)malloc(sizeof(struct complex));
| <c> | 2016-07-15 10:33:50 | LQ_EDIT |
38,395,345 | i am getting error "java.nio.charset.MalformedInputException: Input length = 1" in scala | scala> val lines = scala.io.Source.fromFile("1.pdf").getLines
java.nio.charset.MalformedInputException: Input length = 1
| <scala> | 2016-07-15 11:46:42 | LQ_EDIT |
38,397,499 | Text doesnt pass to a second line in contenteditable div | I use html **contenteditable div** instead of a **textarea**. But problem is that when i typing something in contenteditable div and input text hits the right border of contenteditable div text doesnt pass to a second line it keeps on staying on a first line thus text horizontally overflows a contenteditable div.
**Is it normal? How to prevent this? How to force a text to pass to the next line when it hits to the right broder of contenteditable div?
Thanks!** | <html><css> | 2016-07-15 13:35:31 | LQ_EDIT |
38,397,850 | How can I let something happen a certain percentage of the time? (Javascript) | <p>I'm a noob at javascript, sorry if this is a dumb question.
I want something to happen a certain % of the time.</p>
<p>So if a user clicks a button, x% of the time situation A will happen (Let's call this succes) and the other times situation B will happen.</p>
<p>The thing is, that the more user succeeds, the more % chance the user should have of succeeding the next time.</p>
<p>Any ideas?</p>
| <javascript> | 2016-07-15 13:52:04 | LQ_CLOSE |
38,399,466 | Simple Example SwingUtilities | <p>I have a probably annoying request. Could someone demonstrate how to use one of these static Java swing utility methods? I am looking for a simple, extremely simple, example.</p>
<pre><code>public static void paintComponent(java.awt.Graphics, java.awt.Component, java.
awt.Container, int, int, int, int);
public static void paintComponent(java.awt.Graphics, java.awt.Component, java.
awt.Container, java.awt.Rectangle);
</code></pre>
<p>These static Java swing methods are found in the <code>javax.swing.SwingUtilities</code> package. </p>
<p>Thank-you for reading this and any help given.</p>
| <java><swing> | 2016-07-15 15:06:51 | LQ_CLOSE |
38,400,202 | SQL - Procedure & Query with SUM & return - Need help - Willing pay 15$ | I'am trying to do a **Procedure** with a sub query who do a **SUM**.
The procedure should list all items of <ProductFinished> (I.e Pizza etc) and list the ingredients , with unit price of ingredient and the total sum of cost of the finished product.
UML of the Database :
http://i.stack.imgur.com/B7r8R.png
**I'am willing to pay 15$ Paypal for anyone who help me figure it out/do this query.**
The product <NameFInishedProduct> is composed of
3 <NameRawProduct> priced <BuyPrice> € each
1 <NameRawProduct> priced <BuyPrice> € each
The total price of the <NameFInishedProduct> is <SUM> €.
Witch in normal output should look like
The product Pizza is composed of
3 Tomato priced 2 € each
1 Cheese priced 1€ each
The total price of the Pizza is 7 €.
| <sql-server><stored-procedures> | 2016-07-15 15:44:24 | LQ_EDIT |
38,401,600 | Why does the following Code throw a NullReferenceException? | <p>I know that most cases of a NullReferenceException are caused of missing initialization. But I initializated MTemp and FTemp. </p>
<p>What I'm missing?</p>
<hr>
<p>Important code inside the class "Foo":</p>
<pre><code>class Team
{
public List<Fahrer> TeamFahrer { get; set; }
public void Bar(string salad, string hotdog, string brokkoli)
{
Motorrad MTemp = new Motorrad(brokkoli);
Fahrer FTemp = new Fahrer(salad, hotdog, MTemp);
TeamFahrer.Add(FTemp);
}
}
</code></pre>
<hr>
<p>Important code inside Motorrad:</p>
<pre><code>class Motorrad
{
public Motorrad(string marke)
{
Marke = marke;
}
public string Marke { get; set; }
}
</code></pre>
<hr>
<p>Important Code inside Fahrer:</p>
<pre><code>class Fahrer
{
public Fahrer(string salad, string hotdog, Motorrad moped)
{
Vorname = salad;
Nachname = hotdog;
MotorradDesFahrers = moped;
}
public string Vorname { get; set; }
public string Nachname { get; set; }
public Motorrad MotorradDesFahrers { get; set; }
}
</code></pre>
| <c#><initialization><nullreferenceexception> | 2016-07-15 17:02:59 | LQ_CLOSE |
38,402,374 | Getting unexpected behaviour with firefox web console, equality for undefined not working fine | <p>When trying to write following javascript code snippet in mozilla web console then getting following unexpected behaviour.Please refer below image.When I declared a variable x then the undefined check evaluated to true.But when I defined it as "var a" then I get a seemingly wrong answer.I have checked it for chrome it is working fine.Can please someone explain this obscure behaviour?</p>
<p><a href="https://i.stack.imgur.com/S56rn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/S56rn.png" alt="enter image description here"></a></p>
| <javascript><mozilla> | 2016-07-15 17:52:01 | LQ_CLOSE |
38,402,573 | In c++, when accessing member variable in a class, any difference between using a.var and a.var() | Just for example
Class A{
public:
int a;
};
int main(){
A test;
int b = test.a;
int c = test.a();
}
My question is that when accessing the member variable of a class, is there any difference between using test.a and test.a()? | <c++> | 2016-07-15 18:05:42 | LQ_EDIT |
38,402,935 | Is it possilbe in Git to simutaneously create a local branch that tracks a currently non-existing remote branch AND switch to it all at the same time? | **I want a yes or no answer to this one guys!**
I've tried this command which the official Git documentation says should work, with respect to the question I am asking:
> git checkout --track origin/my_branch_name
When I do this though, I get the following error:
> fatal: Cannot update paths and switch to branch 'web-2574' at the same >time.
>Did you intend to checkout 'origin/web-2574' which can not be resolved as >commit?
FRUSTRATED BEYOND ALL BELIEF AS TO HOW HARD IT IS TO GET STRAIGHT FORWARD ANSWERS TO BASIC GIT QUESTIONS.
**Just a simple yes or no PLEASE!!** NO complex explanations or, "oh I know, if you jump through these 50 hoops and ladders you can accomplish what you ask!!"
**I am simply asking if it is possible. If the answer is yes, please share the command that does this.** THANK YOU...and sorry for being so upset. Reason why I am mad though...is because it seems to me like it SHOULD be the DEFAULT behavior for all branches created locally to ALSO be created on the remote repo so you can just push seamlessly without all the BS overhead. Doesn't anyone else feel the same or am I some kind of alien on this planet using Git?? [end rant] | <git> | 2016-07-15 18:30:19 | LQ_EDIT |
38,403,098 | I am getting run time error for the below code | #include<stdio.h>
#include<stdlib.h>
int main(){
int i,j,a[10],result=0,p;
int *m=malloc(sizeof(int)*8);
for(i=0;i<10;i++){
scanf("%d",&a[i]);
result+=a[i];}
//printf("%d\n",result);
//printf("\n");
// for(i=0;i<8;i++){
for(j=0;j<9;j++){
scanf("%d",&m[j]);
result=result-m[j];
p=result/2;}
return p;
}
In this code i am runtime error.Any help would be appreciated.THanks! | <c> | 2016-07-15 18:40:44 | LQ_EDIT |
38,403,662 | How do I make an image act as a upload file button | <p>I want to make a image act like a button that when pressed it allows me to upload another image.</p>
<p>What I have right now is the part in the snippet but I want to make it pull a image from my server to act as the button and then run some ajax to not have to reload the page then display the image that was chosen (the previous image should change to the one that was chosen).</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.Uploadbtn {
position: relative;
overflow: hidden;
padding: 10px 20px;
text-transform: uppercase;
color: #fff;
background: #000066;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
width: 100px;
text-align: center;
cursor: pointer;
}
.Uploadbtn .input-upload {
position: absolute;
top: 0;
right: 0;
margin: 0;
padding: 0;
opacity: 0;
height: 100%;
width: 100%;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div class="Uploadbtn">
<input type="file" class="input-upload" />
<span>IMAGE</span>
</div></code></pre>
</div>
</div>
</p>
| <javascript><jquery><html><css><ajax> | 2016-07-15 19:20:32 | LQ_CLOSE |
38,403,750 | Ceaser Cipher using char * ? c++ | So i am trying to use the Ceaser Cipher with `char *`'s, i've written a simple function out like this:
char * Encrypt(char * Source, int Key)
{
char * Crypted = Source;
for(int Current = 0; Current < strlen(Source); Current++)
Crypted[Current] += Key;
return Crypted;
}
that seems to look like it should work but it doesn't? It throws an error when running program. And before you say "why not just use `string`?", well the answer is I'm writing c++ on a certain sdk that causes compiler errors when using `string`. Ok but yeah, any form of help will greatly be appreciated, thanks! | <c++><encryption><caesar-cipher><char-pointer> | 2016-07-15 19:26:17 | LQ_EDIT |
38,405,544 | Do While Loop menu in C++ | <p>I'm having trouble with this do-while loop menu for a program I'm working on for school. I've checked, and as far as I'm concerned I have written the code correctly. However, when testing, if I type 'y' or 'n' the result is the same: the menu streaming down 100's of times non stop until I exit the program. Any idea on what I'm doing wrong and how I can get it to display the menu properly every time? Thanks in advance. </p>
<pre><code>#include <iostream>
#include <iomanip>
#include <string>
#include "CashRegister.h"
#include "InventoryItem.h"
using namespace std;
int main()
{
// Variables
int selection, numUnits, cont;
double price;
// Use the first constructor for the first item
InventoryItem item1;
item1.setCost(5.0);
item1.setDescription("Adjustable Wrench");
item1.setUnits(10);
// Use the second constructor for the second item
InventoryItem item2("Screwdriver");
item2.setCost(3.0);
item2.setUnits(20);
// Use the third constructor for the remaining items
InventoryItem item3("Pliers", 7.0, 35);
InventoryItem item4("Ratchet", 10.0, 10);
InventoryItem item5("Socket Wrench", 15.0, 7);
do
{
cout << "#\t" << "Item\t\t\t" << "qty on Hand" << endl;
cout << "------------------------------------------------------------------" << endl;
cout << "1\t" << item1.getDescription() << "\t" << setw(3) << item1.getUnits() << endl;
cout << "2\t" << item2.getDescription() << "\t\t" << setw(3) << item2.getUnits() << endl;
cout << "3\t" << item3.getDescription() << "\t\t\t" << setw(3) << item3.getUnits() << endl;
cout << "4\t" << item4.getDescription() << "\t\t\t" << setw(3) << item4.getUnits() << endl;
cout << "5\t" << item5.getDescription() << "\t\t" << setw(3) << item5.getUnits() << endl;
cout << "Which item above is being purchased? ";
cin >> selection;
// Validate the selection
while (selection < 1 || selection > 5)
{
cout << "Error, please make a valid item selection: ";
cin >> selection;
}
cout << "How many units? ";
cin >> numUnits;
// Validate the quantity of units to make sure it isn't a negative value
while (numUnits < 0)
{
cout << "Error, please enter a valid quantity: ";
cin >> numUnits;
}
// Use a switch statement to figure out which cost to pull
switch (selection)
{
case 1: {price = item1.getCost();
item1.changeUnits(numUnits); }
break;
case 2: {price = item2.getCost();
item2.changeUnits(numUnits); }
break;
case 3: {price = item3.getCost();
item3.changeUnits(numUnits); }
break;
case 4: {price = item4.getCost();
item4.changeUnits(numUnits); }
break;
case 5: {price = item5.getCost();
item5.changeUnits(numUnits); }
break;
}
// Create a CashRegister object for this particular selection
CashRegister transaction(price, numUnits);
// Display the totals
cout << fixed << showpoint << setprecision(2);
cout << "Subtotal: $" << transaction.getSubtotal() << endl;
cout << "Sales Tax: $" << transaction.getSalesTax() << endl;
cout << "Total: $" << transaction.getPurchaseTotal() << endl;
// Find out if the user wants to purchase another item
cout << "Do you want to purchase another item? Enter y/n: ";
cin >> cont;
} while (cont != 'n' && cont != 'N');
system("pause");
return 0;
</code></pre>
<p>}</p>
| <c++> | 2016-07-15 21:57:16 | LQ_CLOSE |
38,408,064 | How do I make a music start in thebackground when my program starts in c#? | <p>I am trying to make a .wav music file start whenever the program starts. <strong>No, I am not trying to make music play when the user click on a button</strong>, I am trying to make music start by itself whenever the program starts.</p>
<p>I need it for my C# program.</p>
| <c#> | 2016-07-16 05:24:32 | LQ_CLOSE |
38,409,638 | lousy conversion from float to int.type checking in java | the Java is strong type checked language .the java book i am refer
> ***the complete java reference***< says that *numeric types such as integer and float are compatible with each other*
while typing the program i encountered a problem lousy conversion
package niit.program;
public class table5 {
public static void main(String args[]){
int i=5.6;
System.out.println(i);
}
}
[screenshot of the image ][1]
[1]: http://i.stack.imgur.com/2cAvn.png | <java> | 2016-07-16 09:22:25 | LQ_EDIT |
38,410,062 | How to find latitude and longitude lies within radius? | <p>I have latitude and longitude of place. How to find these latitude and longitude lies within some other locations radius? </p>
<p>for example having (6.8914,79.8522) (lat,long) of location,and find within location (6.9584218,80.1783008) of radius 10.</p>
<p>please help me.</p>
| <php><html><mysql><laravel-5><latitude-longitude> | 2016-07-16 10:13:48 | LQ_CLOSE |
38,410,186 | Read a structured txt file in r | I am still on a basic beginner level with r. I am currently working on some natural language stuff and I use the ProQuest Newsstand database. Even though the database allows to download txt files, I don't need everything they provide. The files you can download there look like this:
###############################################################################
____________________________________________________________
Report Information from ProQuest
16 July 2016 09:58
____________________________________________________________
____________________________________________________________
Inhaltsverzeichnis
1. Savills cracks Granite deal to establish US presence ; COMMERCIAL PROPERTY
____________________________________________________________
Dokument 1 von 1
Savills cracks Granite deal to establish US presence ; COMMERCIAL PROPERTY
http:...
Kurzfassung: Savills said that as part of its plans to build...
Links: ...
Volltext: Property agency Savills yesterday snapped up US real estate banking firm Granite Partners...
Unternehmen/Organisation: Name: Granite Partners LP; NAICS: 525910
Titel: Savills cracks Granite deal to establish US presence; COMMERCIAL PROPERTY: [FIRST Edition]
Autor: Steve Pain Commercial Property Editor
Titel der Publikation: Birmingham Post
Seiten: 30
Seitenanzahl: 0
Erscheinungsjahr: 2007
Publikationsdatum: Aug 2, 2007
Jahr: 2007
Bereich: Business
Herausgeber: Mirror Regional Newspapers
Verlagsort: Birmingham (UK)
Publikationsland: United Kingdom
Publikationsthema: General Interest Periodicals--Great Britain
Quellentyp: Newspapers
Publikationssprache: English
Dokumententyp: NEWSPAPER
ProQuest-Dokument-ID: 324215031
Dokument-URL: ...
Copyright: (Copyright 2007 Birmingham Post and Mail Ltd.)
Zuletzt aktualisiert: 2010-06-19
Datenbank: UK Newsstand
____________________________________________________________
Kontaktieren Sie uns unter: http...
Copyright © 2016 ProQuest LLC. Alle Rechte vorbehalten.
Allgemeine Geschäftsbedingungen:
...
###############################################################################
What I need is a way to extract only the full text to a csv file. The reason is, when I download hundreds of articles within one file it is quite difficult to copy and paste them manually and I think the file is quite structured. However, the length of text varies. Nevertheless, one could use the next header after the full text as a stop sign (I guess).
Is there any way to do this?
I really would appreciate some help.
Kind regards,
Steffen | <r><text-analysis> | 2016-07-16 10:27:33 | LQ_EDIT |
38,412,864 | Valid Function Declaration | <p>I have an abstract C++ Question and I'm having an argument with someone about this:</p>
<p>Which one of these could be a valid function declaration:</p>
<pre><code>int f ( int i=0, int j );
int f (int j, void k);
int f (int i, int u=0 );
int f (int * = 0);
</code></pre>
| <c++><methods><declaration> | 2016-07-16 15:54:32 | LQ_CLOSE |
38,412,963 | Console.ReadLine().Split (',') does not work | <p>I have the simple snippet of my C# project below.</p>
<pre><code>char[] Delimiters = new char[] { ',' };
string[] Input = Console.ReadLine ().Split (Delimiters);
Console.WriteLine (Input[0], Input[1]);
</code></pre>
<p>I only seem to be getting Input[0]. I've checked on Microsoft's page for splitting strings and various other sources and from what I can tell this SHOULD work.</p>
| <c#> | 2016-07-16 16:03:56 | LQ_CLOSE |
38,413,705 | How to convert JPanel into JFrame; for a Bouncing Ball | I have obtained from somewhere else a Java Swing code for a bouncing Ball. The code uses a class "Ball" which extends a JPanel.
**Can Anyone help me converting this code to extends JFrame instead.**
I want to do that so I could be able to call it from another JFrame class.
Here is the code:
public class Ball extends JPanel{
int x=0, y=0;
int angleX = 1, angleY = 1;
public void move(){
if (x + angleX <0) {
angleX =1;
} else if (x + angleX >getWidth()-50){
angleX =-1;
} else if (y + angleY <0) {
angleY =1;
} else if (y + angleY >getHeight()-50){
angleY =-1;
}
x = x + angleX;
y = y + angleY;
}
@Override
public void paint(Graphics g) {
super.paint(g);
g.fillOval(x, y, 50, 50);
}
public static void main(String[] args){
JFrame jfrm= new JFrame("BounceBall");
jfrm.setSize(400,400);
jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jfrm.setVisible(true);
Ball bl = new Ball();
Component add = jfrm.add(bl);
while (true){
bl.move();
bl.repaint();
try{
Thread.sleep(10);
}catch(InterruptedException e){
}
}
}
} | <java><swing><jframe><jpanel><paint> | 2016-07-16 17:22:35 | LQ_EDIT |
38,413,896 | C++ Make dword with multiple options | <p>I just want to ask, because I couldn't figure out how to formulate my question, I know there will be for sure some answers on google, but I just don't know what to ask for. So.. I want to make dword with options. I mean something like this;</p>
<pre><code>DWORD dwOpt = 0;
dwOpt = NOTUSE_D3D | USE_FULLSCREEN |.....
</code></pre>
<p>I think this code is ok, please correct me if it isn't. However, when I'm trying to check if it is there, I'm just getting bad results, and that's most likely because I don't know how to make it and I just used logic for it. I'm using:</p>
<pre><code>BOOL bFullScreen = dwOpt |= USE_FULLSCREEN //? TRUE : FALSE;
</code></pre>
<p>Thank you for answers.</p>
| <c++> | 2016-07-16 17:42:30 | LQ_CLOSE |
38,414,512 | C# isnt correctly subtracting my values | i have a set value and a user entry text box, where i have it set to only numeric entry's, followed by converting it to an int, which all works, but when i run the code and put in a number smaller then the set value it doesn't work out properly
TL:DR
(set value 20, user entered value 12, code returns -4)
private void LSum_Load(object sender, EventArgs e)
{
PassengersTXT.Text = LEFcPassanger.sendtext;
DepartDateTXT.Text = LutonDepart.sendtext;
DepTimeTXT.Text = LutonSat.sendtext;
TravelTypeTXT.Text = LEClass.sendtext;
DepartTXT.Text = Form2.sendtext;
ArriveTXT.Text = LArrive.sendtext;
}
if( TravelTypeTXT.Text == "First Class")
{
Seating.FirstClass -= Convert.ToInt32(PassengersTXT.Text);
if (Seating.FirstClass <= 0)
{
MessageBox.Show("Not Enough Seats in First Class", "ERROR!",
MessageBoxButtons.OK, MessageBoxIcon.Error);
LEFcPassanger form = new LEFcPassanger();
form.Show();
this.Close();
}
else
{
Seating.FirstClass -= Convert.ToInt32(PassengersTXT.Text);
AppFin frm = new AppFin();
frm.Show();
this.Close();
}
//seperate class
class Seating
{
public static int FirstClass = 20;
public static int BusinessClass = 36;
public static int EconomyClass = 84;
public static int TotalSeats = 140;
}
| <c#> | 2016-07-16 18:51:11 | LQ_EDIT |
38,414,880 | Javascript: counter on If Else in array loop not executing | <p>I want to show a line of text depending on what image is shown. I did a console.log on the counter and it seems to loop fine as do the images, but I can't get the line of text to show depending on what number the counter is.</p>
<p>Fiddle: <a href="http://jsfiddle.net/jzhang172/RwjFX/7/" rel="nofollow">http://jsfiddle.net/jzhang172/RwjFX/7/</a></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var imagesArray = ["http://vignette2.wikia.nocookie.net/pokemon/images/e/ef/025Pikachu_Pokemon_Mystery_Dungeon_Red_and_Blue_Rescue_Teams.png/revision/latest?cb=20150105233050",
"http://assets.pokemon.com/assets/cms2/img/pokedex/full//007.png",
"http://assets.pokemon.com/assets/cms2/img/pokedex/full/001.png",
"http://www.pokemonxy.com/_ui/img/_en/art/Fennekin-Pokemon-X-and-Y.jpg",
"http://www.pokemon20.com/assets/img/mythical/arceus/poke_arceus.png"];
function loopImages(count) {
var counter = count % imagesArray.length;
$('img').attr('src', imagesArray[counter]);
$('#firstStar').fadeIn(500, function(){
$('#firstStar').delay(500).fadeOut(500, loopImages.bind(null, count + 1));
});
console.log(counter);
if (counter=1){
$('#imageInfo').html('One');
}
else if (counter=2){
$('#imageInfo').html('Two');
}
}
loopImages(0);</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<img src="https://www.kingdomhearts.com/2_8/images/logos/kingdom_hearts_birth_by_sleep_logo.png" id="firstStar">
<p id="imageInfo">
</p></code></pre>
</div>
</div>
</p>
| <javascript><jquery><html> | 2016-07-16 19:33:58 | LQ_CLOSE |
38,415,445 | in C, cannot read string created by malloc | I have a function which receive a pointer of char array as an argument(char** messageErreur). That pointer is created in the main, but no memory is allocated, as it is created only if necessary (error message to display) (no choice here, the method comes from an unchangeable .h file).
here is the code where I get segmentation fault:
imageMsgErr (messageErreur, "error message");
printf("erreur1 P2\n");
printf("message erreur %s\n", *messageErreur); //**where i get the seg fault
void imageMsgErr (char** messageErreur, char* msg){
messageErreur= (char**)malloc(sizeof(char*));
messageErreur[0]= (char*)malloc(sizeof (char) * 100);
if (*messageErreur){
printf("before strcpy\n");
strcpy(*messageErreur, msg);
printf("message erreur %s\n", *messageErreur);
}
return;
I have tried several similar code with the same result: segmentation fault when it execute the line: printf("message erreur %s\n", *messageErreur);
Help!!!
| <c><pointers><malloc> | 2016-07-16 20:41:30 | LQ_EDIT |
38,416,207 | Char assignment to *char not working | <p>Here is a function used in my main. The issue lies in <code>char</code> assignment. </p>
<pre><code>void takeTurn(int *iap, int *tile, char *cap) {
//*iap is 1 right now
printf("\nThe current active player is %d. His character is %c", *iap, *cap);
//prints The current active player is 1. His character is q.
if (*iap == 1) *cap == 'X';
if (*iap == 2) *cap == 'O';
printf("\nThe current active player is %d. His character is %c", *iap, *cap);.
//prints The current active player is 1. His character is q.
. . .
}
</code></pre>
<p>What needs to be done so the <code>*cap</code> assigns the proper <code>char</code> to the proper active player? </p>
| <c><pointers><char><variable-assignment> | 2016-07-16 22:25:15 | LQ_CLOSE |
38,417,334 | Javascript Storing Information in URL | <p>I was wondering how (if it's possible) to store information in the URL of a webpage? I've noticed in websites like Youtube there is information stored in the URL (for example which video in a playlist) and I would like to know how to do this for a website I'm working on. </p>
| <javascript><html><url><web-applications><store> | 2016-07-17 02:23:01 | LQ_CLOSE |
38,417,551 | Get the max length of Sql Server column using an array | I have four columns in my table namely Surname, FirstName, MiddleName, CurrAddress. Is there a way that I can store column names dynamically using an array and get the max length of each the field? Say for example out of the four fields I only need the Surname and FirstName maximum lengths. My code below will only display one column per transaction. Any help is greatly appreciated. Than you!
ALTER PROCEDURE [dbo].[sp_getColumnLength]
@colval nvarchar(50),
@tblval nvarchar(50)
AS
BEGIN
SELECT character_maximum_length as 'Max Length'
FROM information_schema.columns
WHERE column_name=@colval AND table_name = @tblval
END
GO | <sql><sql-server><stored-procedures> | 2016-07-17 03:11:56 | LQ_EDIT |
38,417,791 | How to avoid NRE when reading the tag of a button C# | <p>(Sobbing out of frustration)</p>
<p>How do you avoid annoying NRE in this case? The output of the code is correct, but I wish to get rid of the NRE.</p>
<p>Background:</p>
<p>There are some buttons on a form, some of which represent seats of a classroom. The other buttons are irrelevant because I only need the seat buttons, and only the seat buttons have tags that has value.</p>
<p>So, I loop through all buttons and read their tags, if it is not empty, then keep that button in a list. The rest are ignored.</p>
<p>However, when the code is run, NRE pops up at the fourth line, the line starting with "try".</p>
<pre><code>foreach (Button seatbutton in this.Controls)
{
string betta;
try { betta = seatbutton.Tag.ToString(); }
catch { betta = ""; }
if (!string.IsNullOrEmpty(betta))
{
seatbuttons.Add(seatbutton);
}
}
</code></pre>
<p>This is the shortest, most straightforward example of this type of NRE in my code. There are several more.</p>
<p>I have searched the web, and most responses are among the lines of: "Bad coding habits caused this."</p>
<p>As you can probably tell, I'm quite new at this whole thing and haven't even had the time to build habits yet. Can you guys help? Perhaps with some tips for GOOD coding habits?</p>
<p>T_T thanks!</p>
| <c#><nullreferenceexception> | 2016-07-17 04:00:55 | LQ_CLOSE |
38,417,941 | In SQL, Whether sysjobs will tell which jobs are failed? | In SQL, Whether sysjobs will tell which jobs are failed?
We have around 100 jobs running on SQL Agent. We have set up an email alert notification for any job failed.
Is there a way for us to run a query to identify list of Jobs are failed.
Below query will provide, list of jobs enabled.
select * from MSDB.dbo.sysjobs where enabled = 1 | <sql-server> | 2016-07-17 04:34:41 | LQ_EDIT |
38,418,984 | Accessing a values from | I have the following dictionary
Dict = {'Manu':{u'ID0020879.07': [{'ID': u'ID0020879.07', 'log': u'log-123-56', 'owner': [Manu], 'item': u'WRAITH', 'main_id': 5013L, 'status': u'noticed', 'serial': u'89980'}]}
How can I access the serial from this dictionary?
I tried `Dict[Manu]['serial']`, But its not working as expected..
Guys any idea? | <python><dictionary> | 2016-07-17 07:41:07 | LQ_EDIT |
38,419,496 | Ruby Rails - Where to start my understanding | <p>I'm trying to learn code and currently running through the exercises within codecademy for Rails.</p>
<p>Though I find this a good learning resource, i'm struggling to understand the relevance of the commands etc to "real life", so I can relate to it.</p>
<p>Can anyone recommend "real life" projects to work through on line re. rails, so I can piece all the fundamental pieces together, whilst seeing what my actions do to the outcome project.</p>
<p>Thank you in advance.</p>
<p>Brendan</p>
| <ruby-on-rails> | 2016-07-17 08:54:19 | LQ_CLOSE |
38,421,376 | Join table and take name into model MVC , LINQ, C#, Models | <p>Here is my Office model</p>
<pre><code>public class Office
{
public int ID { get; set; }
public string Color { get; set; }
}
</code></pre>
<p>And here is my Worker model</p>
<pre><code>public class Worker
{
public int ID { get; set; }
public int OfficeID { get; set; }
public string FullName { get; set; }
[NotMapped]
public string OfficeColor { get; set; }
}
</code></pre>
<p>what I want is to get all workers with LINQ with OfficeColor the Color of the specified OfficeID color</p>
| <c#><asp.net-mvc><linq><select> | 2016-07-17 12:47:40 | LQ_CLOSE |
38,421,734 | Oracle how to combination and count two columns | i need help
my table like this;
A.........................B
1.......................100
1.......................102
1.......................105
2.......................100
2.......................105
3.......................100
3.......................102
i want output like this:
A......................Count(B)
1...................... 3
1,2.................... 2
1,2,3.................. 3
2...................... 2
3...................... 2
how can i do this?
i try to use listagg but it didnt work. sorry for my english | <sql><oracle> | 2016-07-17 13:27:22 | LQ_EDIT |
38,422,362 | use app.use() instead of script tag in node express | <p>I want to use bootstrap with nodejs, express
how to use</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>app.use('/scripts', express.static(__dirname + '/node_modules/jquery/dist/js/jquery.min.js'));
app.use('/link', express.static(__dirname + '/node_modules/bootstrap/dist/css/bootstrap.min.css'));
app.use('/scripts', express.static(__dirname + '/node_modules/bootstrap/dist/js/bootstrap.min.js'));</code></pre>
</div>
</div>
</p>
<p>instead of</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script></code></pre>
</div>
</div>
</p>
<p>Please help me, thanks!</p>
| <javascript><node.js><twitter-bootstrap><express> | 2016-07-17 14:34:51 | LQ_CLOSE |
38,422,390 | Should the data be calculated in DB server or in CGI process? Which way is better? | <p>So I am an green hand, when I am coding, I always think that should the data be calculated (for example , in MYSQL, I need to do calculation in script which including 'group by') in DB server or in the CGI procedure? Which way is more better and more efficient? </p>
<p>Actually this stuff confuse me such a long time..</p>
<p>By the way, recently I use PHP coding in my work.</p>
| <php><mysql><stored-procedures><server> | 2016-07-17 14:37:01 | LQ_CLOSE |
38,422,813 | Passing pointers (matrix) to a function in c | <p>I have dynamically created a matrix using calloc in the usual way:</p>
<pre><code>int **matrix;
int dim,r;
scanf("%d",&dim);
matrix=(int **)calloc(dim, sizeof(int *));
for(r=0; r<dim; r++)
{
matrix[r]=(int *)calloc(dim, sizeof(int));
}
</code></pre>
<p>Now if I wanted to create a function to just print the elements of this matrix, I should write something like:</p>
<pre><code>void stampmatrix(int **matrix, int dim)
{
int r=0, c=0;
for(r=0; r<dim; r++)
{
printf("(");
for(c=0;c<dim;c++)
{
printf(" %d , ",matrix[r][c]);
}
printf(")");
}
}
</code></pre>
<p>And this works fine.
Now I add this line to the previous function</p>
<pre><code>`...`
matrix[r][c]=1;
printf(" %d , ",matrix[r][c]);
...
</code></pre>
<p>If i call this function in my main function,
stampmatrix(matrix,dim)
once i run the program, the compiler should create a copy of my matrix, fill it with 1, and then print them, and then return to my main function <strong>without changing the actual matrix</strong>. But if I do this and then i check in my main function the values of my matrix elements, they are changed to 1.
In class i was told that if I pass values to a function, the program creates a copy of the values, works with them and then cancel the copy, so I need to pass addresses to a function in order to actually change the contents of my variables in my main function.
Why in this case it doesn't work, and changes my matrix values? It's because I still pass pointers to the function stampmatrix? I really don't understand. Shouldn't the function be something like:</p>
<pre><code>void stampfunction(int dim, int ***matrix)
</code></pre>
<p>Or it's because i used a void function?
Thanks for the attention!</p>
| <c><pointers><matrix><dynamic-arrays><dynamic-allocation> | 2016-07-17 15:23:55 | LQ_CLOSE |
38,422,843 | C++: Cannot copy line from an input file to an output file | <p>This is a home work question, so if you are not a fan of those I understand. Here is my code:</p>
<pre><code>#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main()
{
fstream myfile1("datafile1.txt"); //this just has a bunch of names in it
fstream myfile2("cmdfile1.txt"); //has commands like "add bobby bilbums"
ofstream outputFile("outfile1.txt"); //I want to take the "add bobby" command and copy the name into this new file.
string line;
if (myfile1.is_open() && myfile2.is_open()) //so I open both files
{
if (myfile2, line == "add"); //If myfile2 has an "add" in it
{
outputFile.is_open(); //open outputfile
outputFile << line << endl; //input the line with add in it till the end of that line.
}
}
cout << "\nPress Enter..."; // press enter and then everything closes out.
cin.ignore();
outputFile.close();
myfile2.close();
myfile1.close();
return 0;
}
</code></pre>
<p>Problem is, though the outputFile is always empty. It never copies any lines from cmdfile1 into the output file. Does anyone know what I am missing here? </p>
| <c++> | 2016-07-17 15:26:58 | LQ_CLOSE |
38,424,947 | How to multiply a double array and a double together in java | I'm new to this site, and am working on a school assignment, but got stuck. I was wondering if there is any way to multiply a double []array by a double?
for(int i = 0; i <= speed.length; i++)
double [] mph = speed[i] * 1.15;
That is my code, but when I compile it in java, it says
"Incompatible types: double cannot be converted to double[]"
How do I fix this? | <java><arrays> | 2016-07-17 19:07:55 | LQ_EDIT |
38,426,285 | Pug (formerly Jade) Variables Not Working (Interpolating) Correctly Inside Anchor Href | <p>I'm playing around with Node and Express and I'm using the Pug (formerly Jade) templating engine to render my html. Everything has been working fine up until I started trying to inject variables into the <code>href</code> of my anchor links. Whats odd is that if I change my Express app <code>view engine</code> to <code>jade</code> then things start working as expected.</p>
<p>Based upon <a href="https://github.com/pugjs/pug/issues/1028" rel="noreferrer">other articles</a> I've read the issue appears to be an interpolation issue, however I can't seem to find a resource or documentation that shows how to correctly fix this issue.</p>
<p>Ex.</p>
<p>I'm pulling in data from a <code>rooms</code> json array and then using a <code>for</code> loop to cycle through each array element and output the data for each room. Using <code>jade</code> the following works. </p>
<pre><code>table.table.table-striped
thead
tr
th Name
th Id
tbody
each room in rooms
tr
td(style="width: 50px;")
a(href!="/admin/rooms/delete/#{room.id}") Delete
td #{allTitleCase(room.name)}
td #{room.id}
</code></pre>
<p>Using <code>pug</code> the above does NOT work correctly. Specifically the <code>a(href='/admin/rooms/delete/#{room.id}') Delete</code> link doesn't work correctly. Instead of injecting the room id into the link href, it literally outputs <em>#{room.id}</em> as the end part the <code>href</code> link.</p>
<p>Any ideas how to fix this in <code>pug</code>? </p>
<p>Note that I've tried all of the following using <code>pug</code> but none of these options have worked.</p>
<ul>
<li><code>a(href="/admin/rooms/delete/#{room.id}") Delete</code></li>
<li><code>a(href!="/admin/rooms/delete/#{room.id}") Delete</code></li>
</ul>
| <node.js><express><pug><pugjs> | 2016-07-17 21:54:03 | HQ |
38,426,420 | How does a Email-Form work? | <p>this might be a stupid question but its been bugging me all day, I am creating a website from scratch in html , css and js and hope for it to go live very soon. Almost at the end section which is producing a email form for users to enter on the site and the information gets sent directly to my email address. I tried doing alot of research and noticed that like all email forms are done in php if this is the case I may have to do it in a different system because my XAMPP is not working and I won't go into that now but is there any other way to produce a email form without the use of php and still have the sending functionality? Also if produced in php and website goes live will the php code for the email form work as it will be developed in a local host ? Sorry about this question I have never set put up a scratch website live only done wordpress.</p>
| <javascript><php><html><forms><email> | 2016-07-17 22:11:54 | LQ_CLOSE |
38,426,617 | Multivariate Regression Neural Network Loss Function | <p>I am doing multivariate regression with a fully connected multilayer neural network in Tensorflow. The network predicts 2 continuous float variables <code>(y1,y2)</code> given an input vector <code>(x1,x2,...xN)</code>, i.e. the network has 2 output nodes. With 2 outputs the network does not seem to converge. My loss function is essentially the L2 distance between the prediction and truth vectors (each contains 2 scalars): </p>
<pre><code>loss = tf.nn.l2_loss(tf.sub(prediction, truthValues_placeholder)) + L2regularizationLoss
</code></pre>
<p>I am using L2 regularization, dropout regularization, and my activation functions are tanh.</p>
<p><strong>My questions</strong>: Is L2 distance the proper way to calculate loss for a multivariate network output? Are there some tricks needed to get multivariate regression networks to converge (as opposed to single-variable networks and classifiers)?</p>
| <neural-network><tensorflow><linear-regression> | 2016-07-17 22:41:58 | HQ |
38,426,782 | I can't connect to my SQL database. | <p>This is the code I've been using. And when I open it always says "Cannot connect to the server"</p>
<p>Please help me</p>
<pre><code><?php
define('HOST','localhost');
define('USER','root');
define('PASSWORD','');
define('DATABASE','trialdb');
$link = mysqli_connect(HOST,USER,PASSWORD,DATABASE);
mysqli_select_db($link,DATABASE);
if (mysqli_connect(HOST,USER,PASSWORD,DATABASE)) {
die("Cannot connect to the server!");
} else {
echo "Success! You are connected to the server!<br />";
}
if (mysqli_select_db($link,DATABASE)) {
echo "Success! You are now connected to the database.";
} else {
die ("Cannot connect to the database!");
}
?>
</code></pre>
| <php><mysql><database> | 2016-07-17 23:10:11 | LQ_CLOSE |
38,427,420 | Confused by C String | <p>While learning C String, I had this code snippet:`</p>
<pre><code>char s[1];
strcpy(s, "hello");
puts(s);
printf("sizeof(s) = %ld\n", sizeof(s));//the result is 1
printf("strlen(s) = %ld\n", strlen(s));//the result is 5
printf("s[4] = %c\n", s[4]);//print 'o'
</code></pre>
<p>Why do this code snippet have this strange result? I mean I can legally assign the string of length 5 to a string declared with size 1.</p>
| <c><string><strcpy> | 2016-07-18 01:19:47 | LQ_CLOSE |
38,427,506 | How to put a 2 array in config (.ini) file? | <p>I have this simple basic code of VBScript.</p>
<pre class="lang-js prettyprint-override"><code>Dim cars: cars = Array("Volvo", "Saab", "BMW")
Dim fruits: fruits = Array("Apple", "Orange", "Banana")
Dim i: i = 0
For i = 0 To UBound(cars)
Call Response.Write(cars(i) & " " & fruits(i))
Next
</code></pre>
<p>Output:</p>
<pre class="lang-js prettyprint-override"><code>Volvo Apple
Saab Orange
BMW Banana
</code></pre>
<p>I want to put all the variables in a config <strong>.ini file</strong> in a way that the array variable is still in match. (e.g. <strong>Volvo</strong> and <strong>Apple</strong> for <strong>Volvo Apple</strong>) Anyone know or have an idea to do it? </p>
<p>I tried to search for this on the internet but no topic for this one. A big appreciation for the answer.</p>
| <arrays><loops><vbscript><config><ini> | 2016-07-18 01:35:03 | LQ_CLOSE |
38,428,047 | How to put a 2 array variables in config (.ini) file? | <p><strong>I have this VBScript that send specific files to FTP based on the file name.</strong>
</p>
<pre><code>Option Explicit
Dim objFSO, objMyFile, objShell, strFTPScriptFileName, strFilePut
Dim strLocalFolderName, strScriptFolder, strFTPServerName, strLoginID, strReportPath
Dim strPassword, strFTPServerFolder
Dim objArg, strIniFilePath, oShell
Dim i: i = 0
'Locates the INI File
Set objArg = WScript.Arguments
strIniFilePath = objArg(0)
'Gets FTP UserId and Password
strLocalFolderName = ReadIni(strIniFilePath,"FTP","LocalFolderName")
strFTPServerName = ReadIni(strIniFilePath,"FTP","FTPServerName")
strLoginID = ReadIni(strIniFilePath,"FTP","LoginID")
strPassword = ReadIni(strIniFilePath,"FTP","Password")
strFTPScriptFileName = ReadIni(strIniFilePath,"FTP","FTPScriptFileName")
strReportPath= Array("/davaoccc" , "/calambaccc" , "/cebuccc")
strFilePut= Array("0970*.txt" , "0979*.txt" , "0983*.txt")
Set oShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If (objFSO.FileExists(strFTPScriptFileName)) Then
objFSO.DeleteFile (strFTPScriptFileName)
End If
For i = 0 To UBound(strReportPath)
Set objMyFile = objFSO.CreateTextFile(strFTPScriptFileName, True)
objMyFile.WriteLine ("open " & strFTPServerName)
objMyFile.WriteLine (strLoginID)
objMyFile.WriteLine (strPassword)
objMyFile.WriteLine ("cd " & strReportPath(i))
objMyFile.WriteLine ("bin")
objMyFile.WriteLine ("lcd " & strLocalFolderName)
objMyFile.WriteLine ("prompt off")
objMyFile.WriteLine ("mput " & strFilePut(i))
objMyFile.WriteLine ("disconnect")
objMyFile.WriteLine ("bye")
objMyFile.Close
'Execute the FTP script.
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run "ftp -s:" & Chr(34) & strFTPScriptFileName & Chr(34), , True
next
</code></pre>
<p><strong>This is the .ini file</strong>
</p>
<pre><code>[FTP]
LocalFolderName=D:\Output\
FTPServerName=172.22.11.220
LoginID=user
Password=1234
FTPScriptFileName=D:\FTP_Log.txt
</code></pre>
<p>As you can see, the values of the variables is in the .ini file (hardcoded value should be in the .ini files) but except for the two variables: <strong>strReportPath</strong>, <strong>strFilePut</strong></p>
<p>There are multiple destination folder in the FTP, and different files based on the filename (files starts with 0970, 0979, 0983) in which, this VBScripts successfully sends. But I am having a hard time on how to put a 2 array variables in config ini file in a way that the array variable is still in match. (e.g. /davaoccc for 0970, /calambaccc for 0979, /cebuccc for 0983)</p>
<p>Anyone know or have an idea to do it?</p>
<p>I tried to search for this on the internet but no topic for this one. A big appreciation for the answer.</p>
| <arrays><loops><vbscript><ftp><ini> | 2016-07-18 03:06:58 | LQ_CLOSE |
38,428,220 | convert string to Dom in vuejs | <p>recently I want to convert a stirng to Dom in a vue component, but it does't work as my expectation. My code looks like this:</p>
<pre><code> // what I wrote in the template
<div id="log">
{{libText}}
</div>
// what I wrote in js
Vue.component(... , {
template: ... ,
data: function () {
return ...
}
},
computed: {
libText:function(){
var str="<p>some html</p>";
var div = document.createElement('div');
div.innerHTML = str;
return div;
}
},
methods:{...}
})
</code></pre>
<p>The result I get is a string "[object HTMLDivElement]" rather than a Dom.
It would be greatful if anyone can help me solve this problem</p>
| <html><string><dom><vue.js> | 2016-07-18 03:35:02 | HQ |
38,428,659 | group rows into different datasets by condition.. ( picture attached) |
favorite
I need to create 7 datasets ((local, web, call, local&call, local&web, call&web, all ) depending on if the customer has used a channel from the below sample data.
[please see this picture for more details on the sample table][1]
So if a customer has used all three channels in one instance and in the other instance he just uses either of them, then that row with Customer=1 should go to the'all' dataset. Similarly for 3, if he has used local and web in one instance and just web in another instance, then it should go to the 'local&web' dataset.
Customer IDs should not be duplicated in other dataset i.e. customer 1 can belong to wither one of the dataset only.
I am stuck with this, can anyone give me a snippet of either sas or sql code to proceed further.
Thanks !
[1]: http://i.stack.imgur.com/OAIMp.png | <sql><sas> | 2016-07-18 04:36:36 | LQ_EDIT |
38,428,796 | How to do 'lateral view explode()' in pandas | <p>I want to do this :</p>
<pre><code># input:
A B
0 [1, 2] 10
1 [5, 6] -20
# output:
A B
0 1 10
1 2 10
2 5 -20
3 6 -20
</code></pre>
<p>Every column A's value is a list</p>
<pre><code>df = pd.DataFrame({'A':[[1,2],[5,6]],'B':[10,-20]})
df = pd.DataFrame([[item]+list(df.loc[line,'B':]) for line in df.index for item in df.loc[line,'A']],
columns=df.columns)
</code></pre>
<p>The above code can work but it's very slow</p>
<p>is there any clever method?</p>
<p>Thank you</p>
| <python><pandas> | 2016-07-18 04:53:54 | HQ |
38,429,498 | Can someone answer for conversion in java? | Can someone guide me how to convert a string value(which is "15000000" to string "150.00"?
what I am trying is :
public static String truncate(String str, int length) {
// Ensure String length is longer than requested size.
str = str.trim();
if (str.length() > length) {
str = str.substring(0, length - 1);
}
return str;
}
private void populateDetails() throws BusinessObjectException, ParseException {
List<PolicyProducerDetails> policyProducerDetailsList = null;;
if (results!=null) {
policyProducerDetailsList = new ArrayList<PolicyProducerDetails>();
for (Iterator<PolhierPprModel> iterator = results.iterator(); iterator.hasNext();) {
PolhierPprModel resultPolhierPprModel = (PolhierPprModel) iterator.next();
{
String test = resultPolhierPprModel.getCommRate().toString();
String test1 =truncate(test,4);
Float test2 = Float.parseFloat(test1);
String test3 = String.valueOf(test2);
policyProducerDetailsLocal.setCommRateOverride(test3);
}
Right now I am getting a 150.0 but I want to make it 150.00...Also I dont want it to be hardcoded as i have done.
Any Help will be great. | <java><string><string-formatting> | 2016-07-18 06:00:40 | LQ_EDIT |
38,429,665 | unique ID for every Device | <p>Is there any ID kinda thing on an Android smartphone which is on every device unique? I want to store feedback, which the users sent me to my server, device specific. So the user can see if I fixed the bug they reported or if I implemented their idea.</p>
| <android> | 2016-07-18 06:12:59 | LQ_CLOSE |
38,431,549 | How to remove a key of an array? | <p>I need to remove <strong>[picture_names]</strong> from my <code>array</code>. Help me to remove this?</p>
<p><a href="https://i.stack.imgur.com/xOJuX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xOJuX.jpg" alt="enter image description here"></a></p>
| <php><arrays> | 2016-07-18 08:06:56 | LQ_CLOSE |
38,431,899 | Convert dd/mm/yyyy to yyyy-mm-dd in php | <p>I need to convert date format in php , But i am getting getting error</p>
<p>here is my code </p>
<pre><code> $test = new DateTime('23/09/2016');
echo date_format($test, 'Y-m-d');
</code></pre>
<p>But i am getting error as </p>
<pre><code>Message: DateTime::__construct(): Failed to parse time string (23/09/2016) at position 0 (2): Unexpected character
</code></pre>
<p>How to resolve the issue </p>
| <php><date> | 2016-07-18 08:26:34 | LQ_CLOSE |
38,432,376 | PHP - How do facebook change the facebook/message/username to facebook/message/username2 on the same page? | <p>I'm trying to create a real-time chat on my website. One of the functions I want to imitate is how <a href="http://facebook.com/messages/" rel="nofollow">facebook.com/messages</a> changes not only content of the webpage but also the url without refreshing. I think this is a lot cleaner more efficient. </p>
<p>My current process is just a <code>("#class_name").click</code> with a <code>var id = $(this).attr("id")</code> running with an <strong>Ajax</strong>.</p>
| <javascript><php><jquery><facebook> | 2016-07-18 08:52:32 | LQ_CLOSE |
38,433,591 | linux Uinsg write command to communicate with other users | I am learning linux
and I am learning how to communicate with other users
in addition, I am using ubuntu
and I already have a existing user
and when I try to use the command write to communicate with other user
write lex pts/5
a error pop out,
write: you are uid 1000, but your login is as uid 1001
I thought the shell will allow communication in different uid, so it cannot?
is there any ways to fix this?
Thank
| <linux><communication> | 2016-07-18 09:49:52 | LQ_EDIT |
38,434,173 | android studio 2: Capture latitude and longitude | i know this question is repeated question, but i didn't find a clear overview. I am using Studio 2.1 and I need below information.
I am developing a app, which capture the latitude and logitude from one mobile and send those details to Master/Server Mobile, So that server mobile will show the tracking maps on server mobile.
Here i need an over all process.
1. I developed a background code in client mobile
After 1st step, i am confused how to move further. Do i need to create any website and capture the latitude and longitude.
OR
Do i need to follow any other steps.
Please guide me only on higher level steps.
Regards
Kathi | <android><google-maps> | 2016-07-18 10:17:15 | LQ_EDIT |
38,434,443 | how to convert image to pdf and ms word document C#? | <p>i want to develop desktop app to convert images to text than add that text to PDF and ms word document simple c# code can anyone help me i just uploaded the image in picturebox but i can not get it how to to the remaining task</p>
| <c#><visual-studio-2015> | 2016-07-18 10:30:41 | LQ_CLOSE |
38,435,622 | XML is having HTML Content inside its tags. Need to get HTML content as it is, as a String or other format | <xbrli:xbrl xmlns:aoi="http://www.aointl.com/20160331" xmlns:country="http://xbrl.sec.gov/country/2016-01-31" xmlns:currency="http://xbrl.sec.gov/currency/2016-01-31" xmlns:dei="http://xbrl.sec.gov/dei/2014-01-31" xmlns:exch="http://xbrl.sec.gov/exch/2016-01-31" xmlns:invest="http://xbrl.sec.gov/invest/2013-01-31" xmlns:iso4217="http://www.xbrl.org/2003/iso4217" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:naics="http://xbrl.sec.gov/naics/2011-01-31" xmlns:nonnum="http://www.xbrl.org/dtr/type/non-numeric" xmlns:num="http://www.xbrl.org/dtr/type/numeric" xmlns:ref="http://www.xbrl.org/2006/ref" xmlns:sic="http://xbrl.sec.gov/sic/2011-01-31" xmlns:stpr="http://xbrl.sec.gov/stpr/2011-01-31" xmlns:us-gaap="http://fasb.org/us-gaap/2016-01-31" xmlns:us-roles="http://fasb.org/us-roles/2016-01-31" xmlns:us-types="http://fasb.org/us-types/2016-01-31" xmlns:utreg="http://www.xbrl.org/2009/utr" xmlns:xbrldi="http://xbrl.org/2006/xbrldi" xmlns:xbrldt="http://xbrl.org/2005/xbrldt" xmlns:xbrli="http://www.xbrl.org/2003/instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<link:schemaRef xlink:href="aoi-20160331.xsd" xlink:type="simple"/>
<xbrli:context id="FD2016Q4YTD">
<xbrli:entity>
<xbrli:identifier scheme="http://www.sec.gov/CIK">0000939930</xbrli:identifier>
</xbrli:entity>
<xbrli:period>
<xbrli:startDate>2015-04-01</xbrli:startDate>
<xbrli:endDate>2016-03-31</xbrli:endDate>
</xbrli:period>
</xbrli:context>
<aoi:OtherIncomeAndExpensePolicyTextBlock contextRef="FD2016Q4YTD" id="Fact-F51C7616E17E5B8B0B770D410BBF5A3E">
<div style="font-family:Times New Roman;font-size:10pt;"><div style="line-height:120%;text-align:justify;font-size:10pt;"><font style="font-family:inherit;font-size:10pt;font-weight:bold;">Other Income (Expense)</font></div><div style="line-height:120%;text-align:justify;font-size:10pt;"><font style="font-family:inherit;font-size:10pt;"></font></div></div>
</aoi:OtherIncomeAndExpensePolicyTextBlock>
</xbrli:xbrl>
This is My XML[XBRL], i need to parse this. This xml is my input and i don't know whether its a valid or not but in need output like this :
<div style="font-family:Times New Roman;font-size:10pt;"><div style="line-height:120%;text-align:justify;font-size:10pt;"><font style="font-family:inherit;font-size:10pt;font-weight:bold;">Other Income (Expense)</font></div><div style="line-height:120%;text-align:justify;font-size:10pt;"><font style="font-family:inherit;font-size:10pt;"></font></div></div>
Please someone share me the knowledge for this problem i am facing from last two weeks. | <java><xml> | 2016-07-18 11:31:01 | LQ_EDIT |
38,437,638 | Swift, print issue when use ? and ! variables | <p>I got access error('fatal error: unexpectedly found nil while unwrapping an Optional value') when print variable p02. According to the error message, I still cannot understand the reason.</p>
<pre><code>var p02:Person! = nil
var p03:Person? = nil
if (p02==nil)
{
print("p02 is nil")
}
if (p03==nil)
{
print("p03 is nil")
}
print(p03)
print(p02)
</code></pre>
<p>Anyone know why,
Thanks</p>
| <swift><variables><declaration> | 2016-07-18 13:12:49 | LQ_CLOSE |
38,438,087 | Ruby thinks an integer I'm passing as an argument is a method | I am trying to write a simple function in ruby but keep getting this error: undefined method `b' for main:Object (NoMethodError).
Here is the code I have written can anyone tell me why I keep getting this.
def get_sum(a,b)
if a == b do
return a
end
else
total = 0
for num in a...b
total += num
end
return total
end
end
This is obviously something really simple but would like to know why it is happening. Thanks in advance. | <ruby> | 2016-07-18 13:32:41 | LQ_EDIT |
38,438,460 | how to add zeros to string in php | <p>I have strings: <code>23-65, 123-45, 2-5435, 345-4</code>
I want to add zeros to them so all of them will look like <code>###-#### (three digits dash four digits): 023-0065, 123-0045, 002-5435, 345-0004</code>
How can i do it in php?
Thanks!</p>
| <php><string><format><zero> | 2016-07-18 13:49:29 | LQ_CLOSE |
38,440,131 | Can you determine the terminating boolean expression of a for loop at runtime? | I'm in a situation where it would be really nice to be able to determine what boolean expression I use for the terminating statement of a for loop at runtime. Or in more simpler words, decide whether I want i > 0, or i < file.length and decrement or increment `i` respectively. I know you can use lambdas to make the iterator either decrement or increment at runtime, explained in [this][1] SO question, but is something along the same lines possible for the terminator?
From trying to attempt this myself with `System.Action` to act as an anonymous function so I can still access the objects the for loop uses whilst inside action having some logic to determine whether or not I go forwards or backwards (this ended up with me realising that this wont work), it seems as if this is very much so the case of, if it is possible, it's far more complicated and is not worth the boilerplate code required compared to just having two loops within an if/else statement. I can't be the only one that has wondered this, surely!
[1]: http://stackoverflow.com/questions/14255618/store-an-operator-in-a-variable | <c#><for-loop><boolean-expression> | 2016-07-18 15:06:13 | LQ_EDIT |
38,441,723 | string functions in sql server 2012 | I have a table like Emp( id,name)
values(10,`RAMESH`)
OUTPUT-RamesH
HOW TO WRITE A QUERY | <sql><sql-server-2012> | 2016-07-18 16:25:59 | LQ_EDIT |
38,442,996 | perl: find the index of the nth occurrence of a character in a string | I've found `index` and `rindex` for finding the first or last occurrence of a character (or substring) in a string. I'm also aware that they have an `offset` that can be used to start at a certain index.
What I want to know is if there is a simple way to find the index `n`th occurrence of a character or substring in a string. I'd prefer not to have to do it regex and would prefer not to have to write a loop that just repeatedly calls `index` with an offset. | <string><perl> | 2016-07-18 17:48:47 | LQ_EDIT |
38,443,028 | How to set stackoverflow page local time | Since I have became a user on stack-overflow, I'm having issues with the time stamps on questions and comments. The time stamp is not taking my local time zone. I have looked around in the profile settings and searched for a solution but no luck.
Any idea ? | <stack-overflow><stackexchange> | 2016-07-18 17:50:50 | LQ_EDIT |
38,444,173 | How can I create a public static method while implementing an interface in c#? | <p>I have the following interface</p>
<pre><code>public interface IQueryBuilder
{
SqlCommand Build(IReportDataSource dataSource, List<IReportColumn> columns, List<IReportRelationMapping> relationMappings, IReportFilterMapping filters, List<IReportColumn> columsToSortBy, ReportFormat reportFormat);
string GetSqlClause(List<IReportFilter> reportFilters, ref List<IDataParameter> sqlParams);
}
</code></pre>
<p>However, I would like to be able to access the method <code>GetSqlClause</code> in the implementation directly.</p>
<p>Here is how I implemented the above </p>
<pre><code>public class QueryBuilder : IQueryBuilder
{
public SqlCommand Build(IReportDataSource dataSource, List<IReportColumn> columns, List<IReportRelationMapping> relationMappings, IReportFilterMapping filters, List<IReportColumn> columsToSortBy, ReportFormat reportType)
{
//Do something awsome!!!
string sqlQuery = "";
List<IDataParameter> sqlParameters = new List<IDataParameter>();
return this.GetSqlCommand(sqlQuery, sqlParameters);
}
private SqlCommand GetSqlCommand(string sqlQuery, List<IDataParameter> sqlParams)
{
var command = new SqlCommand(sqlQuery);
foreach (IDataParameter dataParameter in sqlParams)
{
command.Parameters.Add(dataParameter);
}
return command;
}
public static string GetSqlClause(List<IReportFilter> reportFilters, ref List<IDataParameter> sqlParams)
{
string sqlFilter = "";
if (reportFilters != null && reportFilters.Any())
{
//At this point we know there are some filter to add to the list
var firstFilter = reportFilters.First();
foreach (var reportFilter in reportFilters)
{
var parameter = GenerateDbParameter("p" + sqlParams.Count, reportFilter.FormattedValue, SqlDbType.NVarChar);
....
....
}
}
return sqlFilter;
}
private static IDataParameter GenerateDbParameter(string parameterName, object parameterValue, SqlDbType parameterType)
{
if (string.IsNullOrEmpty(parameterName) || parameterValue == null)
{
throw new ArgumentException();
}
var parameter = new SqlParameter("@" + parameterName, parameterType)
{
Value = parameterValue
};
return parameter;
}
}
</code></pre>
<p>Because I am using <code>static</code> on my <code>GetSqlClause</code> method I get an error</p>
<blockquote>
<p>cannot implement an interface member because it is static.</p>
</blockquote>
<p>What is a good work around to this problem? How can I access my <code>GetSqlClause</code> directly?</p>
| <c#> | 2016-07-18 19:03:08 | LQ_CLOSE |
38,444,619 | How to create gifs with images in Python | <p>Are there any APIs or libraries I can use to create a .gif out of .jpgs and .pngs? I'm looking for one that will work with Python 3. </p>
| <python> | 2016-07-18 19:33:13 | LQ_CLOSE |
38,444,915 | Conversion of numbers from one form to other | I have a data frame "df" with a column "Amount", which contains values in millions like 2.3, 17, 1.47 and so on. I want to create a new column "Amount1" in "df" which converts each value in "Amount" to the form like 2300000, 17000000, 1470000 and so on. How would I accomplish this task? | <python><pandas> | 2016-07-18 19:51:22 | LQ_EDIT |
38,445,448 | i am trying to get FACEBOOK COVER via graph API, but i cant. My code is | ` `` try {
` `$requestCover = $fb->get('me?fields=cover'); //getting user Cover
$requestProfileCover=$fb->get('/me');
// $cover = $requestCover->getGraphUser();
// $profile = $requestProfileCover->getGraphUser();
}
catch(Facebook\Exceptions\FacebookResponseException $e) {
echo ' error: ' . $e->getMessage();
exit;
}
catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK error: ' . $e->getMessage();
exit;
}
print_r($requestCover); // showing cover details on the screen
echo "<img src='".$requestCover['source']."'/>"; | <facebook><api><graph> | 2016-07-18 20:26:49 | LQ_EDIT |
38,446,087 | can we use CSS file in javascript? | <p>green fisher here again.
Here is my this time question:</p>
<p>can we use CSS file in javascript?</p>
<p>I indeed know how to do the that: <strong>object.style = "";</strong>
however, if we can like do something really easy like: <strong>import stylesheet.css</strong>
then we can do something like <strong>object.style = stylesheet.getStyleById('#something')</strong></p>
<p>well, those syntax above are all bullshit by my imagination, however, is there some similar way to do it?</p>
| <javascript><css> | 2016-07-18 21:13:58 | LQ_CLOSE |
38,447,718 | Print a character a random number of times in C | <p>Im trying to print a character a random number of times. I know that to print a random character I can type the code bellow but I cant get my head around this problem.Thanks!!!</p>
<p>RANDLOWER = rand() % 26 + 'A';
printf("%c ", RANDLOWER);</p>
| <c><random> | 2016-07-19 00:11:49 | LQ_CLOSE |
38,448,336 | So im stuck on how to add multiple numbers after I find them | I get all of the numbers from 0 to 1000 that are multiples of three but could someone help me on how to add those numbers together now im just really stuck on that part
public class Hi {
public static void main(String[] args){
for(int i = 0; i<1000; i++){
if(i % 3 == 0)
System.out.println(i);
}
}
} | <java><for-loop> | 2016-07-19 01:46:20 | LQ_EDIT |
38,448,876 | Swift: saving UIImageView to Camera Roll | Even tough this sounds super simple, I got stuck on this because of how my app works.
I'm using Swift.
I have a UIImageView that loads an online image. On the app, I will have a button that gives the user a choice to export the image to Camera Roll.
Most solutions such as UIImageWriteToSavedPhotosAlbum don't work with UIImageView.
Should I first capture a UIImage from the UIImageView and then save to Camera Roll? How? Or can I save directly?
Thanks! | <ios><swift><uiimageview><camera-roll> | 2016-07-19 02:58:07 | LQ_EDIT |
38,449,093 | JavaScript: what's wrong with this code? (Please, help!) | This error is driving me CRAZY. The function throws this error:
> Uncaught ReferenceError: Invalid left-hand side in assignmen*t
Could someone point out ***where*** is the damned error?
function listo()
{
if (document.getElementById('titulo')='') {
AbreSnackBar('Debes especificar un título para esta obra','rojo');
exit();
}
var data=
'titulo=' + document.getElementById('titulo').value +
'&plantilla=' + document.getElementById('plantilla').value +
'&pags=' + document.getElementById('pags').value +
'&genero=' + document.getElementById('gen').value +
'&comp_real=' + document.getElementById('comp_orig').value +
'&ano=' + document.getElementById('ano').value +
'&up_im1=' + document.getElementById('up_im1').value +
'&up_im2=' + document.getElementById('up_im2').value +
'&up_im3=' + document.getElementById('up_im3').value +
'&up_ref=' + document.getElementById('up_ref').value +
'&video=' + document.getElementById('link').value +
'&descr=' + document.getElementById('descr').value +
'&descr_ing=' + document.getElementById('descr_ing').value +
'&minutos=' + document.getElementById('minutos').value +
'&dificultad=' + document.getElementById('dif').value +
'&up_PDF=' + document.getElementById('up_PDF').value +
'&up_RAR=' + document.getElementById('up_RAR').value +
'&up_MUS=' + document.getElementById('up_MUS').value +
'&up_SIB=' + document.getElementById('up_SIB').value +
//'&tags=' + document.getElementById('tags').value +
'&modo=' + document.getElementById('modo').value +
'&id_concurso=' + document.getElementById('id_concurso').value +
'&copias_min=' + document.getElementById('copias_min').value;
AbreSnackBar('Espera...');
$.ajax({
type: "POST", url: "acc_sube_obra.php", data: data ,
success: function (data)
{
alert(data);
switch (data.trim())
{
case '0':
AbreSnackBar('Ocurrió un error','rojo');
break;
default: //id
AbreSnackBar('Bien','verde');
window.location.href = 'http://www.aboutscores.com/obra_subida.php?id='+ data.trim;
}
}
});
}
I've seen that the cause could be that I'm *trying to assign a new value to the result of a function*, but I don't see that's the case.
| <javascript><ajax> | 2016-07-19 03:25:03 | LQ_EDIT |
38,449,585 | What are the best responsive blogger templates for technical blogger? | <p>I am looking for the best blogger template for technical blogger with following options: </p>
<ul>
<li>SEO Friendly </li>
<li>Integrated Social</li>
<li>Bunch of needful widgets </li>
<li>AdSense enabled</li>
<li>Good looking styles</li>
<li>Should support full customisation </li>
<li>Preferred free templates</li>
</ul>
<p>I have seen so many templates online, but doesn't find the right one for technical blogging for my blogger site <a href="http://www.dotnet4techies.com" rel="nofollow">www.dotnet4techies.com</a></p>
<p>Can someone suggest me the good blogger templates with these requirements?</p>
| <blogger><blogger-dynamic-views> | 2016-07-19 04:26:21 | LQ_CLOSE |
38,450,314 | I have c sharp code, how can i convert it into android | I have c sharp code snippet for encryption and my requirement is to decrypt in android, having problem
public static byte[] AES_Encrypt(byte[] bytesToBeEncrypted, byte[] passwordBytes)
{
byte[] encryptedBytes = null;
// Set your salt here, change it to meet your flavor:
// The salt bytes must be at least 8 bytes.
byte[] saltBytes = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
using (MemoryStream ms = new MemoryStream())
{
using (RijndaelManaged AES = new RijndaelManaged())
{
AES.KeySize = 256;
AES.BlockSize = 128;
var key = new Rfc2898DeriveBytes(passwordBytes, saltBytes, 1000);
AES.Key = key.GetBytes(AES.KeySize / 8);
AES.IV = key.GetBytes(AES.BlockSize / 8);
AES.Mode = CipherMode.CBC;
using (var cs = new CryptoStream(ms, AES.CreateEncryptor(), CryptoStreamMode.Write))
{
cs.Write(bytesToBeEncrypted, 0, bytesToBeEncrypted.Length);
cs.Close();
}
encryptedBytes = ms.ToArray();
}
}
return encryptedBytes;
} | <c#><android> | 2016-07-19 05:39:22 | LQ_EDIT |
38,450,801 | I have 16 in database I need to change into 4PM | I have time in format of 16, 18 like this. I need to convert into AM PM format please help me | <ios><iphone> | 2016-07-19 06:15:09 | LQ_EDIT |
38,450,993 | how to value pass option to input ng-model | <div ng-app ng-controller="MyCtrl">
<select ng-model="referral.organization" ng-options="b for b in organizations"></select>
</div>
<script type='text/javascript'>
function MyCtrl($scope) {
$scope.organizations = ['Moo Milk','Silver Dairy'];
$scope.referral = {
organization: $scope.organizations[0]
};
}
</script>
<input name="job_description" onkeypress="return event.keyCode != 13;" ng-model="req_data.job_description" value="{{referral}}" placeholder="Quantity" type="text" />
This is my code just i want to pass option value into input ng-model please help | <javascript><angularjs> | 2016-07-19 06:28:12 | LQ_EDIT |
38,454,154 | How to retrieve values at key =2 into NSString? | How to retrieve values at key =2 of a NSMutableDictionary into NSString?
| <ios><objective-c><nsstring><nsarray><nsmutabledictionary> | 2016-07-19 09:11:32 | LQ_EDIT |
38,454,324 | How to subtract months in dates? | <p>I have this dates function:</p>
<pre><code>var isAnnual;
var setupDate="05/09/2016"
var currDate = new Date();//today
</code></pre>
<p>I need to check if subtraction of the <strong>months</strong> in dates above is equal to zero.</p>
<p>Any idea what is the best way to implement it?</p>
| <javascript> | 2016-07-19 09:18:19 | LQ_CLOSE |
38,454,993 | I have few files in a folder,how i can save the path of the files into database by using spring mvc? | [This is my project folder structure ][1]
I wants to save the file path into database by using spring mvc .please help
[1]: http://i.stack.imgur.com/pUwZ6.jpg | <java><mysql><spring><spring-mvc><jdbctemplate> | 2016-07-19 09:47:53 | LQ_EDIT |
38,455,504 | css rule not applying 100% to height | CSS rule not working..
> #wrapper{
height:100%;
width:100%;
background-color: aliceblue;
}
not working for height. | <css> | 2016-07-19 10:09:30 | LQ_EDIT |
38,455,520 | How to take out int value from JSON object | i'm working with Laravel 5 right now and i'm stuck with this problem. I've got response from DB query :
[{"id":1}]
and i want to take out 1 as int or string. Any ideas? | <php><json><laravel><laravel-5> | 2016-07-19 10:10:18 | LQ_EDIT |
38,456,751 | Is WebAPI Body.json async? | `Body.json` [returns a promise][1].
Is this method asynchronous to avoid blocking on reading large inbound data streams?
If this is correct, does it do something like `setTimeout(sampleStream, 0)` repeatedly until the end of the stream is found?
[1]: https://developer.mozilla.org/en-US/docs/Web/API/Body/json | <javascript><fetch-api> | 2016-07-19 11:05:05 | LQ_EDIT |
38,457,764 | Convert from one date format to another in javascript | <p>I want to convert this date 16:07:19 to format as July 19, 2016 in javascript. Should i implement the complete functionality or do we have any readily available thing to use in javascript to do the same? Kindly help. Thanks in advance!</p>
| <javascript><date> | 2016-07-19 11:51:12 | LQ_CLOSE |
38,457,880 | Replace an element in array using jquery | I have got this array
var left=[323,345,654,123];
How can i replace `345` using Jquery I have tried
left[2]=456
But it did not really work
| <javascript> | 2016-07-19 11:56:44 | LQ_EDIT |
38,458,738 | calendar app take value date(January 1st, 1970) as default in frontend if device language is english[Hongkong SAR china] | calendar app take value date(January 1st, 1970) as default in frontend if device language is english[Hongkong SAR china] in my website based on magento framework.Is there any solution to get current time? and the problem is only in Internet Explorer.
| <php><magento><calendar><web> | 2016-07-19 12:33:59 | LQ_EDIT |
38,459,426 | Implementing timer Javascript - Trivia Game | <p>I've written up a Trivia Game in Javascript, but am having a hard time understanding how to correctly implement a timer for each question. I've made it so that each question gets presented individually, and I'd like to have a timer for each question. If the timer runs out, it should proceed to the next question. </p>
<p>Here is a <code>link</code> to <a href="https://jsfiddle.net/qyhkv7e4/" rel="nofollow">JSFiddle</a> </p>
<p>If someone could take a few minutes and modify the JSFiddle, or let me know what I'd have to do in order to make each question count down from 10, I'd greatly appreciate it. Thanks a lot!</p>
| <javascript><jquery><html> | 2016-07-19 13:02:36 | LQ_CLOSE |
38,460,325 | Text in my heading should be top not bottom | <p>I have a table it looks like <a href="http://oi65.tinypic.com/2meu6ud.jpg" rel="nofollow">this</a>, but the table headings should be on the same height(top)/ start at the same line.</p>
<p>What shall I write in my css:</p>
<pre><code>table th{
...
}
</code></pre>
| <html><css> | 2016-07-19 13:41:12 | LQ_CLOSE |
38,460,354 | Scraping data when javascript is involved? | <p>I'm really new to web stuff so plz forgive my noobness. I am trying to make website that takes data from a British cycling event then analyses it. The main trouble that I'm having is that to get the table, you have to click on a button "view entrants" which I think runs a JavaScript which brings up the table. So how would I go about scraping the data from a given event?</p>
<p>Thanks in advanced</p>
<p>Here is an example: <a href="https://www.britishcycling.org.uk/events/details/141520/London-Dynamo-Summer-Road-Race-2016" rel="nofollow">https://www.britishcycling.org.uk/events/details/141520/London-Dynamo-Summer-Road-Race-2016</a></p>
| <javascript><php><html> | 2016-07-19 13:42:48 | LQ_CLOSE |
38,460,512 | regualr expression, match all text within two characters | gotta ask cuz this takes me to much time to go over again again everytime needed, how to match this:
Carina Costa(42353)
when given this:
"CN=Carina Costa(42353),OU=Administrativos,OU=Amadora,OU=Utilizadores,DC=hluz,DC=ess,DC=local"
using php preg_match() | <php><regex> | 2016-07-19 13:49:29 | LQ_EDIT |
38,460,594 | Creating an initializer list in C | <p>How do you create an initializer list in C? Do you have to use a struct or union?</p>
<p>Because currently I have written code that apparently has a problem with how many initialized variables I have.</p>
<p>Compiling error:
<strong>Number of initializers cannot be greater than the number</strong></p>
| <c> | 2016-07-19 13:53:48 | LQ_CLOSE |
38,461,509 | why can't return assignment statement | <p>In IDLE,
I write a function and intend to return a value. but it can't return</p>
<pre><code>>>> def grade(value):
if value > 100:
return (value=100)
if value <0:
return (value=0)
SyntaxError: invalid syntax
</code></pre>
<p>why can't return? but when I change to</p>
<pre><code>value = 100
return value
</code></pre>
<p>It can work</p>
| <python> | 2016-07-19 14:34:44 | LQ_CLOSE |
38,461,621 | Where shall I put an existing DB in a android project | <p>Im making an app, and want to port it to android which im new to. Where should i place the db? and is the code below enough to successfully connect and query the db or do i need more to just test if it works?</p>
<pre><code> String path = "WHERE_SHOULD_I_PLACE_MY_DB_?";
SQLiteDatabase sqLiteDatabase = SQLiteDatabase.openDatabase(path, null,
SQLiteDatabase.OPEN_READONLY);
Cursor cursor = sqLiteDatabase.rawQuery("select * from table", null);
String something = cursor.getString(1);
System.out.println(something);
</code></pre>
| <android> | 2016-07-19 14:39:29 | LQ_CLOSE |
38,462,952 | I wanted to add the result i get from SELECT MAX(id) FROM balance and sum(totalSEK) from balance) | this is what i currently have but it is not working
select sum(totalSEK) from balance) + ( SELECT MAX(id) FROM balance;) ) as totalSums | <mysql> | 2016-07-19 15:37:35 | LQ_EDIT |
38,463,007 | From the user's input total the odd and even numbers. input numbers in between 0 to 99 | <pre><code>#include <iostream>
using namespace std;
int main()
{
int i,t,x[20], even, odd, prime;
cout << "Enter 20 integer numbers from 0 to 99: "<<endl;
for (i=1;i<=20;i++)
{
cout << "Input " << i <<":";
cin >> x[i];
}
cout << "\nPrime numbers are: " << endl ;
prime=1;
for (i=2; i<=20 ; i++)
{
for(t=2;t<x[i];t++)
{
if(x[i]%t==0)
{
prime=0;
}
}
if(prime==1)
{
cout << x[i] << endl;
}
prime=1;
}
for(i=1; i<=20; i++) // this is where i have problem.
{
if(x[i]% 2 == 0)
{
even++;
}
else
{
odd++;
}
}
cout << "Number of odd numbers: " << odd << "\n";
cout << "Number of even numbers: " << even << "\n";
return 0 ;
}
</code></pre>
<p>When i compile it shows even (40) and odd (10) for input of 0 till 19. Where it should show even 10(including the 0) and odd (10). Im not sure where am i doing it wrongly. I hope someone can help me improve the code.</p>
| <c++> | 2016-07-19 15:40:34 | LQ_CLOSE |
38,463,430 | Replace all letters in a string with an underscore and space | <p>As the title says, I am attempting to replace every letter in a string with an underscore followed by a space. For example: "hello" would be replaced with
"_ _ _ _ _". I can replace letters with just a space or just an underscore, but I am having trouble with replacing both. Any help is appreciated!</p>
| <c++> | 2016-07-19 16:00:16 | LQ_CLOSE |
38,465,183 | C: How to perform accurate floating-point operations? | <p>I am well aware that <code>0.1+0.2 != 0.3</code> because of precision errors. However I need it to be equal to 0.3.</p>
<p>My solution would be to :</p>
<ul>
<li>Declare an <code>add</code> function that returns the correct <code>double</code>.</li>
<li>Inside this function, add the two numbers then round to the 13th digit.</li>
</ul>
<p>This would work for 0.49999999999999994 and 0.30000000000000004.</p>
<p>How would I implement such a rounding function? Is there another way?</p>
| <c><floating-point><floating-accuracy> | 2016-07-19 17:44:08 | LQ_CLOSE |
38,467,519 | jquery data when element has children | suppose I have in html
<li class="media_item upload" data-actions-permissions="{}" data-info="{}">
<p></p>
</li>
how do I get the `data-info`?
What i know is if I have
<li class="media_item upload" data-actions-permissions="{}" data-info="{}">
</li>
I can use `$(".media_item.upload").data("info")` | <javascript><jquery><angularjs> | 2016-07-19 20:03:54 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.