c# – como compartir data table entre un formulario y un reporte

tengo un formulario donde lleno “manualmente” un datatable contenido en un dataset, y otro formulario donde tengo un control reportviewer que utiliza la misma tabla como data del reporte. yo confirmo en el formulario donde lleno la tabla que termina con registros, pero el reporte no muestra data.

cuando lleno la tabla en el mismo formulario donde tengo el control reportviewer si muestra los datos.

pero necesito llenarla en otro.

gracias de antemano por la orientación.

python 3.x – Seleccionar un selector entre varios con el mismo nombre de id en selenium

Queriendo hacer una presentación sobre hacking ético y formas de pirateo usando Selenium con python me encontré con un problema.
La página que elegí para hacer una demostración de cómo algunas personas crackean cuentas gratis de Disney+ usando Selenium me encontré con un problema.
En la pestaña de verificación de tarjeta de crédito me encontré con que hay 2 mismos selectores con el mismo id, por lo tanto al llegar a ese apartado no me continuaba

# Importar librerías
import pandas
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec

excel_credenciales = r'E:AutomatizarCuentasDisneydatos.xlsx'

df = pandas.read_excel(excel_credenciales)

# Leer usuario y contraseña del excel datos.xlsx
user = df('usuario')(0)
psw = df('contraseña')(0)
cardNum = df('tarjeta')(0)
cardName = df('nombre')(0)
date = df('fecha')(0)
cvv = df('cvv')(0)
# URL de la página a la que se va a acceder, en este caso disneyplus.com
url = 'https://www.disneyplus.com/'

# Selectores:
button_subscribe_now = '#cta-target > div.plan.plan-0.normal > div.button-group > a'
selector_email = '#email'
button_continue = '#dssLogin > div > div > button'
button_accept_and_continue = '#onboarding_index > div > div > div.sc-iQNlJl.gfSJkT > div.sc-bsbRJL.kGiVbS > button'
selector_password = '#password'
button_password_continue = '#dssLogin > div.sc-hwwEjo.rkHHK > button'
selector_card_name = '#billing-card-name'
selector_card_number = '#billing-card-number'
selector_card_date = '#billing-card-exp-date'
selector_card_cvv = '#billing-card-CSC'
button_accept_and_subscribe = '#credit-submit-button > span'

# Abrir Firefox
driver = webdriver.Firefox()
# Maximiza pantalla
driver.maximize_window()
#Abrir página desde variable url.
driver.get(url)

#Acciones
    # Hacer clic en Subscribe Now
driver.find_element_by_css_selector(button_subscribe_now).click()
    # Escribir el primer correo registrado en el excel
driver.find_element_by_css_selector(selector_email).send_keys(user)
    # Hacer clic en continuar
driver.find_element_by_css_selector(button_continue).click()
    # Hacer clic en accept and continue
driver.find_element_by_css_selector(button_accept_and_continue).click()
    # Escribir contraseña del excel
driver.find_element_by_css_selector(selector_password).send_keys(psw)
    # Hacer clic en continuar
driver.find_element_by_css_selector(button_password_continue).click()
    # Escribir nombre de tarjeta del excel
driver.find_element_by_css_selector(selector_card_name).send_keys(cardName)
    # Escribir número de tarjeta del excel
driver.find_element_by_css_selector(selector_card_number).send_keys(cardNum)
    # Escribir fecha de vencimiento de la tarjeta del excel
driver.find_element_by_css_selector(selector_card_date).send_keys(date)
    # Escribir el cvv de la tarjeta del excel
driver.find_element_by_css_selector(selector_card_cvv).send_keys(cvv)
    # Hacer clic en aceptar y subscribirse
driver.find_element_by_css_selector(button_accept_and_subscribe).click()

# Acciones extra
time.sleep(7)
driver.quit()

El selector duplicado es: #billing-card-name

IMPORTANTE: Lo he programado para Firefox asi que si alguien lo prueba que tenga geckodriver.exe instalado
IMPORTANTE2: Hay que crear un excel llamado “datos.xlsx” y poner la ruta de donde pongais el excel en la línea 9 del código entre las comillas simples ‘ ‘ .

python 3.x – Usar Lock() em pyhon para não compartilhar dados entre Threads

Tenho um aplicativo que abre cerca de 25 Threads, ao acessar um método, eventualmente uma thread “rouba” as informações de outra, oq causa erros críticos no sistema.

Estou tentando travar o acesso ao método por Lock() mas não estou conseguindo.

from threading import Thread, Lock, get_ident

def calc(valor1, valor2):
    
    lockCalc = get_ident()
    lockCalc = Lock()
    lockCalc.acquire()    
    
    diferenca = round((valor2 - valor1), 2)

    lockCalc.release()
    return diferenca

Alternar entre programas utilizando o switch C++

resumirei brevemente o problema que estou enfrentando.
Estou programando, junto ao meu grupo, o meu projeto final de C++. Pois bem, somos três e cada participante programou um fator. No entanto, precisamos entregar o código todo sem headers, e em apenas um arquivo .cpp. Para isto, resolvi utilizar SWITCH para alternar entre os programas que cada participante do grupo escreveu.
Estou o dia todo tentando perceber qual o problema, já tentei unir o código de formas diferentes, no entanto, sem sucesso. Aparentemente o SWITCH está funcionando, porém não executa até o final do laço.

O problema que estou enfrentando–>
Quando executo, por exemplo, o Case2, ele apenas me retorna “File Open With Success”. Todas as funções, saídas, e até mesmo o último CIN deste laço ele não executa.

case 2 :    //Weather System
                     {
                ifstream Ifile("Weather.dat");          //data file responsible for sotring information related to the weather   
                Ifile.open("Weather.dat");  
                
                if (Ifile.is_open())
                {
                    cout << "File open with success.";
                 }

Sendo que este case, possui o seguinte código:

   ```                  case 2 :    //Weather System
                 {
            ifstream Ifile("Weather.dat");          //data file responsible for sotring information related to the weather   
            Ifile.open("Weather.dat");  
            
            if (Ifile.is_open())
            {
                cout << "File open with success.";
             }
            while(!Ifile.eof())
{
    
    Ifile>>FileVal;
    if (FileLine==1) 
    day1.set_wind_speed(FileVal,hour);
    if (FileLine==2)
    day1.set_rainfall(FileVal,hour);
    if (FileLine==3)
    day1.set_snowfall(FileVal,hour);
    if (FileLine==4)
    day1.set_temp(FileVal,hour);
    

    if(Ifile.peek()=='n')      //Once file reaches end of line
    {
    FileLine+=1;
    StaticHour=hour;    //To save what hour it is, doesnt matter what line because all lines are same length
    hour=0;     //Sets 0 because new line with new hours
    }
    hour+=1;

}
Ifile.close();
day1.display(StaticHour);

//Exceptions throw variables in warning functions in the weather class so if there is a exception value it wont display a warning//
    try 
    {
                             day1.Check_Wind(StaticHour);
    }
    
    catch (Wind_Error E1)
    {
                            E1.Read_Error();
    }
    
    try
    {
                            day1.Check_Rain(StaticHour); 
    }
    
    catch (Rain_Error E2)
    {
                            E2.Read_Error();
    }
    
    try
    {
                            day1.Check_Snow(StaticHour);
    }
    
    catch (Snow_Error E3)
    {
                            E3.Read_Error();
    }
    
    try
    {
                            day1.Check_Temp(StaticHour);
    }
    
    catch (Temp_Error E4)
    {
                            E4.Read_Error();
    }
    
                        cout<<"If you would like to see all weather values of the day press 1 if not press any other key --> ";
                        cin>>Input;
                        if(Input==1)
                        day1.display_all(StaticHour);
                        else 
                        break;

                        } 

Estarei postando o código inteiro para uma melhor análise.

#include <fstream>
#include <sstream>
#include <exception>
// #include <bits/stdc++.h>  --> replaced for cstdlib &  ctime  for less compilation time 
#include <ctime>
#include <cstdlib>
#include <string>


using namespace std;

class stock 
{

private:
    string Symbol;
    int amount;
    double open_p;
    double close_p;
    double buy_p;

public:
    
          //FUNCTIONS
          
    stock();
    stock(string symbol, int amount, double open_p, double close_p, double buy_p)
    {
            setSymbol(symbol);
            setAmount(amount);
            setOpenP(open_p);
            setCloseP(close_p);
            setBuyP(buy_p);
    }
    virtual ~stock()
    {
        
        
    }

    string getSymbol()
    {
        return Symbol;
    }
    
    int  getVolume()
    {
            return amount;      
    }
    
    double getOpenP()
    {
            return open_p;
    }
    
    double getCloseP()
    {
            return close_p;

    }
    
    double getBuyP()
    {
            return buy_p;

    }
    
    void setSymbol(string Symbol)
    {
            this->Symbol = Symbol;

    }
    
    void setAmount(int amount)
    {
            this->amount = amount;

    }
    
    void setOpenP(double o_price)
    {
            this->open_p = open_p;

    }
    
    void setCloseP(double c_price)
    {
            this->close_p = close_p;

    }
    
    void setBuyP(double b_price)
    {
            this->buy_p = buy_p;

    }
    
    double calc_ActualHolding()
    {
        double h;
        h = (double)getVolume() * getBuyP();
        return h;
        
    }
    double calc_OpenHolding()
    {
        double h_marketopen;
        h_marketopen = (double)getVolume() * getOpenP();
        return h_marketopen;
    }
    double calc_CloseHolding()
    {
            double h_marketclose;
            h_marketclose = (double)getVolume() * getCloseP();
            return h_marketclose;
    }
            
};

class  Bank_Account : public stock
{
        public: 
            double balance;
            int Account_ID;
            
            Bank_Account()
            {
                        balance = 0.0;
                        Account_ID = 0;
    
        }
            Bank_Account(double, int)
            {
                            this->balance = balance;
                            this->Account_ID = Account_ID;
            }
            
            double get_userbalance()
            {
                return balance;     
            }
            
            int get_accountid()
            {
                return Account_ID;
            }
};


        ///////////////////////////##############################//////////////////////////////************************************************************/////////////////////////////////////
        ////////////////////////////############################//////////////////////////////************************************************************/////////////////////////////////////
class Wind_Error : public exception
{
            public:
                         float wind_speed;
                         
    Wind_Error(float wind)
    {
    this->wind_speed=wind;
    }
    
        void Read_Error()
        {
                    cout<<"***WIND SPEED ERROR***"<<endl;
                    cout<<"The wind speed value "<<this->wind_speed<<" at the end of the first line in file is a exception/error value"<<endl;
                    cout<<"**********************"<<endl;
        }
};
        
        ///////////////////////////##############################//////////////////////////////************************************************************/////////////////////////////////////
        ////////////////////////////############################//////////////////////////////************************************************************/////////////////////////////////////

class Rain_Error : public exception
{
            public:
                         float rainfall;
                         
        Rain_Error(float rain)
        {
        this->rainfall=rain;
        }
    
        
        ///////////////////////////##############################//////////////////////////////************************************************************/////////////////////////////////////
        ////////////////////////////############################//////////////////////////////************************************************************/////////////////////////////////////

        
        void Read_Error()
        {
                    cout<<"***RAINFALL ERROR***"<<endl;
                    cout<<"The rainfall value "<<this->rainfall<<" at the end of the second line in file is a exception/error value"<<endl;
                    cout<<"*********************"<<endl;
        }
};
        
    
        ///////////////////////////##############################//////////////////////////////************************************************************/////////////////////////////////////
        ////////////////////////////############################//////////////////////////////************************************************************/////////////////////////////////////

        
        
   class Snow_Error : public exception
{
        public:
                     float snowfall;
                     
    Snow_Error(float snow)
        {
        this->snowfall=snow;
        }
        
    void Read_Error()
        {
                    cout<<"***SNOWFALL ERROR***"<<endl;
                    cout<<"The snowfall value "<<this->snowfall<<" at the end of the second line in file is a exception/error value"<<endl;
                    cout<<"*********************"<<endl;
        }
};  
        ///////////////////////////##############################//////////////////////////////************************************************************/////////////////////////////////////
        ////////////////////////////############################//////////////////////////////************************************************************/////////////////////////////////////     
        class Temp_Error : public exception
{
        public:
                float temp;
                
        Temp_Error(float temp)
        {
        this->temp=temp;
        }
        
        void Read_Error()
        {
                    cout<<"***TEMPERATURE ERROR***"<<endl;
                    cout<<"The temperature value "<<this->temp<<" at the end of the second line in file is a exception/error value"<<endl;
                    cout<<"*********************"<<endl;
        }
};
//**EXCEPTION CLASSES END**//
        ///////////////////////////##############################//////////////////////////////************************************************************/////////////////////////////////////
        ////////////////////////////############################//////////////////////////////************************************************************/////////////////////////////////////

class Weather
{
         private:
                float wind_speed(24);
                float snowfall(24);
                float rainfall(24);
                float temp(24);
public:

    storms()
        {
            
        }
//**SET FUNCTIONS**//
    void set_wind_speed(float wind_speed, int hour)
        {
        this->wind_speed(hour)=wind_speed;
        }
        
    void set_rainfall(float rainfall, int hour)
        {
        this->rainfall(hour)=rainfall;
        }
        
    void set_snowfall(float snowfall, int hour)
        {
        this->snowfall(hour)=snowfall;
        }
        
    void set_temp(float temp, int hour)
        {
        this->temp(hour)=temp;
        }
//****CHECK FUNCTIONS BEGIN****//
    bool Check_Wind(int hour) //Bool so it can return a value to leave the function and return to main
        {
            
    //**Check for exception**//
    if (this->wind_speed(hour)<0 || this->wind_speed(hour)>=500)
    {
        Wind_Error Error1(this->wind_speed(hour));
        throw Error1;
    }
            //**Blizzard Statement**//
            if  (this->wind_speed(hour) >= 56 && this->snowfall(hour)>=1)
            {
                        cout<<"****WARNING BLIZZARD****"<<endl<<"There is a blizzard happening in your area with wind speeds of "<<this->wind_speed(hour)<<"km/h and snowfall of "<<this->snowfall(hour)<<" feet"<<endl;
                        cout<<"Please Follow Safety Procautions: "<<endl;
                        cout<<"Avoid driving as roads may be slippery and vision is obscured "<<endl;
                        cout<<"Stay inside "<<endl;
                        cout<<"************************"<<endl<<endl;
            return 1;       //Return Garbage value to jump back to main
            }
            //**Warning Statement**//
            else if (this->wind_speed(hour) >= 50)
            {
                        cout<<"****WARNING HIGH WINDS****"<<endl<<"There are high winds in your area with wind speeds of "<<this->wind_speed(hour)<<"km/h"<<endl;
                        cout<<"Please Follow Safety Procautions:"<<endl;
                        cout<<"Slow down while driving "<<endl;
                        cout<<"Be wary of debris "<<endl;
                        cout<<"Stay inside"<<endl;
                        cout<<"**************************"<<endl<<endl;
            return 1;
            }
            else if (this->wind_speed(hour) != 0)
            {
                        cout<<"---Winds---";
                        cout<<"It is currently windy in your are with wind speeds of "<<this->wind_speed(hour)<<"km/h"<<endl;
                        cout<<"-----------"<<endl<<endl;
            return 1;
            }
        }       
    
    bool Check_Rain(int hour)
        {
    //**Check for exception**//
    if (this->rainfall(hour)<0 || this->rainfall(hour)>=10)
    {
    Rain_Error Error2(this->rainfall(hour));
    throw Error2;
    }
            if  (this->rainfall(hour) >= .75)
            {
                        cout<<"****WARNING HEAVY RAIN****"<<endl<<"There is Heavy Rain in your area with rainfall of "<<this->rainfall(hour)<<" inches per hour"<<endl;
                        cout<<"Please Follow Safety Procautions:"<<endl;
                        cout<<"Avoid driving or slow down while as roads may be slippery and vision is obscured"<<endl;
                        cout<<"Stay inside"<<endl;
                        cout<<"**************************"<<endl<<endl;
            return 1;
            }
            else if (this->rainfall(hour)!=0 )
            {
                        cout<<"---RAINFALL---"<<endl;
                        cout<<"It is curently raining in your area with rainfall of "<<this->rainfall(hour)<<"inches per hour"<<endl;
                        cout<<"----------"<<endl<<endl;
            return 1;
            }   
            
        }

bool Check_Snow(int hour)
    {
//**Check for exception**//
if (this->snowfall(hour)<0 || this->snowfall(hour)>=50)
{
Snow_Error Error3(this->snowfall(hour));
throw Error3;
}
        if (this->snowfall(hour)>= 1)
        {
                    cout<<"****WARNING HEAVY SNOWFALL****"<<endl<<"There is a large amount of snowfall in your area with "<<this->snowfall(hour)<<" feet of snow on the ground"<<endl;
                    cout<<"Please Follow Safety Procautions: "<<endl;
                    cout<<"Avoid driving or slow down as roads may be icy and slippery"<<endl;
                    cout<<"Wear warm and insulating clothing if going outside "<<endl;
                    cout<<"*******************************"<<endl<<endl;
        return 1;
        }
        else if (this->snowfall(hour)!=0 )
        {
                    cout<<"---SNOWFALL---"<<endl;
                    cout<<"It is curently snowing in your area with snowfall of "<<this->snowfall(hour)<<" feet"<<endl;
                    cout<<"--------------"<<endl<<endl;
        return 1;
        }
    }
    
bool Check_Temp(int hour)
    {
//**Check for exception**//
if (this->temp(hour)<-100 || this->temp(hour)>=60)
{
Temp_Error Error4(this->temp(hour));
throw Error4;
}
    if(this->temp(hour)>=25)
        {
                    cout<<"****WARNING HIGH TEMPERATURES****"<<endl<<"The temperature in your area is currently "<<this->temp(hour)<<" C"<<endl;
                    cout<<"Please Follow Safety Procautions:"<<endl;
                    cout<<"Wear light and loose clothing"<<endl<<"Do not leave children or pets in cars"<<endl<<"Wear sunscreen"<<endl<<"Find somewhere cool"<<endl;
                    cout<<"*********************************"<<endl<<endl;
        return 1;
        } 
    if(this->temp<=0)
        {
                    cout<<"****WARNING BELOW FREEZING TEMPERATURES****"<<endl<<"The temperature in your area is currently "<<this->temp(hour)<<" C"<<endl;
                    cout<<"Please Follow Safety Procautions:"<<endl;
                    cout<<"Wear warm and insulating clothing"<<endl;
                    cout<<"Be cautious while driving as roads may be icy or slippery"<<endl;
                    cout<<"*******************************************"<<endl<<endl;
        return 1;
        }
    }
    
//****CHECK FUNCTIONS END****//

    void display(int hour)
    {
        if(hour<=12)
                    cout<<"*--It is currently "<<hour<<"am"<<" and the temperature outside is "<<this->temp(hour)<<" Celcius --*"<<endl<<endl;
        else
                    cout<<"*--It is currently "<<(hour-12)<<" and the temperature outside is "<<this->temp(hour)<<" C--*"<<endl;
    }
    void display_all(int hours)
    {
              cout<<"HOURtSNOWFALLtRAINFALLtWIND SPEEDtTEMPERATURE"<<endl;//temperature 
        for(int i=1;i<=hours;i++)
        {
                        cout<<i<<"t"<<this->snowfall(i)<<"Feettt"<<this->rainfall(i)<<" Inches t"<<this->wind_speed(i)<<"km/htt"<<this->temp(i)<<" C"<<endl;
        }
    }
};

        ///////////////////////////##############################END OF CLASS DECLARATION END OF CLASS DECLARATION END OF CLASS DECLARATION ******************************///////////////////////////////
        ////////////////////////////############################/END OF CLASS DECLARATION END OF CLASS DECLARATION END OF CLASS DECLARATION *****************************///////////////////////////////



int main ()
{
        /* Main program variables 
                                        -> Economic, Weather, Healthy  
  */ 
                                    //Financial Market Alarm System Variables
        int stock_hold;
        string Symbol;
        int amount;
        double open_p;
        double close_p;
        double buy_p;
        
                                        //Weather Alarm System Variables
    int hour=1,StaticHour,FileLine=1;
    Weather day1;
    float FileVal;
    bool Input;
    string work="It Worked!!!",copy_line;
        //Ifile.open("Weather.dat");    *********
                                                                
                        //Diastolic Alarm System Variables
                        
        int age, number,temp,systolic, diastolic,i=1;
        char slash;
        string line, name;
        
      //CONTROL SYSTEM - SELECT (CONTROL SWITCH) //
         int select;
         cout << "Which program would like to access? n (for STOCK SYSTEM: 1 t for SNOWFALL SYSTEM: 2 t for BLOODPRESSURE: 3 t for REGULATORY COMPLIANCE: 4)n";
         cout << "System:";
         cin >> select;
         
    
        //Program .dat files
        ifstream Ifile("Weather.dat");          //data file responsible for sotring information related to the weather (snowfallsystem)
        ifstream file("Medical.dat");       //data file responsible for storing information related to the diastolic
        ofstream stocks("Stockinfo.dat");   //data file responsible for storing information related to the stocks
        ofstream accinfo("AccountInfo.dat"); //data file responsible for storing information related to the bank_account


        switch ( select )  //switch method to alternate between each system
                 
     {
                     case 1 :
                        
                        {
                                        
                 // first change of the second solution (user sets the value of stock_hold
                 cout << "Number of shares: ";
                 cin >> stock_hold;
                 //  defines the number of instances. 
             stock* stok(stock_hold);
    
        for (int i = 0; i < sizeof(stok)/sizeof(*stok); i++)
        {
            cout << "tSTOCK" << i + 1 <<"t"<<endl;
        symbol:
            cout << "Share Symbol: ";
            cin >> Symbol;
    
            if ((Symbol.find_first_not_of(' ') == string::npos) || Symbol.empty() || (Symbol.length() > 4))
            {
                cout << "Symbol cannot be empty and must be less than four characters" << endl;
                goto symbol;
            }
    
        amount:
            cout << "Shares amount: ";
            cin >> amount;
            if (amount <= 0 )
            {
                cout << "Amount cannot be zero or negative.";
                goto amount;
            }
    
        openp: 
            cout << "Stock Opening Price: ";
            cin >> open_p;
    
            if (open_p <= 0)
            {
                cout << "Stock opening price must be higher than zero. Try againn";
                goto openp;
            }
    
        closep:
            cout << "Stock Closing Price: ";
            cin >> close_p ;
    
            if (close_p <= 0)
            {
                cout << "Stock closing price must be higher than zero. Try againn";
                goto closep;
            }
            
        buyp:
            cout << "Share buying price: ";
            cin >> buy_p ;
    
            if (buy_p <= 0)
            {
                cout << "Stock buying cannot be negative or zero. Try againn";
                goto buyp;
            }
            
             
            cout << "n";
            stok(i) = new stock(Symbol, amount, open_p, close_p, buy_p);
            stocks << stok(i)->getSymbol();
            stocks << stok(i)->getVolume();
            stocks << stok(i)->getOpenP();
            stocks << stok(i)->getCloseP();
            stocks << stok(i)->getBuyP();       
        }
        stocks.close();
    
        cout << endl << "ttt" << "----------- Showing Holding Infos ----------ttt" << endl<<endl;
        for (int i = 0; i < stock_hold; i++)
        {
            cout << "SYMBOL = " <<right<< stok(i)->getSymbol() << " | CurrentHolding($) = " << stok(i)->calc_ActualHolding() <<
                "| OpenPriceHolding = "<< stok(i)->calc_OpenHolding()<<" | AfterCloseHolding = "<< stok(i)->calc_CloseHolding()<< endl;
        }
    
        double totalhold = 0;                           //total hold
        double total_hopen = 0;             //total hold at market open
        double total_hclose = 0;            //total hold at market close
    
        cout << endl << "SYMS = ";
        for (int i = 0; i < stock_hold; i++)
        {
            totalhold = totalhold + stok(i)->calc_ActualHolding();
            total_hopen = total_hopen + stok(i)->calc_OpenHolding();
            total_hclose = total_hclose + stok(i)->calc_CloseHolding();
            cout << stok(i)->getSymbol() << " | ";
        }
        cout << endl;
        cout << "Total Holding: " << totalhold << endl;
        cout << "Total Holding at Market Open: " << total_hopen << endl;
        cout << "Total Holding at Market Close: " << total_hclose << endl;
                stocks.close();             
                            break;
            }
                
                
                    case 2 :    //Weather System
                     {
                ifstream Ifile("Weather.dat");          //data file responsible for sotring information related to the weather   
                Ifile.open("Weather.dat");  
                
                if (Ifile.is_open())
                {
                    cout << "File open with success.";
                 }
                while(!Ifile.eof())
    {
        
        Ifile>>FileVal;
        if (FileLine==1) 
        day1.set_wind_speed(FileVal,hour);
        if (FileLine==2)
        day1.set_rainfall(FileVal,hour);
        if (FileLine==3)
        day1.set_snowfall(FileVal,hour);
        if (FileLine==4)
        day1.set_temp(FileVal,hour);
        
    
        if(Ifile.peek()=='n')      //Once file reaches end of line
        {
        FileLine+=1;
        StaticHour=hour;    //To save what hour it is, doesnt matter what line because all lines are same length
        hour=0;     //Sets 0 because new line with new hours
        }
        hour+=1;

    }
Ifile.close();
day1.display(StaticHour);

//**Exceptions throw variables in warning functions in the weather class so if there is a exception value it wont display a warning**//
    try 
    {
                             day1.Check_Wind(StaticHour);
    }
    
    catch (Wind_Error E1)
    {
                            E1.Read_Error();
    }
    
    try
    {
                            day1.Check_Rain(StaticHour); 
    }
    
    catch (Rain_Error E2)
    {
                            E2.Read_Error();
    }
    
    try
    {
                            day1.Check_Snow(StaticHour);
    }
    
    catch (Snow_Error E3)
    {
                            E3.Read_Error();
    }
    
    try
    {
                            day1.Check_Temp(StaticHour);
    }
    
    catch (Temp_Error E4)
    {
                            E4.Read_Error();
    }
    
                        cout<<"If you would like to see all weather values of the day press 1 if not press any other key --> ";
                        cin>>Input;
                        if(Input==1)
                        day1.display_all(StaticHour);
                        else 
                        break;

                        } 
                        
                        
//////////////////// END OF WEATHER SYSTEM PROGRAM /////////////////////////////////////////////////////////////////////////////////
//////////////////// END OF WEATHER SYSTEM PROGRAM /////////////////////////////////////////////////////////////////////////////////

                                    case 3 : // Health Alarm System
                        
                        {
        ifstream file("Medical.dat");       //data file responsible for storing information related to the diastolic                                                
        file.open("Medical.dat");
        
            if (file.fail())
            {
                cout<<"File does not exist";
                return 0;
            }   
                cout<<"Please enter your name: ";
                cin>>name;
                cout<<"Please Enter your age: ";
                cin>>age;
                cout<<"Enter your room number: ";
                cin>>number;
    
        while(getline(file,line))
        {
            
            if (i==1)
            {
                stringstream ss;
                ss<<line;
                while(ss>>systolic>>slash>>diastolic)
                {
            

                if ((age>=18) && (age<25))
                {
                    if ((systolic<108) && (diastolic<75))
                    {
                        cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a low blood pressure. "<<endl;
                    }
                    else if ((systolic>132) && (diastolic>83))
                    {
                        cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a high blood pressure."<<endl;
                    }
                    else 
                    {
                        cout<<name<<", room number: "<<number<<", blood pressure is normal."<<endl;
                    }
                }
            
                else if ((age>=25) && (age<30))
                {
                    if ((systolic<109) && (diastolic<76))
                    {
                        cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a low blood pressure. "<<endl;
                    }
                    else if ((systolic>133) && (diastolic>84))
                    {
                        cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a high blood pressure."<<endl;
                    }
                    else 
                    {
                        cout<<name<<", room number: "<<number<<", blood pressure is normal."<<endl;
                    }
                }
            
            
                else if ((age>=30) && (age<35))
                {
                    if ((systolic<110) && (diastolic<77))
                    {
                        cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a low blood pressure. "<<endl;
                    }
                    else if ((systolic>134) && (diastolic>85))
                    {
                        cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a high blood pressure."<<endl;
                    }
                    else 
                    {
                        cout<<name<<", room number: "<<number<<", blood pressure is normal."<<endl;
                    }
                }
                
            
                else if ((age>=35) && (age<40))
                {
                    if ((systolic<111) && (diastolic<78))
                    {
                        cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a low blood pressure. "<<endl;
                    }
                else if ((systolic>135) && (diastolic>86))
                {
                    cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a high blood pressure."<<endl;
                }
                else 
                {
                    cout<<name<<", room number: "<<number<<", blood pressure is normal."<<endl;
                }
            }
            
            else if ((age>=40) && (age<45))
            {
                if ((systolic<112) && (diastolic<79))
                {
                    cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a low blood pressure. "<<endl;
                }
                else if ((systolic>136) && (diastolic>87))
                {
                    cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a high blood pressure."<<endl;
                }
                else 
                {
                    cout<<name<<", room number: "<<number<<", blood pressure is normal."<<endl;
                }
            }
            
            else if ((age>=45) && (age<50))
            {
                if ((systolic<115) && (diastolic<80))
                {
                    cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a low blood pressure. "<<endl;
                }
                else if ((systolic>139) && (diastolic>88))
                {
                    cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a high blood pressure."<<endl;
                }
                else 
                {
                    cout<<name<<", room number: "<<number<<", blood pressure is normal."<<endl;
                }
            }
            
            else if ((age>=50) && (age<55))
            {
                if ((systolic<116) && (diastolic<81))
                {
                    cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a low blood pressure. "<<endl;
                
                }
                else if ((systolic>142) && (diastolic>89))
                {
                    cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a high blood pressure."<<endl;
                
                }
                else 
                {
                    cout<<name<<", room number: "<<number<<", blood pressure is normal."<<endl;
                }
            }
            
            else if ((age>=55) && (age<60))
            {
                if ((systolic<118) && (diastolic<82))
                {
                    cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a low blood pressure. "<<endl;
                
                }
                else if ((systolic>144) && (diastolic>90))
                {
                    cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a high blood pressure."<<endl;
                
                }
                else 
                {
                    cout<<name<<", room number: "<<number<<", blood pressure is normal."<<endl;
                }
            }
            
            else if ((age>=60) && (age<65))
            {
                if ((systolic<121) && (diastolic<83))
                {
                    cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a low blood pressure. "<<endl;
        
                }
                else if ((systolic>147) && (diastolic>91))
                {
                    cout<<name<<", room number "<<number<<",blood pressure is "<<systolic<<"/"<<diastolic<<". Have a high blood pressure."<<endl;
                    
                }
                else 
                {
                    cout<<name<<", room number: "<<number<<", blood pressure is normal."<<endl;
                }
            }
            
        }
        }
            
        if (i==2)
        {   
            stringstream ss;        
            ss<<line;
            
            while(ss>>temp)
            {
            
        
                if(temp<=97)
                {
                    cout<<name<<", room number: "<<number<<", body temperature: "<<temp<<". Have low temperature."<<endl;
                }
                
                else if ((temp>=98) && (temp<=100))
                {
                    cout<<name<<", room number: "<<number<<", body temperature: "<<temp<<"."<<endl;
                }
            
                else if (temp>100)
                {
                    cout<<name<<", room number: "<<number<<", body temperature: "<<temp<<". Have high fever."<<endl;
                }
            }
        }   
        i++;
        
}
file.close();
                break;
} //end of while
                    } //end of switch
 return 0;
} //end of main

//////////////////// END OF HEALTH ALARM SYSTEM PROGRAM /////////////////////////////////////////////////////////////////////////////////
//////////////////// END OF HEALTH ALARM SYSTEM PROGRAM/////////////////////////////////////////////////////////////////////////////////
            

mysql – Insertar contenido entre párrafos en PHP

Necesitaría saber como puedo reemplazar un contenido entre párrafos con php (vanilla).

Creo sería algo similar a un shortcode en wordpress.

Por ejemplo reemplazar dentro de un parrafo ingresado desde en un editor algún codigo o etiqueta.
EJ: Cuando dentro del párrafo encuentro por ejemplo la etiqueta “(5684)”, me reemplace eso por una función que llame a ese id para algo, ejemplo insertar una nota relacionada entre párrafos.

Espero se entienda, muchas gracias!

(Linguagem C) Não estou conseguindo efetivamente fazer a comparação de if entre duas chars

Este é o código inicial de menu do programa:

    #include<stdlib.h>
    #include<stdio.h>
    #include<conio.c>
    #include<time.h>
    #include<locale.h>

    void inicio();
    void logar();
    void cadastrar();
    void sobre();
    void sair();
    void cadastroAdministrativo();
    
    int opcao;               
    char valor();
    char token() = "a";

    int main()  
    {
    setlocale(LC_ALL,"");      
    inicio();
    }       
       
    void inicio(){
    system("cls");
    printf("Bem vindo a central da coleta de dados da Secretaria Municipal de Gestão!n");
    printf("1-Logarn");
    printf("2-Cadastrarn");
    printf("3-Sobren");
    printf("4-Sairn");
    printf("Opção: ");
    scanf("%i",&opcao);
    switch (opcao){
          case 1:logar(); break;
          case 2:cadastroAdministrativo(); break;
          case 3:sobre(); break;
          case 4:sair(); break;
          }
    } 

e esta é a parte que esta dando problema:

void cadastroAdministrativo(){
opcao = 1;     
do {
fflush(stdin);    
system("cls");        
printf("Por favor digite o token de administração:n");
scanf("%c",&valor);

if (valor == token){
printf("Placeholdern");
scanf("%i",&valor);               
} else {
system("cls");
printf("Você errou! deseja:n");
printf("1-Tentar novamenten");
printf("2-Voltarn");
printf("Opção: ");
fflush(stdin);
scanf("%i",&opcao);
} } while(opcao == 1); 
inicio();
}

como vocês podem ver essa função cadastroAdministrativo(); é chamada se eu escolher a opção 2 no menu inicial na variavel opcao, e quando essa função é chamada, eu devo digitar o token de administração (que serviria pro programa saber se eu sou um administrador ou não) e então ele autenticaria e me deixaria continuar, o problema, é q quando eu faço essa comparação

if (valor == token){
printf("Placeholdern");
scanf("%i",&valor);               
}

independente do que eu digite, a comparação retorna um resultado de falso, como podem ver o token na declaração de variaveís é “a” então eu teria que digitar “a” para funcionar, so que mesmo eu digitando a ele não valida, independente do que eu digite ele sempre retorna falso logo o programa não funciona como deveria, é isso.

python – 10 dias diferentes mostrar como resultado o cálculo da porcentagem de diferença entre um dia e outro

Em Python: O objetivo deste projeto é construir um programa que simule a leitura de informações, onde o usuário deve entrar com o nome do estado e o número de mortes para 10 dias diferentes. Mostrar como resultado o cálculo da porcentagem de diferença entre um dia e outro.

¿Cual seria la diferencia entre interface y metodos? JAVA

entiendo lo que son los métodos(comportamientos que tiene los objetos) e interfaz(lo que puede hacer una clase/objeto), pero a la hora de crear una interface me confunde y pienso que es lo mismo que los métodos, por ejemplo si tengo una clase abstracta llamada: figura (y ademas podria tener la clase triangulo, cuadrado que extiende de esa) puede tener como método calcularPerimetro y calcularArea , pero también eso podría ser una interface no? Entonces como podría separar (el concepto como para entenderlo mejor) de lo que seria los métodos y por otro lado interfaces.

criteria – JOIN em Critéria entre duas tabelas e retornar com ORDER BY

Eu envio por parâmetro o nome da Categoria ex: ‘Categoria 01′ e preciso que retorne os cursos desta categoria sem paginação. Na tabela Curso eu só tenho o idCategoria. O select abaixo me retorna exatamente o que eu preciso. Preciso desta query em critéria. Alguém pode me ajudar?
”’
insira o código aqui
SELECT Categoria., Curso.
FROM Categoria Cat, Curso C
WHERE
C.idCategoria = Cat.idCategoria AND
Cat.nome LIKE ‘Categoria 01′
ORDER by C.nome
”’

es posible desarrollar una pagina web que sirva para que se trace una ruta entre dos puntos en movimiento?

[mi profesor dice que no se puede, que no es posible hacerlo en web sino que tiene obligatoria mente que hacerse con android estudio y yo quisiera que fuera web como si fuera un app uber? ]