the compiler compile the code,but traversing output is wrong .please chech ny logic is correct,tell me best tutorial to learn of binary tree using stack .

void usman:: inorder()
{
stack<node*>s;   
    node *t=root;
    while(!s.empty()||t!=NULL)
    {
   if(t!=NULL)
   {
    s.push(t);
    t=t->left;
}
else
{   
   t=s.top();
  s.pop();
    cout<<t->data<<",";
    t=t->right;
}
   }
    }
#define size 50     //minimum input 50

You're asking for trouble #defining size to equal a number (or anything else). You got away with it here, but what if you had a program that used vectors and you wanted to use vector's size function?

vector<int> intVector;
cout << intVector.size();

Preprocessor changes "size" to "50", so the compiler has to try to make sense of

vector<int> intVector;
cout << intVector.50(); // error

It would be better to make the size upper-case if you're going to #define it. It's part of the naming convention to make it all upper-case anyway, even if it was a name like ABCDEFGHIJ that isn't going to be a common function name like "size". Constants and #define's are upper-case. Easier to read the code that way.

#define SIZE 50

Ah, this is a simple fix. You don't put the query in the mysqli_query()

This is what you would do:

$sql= "SELECT * FROM member WHERE email='" . $_POST['inputEmail']. "'";
 $result = mysqli_query($conn, $sql);

and the $conn would be the variable you have for the connection to the database, so that name could be different in yours for your connect.
Hope this helps!

I'm trying to do something, but it doesn't work out, the primary suspect is incorrect query, but I don't know whether it's correct or not. I could try running it in phpMyAdmin, but then I don't know how these are escaped. The result is: array(5) { ["current_field"]=> NULL ["field_count"]=> NULL ["lengths"]=> NULL ["num_rows"]=> NULL ["type"]=> NULL }. So I figured maybe the query, maybe something else.

mysqli_query("SELECT * FROM members WHERE email='" . $_POST["inputEmail"] . "' OR username='" . $_POST["inputUsername"] . "'");

Does this get parsed properly? Given that $_POST's are alphanumerical?

I am writing a code for a user to choose numbers in a progress bar. For some reason the progress bar does not fill up or empty when the int progress is not exact.

For example: The progress bar value is 5 at the moment. The user chooses 250 Million Cars whose progress value is 7 but the progress bar does not empty. Is there an algorithm or a method that can fix this problem

Thank you.

public class Tester extends JFrame implements PropertyChangeListener
{
    private JButton backJButton;

    private JComboBox carsJComboBox, treesJComboBox;

    private String[] newnumbers = {"Add 250 Million","Add 500 Million","Add 1 billion","Add 1.5 Billion","Add 2 Billion","Remove 250 Million", "Remove 500 Million","Remove 1 billion", "Remove 1.5 Billion", "Remove 2 Billion"};


    private String[] numbers2 = {"Add 100 Million", "Add 500 Million","Add 1 billion","Add 50 Billion"};

    private JLabel carsJLabel, treesJLabel, temperatureJLabel, point1JLabel, point2JLabel, pointmidJLabel, point01JLabel, point02JLabel, point03JLabel, 
    point04JLabel, point06JLabel, point07JLabel, point08JLabel, point09JLabel;

    private JProgressBar progressBar;

    private int currentIndex;

    int time = 0;
    int duration = 150;

    private Task task;
    private int progress = 0;

    class Task extends SwingWorker<Void, Void>
    {
        public Void doInBackground()
        {
            //progress += 1;
            setProgress(progress);
            return null;    
        }

    }

    public void doTask()
    {

        if(carsJComboBox.getSelectedIndex() == 0)
        {
            progress+=7;
            System.out.println(progress);
        }
        if(carsJComboBox.getSelectedIndex() == 1)
        {
            progress+=17;
        }
        if(carsJComboBox.getSelectedIndex() == 2)
        {
            progress+=37;
        }
        if(carsJComboBox.getSelectedIndex() == 3)
        {
            progress+=57;
        }
        if(carsJComboBox.getSelectedIndex() == 4)
        {
            progress+=77;
        }
        if(carsJComboBox.getSelectedIndex() == 5)
        {
            progress-=7;
            System.out.println(progress);
        }


        task = new Task();
        task.addPropertyChangeListener(this);
        task.execute();
    }

    public void doTask2()
    {
        if(treesJComboBox.getSelectedIndex() == 0)
        {
            progress-=17;
        }

        task = new Task();
        task.addPropertyChangeListener(this);
        task.execute();
    }


    public Tester()
    {
        createUserInterface();
    }

    private void createUserInterface()
    {
        Container contentPane = getContentPane(); 
        contentPane.setLayout(null);
        contentPane.setBackground(Color.white);


        getRootPane().setBorder(BorderFactory.createMatteBorder(6, 6, 6, 6, Color.BLACK));


        backJButton = new JButton("<<Back");
        backJButton.setBounds(0, 0, 100, 30);
        contentPane.add(backJButton);
        backJButton.addActionListener(

                new ActionListener()
                {
                    public void actionPerformed(ActionEvent event)
                    {
                            MainWindow window = new MainWindow();
                            closeTester();
                    }

                }

        );

        carsJLabel = new JLabel("Add/Remove Cars");
        carsJLabel.setBounds(142, 420, 135, 21);
        contentPane.add(carsJLabel);

        carsJComboBox = new JComboBox(newnumbers);
        carsJComboBox.setBounds(116,480,175,21);
        carsJComboBox.addActionListener(

                new ActionListener()
                {
                    public void actionPerformed(ActionEvent event)
                    {
                        doTask();
                    }

                }

        );

        contentPane.add(carsJComboBox);

        treesJLabel = new JLabel("Add/Remove Trees");
        treesJLabel.setBounds(400, 420, 135, 21);
        contentPane.add(treesJLabel);

        treesJComboBox = new JComboBox(numbers2);
        treesJComboBox.setBounds(376,480,175,21);
        treesJComboBox.addActionListener(

                new ActionListener()
                {
                    public void actionPerformed(ActionEvent event)
                    {
                        doTask2();
                    }

                }

        );




        contentPane.add(treesJComboBox);

        progressBar = new JProgressBar();
        progressBar.setValue(0);
        progressBar.setBounds(97, 120, 500, 250);
        progressBar.setSize(500, 100);
        UIManager.put("ProgressBar.Background", Color.RED);
        contentPane.add(progressBar);

        temperatureJLabel = new JLabel("Change in Temperature (°F)");
        temperatureJLabel.setBounds(240, 80, 300, 50);
        temperatureJLabel.setFont(new Font("Georgia",Font.PLAIN,18));
        contentPane.add(temperatureJLabel);

        point1JLabel = new JLabel("0°");
        point1JLabel.setBounds(97, 180, 100, 30);
        contentPane.add(point1JLabel);

        point2JLabel = new JLabel(".1°");
        point2JLabel.setBounds(580, 180, 100, 30);
        contentPane.add(point2JLabel);

        pointmidJLabel = new JLabel(".05°");
        pointmidJLabel.setBounds(327, 180, 100, 30);
        contentPane.add(pointmidJLabel);

        point01JLabel = new JLabel(".01°");
        point01JLabel.setBounds(127, 180, 100, 30);
        contentPane.add(point01JLabel);

        point02JLabel = new JLabel(".02°");
        point02JLabel.setBounds(177, 180, 100, 30);
        contentPane.add(point02JLabel);

        point03JLabel = new JLabel(".03°");
        point03JLabel.setBounds(227, 180, 100, 30);
        contentPane.add(point03JLabel);

        point04JLabel = new JLabel(".04°");
        point04JLabel.setBounds(277, 180, 100, 30);
        contentPane.add(point04JLabel);

        point06JLabel = new JLabel(".06°");
        point06JLabel.setBounds(377, 180, 100, 30);
        contentPane.add(point06JLabel);

        point07JLabel = new JLabel(".07°");
        point07JLabel.setBounds(427, 180, 100, 30);
        contentPane.add(point07JLabel);

        point08JLabel = new JLabel(".08°");
        point08JLabel.setBounds(477, 180, 100, 30);
        contentPane.add(point08JLabel);

        point09JLabel = new JLabel(".09°");
        point09JLabel.setBounds(527, 180, 100, 30);
        contentPane.add(point09JLabel);


        setSize(700,600);
        setTitle("Climate Tester");
        setVisible(true);
        setResizable(false);

    }


    private void closeTester()
    {
        this.dispose();
    }

    @Override
    public void propertyChange(PropertyChangeEvent evt)
    {
        if("progress" == evt.getPropertyName())
        {
            //progress += 1;
            progressBar.setValue(progress);
        }
    }

}

You can do it like that, however, you may be better off making the styling more specific to the table tag, e.g.

<table class="resulttable resulttable-yellow">

Place common table properties within .resulttable{} and specific yellow background stuff within .resulttable-yellow{}

.tablebox{
    float:left;
    width:45%;
    height:70%;
    border:1px solid #ccc;
    border-radius:0px;  
    padding:30px 0px 0px 0px;
    margin:10px 10px 10px 0px;
    color:#39F;
    font-weight:bold;
    text-align:center;
    overflow:hidden;
}

.tablebox div{
    margin:0 auto;
    width:80%;
}

.resulttable{
    width: 100%;
    text-align: center;
    border-collapse: collapse;
    border-color:#C0C0C0;
}
.resulttable th, .resulttable td{
    border: 1px solid #C0C0C0;   
}
.resulttable th:first-child{
    width: 70%;
}
.resulttable th:nth-child(2){
    width: 30%;
}
.resulttable td span{
    color: #804000;
}

/* OK now go to it to style individual types of resulttable... */

.resulttable-yellow{
    background-color:#FFC;
}

.resulttable-yellow th{
    color:#66C;
    background-color:#FF6;
}

.resulttable-red{
    background-color:#CFF;
}

.resulttable-red th{
    color:#F30;
    background-color:#CFC;
}

I have no idea which colours you have, but the above is just an example. It's generally a bad idea to name classes with colours.

Anyhow, this allows you to anter a cleaner markup:

<div class="tablebox">
        <div>
            <table class="resulttable resulttable-yellow">
                <tr>
                    <th>Particulrs</th>
                    <th>Bags</th>
                </tr>
                <tr>
                    <td>Opening</td>
                    <td><input type="text"  value="650" size="6" maxlength="6" /></td>
                </tr>
                <tr>
                    <td>Purchase</td>
                    <td><input type="text"  value="100" size="6" maxlength="6" /></td>
                </tr>
                <tr>
                    <td><span>Total</span></td>
                    <td><input type="text"  value="750" size="6" maxlength="6" readonly tabindex="-1" /></td>
                </tr>
        </table>
    </div>
</div>

I haven't checked the CSS usage, but it looks a little verbose. There are many ways to skin a cat and I'm sure that you could find a more succinct way again. Just remember if you're reusing a lot of properties over and over - make a class not an id. An id is a bit of a pain as you need to specify each descendent if you want to give them the same styling, e.g.

<div id="box1">
    <div>
    </div>
</div>
<div id="box2">
    <div>
    </div>
</div>

Versus:

<div class="box">
    <div>
    </div>
</div>
<div class="box">
    <div>
    </div>
</div>

The first you'd need to do this (name each id):

#box1 div, #box2 div{
    ...blah blah
}

Whereas the second:

.box div{
    ...blah blah
}

The latter is scalable, the first isn't.

#include<iostream>
#include<conio.h>
#include<string.h>
#define size 50     //minimum input 50
using namespace std;
int main()
{
    int i=0;;
string names[size];//store input
string names_dis[size];//save input condition fullfill
do
{
cout<<"Enter name"<<i+1<<"::"<<endl;
cin>>names[i];      
if(names[i]!="end"&&names[i].length()<=25&&names[i].length()>10)
{
names_dis[i]=names[i];  
}
i++;
}
while(names[i-1]!="end");
for(int j=0;j<i;j++)
{   
cout<<names_dis[j]<<endl;   
}

getch();    
}

Hi all,

I would like to replace new lines with "<BR>" in a text file. I'm executing the following line in Powershell:

[regex]::Replace((Get-Content "testfile.txt"), "\.``n", ".<BR>", "Singleline")

The contents of testfile.txt:

Some text here for paragraph one.

More text for paragraph two.

Hello Everyone,
I am new to c# and am trying to use Open XML to pull data from a SQL server into a spreadsheet. I followed some examples I found online but had to alter them to fit the test scenario I have set up and have run into an error I am not sure how to debug.

I am receiving error code CS0120, "An object reference is required for the non-static field, method or property 'Program.CreateContentRow(int, int, string, string, string)'"

I tried adding code along the lines of "Row contentRow = new Row()", because that is pretty much the extent of what my current knowledge is regarding object references, but that does not fix the problem. Is the issue with my code that I need to pull the code from the static main method? Any help or information would be greatly appreciated. I am trying to understand what I did wrong here so I know how to do things differently in the future.

Thanks.

using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using DocumentFormat.OpenXml;
    using DocumentFormat.OpenXml.Packaging;
    using DocumentFormat.OpenXml.Spreadsheet;
    using System.IO;

    namespace ExcellTakeTwo
    {
    class Program
    {
        private const string ExcelTemplateFile = @"Template.xlsx";
        private const string GeneratedExcelFile = @"Security.xlsx";
        string[] headerColumns = new string[] { "A", "B", "C", "D" };
        static void Main(string[] args)
        {
            // Make a copy of template file
            File.Copy(ExcelTemplateFile, GeneratedExcelFile, true); 

            //Open the copied template workbook           
            using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(GeneratedExcelFile, true))
            {
                // Access the main workbook part with all of the references
                WorkbookPart workbookPart = spreadsheetDocument.WorkbookPart;

                // Grab the first worksheet
                WorksheetPart worksheetPart = workbookPart.WorksheetParts.First();

                // SheetData will contain all the data
                SheetData sheetData = worksheetPart.Worksheet.GetFirstChild<SheetData>();

                //Connect to the database Security
                WyattsLinqDataContext wyattsLinqDataContext = new WyattsLinqDataContext();

                // Data starts on row 2
                int index = 2;

                // Select * from Security table
                var securityQuery =
                    from Security
                    in wyattsLinqDataContext.Securities
                    select Security;

                // For each row in database add a row to spreadsheet
                foreach (var item in securityQuery)
                {
                    int personId = item.PersonID;
                    string lastName = item.LastName;
                    string firstName = item.FirstName;
                    string userPass = item.Password;

                    //Add a new row                    
                    Row contentRow = CreateContentRow(index, personId, lastName, firstName, userPass);
                    index++;

                    // Append new row to data sheet
                    sheetData.AppendChild(contentRow);                    
                }  

            }

        }
        Row CreateContentRow(int index, int personId, string lastName, string firstName, string userPass)
        {
            // Create new row
            Row row = new Row();

            row.RowIndex = (UInt32)index;

            // first cell is a text cell, so create it and append it

            Cell firstCell = CreateTextCell(headerColumns[0], personId.ToString(), index);

            row.AppendChild(firstCell);

            // Create cells that contain data

            for (int i=1; i < headerColumns.Length; i++)
            {
                Cell cell = new Cell();

                cell.CellReference = headerColumns[i] + index;

                CellValue cellValue = new CellValue();

                if (i == 1)
                {
                    cellValue.Text = lastName.ToString();
                }
                else if (i == 2)
                {
                    cellValue.Text = firstName.ToString();
                }
                else
                {
                    cellValue.Text = userPass.ToString();
                }
                cell.AppendChild(cellValue);
                row.AppendChild(cell);
            }
            return row;
        }
        Cell CreateTextCell(string header, string text, int index)
        {
            // Create new inline string cell
            Cell cell = new Cell();

            cell.DataType = CellValues.InlineString;

            cell.CellReference = header + index;

            // Add text to text cell
            InlineString inlineString = new InlineString();

            Text newText = new Text();

            newText.Text = text;

            inlineString.AppendChild(newText);
            cell.AppendChild(inlineString);

            return cell;
        }
    }
    }

Hey everyone, I have a question. I have a web app where you have a table that will either update, delete, or add a user. The update works great but the delete is weird. It deletes just fine, but I ask for a confirmation first before the action is completed.
I am using PHP, jquery/javascript, html, and MySQL
This is the code that I used for the button

 echo "<td><button type='submit' name='delete' value='".$row['UserID']."' class='delete-button'>Delete</button></td>";

This is the jquery/javascript that I am using

 $('.delete-button').on('click', function()
        {
                var conf=confirm("Are you sure?");
                if(conf==false)
                {
                        window.close();
                }
                       });
});

When the user hits the button, the popup comes out asking if they are sure. If they hit the cancel button, the window will close. If they hit okay, they will go to the next page where the Query will be executed to delete the entry.
However, sometimes but not all the time, the entry will be deleted even if the user hits the cancel button. Would anyone know why that is happening?

How to handle org.springframework.web.multipart.MaxUploadSizeExceededException in spring 4 am uploading a file in java it will accept only 2omb but i have uploaded 30mb its giving org.springframework.web.multipart.MaxUploadSizeExceededException how to handle in spring 4 How to handle org.springframework.web.multipart.MaxUploadSizeExceededException in spring 4 am uploading a file in java it will accept only 2omb but i have uploaded 30mb its giving org.springframework.web.multipart.MaxUploadSizeExceededException how to handle in spring 4