Exemplo n.º 1
0
void VideoWindow::remove(QList<int> rows){
    disconnect(this->ui->sequence,SIGNAL(itemSelectionChanged()),this,SLOT(review()));
    while(rows.size()>0){
        this->eventsPositionInMiliseconds.removeAt(rows.last());
        this->ui->sequence->removeRow(rows.last());
        rows.pop_back();
    }
    connect(this->ui->sequence,SIGNAL(itemSelectionChanged()),this,SLOT(review()));
    this->checkSaveCondition();
}
int InputData(int net) 
{


    int resource = 0;

    if ( getrequestheader(net) < 0 )                      /*  Get HTTP request  */
	return -1;
    output(net);
    if ( (resource = review()) < 0 )          /* Check whether resource exists and updates the status code */
	{
	  output(net);
	  return 1;
	  
	}
	printf("Status is: %d\n",status);
    
	                            /*Outputs HTTP response headers  */

    /*  Service the HTTP request  */

   if ( status == 200 ) 
	{
	if ( ack(net, resource) )                  /* returns the resource */
	    error("Error returning the resource");
     }


    if ( resource > 0 )
	if ( close(resource) < 0 )
	{
	  error("Resource could not be closed"); 
	}
    return 0;
}
Exemplo n.º 3
0
int main(int args, char *argv[]){
  
  int option = checkArgs(args, argv);
  int returnVal = 0;
  switch (option){
    case 1:{ //-review
        XmElem *top = openXmElemTree( stdin );
        if (top == NULL){
          return EXIT_FAILURE;
        }
        returnVal = review(top, stdout);
        mxCleanElem (top);
      break;
    }
    case 2:{ //-cat
      returnVal = combineFiles(args, argv, stdout);
      break;
    }
    case 3:{ //-keep 
      XmElem *top = openXmElemTree( stdin );
      if (top == NULL){
        return EXIT_FAILURE;
      }
      returnVal = selects(top, KEEP, argv[2], stdout);
      mxCleanElem(top);
      break;
    }
    case 4:{ //-discard
      XmElem *top = openXmElemTree( stdin );
      if (top == NULL){
        return EXIT_FAILURE;
      }
      returnVal = selects(top, DISCARD, argv[2], stdout);
      mxCleanElem(top);
      break;
    }
    case 5:{ //-lib
      XmElem *top = openXmElemTree( stdin );
      if (top == NULL){
        return EXIT_FAILURE;
      }
      returnVal = libFormat(top, stdout);
      mxCleanElem(top);
      break;
    }
    case 6:{ //-bib
      XmElem *top = openXmElemTree( stdin );
      if (top == NULL){
        return EXIT_FAILURE;
      }
      returnVal = bibFormat(top, stdout);
      mxCleanElem(top);
      break;
    }
    default://invalid command 
      return EXIT_FAILURE;
  }
  
  return returnVal;
}
Exemplo n.º 4
0
/**
@brief Основная функция
*/
int main()
{
	setlocale( LC_CTYPE, ".1251" ); ///Руссифицируем
	char s[80]; /// инициализация массива очереди
	int t; /// инициализация счетчика

	for(t=0; t < MAX; ++t) p[t] = NULL;  

	for(;;)
	{
		printf("Ввести (E), Список (L), Удалить (R), Выход (Q): ");/// вывод меню функций на экран
		gets(s);
		*s = toupper(*s);

		switch(*s) {
			case 'E':
			enter();
			break;
		case 'L':
			review();
			break;
		case 'R':
			delete_ap();
			break;
		case 'Q':
			exit(0);
    }/// выбор функции пользователем
  }
  return 0;
}
Exemplo n.º 5
0
QVector<Review> DBManager::queryAppReviews(QString app_name)
{
    QVector<Review> review_vector;

    int review_total = this->queryTotalAppReviews(app_name);

    QSqlQuery query;
    QString sql = "SELECT * FROM review WHERE app_id = (SELECT id FROM  application WHERE app_name = \'"+ app_name +"\')";
    query.exec(sql);

    for(int i=0;i<review_total;i++){
        if(query.next()){
            QString user_display = query.value(3).toString();
            QString content = query.value(2).toString();
            QString db_datetime =query.value(4).toString();
            QDateTime datetime = QDateTime::fromString(db_datetime);
            qDebug()<<"db_datetime:"<<db_datetime;
            qDebug()<<"datetime:"<<datetime;

            Review review(app_name);
            review.setUserDisplay(user_display);
            review.setReviewDate(datetime);
            review.setReviewContent(content);

          //  qDebug()<<"user display name:"<<review.getUserDisplay();
          //  qDebug()<<"user content:"<<review.getReviewContent();
          //  qDebug()<<"review time:"<<review.getReviewDate();
            review_vector.append(review);
        }
    }

    return review_vector;

}
Exemplo n.º 6
0
Arquivo: fhdr.c Projeto: ombt/ombt
void
editfhdr(ElfObject &eo, char *)
{
	char s[BUFSIZ];

	// start of file headers editing
	printf("editing file headers:\n");

	// start interactive loop
	for (int done=0; !done; )
	{
		// get cmd from user
		printf("fhdr cmd: ");
		rmvnlgets(s);
		tokenize(s, " \t");
		char *pt = gettoken(1);

		// what is the command
		if (pt == NULL || *pt == '\0')
		{
			review(eo);
		}
		else if (*pt == '?' || *pt == 'h')
		{
			printmenu();
		}
		else if (*pt == 'r')
		{
			review(eo);
		}
		else if (*pt == 'u')
		{
			update(eo);
		}
		else if (*pt == 'q')
		{
			done = 1;
		}
		else
		{
			printf("unknown cmd.\n");
		}
	}
	return;
}
Exemplo n.º 7
0
 jobjectArray ToJavaReviews(JNIEnv * env, std::vector<ugc::Review> const & reviews)
 {
   size_t const n = reviews.size();
   jobjectArray result = env->NewObjectArray(n, m_reviewClass, nullptr);
   for (size_t i = 0; i < n; ++i)
   {
     jni::TScopedLocalRef review(env, ToJavaReview(env, reviews[i]));
     env->SetObjectArrayElement(result, i, review.get());
   }
   return result;
 }
Exemplo n.º 8
0
Arquivo: main.cpp Projeto: CCJY/coliru
int main()
{
    std::map<int, char> map{ {1, 'a'}, {2, 'b'}, {3, 'c'} };
    std::unordered_map<int, char> umap{ {1, 'a'}, {2, 'b'}, {3, 'c'} };
    std::set<int> set{ 1, 2, 3, 4, 5 };
    std::vector<int> vec{ 1, 2, 3, 4, 5 };
    std::array<int, 5> arr = { 1, 2, 3, 4, 5 };
    
    auto x2 = [](int i) { return i * 2; };
    auto tos = [](int i) { return std::to_string(i); };
    auto rev = [](std::pair<int, char> p) -> std::pair<const char, int> { return std::make_pair(p.second, p.first); };
    auto dupkey = [](std::pair<int, char> p) -> std::pair<const int, int> { return std::make_pair(p.first, p.first); };
    auto dupval = [](std::pair<int, char> p) -> std::pair<const char, char> { return std::make_pair(p.second, p.second); };
    
    auto tset = transform_container(set, x2);
    review("tset", set, tset);

    auto tvec = transform_container(vec, x2);
    review("tvec", vec, tvec);

    auto sset = transform_container(set, tos);
    review("sset", set, sset);
    
    auto svec = transform_container(vec, tos);
    review("svec", vec, svec);
    
    auto swapmap = transform_container(map, rev);
    review("swapmap", map, swapmap);
    
    auto swapumap = transform_container(umap, rev);
    review("swapumap", umap, swapumap);
    
    auto dupkeymap = transform_container(map, dupkey);
    review("dupkeymap", map, dupkeymap);
    
    auto dupvalumap = transform_container(umap, dupval);
    review("dupvalmap", umap, dupvalumap);

    // uncomment following to see compilation errors on std::inserter(std::array<int, 5>)
    
    //auto tarr = transform_container(arr, x2);
    //review("tarr", arr, tarr);
    
    //auto sarr = transform_container(arr, tos);
    //review("sarr", arr, sarr);
    
    return 0;
}
Exemplo n.º 9
0
int fortosi_new_1a::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: next(); break;
        case 1: review(); break;
        case 2: back(); break;
        case 3: startread(); break;
        case 4: tableclicked((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
Exemplo n.º 10
0
void VideoWindow::createConnections()
{
    connect(this->ui->b_play,SIGNAL(clicked()),this,SLOT(play()));
    connect(this->ui->b_pause,SIGNAL(clicked()),this,SLOT(pause()));
    connect(this->ui->b_stop,SIGNAL(clicked()),this,SLOT(stop()));
    connect(this->ui->speed,SIGNAL(valueChanged(int)),this,SLOT(setSpeed(int)));
    connect(this->ui->in_event,SIGNAL(returnPressed()),this,SLOT(newEntry()));
    connect(this->ui->in_event,SIGNAL(textChanged(QString)),this->_player,SLOT(pause()));
    connect(this->ui->sequence,SIGNAL(itemSelectionChanged()),this,SLOT(review()));
    connect(this->ui->sequence,SIGNAL(cellDoubleClicked(int,int)),this,SLOT(saveOrigText(int,int)));
    connect(this->ui->sequence,SIGNAL(cellEntered(int,int)),this,SLOT(saveOrigText(int,int)));
    connect(this->ui->b_excluir,SIGNAL(clicked()),this,SLOT(remove()));
    connect(this->ui->subject,SIGNAL(textChanged(QString)),this,SLOT(checkSaveCondition()));
    connect(this->ui->species,SIGNAL(textChanged(QString)),this,SLOT(checkSaveCondition()));
    connect(this->ui->description,SIGNAL(textChanged(QString)),this,SLOT(checkSaveCondition()));
    connect(this->ui->b_save,SIGNAL(clicked()),this,SLOT(saveSession()));
    connect(this->ui->b_dict,SIGNAL(clicked()),this,SLOT(showDict()));
    connect(this->_player,SIGNAL(timeChanged(int)),this,SLOT(highlight(int)));
}
Exemplo n.º 11
0
void rand_type_1(int *arr ,int n){
	int i;
	for(i=0;i<n;i++){
		arr[i]=-1;
	}
	arr[0]=randInt(1,n);
	int j;
	int rand=randInt(1,n);
	for(j=1;j<n;j++){

		while(review(arr,j,rand)==1){
			rand=randInt(1,n);
		}
		arr[j]=rand;

	}


}
Exemplo n.º 12
0
void fsm_msgVerifyMessage(VerifyMessage *msg)
{
    if(!msg->has_address)
    {
        fsm_sendFailure(FailureType_Failure_Other, "No address provided");
        return;
    }

    if(!msg->has_message)
    {
        fsm_sendFailure(FailureType_Failure_Other, "No message provided");
        return;
    }

    const CoinType *coin = fsm_getCoin(msg->coin_name);
    if (!coin) return;

    layout_simple_message("Verifying Message...");

    uint8_t addr_raw[21];

    if(!ecdsa_address_decode(msg->address, addr_raw))
    {
        fsm_sendFailure(FailureType_Failure_InvalidSignature, "Invalid address");
    }

    if(msg->signature.size == 65 &&
            cryptoMessageVerify(coin, msg->message.bytes, msg->message.size, addr_raw,
                                msg->signature.bytes) == 0)
    {
        if(review(ButtonRequestType_ButtonRequest_Other, "Message Verified",
                  (char *)msg->message.bytes))
        {
            fsm_sendSuccess("Message verified");
        }
    }
    else
    {
        fsm_sendFailure(FailureType_Failure_InvalidSignature, "Invalid signature");
    }

    go_home();
}
Exemplo n.º 13
0
int main(int argc, char *argv[])
{
    Config config = Config::parse("../result.cfg");
    Config updateConfig;
    std::vector<DataPicture> queuePicture;
    for (Config::Section section: config["input_field"]) {
            DataPicture newElement;
            assert(section["output_file"].size() == 1);
            for (std::string property: section["output_file"]) {
                newElement.path = property;
            }
            assert(section["recognized_value"].size() == 1);
            for (std::string property: section["recognized_value"]) {
                newElement.ball = property;
            }
            assert(section["x"].size() == 1);
            for (std::string property: section["x"]) {
                newElement.x = property;
            }
            assert(section["y"].size() == 1);
            for (std::string property: section["y"]) {
                newElement.y = property;
            }
            assert(section["width"].size() == 1);
            for (std::string property: section["width"]) {
                newElement.width = property;
            }
            assert(section["height"].size() == 1);
            for (std::string property: section["height"]) {
                newElement.height = property;
            }
            queuePicture.push_back(newElement);
    }
    QApplication app(argc, argv);
    Review review(queuePicture);
    review.show();
    return app.exec();
}
Exemplo n.º 14
0
ContestantApp::ContestantApp ( QWidget* parent )
        : QMainWindow ( parent ), m_dlg ( new Ui::contestant_app_dlg ),
		DISCONNECT_INFORMATION ( tr ( "There will be a penalty for disconnecting." ) ),
		DISCONNECT_QUESTION ( tr ( "Are you sure you want to exit the program?" ) ),
		UNAUTH_TEXT ( tr ( "Unable to obtain authorization." ) ),
		UNAUTH_INFORMATION ( tr ( "Username or password may be incorrect." ) )
{
	m_login_dlg = new Ui::login_dlg;
	m_welcome_dlg = new Ui::welcome_dlg;
	m_elims_dlg = new Ui::elims_dlg;
    m_semifinals_dlg = new Ui::semifinals_dlg;
    m_finalsChoice_dlg = new Ui::finalsChoice_dlg;
    m_finalsIdent_dlg = new Ui::finalsIdent_dlg;
    m_summary_dlg = new Ui::summary_dlg;
    m_ending_dlg = new Ui::ending_dlg;

        m_dlg->setupUi( this );
        QPixmap logo("resources/logo.png");
        m_dlg->cerb_logo_lbl->setPixmap(logo);
        //this->hide();
	m_welcome_w = new QDialog( this );
	m_welcome_dlg->setupUi( m_welcome_w );
	m_welcome_w->hide();

	m_elims_w = new QDialog( this );
	m_elims_dlg->setupUi( m_elims_w );
    m_elims_w->hide();

    m_semifinals_w = new QDialog( this );
    m_semifinals_dlg->setupUi( m_semifinals_w );
    m_semifinals_w->hide();

    m_finalsChoice_w = new QDialog( this );
    m_finalsChoice_dlg->setupUi( m_finalsChoice_w );
    m_finalsChoice_w->hide();

    m_finalsIdent_w = new QDialog( this );
    m_finalsIdent_dlg->setupUi( m_finalsIdent_w );
    m_finalsIdent_w->hide();

	m_summary_w = new QDialog( this );
	m_summary_dlg->setupUi( m_summary_w );
	m_summary_w->hide();

    m_ending_w = new QDialog( this );
    m_ending_dlg->setupUi( m_ending_w );
    m_ending_w->hide();

	m_login_w = new QDialog( this );
	m_login_dlg->setupUi( m_login_w );
    m_login_w->show();

	m_network = new ContestantNetwork ( this );
    timer = new QTimer( this );

	connect( m_network, SIGNAL ( onConnect() ), this, SLOT ( onConnect() ) );
	connect( m_network, SIGNAL ( onDisconnect() ), this, SLOT ( onDisconnect() ) );
	connect( m_network, SIGNAL ( onAuthenticate ( bool ) ), this, SLOT ( onAuthenticate ( bool ) ) );

	connect( m_network, SIGNAL ( onContestStateChange ( int, CONTEST_STATUS ) ),
	         this, SLOT ( onContestStateChange ( int, CONTEST_STATUS ) ) );
	connect( m_network, SIGNAL ( onQuestionStateChange ( ushort, ushort, QUESTION_STATUS ) ),
	         this, SLOT ( onQuestionStateChange ( ushort, ushort, QUESTION_STATUS ) ) );
	connect( m_network, SIGNAL ( onContestTime ( ushort ) ), this, SLOT ( onContestTime ( ushort ) ) );
	connect( m_network, SIGNAL ( onQData ( QString ) ), this, SLOT ( onQData ( QString ) ) );
	connect( m_network, SIGNAL ( onAData ( bool ) ), this, SLOT ( onAData ( bool ) ) );

	connect( m_network, SIGNAL ( onContestError ( ERROR_MESSAGES ) ),
	         this, SLOT ( onContestError ( ERROR_MESSAGES ) ) );
	connect( m_network, SIGNAL(onError(QString)),
	         this, SLOT ( onError ( QString ) ) );


	// connections for the login dialog
	connect( m_login_dlg->login_btn, SIGNAL ( clicked() ), this, SLOT ( login() ) );
	connect( m_login_dlg->exit_btn, SIGNAL ( clicked() ), this, SLOT ( exit() ) );

	// connections for the welcome dialog
	connect( m_welcome_dlg->start_btn, SIGNAL ( clicked() ), this, SLOT ( welcomeStart() ) );

    // connections for the elims and semis dialog
    connect( m_elims_dlg->prev_btn, SIGNAL ( clicked() ), this, SLOT ( elimSemiPrev() ) );
    connect( m_elims_dlg->next_btn, SIGNAL ( clicked() ), this, SLOT ( elimSemiNext() ) );
    connect( m_semifinals_dlg->prev_btn, SIGNAL ( clicked() ), this, SLOT ( elimSemiPrev() ) );
    connect( m_semifinals_dlg->next_btn, SIGNAL ( clicked() ), this, SLOT ( elimSemiNext() ) );

    // connections for summary dialog
	connect( m_summary_dlg->review_btn, SIGNAL( clicked() ), this, SLOT( review() ) );
	connect( m_summary_dlg->submit_btn, SIGNAL( clicked() ), this, SLOT( submit() ) );

    // connections for finals dialog
    connect( m_finalsChoice_dlg->submit_btn, SIGNAL( clicked() ), this, SLOT( finalsSubmit() ) );
    connect( m_finalsIdent_dlg->submit_btn, SIGNAL( clicked() ), this, SLOT( finalsSubmit() ) );

    // connections for ending dialog
    connect( m_ending_dlg->exit_btn, SIGNAL( clicked() ), this, SLOT( exit() ) );

    // slot for timer
    connect( timer, SIGNAL( timeout() ), this, SLOT( updateTimer() ) );

	// Get the client configuration from XmlUtil

    qCount = 0;
    time = 0;
    status = CONTEST_STOPPED;
    qStatus = QUESTION_STOPPED;
    connected = false;
    loggedIn = false;
    closing = false;
}
Exemplo n.º 15
0
Arquivo: hash.c Projeto: ombt/ombt
void
edithash(ElfObject &eo, char *)
{
	char s[BUFSIZ];

	// start of hash table editing
	printf("editing hash tables:\n");

	// initialize hash table pointers
	int csec = eo.pehdr()->e_shnum;
	int cbucket = 0;
	int cchain = 0;

	// find the first hash table
	for (int sec=0; sec<eo.pehdr()->e_shnum; sec++)
	{
		if (eo.pshdr(sec).sh_type == SHT_HASH)
		{
			csec = sec;
			break;
		}
	}
	if (csec >= eo.pehdr()->e_shnum)
	{
		printf("no hash tables found.\n");
		return;
	}
	cchain = EOSWABIT(eo, eo.phashtbls(csec)[cbucket+2]);

	// pointers to hash tables
	Elf32_Word *p0 = eo.phashtbls(csec);
	Elf32_Word *pe = eo.phashtbls(csec) + 
		eo.pshdr(csec).sh_size/sizeof(Elf32_Word);

	// start interactive loop
	for (int done=0; !done; )
	{
		// get cmd from user
		printf("hash cmd: ");
		rmvnlgets(s);
		tokenize(s, " \t");
		char *pt = gettoken(1);

		// what is the command
		if (pt == NULL || *pt == '\0')
		{
			increment(eo, cchain, cbucket, csec, p0, pe);
		}
		else if (*pt == 'n')
		{
			// show all section names
			printf("hash table names:\n");
			for (int sec=0; sec<eo.pehdr()->e_shnum; sec++)
			{
				if (eo.pshdr(sec).sh_type != SHT_HASH)
					continue;
				printf("section %d: %s (%d) nb: %ld, nch: %ld\n", 
					sec, eo.shdrnm(sec), 
					eo.pshdr(sec).sh_name,
					EOSWABIT(eo, eo.phashtbls(sec)[0]), 
					EOSWABIT(eo, eo.phashtbls(sec)[1]));
			}
		}
		else if (*pt == '?' || *pt == 'h')
		{
			printmenu();
		}
		else if (*pt == 'D')
		{
			dflag = !dflag;
			if (dflag)
				printf("demangle mode ON.\n");
			else
				printf("demangle mode OFF.\n");
		}
		else if (*pt == 'r')
		{
			review(eo, cchain, cbucket, csec, p0, pe);
		}
		else if (*pt == 'u')
		{
			update(eo, cchain, cbucket, csec, p0, pe);
		}
		else if (*pt == '+')
		{
			increment(eo, cchain, cbucket, csec, p0, pe);
		}
		else if (*pt == 'q')
		{
			done = 1;
		}
		else
		{
			printf("unknown cmd.\n");
		}

	}
	return;
}