0
public void RowsColor()
        {
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {

 int val =Int32.Parse(dataGridView1.Rows[i].Cells[5].Value.ToString());

                if (val < 14)

                {
                    dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Red;
                }
                else
                {
                    dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Green;
                }
            }
        }

Please, check

int val =Int32.Parse(dataGridView1.Rows[i].Cells[5].Value.ToString());
0

Dear Friends,
I facing problem to change color of DGV Row w.e.o Quantity of Remaining days. I tried it but i got error. PLease, check my code.

public void RowsColor()
        {
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                int val = Int32.Parse(dataGridView1.Rows[i].Cells[5].Value.ToString());
                if (val < 14)
                {
                    dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Red;
                }
                else
                {
                    dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Green;
                }

            }
        }

and

private void btn_Show_Click(object sender, EventArgs e)
        {
            con.Open();
            SqlCommand cmd = con.CreateCommand();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT pro_ID,pur_Date,pur_Batch as BatchNo, pur_ItemName as ItemName,pur_ExpDate as ExpiryDate, DATEDIFF(DAY, GETDATE(), pur_ExpDate) AS RemainingDays FROM pur_tab WHERE pur_Date BETWEEN '"+dt_From.Value.ToString("yyyy-MM-dd")+"' AND '"+ dt_To.Value.ToString("yyyy-MM-dd") + "'";
            cmd.ExecuteNonQuery();
            dt = new DataTable();
            da = new SqlDataAdapter(cmd);
            da.Fill(dt);
            dataGridView1.DataSource = dt;
            RowsColor();
            con.Close();
        }

I got error An "unhandled exception of type 'System.NullReferenceException' occurred in MMS1.exe
"Object reference not set to an instance of an object."}"
Please , help me.

0
and the TestDemo Class: it keep failing the Operator < ...testLessThan function 

#include <iostream>
#include <string>
#include <cstdlib>
#include <sstream>

#include "Date.h"

bool testConstructors(void);
bool testLessThan(void);
bool testInsertion(void);

int main{

    if (!testConstructors()) {
       cerr << "Constructor and\\or accessors failed check\n";
       return EXIT_FAILURE;
    }

    if (!testLessThan()) {
       cerr << "Operator < failed check\n";
       return EXIT_FAILURE;
    }

    if (!testInsertion()) {
       cerr << "Operator >> failed check\n";
       return EXIT_FAILURE;
    }

    cout << "All tests passed\n";

    return EXIT_SUCCESS;
}

bool testInsertion(void) {

    stringstream s;
    s << "8/17/1976 1:2:3\n";

    Date d;
    s >> d;

    if (d.getMonth() == 8 &&
        d.getDay() == 17 &&
        d.getYear() == 1976 &&
        d.getHour() == 1 &&
        d.getMinute() == 2 &&
        d.getSecond() == 3) {

        return true;   
    }
    else {
        return false;
    }
}

bool testConstructors(void) {

    Date d(8, 17, 1976, 1, 2, 3);
    Date e;

    if (d.getMonth() == 8 &&
        d.getDay() == 17 &&
        d.getYear() == 1976 &&
        d.getHour() == 1 &&
        d.getMinute() == 2 &&
        d.getSecond() == 3 &&
        e.getMonth() == 0 &&
        e.getDay() == 0 &&
        e.getYear() == 0 &&
        e.getHour() == 0 &&
        e.getMinute() == 0 &&
        e.getSecond() == 0) {

        return true;   
    }
    else {
        return false;
    }
}

bool testLessThan(void) {

    Date d1(1, 1, 2004, 1, 1, 1);
    Date d2(2, 1, 2004, 1, 1, 1);    
    Date d3(1, 2, 2004, 1, 1, 1);    
    Date d4(1, 1, 2005, 1, 1, 1);
    Date d5(1, 1, 2004, 2, 1, 1);
    Date d6(1, 1, 2004, 1, 2, 1);        
    Date d7(1, 1, 2004, 1, 1, 2);            

    if ((d1 < d2) && ...
0

implementation: I will also Appreciate if better way to improve the efficiency

#include <iostream>
#include <cstdlib>
#include <cctype>
#include <string>
#include <sstream>
#include <locale>

#include "Date.h"

using namespace std;

string replaceSpace(string& sample);

Date::Date()/**Default constructor, all variable are set to Zero..  **/
{
    month =0;
    day=0;
    year =0;
    hour =0;
    minute =0;
    second =0;

};

Date::Date(int theMonth, int theDay, int theYear, int theHour, int theMinute, int theSecond)
{
    if(theHour < 0 || theHour > 24 || theMinute < 0 || theMinute > 59 || theSecond < 0 || theSecond >59
            || theDay < 1|| theDay >31 || theMonth < 1 || theMonth > 12 )
    {
        cout << "Illegal argument to Date Class constructor.";
        exit(1);
    }
    else
    {
        if(theHour == 24)
        {
            theHour = 0; //Standardize midnight Time as 0:00
        }

        month   = theMonth;
        day     = theDay;
        year    = theYear;
        hour    = theHour;
        minute  = theMinute;
        second  = theSecond;
    }
    }

void Date::setMonth(int& newMonthValue)
{
    if(newMonthValue <1 || newMonthValue >12)
    {
        cout << "Illegal argument -- SetMonth Value Error.";
        exit(1);
    }
    else
    {
        month = newMonthValue;
    }
}

void Date::setDay(int& newDay)
{
    if(newDay <1 || newDay >31)
    {
        cout << "Illegal argument Day Value Error.";
        exit(1);
    }
    else
    {
        day = newDay;
    }
}

void Date::setYear(int& newYear)
{
    year = newYear;
}

void Date::setHour(int& newHour)
{
    if(newHour < 0 || newHour > 24)
    {
        cout << "Illegal argument --Na Hour Get Issue Value Error.";
        exit(1);
    }
    else
    {
        if(newHour == 24)
            newHour = 0;
        hour = newHour;
    }
}

void Date::setMinute(int& ...
0

Hello,
Please, i dont know why my implementation is failing the testDemo Fucntion.. Below is the full code.
it is Failing operator < .... testLessThan
interface:

  #ifndef DATE_H_
    #define DATE_H_

    #include<iostream>

    using namespace std;

    class Date;
    ostream &operator<<(ostream&, const Date&);
    istream &operator>>(istream&, Date&);

    class Date
    {
    private:
        int month;
        int day;
        int year;
        int hour;
        int minute;
        int second;

    public:
        virtual ~Date();
        Date(void);
        Date (int month, int day, int year, int hour, int minute, int second);

        virtual void setMonth(int&);
        virtual void setDay(int&);
        virtual void setYear(int&);
        virtual void setHour(int&);
        virtual void setMinute(int&);
        virtual void setSecond(int&);

        virtual int getMonth(void) const;
        virtual int getDay(void) const;
        virtual int getYear(void) const;
        virtual int getHour(void) const;
        virtual int getMinute(void) const;
        virtual int getSecond(void) const;

        virtual bool operator== (const Date &rhs);
        virtual bool operator< (const Date &rhs);

        //    friend ostream &operator<<(ostream&, const Date&);
        //    friend istream &operator>>(istream&, Date&);
    };
0

fixed my vector code, completely removed dict handling of both the attributes, and the proxy link infrastructure.

here's the working code:

https://cdn.discordapp.com/attachments/161204326218465280/358566142270373889/working_vector_code.png

as well as the debug result showing it works:

https://cdn.discordapp.com/attachments/98580359909773312/358440129150582784/I_feel_good.png

Bone attributes Locaction, Rotation, and Scale are all vector instances.

0

Following an interface of

class Date;

ostream &operator<<(ostream&, const Date&);
istream &operator>>(istream&, Date&);

class Date {

  private:
    int month;
    int day;
    int year;
    int hour;
    int minute;
    int second;

  public:

    Date(void);
    Date (int month, int day, int year, int hour, int minute, int second);

    virtual void setMonth(int&);
    virtual void setDay(int&);
    virtual void setYear(int&);
    virtual void setHour(int&);
    virtual void setMinute(int&);
    virtual void setSecond(int&);

    virtual int getMonth(void) const;
    virtual int getDay(void) const;
    virtual int getYear(void) const;
    virtual int getHour(void) const;
    virtual int getMinute(void) const;
    virtual int getSecond(void) const;

    virtual bool operator== (const Date &rhs);
    virtual bool operator< (const Date &rhs);

//    friend ostream &operator<<(ostream&, const Date&);
//    friend istream &operator>>(istream&, Date&);

};

#endif

Then I implement the below code...

/** Class Date models a date and time.
//This class contains private data members to store the day, month, and year of a date
//and the hour, minute, and second of a time.
//The class declaration includes the following public members

**/
#include <iostream>
#include <cstdlib>
#include <cctype>
#include <sstream>

#include "Date.h"

using namespace std;

Date::Date( )//: month(0), day(0), year(0), hour(0), minute(0), second(0)
{
    month(0), day(0), year(0), hour(0), minute(0), second(0);
    /**Default constructor, all variable are set to Zero..  **/
};

Date::Date(int theMonth, int theDay, int theYear, int theHour, int theMinute, int theSeconds)
{
    if(theHour < 0 || theHour > 24 || theMinute < 0 || theMinute > 59 || theSeconds < 0 || theSeconds >59
        || theDay < 1|| theDay >31 || theMonth <1 || theMonth > 12 )
    {
        cout << "Illegal ...
0

Error: The Remote Server Returned An Error 400 Bad Request

I am using asp vb.net and instagram api

also I am using Newtonsoft.Json -Version 10.0.3

I following below link as a tutorial but issue is I am converting code from c# to VB and I am getting an error:
https://code.msdn.microsoft.com/Haroon-Said-e1d8d388

The insta api's documentation says I need to request it like this :

curl \-F 'client_id=CLIENT-ID' \
-F 'client_secret=CLIENT-SECRET' \
-F 'grant_type=authorization_code' \
-F 'redirect_uri=YOUR-REDIRECT-URI' \
-F 'code=CODE' \https://api.instagram.com/oauth/access_token

I am getting an error on line client.uploadvalues(...)

Dim parameters As New NameValueCollection
parameters.Add("client_id", "ssdfsdfsdfsdfsdf")
parameters.Add("client_secret", "sdsdfdsfsdfsdfsdfsdfsdf")
parameters.Add("grant_type", "authorization_code")
parameters.Add("redirect_uri", "http://localhost:8979/UI/InstaHome.aspx")
parameters.Add("code", "5ce168cc4dee45388af9d297324dda3a")

Dim client As WebClient = New WebClient()
Dim result = client.UploadValues("https://api.instagram.com/oauth/access_token", "POST", parameters)
0

So here is my problem laid out as simple as I can put it.
I cant combine multiple entities together that have related data but are different
(one database table has id number that is shared by database table 2 and table 2 has employee number which is shared with database table 3, I need to limit the active employees in table 3 while searching for the current employees with id number “Something” because table 1 has their job details, which are also marked as active or none active and need to be limited in that search as well)

Table 1

Id_num          Job_desc            Job_active
123123          supervisor         checked
123123          advisor           unchecked

Table 2

Id_num       Job_id       Employee_number
123123       B04           29928
234234       B00           29999

Table 3

Employee_number        Employee_active        Employee_name
29928                               true             Alfred
29999                               false            Batman

My dilemma is that I need to combine all these table into one searchable query either using LINQ entities or just plain sql (I do not care which at this point) and then return the results as a list and print them on a view inside my app.

This is what I have so far and I know its very wrong because I have no idea what to do or what direction is better, I read that raw sql is better but then I read that its better to do what I have done below. Any guidance is appreciated, and please using coding examples in responses so I can better understand any points you might make.

(here is ...

0

Hello,
Please I want to get an input of string, like mm/dd/yyyy hh/mm/ss
where first mm is month,.... and second mm is minutes....
then want to split each into date object.. like ... month day year.... after each / ....
I am lost here...
thanks

istream &operator>>(istream& inputStream, Date& dateObject)
{
    string inVariable[20];
    inputStream.getline(inVariable, 20, "\n" );
    //inputStream >> inVariable;

}
0

This problem was solved like 40 years ago.

$ sort -t" " -rnk4 data.tsv
ascon1 201707015 Jack 97.5 11.5 11.5 11.5
ascon1 201707013 Josh 79.5 11.5 11.5 11.5
ascon1 201707011 John 77.5 11.5 11.5 11.5
ascon1 201707012 Grld 70.0 11.5 11.5 11.5
ascon1 201707014 Jess 67.5 11.5 11.5 11.5
  • -t" " to tell sort to split on spaces
  • -r for reverse (highest first)
  • -n to tell sort that it's a numeric field
  • -k4 to tell sort that we're loking at the fourth column
0

Hi,

I'm developing a windows forms based software that process various '.log' files and provides the output to the user.

I've implemented a stop button to stop the processing of the files and when the button is clicked, a message box would display with Yes/No options.

The process thread keeps on running when the message box is displayed. I would like to pause the process thread temporarily till the user responds to the message box.

I tried 'suspend' method and it is actually obsolete.

Need your assistance.

Thank you
Karthik

0

@rproffitt So would the following be how I approach it? So would the absolute be calculated like this: (610 secs) T=Tna X Nna (10 X 1) + Ta X Na (100 x 6);

Line 1: for(int=0; i<1,000,000; i++)
i variable in for loop, needs memory access and rest operations. This executes 1,000,000 times
You have:
1000000 times of
2 - memory access (1 read and 1 assign)
1 - compare
1 - incr (depends. It could be -> 1 read and 1 add)
Line 3: if(data[i]< 0)
data[i] in if statement is a memory reference and a compare operation. This executs 1,000,000 times
You have:
1000000 times of
2 - memory access
1 - compare
Line 4: data[i]= data[i] * 2
You have: 0 to 1000000 times depending on value of the data. You may want to calculate the worst case.
Hence, 1000000 times.
2 - memory access (1 read and 1 assign)
1 multiply

0

Who is Frien? Anyhow it appears you are posting widely. But searching seems to find a tutorial. So moving on.
http://www.c-sharpcorner.com/forums/transfer-data-from-dgv-of-form1-to-crystal-report-of-form2
https://www.youtube.com/watch?v=7J_zpg1Xo0A shows passing data from grid to another form.
https://www.codeproject.com/Answers/758276/How-transfer-data-datagridview-to-crystal-report-i#answer1 notes how to get data into CR without a database.

You have a lot of stuff to read, and more work ahead of you.