Esempio n. 1
0
void myLog::init(const string& fileName, int mode)
{
   if ( (fileName.c_str())[0] )
      openLog(fileName,mode);
   else
      openLog("syslog.log", mode);
}
Esempio n. 2
0
    void
    BasicDeviceDriver::consume(const IMC::LoggingControl* msg)
    {
      if (!enableLogControl())
        return;

      switch (msg->op)
      {
        case IMC::LoggingControl::COP_CURRENT_NAME:
          if (m_log_name_pending)
          {
            m_log_name_pending = false;
            openLog(msg->name);
          }
          break;

        case IMC::LoggingControl::COP_STARTED:
          openLog(msg->name);
          break;

        case IMC::LoggingControl::COP_STOPPED:
          closeLog();
          break;
      }
    }
Esempio n. 3
0
void myLog::init(const string& fileName)
{
   if ( (fileName.c_str())[0] )
      openLog(fileName,LOG_WRITE);
   else
      openLog("syslog.log",LOG_WRITE);
}
Esempio n. 4
0
    void
    BasicDeviceDriver::consume(const IMC::LoggingControl* msg)
    {
      if ((msg->getDestination() != getSystemId())
          || (msg->getDestinationEntity() != getEntityId()))
        return;

      switch (msg->op)
      {
        case IMC::LoggingControl::COP_CURRENT_NAME:
          if (m_log_name_pending)
          {
            m_log_name_pending = false;
            openLog(m_ctx.dir_log / msg->name);
          }
          break;

        case IMC::LoggingControl::COP_STARTED:
          openLog(m_ctx.dir_log / msg->name);
          break;

        case IMC::LoggingControl::COP_STOPPED:
          closeLog();
          break;
      }
    }
Esempio n. 5
0
int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParamarg, int cmdShow) {
	openLog();

#ifdef _NEED_WIN_GENERATE_DUMP
	_oldWndExceptionFilter = SetUnhandledExceptionFilter(_exceptionFilter);
#endif

	writeLog(L"Updaters started..");

	LPWSTR *args;
	int argsCount;

	bool needupdate = false, autostart = false, debug = false;
	args = CommandLineToArgvW(GetCommandLine(), &argsCount);
	if (args) {
		for (int i = 1; i < argsCount; ++i) {
			if (equal(args[i], L"-update")) {
				needupdate = true;
			} else if (equal(args[i], L"-autostart")) {
				autostart = true;
			} else if (equal(args[i], L"-debug")) {
				debug = _debug = true;
				openLog();
			}
		}
		if (needupdate) writeLog(L"Need to update!");
		if (autostart) writeLog(L"From autostart!");

		exeName = args[0];
		writeLog(L"Exe name is: " + exeName);
		if (exeName.size() > 11) {
			if (equal(exeName.substr(exeName.size() - 11), L"Updater.exe")) {
				exeDir = exeName.substr(0, exeName.size() - 11);
				writeLog(L"Exe dir is: " + exeDir);
				if (needupdate && update()) {
					updateRegistry();
				}
			} else {
				writeLog(L"Error: bad exe name!");
			}
		} else {
			writeLog(L"Error: short exe name!");
		}
		LocalFree(args);
	} else {
		writeLog(L"Error: No command line arguments!");
	}

	wstring targs = L"-noupdate";
	if (autostart) targs += L" -autostart";
	if (debug) targs += L" -debug";

	ShellExecute(0, 0, (exeDir + L"Telegram.exe").c_str(), targs.c_str(), 0, SW_SHOWNORMAL);

	writeLog(L"Executed Telegram.exe, closing log and quiting..");
	closeLog();

	return 0;
}
Esempio n. 6
0
File: Main.c Progetto: k2b3d/tconsrc
int main(int argc, char *argv[])
{
	pid_t 		pid ;
	int 		stat ;
	pthread_t	pthread_cancel_id, pthread_sms_id, pthread_cois_id ;	
	int			ret ;

	isDup(argv[0]) ;

	if((pid = fork()) < 0)
		return  -1;
	else    if(pid != 0)
		exit(0);

	setsid() ;

	set_signal() ;

	if (argc > 1) {
		if (argc == 3) {
			if (strcmp(argv[1], "-f") == 0) {
				strcpy(config_file_path, argv[2]);
			}
			else    {
				printf("---------------------------------\n");
				printf("-%s [-f ConfigFilePath]\n", argv[0]);
				printf("---------------------------------\n");
				}
			}
		else    {
			printf("---------------------------------\n");
			printf("-%s [-f ConfigFilePath]\n", argv[0]);
			printf("---------------------------------\n");
		}
	}
	else
		sprintf(config_file_path, "../config/TCenter.Config");

	memset(&Config, 0, sizeof(CONFIG_T)) ;
	readConfig(config_file_path, &Config) ;
	Log = openLog(argv[0], Config.LOG_FILE, LOG_MODE) ;
#ifdef _FOR_STAT_
	StatLog = openLog(argv[0], Config.STAT_LOG_PATH, LOG_MODE) ;
#endif
	printLog(HEAD, "=====[Program Start]=====\n") ;

	printConfig(&Config) ;

	pthread_mutex_init(&p_lock, NULL);
	thread_count = 0;

	Worker() ;

	exit_handler() ;
	return M_TRUE ;
}
Esempio n. 7
0
int	main(int argc, char *argv[])
{
	int	ErrorCode = NO_ERROR;
	int	FileCount;
	AGPS_CONFIG_T *AGPSConfig;
	char	config_file_path[CFG_FILE_LEN+1];

	if (argc > 1) {
		if (argc == 3) {
			if (strcmp(argv[1], "-f") == 0)	{
				strcpy(config_file_path, argv[2]);
			}
			else	{
				printf("---------------------------------\n");
				printf("-%s [-f ConfigFilePath]\n", argv[0]);
				printf("---------------------------------\n");
			}
		}
		else	{
			printf("---------------------------------\n");
			printf("-%s [-f ConfigFilePath]\n", argv[0]);
			printf("---------------------------------\n");
		}
	}
	else
		sprintf(config_file_path, "../config/CouponMgr.Config");

	if(ReadConfig(config_file_path, &Config) < 0)	{
		printf("Configuration File Read Error\n");
		exit(1);
	}

	SvcLog = openLog("CouponMgr", Config.SERVICE_LOG_PATH, LOG_MODE);
#ifdef	__DEBUG_LOG
	DebLog = openLog("CouponMgr", Config.DEBUG_LOG_PATH, LOG_MODE);
#endif

	AGPSConfig = LoadAGPSConfig(&FileCount, &ErrorCode, Config);
	if(ErrorCode != NO_ERROR)	{
		printLog(HEAD, "Init Data Index Error..\n");
		exit(-1);
	}

	ProcessUpdate(AGPSConfig, FileCount);

	free(AGPSConfig);
	return	NO_ERROR;
}
Esempio n. 8
0
int	main()
{
	int	ret;
	char	*deviceBuff = "IAVS010015633030306536323233313135633165080830720870770500530480760506205606305606307312E312E31303604066049048054";

	B2B_AUTH_INFO_T AuthInfo;
	B2B_AUTHENTICATION_T Request;

	srandom((unsigned int) time(NULL));

	SvcLog = openLog("GENTEST", "./GenTest", "dtfl");

	memset(&AuthInfo, 0, sizeof(B2B_AUTH_INFO_T));
	memset(&Request, 0, sizeof(B2B_AUTHENTICATION_T));

	sprintf(Request.ProductID, "%s", "AQRSVA9V");
	sprintf(Request.AgencyID, "%s", "TESTYJAGENCY");
	sprintf(Request.SolutionID, "%s", "TESTYJSOLUTION");
	sprintf(Request.DeviceInfo, "%s", deviceBuff);

	ret = InitAuthInfo(&AuthInfo);
	printf("RET(%d)\n", ret);
	ret = SetAuthKeyInfo_V1(Request, &AuthInfo);
	printf("RET(%d)\n", ret);

	printf("RET(%d)AuthKeyFileData(%s)\n", ret, AuthInfo.EncriptKeyBuff);

	return	1;
}
Esempio n. 9
0
MainWindow::MainWindow(QWidget *parent, Reception *reception) : QMainWindow(parent), _ui(new Ui::MainWindow), _reception(reception) {
	QTimer *timer = new QTimer(this);
	QTimer *day = new QTimer(this);

	timer->start(500);
	day->start(this->_reception->getPreparePizza() * this->_reception->getReplaceStock() * 30);

	this->_ui->setupUi(this);

	QObject::connect(this->_ui->actionQuit, SIGNAL(triggered()), this, SLOT(quitWindow()));
	QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(quitWindow()));

	QObject::connect(this->_ui->tableKitchen, SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)), SLOT(switchItem(QListWidgetItem *, QListWidgetItem *)));

	QObject::connect(this->_ui->sliderPizzaNumber, SIGNAL(valueChanged(int)), this->_ui->pizzaNumber, SLOT(display(int)));
	QObject::connect(this->_ui->buttonOrder, SIGNAL(clicked()), SLOT(getOrderFromForm()));
	QObject::connect(this->_ui->linePizzaOrder, SIGNAL(returnPressed()), SLOT(getOrderFromLine()));

	QObject::connect(this->_ui->actionOpenMan, SIGNAL(triggered()), this, SLOT(openMan()));
	QObject::connect(this->_ui->actionOpenQt, SIGNAL(triggered()), this, SLOT(openQt()));
	QObject::connect(this->_ui->actionOpenLog, SIGNAL(triggered()), this, SLOT(openLog()));
	QObject::connect(this->_ui->actionAchievment, SIGNAL(triggered()), this, SLOT(openAchievment()));

	QObject::connect(timer, SIGNAL(timeout()), SLOT(refresh()));
	QObject::connect(day, SIGNAL(timeout()), SLOT(newDay()));
};
Esempio n. 10
0
int	main(int argc, char **argv)
{
	REQ_CREATE2_T	Query;
	RES_COUPONID_T	*Data = NULL;
	int	ResultCount = 0, ErrorCode = NO_ERROR;

	Q_ENTRY *req = qCgiRequestParse(NULL, (Q_CGI_T) 0);

	memset(&Query, 0, sizeof(REQ_CREATE2_T));

	SvcLog = openLog("CreateCoupon", SERVICE_LOG_PATH_CREATE, LOG_MODE);
	if((ErrorCode = GetParamsReqCreate2(req, &Query)) == NO_ERROR)	{
		if((Data = ProcessCreateCoupon(Query, &ResultCount, &ErrorCode)) == NULL)	{
			printLog(HEAD, "CreateCoupon Error...Count(%d)ErrorCode(%d)\n", ResultCount, ErrorCode);
		}
	}

//	qCgiResponseSetContentType(req, "text/html");
	qCgiResponseSetContentType(req, "application/json;charset=euc-kr");
	PrintResultCouponIDList(ErrorCode, ResultCount, Data);
	printLog(HEAD, "---------------------------------------------------------------\n");

	if(Data != NULL)	
		free(Data);

	req->free(req);

	closeLog(SvcLog);

	return	0;
}
Esempio n. 11
0
void Server::loadConfig(const Config& cfg) {
	LogObject lg(THISLOCATION);
	logFileName = cfg.logFile;
	openLog();
	if (!cfg.helpDir.empty()) {
		try {
			PFolderIterator iter = IFileIOServices::getIOServices().openFolder(cfg.helpDir);
			while (iter->getNext()) {
				try {
				//	loadHelp(iter->getFullPath());
				} catch (Exception &e) {
					lg.warning("Skipping help file: %1 error %2") << iter->entryName << e.getMessage();
				}
			}
		} catch (Exception &e) {
			lg.warning("Unable to open help folder: %1") << e.getMessage();
		}
	}
	setClientPage(cfg.clientPage);
	registerServerMethods(*this,(cfg.developMode ? flagDevelopMode : 0)
		| (cfg.enableMulticall ? flagEnableMulticall : 0)
		| (cfg.enableListMethods ? flagEnableListMethods : 0)
		| (cfg.enableStats ? flagEnableStatHandler : 0));


	wsenabled = cfg.enableWebSockets;
/*	registerStatHandler("server",RpcCall::create(this,&JsonRpcServer::rpcHttpStatHandler));
	if (cfg.corsOrigin != nil) {
		setCORSOrigin((StringA)cfg.corsOrigin);
		enableCORS(true);
	}
	nullV = JSON::create()(null);*/

}
Esempio n. 12
0
cLog::cLog(QString pathToLog)
{
    logFile         = NULL;
    logStream       = NULL;
    QString path    = LOGDIR;
    path += pathToLog + QDateTime::currentDateTime().toString("dd.MM.log");
    openLog(path);
}
Esempio n. 13
0
static int64 writeEventsToSQL(sqlite3 *db)
{
  FILE *input;
  int64 count;
  input = openLog(db);
  count = readLog(input, db);
  (void)fclose(input);
  return count;
}
void MessageLog::logData(const LoggingID& logData)
{
    if (fLogData.fSubsysID != logData.fSubsysID)
    {
        closeLog();
        openLog(logData.fSubsysID, fFacility);
    }

    fLogData = logData;
}
unicorn::MainWindow::MainWindow( QMenuBar* menuBar, QWidget* parent )
    :QMainWindow( parent ), m_menuBar( menuBar )
{
    new QShortcut( QKeySequence(Qt::CTRL+Qt::Key_W), this, SLOT(close()) );
    new QShortcut( QKeySequence(Qt::ALT+Qt::SHIFT+Qt::Key_L), this, SLOT(openLog()) );
    connect( qApp->desktop(), SIGNAL( resized(int)), SLOT( cleverlyPosition()));
#ifdef Q_OS_WIN32
    taskBarCreatedMessage = RegisterWindowMessage(L"TaskbarButtonCreated");
#endif
}
Esempio n. 16
0
int	main(int argc, char **argv)
{
	REQ_CREATE_PRODUCTID_T	Query;
	PRODUCTID_T	*Data;
	int	ErrorCode = NO_ERROR;
	int	Count = 0;
	double start_time=0, end_time=0;
	double real_time = 0;
	struct timeval tp_start;
	struct timeval tp_end;

	gettimeofday(&tp_start, 0);

	Q_ENTRY *req = qCgiRequestParse(NULL, (Q_CGI_T) 0);

	memset(&Query, 0, sizeof(REQ_CREATE_PRODUCTID_T));

	SvcLog = NULL;
	if((SvcLog = openLog("CreateProductID", SERVICE_LOG_PATH_CREATE_PRODUCTID, LOG_MODE)) == NULL)	{
		qCgiResponseSetContentType(req, "text/html");
		printf("File Open Error...(%s)\n", SERVICE_LOG_PATH_CREATE_PRODUCTID);
		return	-1;
	}
	if((ErrorCode = GetParamsReqCreateProductID(req, &Query)) == NO_ERROR)	{
		if((Data = ProcessCreateProductID(Query, &Count, &ErrorCode)) == NULL)	{
			printLog(HEAD, "CreateProductID Error...ErrorCode(%d)\n", ErrorCode);
		}
	}

	if(Query.Mode == 'T')	{
		qCgiResponseSetContentType(req, "text/html");
		PrintResultCreateProductIDWithTable(Count, ErrorCode, Data);
	}
	else	{
		qCgiResponseSetContentType(req, "application/json;charset=euc-kr");
		PrintResultCreateProductID(Count, ErrorCode, Data);
	}

	gettimeofday(&tp_end, 0);
	start_time = (double)tp_start.tv_sec + (double)tp_start.tv_usec/1000000;
	end_time = (double)tp_end.tv_sec + (double)tp_end.tv_usec/1000000;
	real_time = end_time - start_time;

	printLog(HEAD, "STAT::MSG_CREATE_PRODUCTID_T %d %4.6f\n", ErrorCode, real_time);
	printLog(HEAD, "---------------------------------------------------------------\n");

	if(Data != NULL)
		free(Data);

	req->free(req);

	closeLog(SvcLog);

	return	0;
}
Esempio n. 17
0
void logging(std::string message, LogType type, LogStatus status)
{
	static std::ofstream _logFile;
	static std::string _logFileName;
	static int _logIndex = 1;

	openLog(_logFile, _logFileName);
	assert(logType(type)!=LOG_ASSERT_FAILURE);								//raise if type is wrongly inputted
	_logFile << _logIndex << LOGGING_INDEX_BRACKET << getTimeStamp(Current) << logMessages(LOGGING_FORMAT, message) << logType(type) << logStatus(status);
	_logIndex++;
}
Esempio n. 18
0
void Logger::log(const string &msg, const string &file, bool header)
{
	fstream f;
	if (openLog(f, file + ".log"))
	{
		if (header)
			f << toUpper(file) << ": " << timestamp() << endl;
		f << msg << endl << endl;
		closeLog(f);
	}
}
Esempio n. 19
0
int main(int argc, char **argv)
{
	pid_t       pid ;
	int         stat ;
	pthread_t   threads ;
	int         ret ;

	if (argc > 1) {
		if (argc == 4) {
			if (strcmp(argv[1], "-f") == 0) {
				strcpy(config_file_path, argv[2]);
			}
			else    {
				printf("---------------------------------\n");
				printf("-%s [-f ConfigFilePath DumpFileName]\n", argv[0]);
				printf("---------------------------------\n");
				exit(-1);
			}
		}
		else    {
			printf("---------------------------------\n");
			printf("-%s [-f ConfigFilePath DumpFileName]\n", argv[0]);
			printf("---------------------------------\n");
			exit(-1);
		}
	}
	else    {
		printf("---------------------------------\n");
		printf("-%s [-f ConfigFilePath DumpFileName]\n", argv[0]);
		printf("---------------------------------\n");
		exit(-1);
	}

	memset(&Config, 0, sizeof(CONFIG_T)) ;
	readConfig(config_file_path, &Config) ;

	Log = openLog(argv[0], Config.LOG_FILE, LOG_MODE);

	printLog(HEAD, "========================================\n") ;
	printLog(HEAD, "      SERVER START...\n") ;
	printLog(HEAD, "========================================\n") ;
	printLog(HEAD, "\n") ;

	ret = mydbc_connect(Config.DB_NAME, Config.DB_USER, Config.DB_PASSWORD, Config.DB_HOST, Config.DB_PORT, Config.DB_CONN_COUNT);
	if(ret != DB_SUCCESS) {
		printLog(HEAD, "ERROR[%d]\n", ret);
		exit(0);
	}

	RedoUUID(argv[3]);

	exit_handler(1) ;
}
Esempio n. 20
0
int	main(int argc, char **argv)
{
	PRODUCTID_T	Query;
	RES_SEARCH_PRODUCT_ERROR_T	*Data;
	int	ErrorCode = NO_ERROR;
	int	Count = 0;
	char	Mode;
	double start_time=0, end_time=0;
	double real_time = 0;
	struct timeval tp_start;
	struct timeval tp_end;

	gettimeofday(&tp_start, 0);

	Q_ENTRY *req = qCgiRequestParse(NULL, (Q_CGI_T) 0);

	memset(&Query, 0, sizeof(PRODUCTID_T));

	SvcLog = openLog("SearchProductError", SERVICE_LOG_PATH_SEARCH_PRODUCT_ERROR, LOG_MODE);
	if((ErrorCode = GetParamsReqSearchProductError(req, &Query, &Mode)) == NO_ERROR)	{
		if((Data = ProcessSearchProductError(Query, &Count, &ErrorCode)) == NULL)	{
			printLog(HEAD, "SearchProductError Error...ErrorCode(%d)\n", ErrorCode);
		}
	}

	if(Mode == 'T')	{
		qCgiResponseSetContentType(req, "text/html");
		PrintResultSearchProductErrorWithTable(Count, ErrorCode, Data);
	}
	else	{
		qCgiResponseSetContentType(req, "application/json;charset=euc-kr");
		PrintResultSearchProductError(Count, ErrorCode, Data);
	}

	gettimeofday(&tp_end, 0);
	start_time = (double)tp_start.tv_sec + (double)tp_start.tv_usec/1000000;
	end_time = (double)tp_end.tv_sec + (double)tp_end.tv_usec/1000000;
	real_time = end_time - start_time;

	printLog(HEAD, "STAT::MSG_SEARCH_PRODUCT_ERROR_T %d %4.6f\n", ErrorCode, real_time);
	printLog(HEAD, "---------------------------------------------------------------\n");

	if(Data != NULL)
		free(Data);

	req->free(req);

	closeLog(SvcLog);

	return	0;
}
Esempio n. 21
0
void write_log(const char *func, const char *file, int line, const char *message, ...) {
	FILE *log;
	va_list args;

  if (access(getLogFilename(), W_OK) == -1) {
    return;
  }
    
	log = openLog(func, file, line);
	va_start(args, message);
	vfprintf(log, message, args);
	va_end(args);
	fprintf(log, "\n");
	fclose(log);
}
Esempio n. 22
0
void PGEN_STATS_print(void) {
  FILE *logFile;
  int numberOfStates = PGEN_getNumberOfStates();

  if (PGEN_getVerboseModeFlag) {
    ATwarning("Logging statistics\n");
  }

  logFile = openLog(PGEN_getStatsFileName());
  
  fprintf(logFile, "int user-productions = %d\n", PGEN_STATS_userProductions);
/*  fprintf(logFile, "int conflicts = %d\n", );
  fprintf(logFile, "int reductions = %d\n", );
  fprintf(logFile, "int shifts = %d\n", );
  fprintf(logFile, "int followRestrictedReductions = %d\n", );
*/

  fprintf(logFile, "int user-rejects = %d\n", PGEN_STATS_userRejects);
  fprintf(logFile, "int user-prefers = %d\n", PGEN_STATS_userPrefers);
  fprintf(logFile, "int user-avoids = %d\n", PGEN_STATS_userAvoids);
  fprintf(logFile, "int user-no-attributes = %d\n", PGEN_STATS_userNoAttributes);


  fprintf(logFile, "int states = %u\n", numberOfStates);
  fprintf(logFile, "int items = %u\n", PGEN_STATS_items);
  fprintf(logFile, "int gotos = %u\n", PGEN_STATS_gotos);
  fprintf(logFile, "int actions = %u\n\n", PGEN_STATS_actions);

  fprintf(logFile, "int max-number-of-items-in-states = %u\n", PGEN_STATS_maxItemsInState);
  fprintf(logFile, "int max-number-of-gotos-in-states = %u\n", PGEN_STATS_maxGotosInState);
  fprintf(logFile, "int max-number-of-actions-in-states = %u\n\n", PGEN_STATS_maxActionsInStates);

  fprintf(logFile, "%%%% items/states = %d\n", (PGEN_STATS_items/numberOfStates));
  fprintf(logFile, "%%%% gotos/state = %d\n", (PGEN_STATS_gotos/numberOfStates));
  fprintf(logFile, "%%%% actions/states = %d\n\n", (PGEN_STATS_actions/numberOfStates));

  fprintf(logFile, "%%%% Normalization-to-Kernel-Sdf = %.6fs\n", PGEN_STATS_normalizationTime);
  fprintf(logFile, "%%%% Parse-table-generation = %.6fs\n", PGEN_STATS_generationTime); 
  fprintf(logFile, "int kernel-productions = %d\n", PGEN_STATS_kernelProductions);
  fprintf(logFile, "int max-user-production-left-hand-side-length = %d\n", PGEN_STATS_maxUserProductionLhsLength);
  fprintf(logFile, "int max-production-left-hand-side-length = %d\n", PGEN_STATS_maxProductionLhsLength);
  fprintf(logFile, "%%%% production-lhs-length/kernel-productions = %d\n", (PGEN_STATS_maxProductionLhsLength/PGEN_STATS_kernelProductions));

  fprintf(logFile, "int priorities = %d\n", PGEN_STATS_priorities);

  closeLog(logFile);

}
Esempio n. 23
0
int main()
{
	FILE *f = openLog("unitTestLog.txt");
	cunit_init();	// Initiate CUnit
	Roots root;
	Terms terms;

	// First unit test, should
	//terms.a = "1", terms.b = "2", terms.c = "1";
	terms = validateInput("1", "2", "1");
	if (terms.input == 1)
	{
		root = eqnControl(terms.a, terms.b, terms.c);
		
		//fwrite(assert_neq("x1", root.x1, -2.0), f);
		assert_neq("x1", root.x1, -2.0);
		fprintf(f, "x1: %f assert not equal %f\n", (double)root.x1, -2.0);
		assert_neq("x2", root.x2, -2.0);
		fprintf(f, "x2: %f assert not equal %f\n", (double)root.x2, -2.0);
	}

	printf("-------------------------------\n");

	//terms.a = "2"; terms.b = "5"; terms.c = "-3";
	terms = validateInput("2", "5", "-3");
	if (terms.input == 1)
	{
		root = eqnControl(terms.a, terms.b, terms.c);
		assert_eq("x1", root.x1, 0.5);
		fprintf(f, "x1: %f assert equal %f\n", (double)root.x1, 0.5);
		assert_eq("x2", root.x2, -3.0);
		fprintf(f, "x2: %f assert equal %f\n", (double)root.x2, -3.0);
	}	

	printf("-------------------------------\n");
	//char terms.a, terms.b, terms.c;
	//terms.a = "a"; terms.b = "b"; terms.c = "c";
	terms = validateInput("a", "b", "c");
	if (terms.input == 1)
	{
		root = eqnControl(terms.a, terms.b, terms.c);
		assert_eq("x1", root.x1, 0.5);
		fprintf(f, "x1: %f assert equal %f\n", (double)root.x1, 0.5);
		assert_eq("x2", root.x2, -3.0);
		fprintf(f, "x2: %f assert equal %f\n", (double)root.x2, -3.0);
	}
	fclose(f);
}
Esempio n. 24
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
    setWindowTitle(tr("Mupen64Plus-Qt"));
    setWindowIcon(QIcon(":/images/mupen64plus.png"));

    autoloadSettings();

    emulation = new EmulatorHandler(this);

    connect(emulation, SIGNAL(started()), this, SLOT(disableButtons()));
    connect(emulation, SIGNAL(finished()), this, SLOT(enableButtons()));
    connect(emulation, SIGNAL(showLog()), this, SLOT(openLog()));


    romCollection = new RomCollection(QStringList() << "*.z64" << "*.v64" << "*.n64" << "*.zip",
                                      QStringList() << SETTINGS.value("Paths/roms","").toString().split("|"),
                                      this);

    connect(romCollection, SIGNAL(updateStarted(bool)), this, SLOT(disableViews(bool)));
    connect(romCollection, SIGNAL(romAdded(Rom*, int)), this, SLOT(addToView(Rom*, int)));
    connect(romCollection, SIGNAL(updateEnded(int, bool)), this, SLOT(enableViews(int, bool)));


    mainWidget = new QWidget(this);
    setCentralWidget(mainWidget);
    setGeometry(QRect(SETTINGS.value("Geometry/windowx", 0).toInt(),
                      SETTINGS.value("Geometry/windowy", 0).toInt(),
                      SETTINGS.value("Geometry/width", 900).toInt(),
                      SETTINGS.value("Geometry/height", 600).toInt()));

    createMenu();
    createRomView();

    mainLayout = new QVBoxLayout(mainWidget);
    mainLayout->setMenuBar(menuBar);

    mainLayout->addWidget(emptyView);
    mainLayout->addWidget(tableView);
    mainLayout->addWidget(gridView);
    mainLayout->addWidget(listView);

    mainLayout->setMargin(0);

    mainWidget->setLayout(mainLayout);
    mainWidget->setMinimumSize(300, 200);
}
Esempio n. 25
0
int	main(int argc, char **argv)
{
	B2B_LOGIN_T	Query;
	CONFIG_T	Config;
	char	LogPath[256];
	int	ErrorCode = NO_ERROR;

	Q_ENTRY *req = qCgiRequestParse(NULL, (Q_CGI_T) 0);

	memset(&Query, 0, sizeof(B2B_LOGIN_T));
	memset(&Config, 0, sizeof(CONFIG_T));

	ReadConfig(CONFIGFILE_PATH, &Config);

	sprintf(LogPath, "%s/%s", Config.LOG_PATH, LOG_NAME_ADMIN);
	if((SvcLog = openLog("ADMIN", LogPath,  LOG_MODE)) == NULL)	{
		qCgiResponseSetContentType(req, "text/html");
		printf("LogFile Open Error..\n");
		ErrorCode = ERROR_CREATE_LOG_FILE;
		PrintAuthError();
		return  ErrorCode;
	}

	if((ErrorCode = GetParamsReqAuth(req, &Query)) == NO_ERROR)	{
		if((ErrorCode = CheckPasswd(Config.AUTHENTICATION_FILE, Query)) != NO_ERROR)	{
			printLog(HEAD, "ADMIN Error...ErrorCode(%d)\n", ErrorCode);
		}
		else	{
			qCgiResponseSetContentType(req, "text/html");
			PrintQueryHTML(Config.QUERY_FILE);
		}
	}
	else	{
		qCgiResponseSetContentType(req, "text/html");
		PrintAuthError();
		printLog(HEAD, "Parameter Error...(%d)\n", ErrorCode);
	}


//	req->free(req);

	closeLog(SvcLog);

	return	0;
}
void Attack::_log(int num){
  openLog();
  addLog((String)attackNames[num]);
  for(int a=0;a<apScan.results;a++){
    if(apScan.isSelected(a)){
      Mac _ap;
      _ap.set(apScan.aps._get(a));
      addLog(_ap.toString());
    }
  }
  addLog("-");
  for(int i=0;i<clientScan.results; i++) {
    if(clientScan.getClientSelected(i)) {
      addLog(clientScan.getClientMac(i).toString());
    }
  }
  closeLog();
}
Esempio n. 27
0
AboutDialog::AboutDialog(QWidget* parent)
    : QDialog(parent)
    , ui(new Ui::AboutDialog)
    , m_debugLogger(0)
{
    setAttribute(Qt::WA_DeleteOnClose);

    ui->setupUi(this);

    ui->textBrowser->setHtml(QString("<center><h2>SuplChecker</h2>"
                                     "<b>Verze:</b> %1 <br /><b>Datum:</b> %2 <br /><br />"
                                     "<b>Autor:</b><br/> %3<br /><b>Poděkování:</b><br/> Rajnymu a Patrickovi<br /><br />"
                                     "<small>Copyright (C) %4 %5</small><br />"
                                     "<a href='%6'>%6</center>"
                                    ).arg(SuplChecker::VERSION, SuplChecker::BUILDTIME, SuplChecker::AUTHOR, SuplChecker::COPYRIGHT, SuplChecker::AUTHOR, SuplChecker::WWWADDRESS)
                            );

    connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(close()));
    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(openLog()));
}
Esempio n. 28
0
int main(int argc, char **argv)
{
	char	EncodingString[2048];
	int	Index = 0;
	int	ErrorCode = 0;
	DEVICE_INFO_T	DeviceInfo;
	Q_ENTRY	*req = qCgiRequestParse(NULL, (Q_CGI_T) 0);

	SvcLog = NULL;
	SvcLog = openLog("DEVICEINFO", LOG_FILE, LOG_MODE);

	memset(&DeviceInfo, 0x00, sizeof(DEVICE_INFO_T));
	memset(EncodingString, 0x00, 2048);

	if((ErrorCode = GetParams(req, EncodingString)) == SDRM_NO_ERROR)	{
		if(strncmp(EncodingString, "IA", 2) == 0)  {
			Index = 2;
		}
		else if(strncmp(EncodingString, "EA", 2) == 0)  {
			Index = 2;
		}

		ErrorCode = DecodingDeviceString4MGR(EncodingString+Index, &DeviceInfo);
		ToUpperString(DeviceInfo.UUID, strlen(DeviceInfo.UUID));
		ToUpperString(DeviceInfo.SecondaryUUID, strlen(DeviceInfo.SecondaryUUID));

		printLog(HEAD, "ClientIP(%s)Input(%s)\t\n<=>UUID(%s)SecondaryUUID(%s)UUIDTypes(%s)DeviceName(%s)OSVersion(%s)AppVersion(%s)RegVersion(%s)BuildNum(%s)ErrorCode(%d)\n",
			getenv("REMOTE_ADDR"), EncodingString, DeviceInfo.UUID, DeviceInfo.SecondaryUUID, DeviceInfo.UUIDTypes, 
			DeviceInfo.DeviceName, DeviceInfo.OSVersion, DeviceInfo.AppVersion, DeviceInfo.RegisterVersion, DeviceInfo.BuildNumber, ErrorCode);

	}
	else	{
		printLog(HEAD, "CientIP(%s)InvalidParams...\n", getenv("REMOTE_ADDR"));
	}
	qCgiResponseSetContentType(req, "text/html");
	printResultDeviceInfo(ErrorCode, DeviceInfo);

	closeLog(SvcLog);

	return 0;
}
Esempio n. 29
0
AuthCore::AuthCore(QObject *parent)
  : QObject(parent)
{
  m_self = this;
  Path::init();

  CmdLine::createPid(Path::app());

  m_log = new NodeLog();

  m_settings = new Settings(defaultConf(), this);
  m_settings->setDefault(LS("BaseUrl"),   QString());
  m_settings->setDefault(LS("Listen"),    QStringList(LS("http://0.0.0.0:7668")));
  m_settings->setDefault(LS("LogColor"),  true);
  m_settings->setDefault(LS("LogLevel"),  NodeLog::WarnLevel);
  m_settings->setDefault(LS("LogOutput"), NodeLog::FileOut);
  m_settings->setDefault(LS("Order"),     QStringList() << LS("facebook") << LS("vkontakte") << LS("google") << LS("live") << LS("github") << LS("stackoverflow") << LS("yandex") << LS("odnoklassniki") << LS("mail_ru") << LS("simpleid"));
  m_settings->setDefault(LS("Root"),      defaultRoot());

  openLog();

  m_handler = new AuthHandler(this);
  m_handler->setRoot(QDir::cleanPath(m_settings->value(LS("Root")).toString()));

  m_state = new AuthState(this);

  add(new ProvidersHandler());
  add(new StateHandlerCreator());
  add(new FacebookAuthCreator());
  add(new GoogleAuthCreator());
  add(new YandexAuthCreator());
  add(new MailRuAuthCreator());
  add(new VkontakteAuthCreator());
  add(new OdnoklassnikiAuthCreator());
  add(new LiveAuthCreator());
  add(new GithubAuthCreator());
  add(new StackOverflowAuthCreator());
  add(new SimpleIdAuthCreator());

  QTimer::singleShot(0, this, SLOT(start()));
}
Esempio n. 30
0
    void
    consume(const IMC::LoggingControl* msg)
    {
        if (msg->getSource() != getSystemId())
            return;

        if (!m_args.save_to_file)
            return;

        switch (msg->op)
        {
        case IMC::LoggingControl::COP_STARTED:
            closeLog();
            openLog(m_ctx.dir_log / msg->name / m_args.file_name_837);
            break;

        case IMC::LoggingControl::COP_STOPPED:
            closeLog();
            break;
        }
    }