void RankingScene::init() { ifstream ifs("rankingdata.txt"); int i = 0; if (isLoaded == false) { loadData(); isLoaded = true; } string tmp; getline(ifs, tmp); getline(ifs, total); for (i = 0; i < 20; i++){ if (i % 2 == 0) getline(ifs, rank_name[i / 2]); else getline(ifs, rank_score[i / 2]); } ifs.close(); counter = 0; }
OrbSysGpsC_30::OrbSysGpsC_30(const PackedNavBits& msg) throw( InvalidParameter): OrbSysGpsC(), Tgd(0.0), ISC_L1CA(0.0), ISC_L2C(0.0), ISC_L5I5(0.0), ISC_L5Q5(0.0), avail_Tgd(false), avail_L1CA(false), avail_L2C(false), avail_L5I5(false), avail_L5Q5(false) { for (int i=0;i<4;i++) { alpha[i] = 0.0; beta[i] = 0.0; } loadData(msg); }
//============================================================================= // SLOT: Delete the line with the given ID. //============================================================================= void CAddress::slotDeleteLine (QString id) { //---------------------------------------------------------------------------- // If ID is an empty string, the line was not saved already, so nothing has // to bo done. //---------------------------------------------------------------------------- if (id != "") { QSqlQuery query ("DELETE FROM contacts_addresses WHERE address_id = " + id); if (!query.isActive()) { SHOW_DB_ERROR(tr ("Error during deleting the data"), query); return; } mDB->commit(); } loadData (mCurrent, mReadonly); }
bool NetTree::goBack() { bool handled = false; if (m_imageDownload && m_imageDownload->isRunning()) m_imageDownload->cancel(); if (m_currentNode != m_siteGeneric) { MythGenericTree *lparent = m_currentNode->getParent(); if (lparent) { SetCurrentNode(lparent); handled = true; } } loadData(); return handled; }
QgsRasterLayer* QgsRemoteDataSourceBuilder::rasterLayerFromRemoteRDS( const QDomElement& remoteRDSElem, const QString& layerName, QList<QTemporaryFile*> &filesToRemove, QList<QgsMapLayer*> &layersToRemove, bool allowCaching ) const { Q_UNUSED( layerName ); Q_UNUSED( allowCaching ); QgsDebugMsg( "entering." ); //load file with QgsHttpTransaction or QgsFtpTransaction QByteArray fileContents; QString uri = remoteRDSElem.text(); QgsRasterLayer* rl = nullptr; if ( loadData( uri, fileContents ) != 0 ) { return nullptr; } QTemporaryFile* tmpFile = new QTemporaryFile(); if ( tmpFile->open() ) { tmpFile->write( fileContents ); tmpFile->flush(); } else { QgsDebugMsg( "Error, creation of temp file failed" ); delete tmpFile; return nullptr; } //create rasterlayer rl = new QgsRasterLayer( tmpFile->fileName(), layerNameFromUri( tmpFile->fileName() ) ); layersToRemove.push_back( rl ); filesToRemove.push_back( tmpFile ); clearRasterSymbology( rl ); return rl; }
void CorrelateMain::update() { if (bangLoad->getBang()) loadData(); if (bangEvaluate->getBang()) evaluate(); if (bangLoadCalibration->getBang()) { calibration.load(); bangEvaluate->enabled = true; } if (bangSave3DScan->getBang()) saveScan(); if (bangSaveMap->getBang()) saveMap(); if (bangAddToImage->getBang()) addToImage(); if (bangSaveImage->getBang()) saveImage(); if (bangClearImage->getBang()) clearImage(); ofVec3f& lbf(scanSet.lbf); ofVec3f& rtb(scanSet.rtb); if (rtb.x < lbf.x) rtb.x = lbf.x; if (rtb.y < lbf.y) rtb.y = lbf.y; if (rtb.z < lbf.z) rtb.z = lbf.z; }
void QtApplication::initialise() { // Splash QPixmap pixmap; // Query for custom splash screens bool foundCustomSplash = false; const auto pSplash = this->get<ISplash>(); if (pSplash != nullptr) { std::unique_ptr<BinaryBlock> splashData; std::string format; const auto loaded = pSplash->loadData(splashData, format); if (loaded) { foundCustomSplash = pixmap.loadFromData(static_cast<const uchar*>(splashData->data()), static_cast<uint>(splashData->length()), format.c_str()); } } // Use default splash screen if (!foundCustomSplash) { pixmap.load(":/qt_app/splash"); } splash_.reset(new QSplashScreen(pixmap)); splash_->show(); auto qtFramework = this->get<IQtFramework>(); TF_ASSERT(qtFramework != nullptr); if (qtFramework != nullptr) { auto palette = qtFramework->palette(); if (palette != nullptr) { application_->setPalette(palette->toQPalette()); } } }
RecommendWidget::RecommendWidget(QWidget *parent) : QWidget(parent) { hostName="www.mvgather.com"; isFirstLoad = true; mainGLayout = new QGridLayout; mainGLayout->setMargin(0); setLayout(mainGLayout); listShowWidget = new ListShowWidget; dyRecommendBtn = new QPushButton; searchBtn = new QPushButton; searchLineEdit = new QLineEdit; searchBtn->setStyleSheet("QPushButton{background-color: rgba(0, 82, 112, 100);color: white;border: 1px;}QPushButton:hover{background-color: rgba(0, 82, 112, 200);color: white;border: 1px;}QPushButton:disabled{background-color: transparent;color: gray;}"); mainGLayout->addWidget(listShowWidget,0,0,10,10); mainGLayout->addWidget(dyRecommendBtn,0,10,1,1); mainGLayout->addWidget(searchLineEdit,1,10,1,2); mainGLayout->addWidget(searchBtn,1,12,1,1); connect(listShowWidget,SIGNAL(clicked(QString,QString)),this,SLOT(addDownloadTask(QString,QString)));//this->tvUrl,this->title connect(listShowWidget,SIGNAL(pageChanged()),this,SLOT(loadData())); connect(dyRecommendBtn,SIGNAL(clicked()),this,SLOT(reLoadData())); dyRecommendBtn->setText("电影推荐"); searchBtn->setText("搜索"); connect(searchBtn,SIGNAL(clicked()),this,SLOT(search())); connect(searchLineEdit,SIGNAL(returnPressed()),this,SLOT(search())); searchLineEdit->setMaximumWidth(200); manager = new QNetworkAccessManager; QTimer::singleShot(5000,this,SLOT(counter())); //QTimer::singleShot(2000,this,SLOT(loadData())); }
FahrtagWindow::FahrtagWindow(QWidget *parent, Fahrtag *f) : QMainWindow(parent), ui(new Ui::FahrtagWindow) { ui->setupUi(this); ui->lineSitze->setValidator(new QRegExpValidator(QRegExp("2[0-9]{2}\\s*\\:\\s*(((([1-9][0-9]?)\\s*-\\s*([1-9][0-9]?))|([1-9][0-9]?)))(\\s*,\\s*((([1-9][0-9]?)-([1-9][0-9]?))|([1-9][0-9]?)))*(;\\s*[1-9][0-9]?\\s*\\:\\s*(((([1-9][0-9]?)\\s*-\\s*([1-9][0-9]?))|([1-9][0-9]?)))(\\s*,\\s*((([1-9][0-9]?)-([1-9][0-9]?))|([1-9][0-9]?)))*\\s*)*"))); fahrtag = f; nehme = true; ui->dateDate->setFocus(); setWindowTitle(Fahrtag::getStringFromArt(fahrtag->getArt())+" am "+fahrtag->getDatum().toString("dddd dd. MM. yyyy")); listeMitNamen = new QMap<QListWidgetItem *, QString>(); listToTable = new QMap<QListWidgetItem*,QTableWidgetItem*>(); namen = new QSet<QString>(); resToItem = new QMap<Reservierung*, QListWidgetItem*>(); itemToRes = new QMap<QListWidgetItem*, Reservierung*>(); nehmeRes = false; loadData(); update(); }
BOOL CDlgMakeTChartImage::OnInitDialog() { CDialog::OnInitDialog(); // TODO: ¿©±â¿¡ Ãß°¡ ÃʱâÈ ÀÛ¾÷À» Ãß°¡ÇÕ´Ï´Ù. layoutCtrls(); CString fname; fname.Format("%s%s", this->m_strSubjectFolder, this->m_pTI->m_chFileName); loadData(fname); makeImages(); OnOK(); return TRUE; // return TRUE unless you set the focus to a control // ¿¹¿Ü: OCX ¼Ó¼º ÆäÀÌÁö´Â FALSE¸¦ ¹ÝȯÇØ¾ß ÇÕ´Ï´Ù. }
bool Compiler::compile(const QString &url) { Q_D(Compiler); clearError(); // check that engine is using correct factory if (!qgetenv("QV4_FORCE_INTERPRETER").isEmpty()) { QQmlError error; error.setDescription("Compiler is forced to use interpreter"); appendError(error); return false; } Q_ASSERT(d->compilation == NULL); QmlCompilation* c = new QmlCompilation(url, QUrl(url), d->engine); d->compilation = c; c->importCache = new QQmlImports(&QQmlEnginePrivate::get(d->compilation->engine)->typeLoader); c->importDatabase = new QQmlImportDatabase(d->compilation->engine); c->loadUrl = url; int lastSlash = url.lastIndexOf('/'); if (lastSlash == -1) c->url = url; else if (lastSlash + 1 < url.length()) c->url = url.mid(lastSlash + 1); else c->url = ""; if (!loadData()) { delete takeCompilation(); return false; } if (!compileData()) { delete takeCompilation(); return false; } return true; }
// TODO 4: Create a method to actually load an xml file // then call all the modules to load themselves bool j1App::LoadGameNow() { bool ret = loadData(); p2List_item<j1Module*>* item; item = modules.start; const char* debug = NULL; item->data->loadNow(load);//save for (item = modules.start; item != NULL && ret == true; item = item->next) { debug = item->data->name.GetString(); ret = item->data->loadNow(load); } if (!ret) LOG("Error at function loadNow File %s", debug); return ret; }
int pchexinit(struct s_pchex *pch) { int fs; //General Init srand(time(NULL)); gfxInitDefault(); consoleInit(GFX_BOTTOM, &pch->bot); consoleInit(GFX_TOP, &pch->top); //Filesystem Init printf("Init Filesystem...\n"); fs = filesysInit(&pch->sd.handle, &pch->sav.handle, &pch->sd.arch, &pch->sav.arch); if (fs) printf("Init FS Failed\n"); else printf("Init FS OK\n"); //Load Pokemon Data if (loadData(&pch->sd.handle, &pch->sd.arch)) return -1; //save loading, save is loaded into the array 'save' pch->save = malloc(0x1D6000); pch->game = loadSave(pch->save, &pch->sav.handle, &pch->sav.arch); if (pch->game < 0) pch->game = loadSave(pch->save, &pch->sd.handle, &pch->sd.arch); if (pch->game < 0) return -1; if (backupSave(pch->save, pch->game, &pch->sd.handle, &pch->sd.arch)) { printf("Backup Failed, Exiting\n"); return -1; } return 0; }
void Settings::accept() { QMap<QString, QString> hermes; hermes["language"] = language(); hermes["seeMedia"] = seeMedia(); hermes["addMedia"] = addMedia(); hermes["removeMedia"] = removeMedia(); hermes["seeCategory"] = seeCategory(); hermes["addCategory"] = addCategory(); hermes["removeCategory"] = removeCategory(); hermes["newData"] = newData(); hermes["loadData"] = loadData(); hermes["saveData"] = saveData(); hermes["saveAsData"] = saveAsData(); hermes["quit"] = quit(); hermes["search"] = search(); hermes["users"] = users(); hermes["settings"] = settings(); emit s_setting(hermes); close(); }
int main ( int argc, char * argv[] ) { Uint32 time = SDL_GetTicks(); init(); loadData(); long long iterator = 0; while ( !quit ) { printf( "\tLoop start {\n " ); Uint32 timePre = time; time = SDL_GetTicks(); dt = ((double)( time - timePre )) / 1000.0; printf( "\tEvents\n " ); pollEvent(); printf( "\tUpdate\n " ); update(); printf( "\tRender\n " ); render(); printf( "%i\t} Loop end\n ", iterator++ ); } return 0x127; }
void InjectedBundle::queueLoadHTMLString(WKStringRef content, WKStringRef baseURL, WKStringRef unreachableURL) { m_useWorkQueue = true; WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueLoadHTMLString")); WKRetainPtr<WKMutableDictionaryRef> loadData(AdoptWK, WKMutableDictionaryCreate()); WKRetainPtr<WKStringRef> contentKey(AdoptWK, WKStringCreateWithUTF8CString("content")); WKDictionarySetItem(loadData.get(), contentKey.get(), content); if (baseURL) { WKRetainPtr<WKStringRef> baseURLKey(AdoptWK, WKStringCreateWithUTF8CString("baseURL")); WKDictionarySetItem(loadData.get(), baseURLKey.get(), baseURL); } if (unreachableURL) { WKRetainPtr<WKStringRef> unreachableURLKey(AdoptWK, WKStringCreateWithUTF8CString("unreachableURL")); WKDictionarySetItem(loadData.get(), unreachableURLKey.get(), unreachableURL); } WKBundlePostMessage(m_bundle, messageName.get(), loadData.get()); }
void chooseBack::setup() { loadData(); ui_chooseBack.setup(ofToDataPath("Img/chooseBack/back"), ofVec2f(456, 303), ofToDataPath("Img/chooseBack/left.png"), ofVec2f(388, 566), ofToDataPath("Img/chooseBack/right.png"), ofVec2f(1510, 566)); ui_chooseBack.setRollSpeed(50); //ÉèÖÃË÷ÒýλÖà pos_instruction.resize(ui_chooseBack.getSize()); int i_xTemp = 980; int i_yTemp = 1000; int i_value = 20; for(int i = pos_instruction.size() / 2 - 1; i >= 0; i --) { pos_instruction[i].x = i_xTemp - (int)((i_value + img_no.getWidth() / 2) * abs((int)(pos_instruction.size() / 2 - i))); pos_instruction[i].y = i_yTemp; } for(int i = pos_instruction.size() / 2; i < pos_instruction.size(); i ++) { pos_instruction[i].x = i_xTemp + (i_value + img_no.getWidth() / 2) * abs((int)(pos_instruction.size() / 2 - i)); pos_instruction[i].y = i_yTemp; } }
int main() { // Store images, 784 rows, 10000 columns double** images = create2DDoubleArray(IMGSIZE, NUMIMGS); // Store layer 1 weights, 200 rows, 784 columns double** wL1 = create2DDoubleArray(LAYER1, IMGSIZE); // Stores layer 2 weights, 200 rows, 200 columns double** wL2 = create2DDoubleArray(LAYER2, LAYER1); // Stores layer 3 weights, 10 rows, 200 columns double** wL3 = create2DDoubleArray(LAYERFINAL, LAYER2); // Stores bias data, two sets of 200 rows, 1 column double** bias = create2DDoubleArray(LAYER1, 2); // Where the computed probabilities are stored double** probabilities = create2DDoubleArray(LAYERFINAL, NUMTEST); // Stores solutions int solutions[NUMIMGS]; if(loadData(images, wL1, wL2, wL3, bias, solutions) == -1) { return -1; } computeProb(images, wL1, wL2, wL3, bias, &probabilities); double accuracy = computeAccuracy(probabilities, solutions); printf("Hit Percentage: %3.2lf%%\n", accuracy * 100); return 0; }
DataFile::DataFile( const QString & _fileName ) : QDomDocument(), m_content(), m_head() { QFile inFile( _fileName ); if( !inFile.open( QIODevice::ReadOnly ) ) { if( Engine::hasGUI() ) { QMessageBox::critical( NULL, SongEditor::tr( "Could not open file" ), SongEditor::tr( "Could not open file %1. You probably " "have no permissions to read this " "file.\n Please make sure to have at " "least read permissions to the file " "and try again." ).arg( _fileName ) ); } return; } loadData( inFile.readAll(), _fileName ); }
void * elf32MapSection(struct ElfObject *obj, struct Section *section) { if (section->data) return section->data; // Find what segment this section is in. Elf32_Addr secStart = section->shdr.sh_offset; Elf32_Addr secEnd = secStart + section->shdr.sh_size; size_t i; for (i = 0; i < obj->elfHeader.e_phnum; i++) { struct Segment *seg = &obj->programHeaders[i]; Elf32_Phdr *phdr = &seg->phdr; if (phdr->p_offset <= secStart && secEnd <= phdr->p_offset + phdr->p_filesz) { section->owns = 0; return section->data = elf32MapSegment(obj, seg) + secStart - phdr->p_offset; } } section->data = loadData(obj, section->shdr.sh_offset, section->shdr.sh_size); section->owns = 1; return section->data; }
static void SearchCrime() { char uident[IDLEN + 1], buf[256]; time_t currTime, ActiveTime; mcUserInfo *mcuInfo; int day, hour, minute; nomoney_show_stat("档案室"); if (!getOkUser("\n请选择查询的档案:", uident, 6, 4)) { move(8, 4); prints("查无此人"); pressanykey(); return; } sethomefile(buf, uident, "mc.save"); if (!file_exist(buf)) initData(1, buf); if((mcuInfo = loadData(buf, sizeof (mcUserInfo))) == (void*)-1) return; ActiveTime = mcuInfo->lastActiveTime; currTime = time(NULL); if (currTime > ActiveTime) { day = (currTime - ActiveTime) / 86400; hour = (currTime - ActiveTime) % 86400 / 3600; minute = (currTime - ActiveTime) % 3600 / 60 + 1; move(9, 1); prints(" 此人上次犯案是在%d天%d小时%d分钟以前。", day, hour, minute); } unloadData(mcuInfo, sizeof (mcUserInfo)); pressanykey(); return; }
JNIEXPORT jfloatArray JNICALL Java_weka_attributeSelection_CMIMAttributeEvaluator__1process( JNIEnv *env, jobject object, jobject instances) { int i, n; std::vector<struct result_record*> result_vector; Data data; JNIRowIterator jniRowIterator(env, object, instances); std::cout << "Loading Data... " << std::endl; loadData(data, jniRowIterator); std::cout << "Calculating CMIM... " << std::endl; process(data, 2, result_vector); std::cout << "Returning Results..." << std::endl; n = result_vector.size(); jfloatArray jresult_array = env->NewFloatArray(n); jfloat* jresult_buffer = (jfloat*) malloc(sizeof(jfloat) * n); for(i = 0; i < n; i++) { jresult_buffer[i] = result_vector[i]->i_u_yx; } env->SetFloatArrayRegion(jresult_array, 0, n, jresult_buffer); free(jresult_buffer); std::cout << "Done." << std::endl; return jresult_array; }
void setup() { ofBackground(0); loadData("lauren-yun.csv"); }
/** Common constructor. It will always open file for read and will * load ocean tide harmonics data in one pass. * * @param fn BLQ data file to read * */ BLQDataReader(const std::string& fn) : FFTextStream(fn.c_str(), std::ios::in) { loadData(); };
/** Common constructor. It will always open file a for read and will * load ocean tide harmonics data in one pass. * * @param fn BLQ data file to read * */ BLQDataReader(const char* fn) : FFTextStream(fn, std::ios::in) { loadData(); };
/** * Constructor that creates a rawData object. * * @param data_table this is a matrix of bytes containing the translated csv data. * @param ds the number of data samples. * @param fs the number of features that each sample has. */ RawData::RawData(char * filename) { dataFile = fopen(filename, "rb"); calculateDSandFS(); loadData(); calculateVR(); }
void PandaChunk::finishLoading() { if (loaded) return; if (reader == NULL) loadData(false); waitForLoad(); }
void dragEvent(ofDragInfo dragInfo) { if(dragInfo.files.size()) { loadData(dragInfo.files.front()); } }
EntityMap::EntityMap(GameState *game, QSharedPointer<TileMap> &map, QString ref): game(game) { this->map = map; loadData(ref); }
void IgorEngine::handleOptionsMenu() { hideCursor(); memcpy(_paletteBuffer, _currentPalette, 768); memset(_screenVGA + 144 * 320, 0, 11 * 320); _system->copyRectToScreen(_screenVGA, 320, 0, 0, 320, 200); for (int m = 3; m < 22; m += 3) { for (int i = 1 * 3; i <= 245 * 3; ++i) { if (_paletteBuffer[i] >= m) { _currentPalette[i] = MAX<int>(_paletteBuffer[i] - m, _currentPalette[i] - 3); } } setPaletteRange(1, 245); _system->updateScreen(); _system->delayMillis(1000 / 60); } setPaletteColor(255, 35, 35, 23); memcpy(_screenTextLayer, _screenVGA + 4800, 36800); uint8 *optionsMenu = loadData(IMG_OptionsMenu); for (int i = 0; i < 36800; ++i) { if (optionsMenu[i]) { _screenTextLayer[i] = optionsMenu[i]; } } free(optionsMenu); uint8 *optionsButton = loadData(IMG_OptionsButton); drawButtonsBar(_screenTextLayer, optionsButton); free(optionsButton); const int yPosCaption = 18 - 15; for (int i = 0; i < 5; ++i) { drawString(_screenTextLayer, pages[i].captions[0], pages[i].xPos[0], yPosCaption, 0xF6, -1, 0); } redrawButton(_screenTextLayer, 0, true); uint8 buttonsBarBackup[320 * 12]; int currentPage = 0; bool menuLoop = true; bool focusOnPage = false; while (menuLoop && !_eventQuitGame && _currentPart != kInvalidPart) { int previousPage = currentPage; Common::Event ev; while (_eventMan->pollEvent(ev)) { switch (ev.type) { case Common::EVENT_QUIT: _currentPart = kInvalidPart; _eventQuitGame = true; break; case Common::EVENT_KEYDOWN: if (focusOnPage) { if ((this->*pages[currentPage].handleKeyDownProc)(ev.kbd.keycode)) { memcpy(_screenTextLayer + 3 * 320, buttonsBarBackup, 320 * 12); for (int y = 22; y <= 110; ++y) { memset(_screenTextLayer + y * 320 + 43 + 4, 0xF8, 226); } focusOnPage = false; } } else { switch (ev.kbd.keycode) { case Common::KEYCODE_ESCAPE: menuLoop = false; break; case Common::KEYCODE_RETURN: if (currentPage == kPagePlay) { menuLoop = false; } else { memcpy(buttonsBarBackup, _screenTextLayer + 3 * 320, 320 * 12); for (int y = 0; y <= 11; ++y) { memset(_screenTextLayer + (y + 3) * 320 + 44, 0xF8, 232); } drawString(_screenTextLayer, pages[currentPage].captions[1], pages[currentPage].xPos[1], yPosCaption, 0xFB, -1, 0); (this->*pages[currentPage].paintProc)(); focusOnPage = true; } break; case Common::KEYCODE_LEFT: --currentPage; if (currentPage < 0) { currentPage = 0; } break; case Common::KEYCODE_RIGHT: ++currentPage; if (currentPage > 4) { currentPage = 4; } break; default: break; } } break; default: break; } } if (previousPage != currentPage) { redrawButton(_screenTextLayer, previousPage, false); redrawButton(_screenTextLayer, currentPage, true); } _system->delayMillis(10); _system->copyRectToScreen(_screenTextLayer, 320, 0, 15, 320, 115); _system->updateScreen(); } for (int m = 21; m >= 3; m -= 3) { for (int i = 1 * 3; i <= 245 * 3; ++i) { if (_paletteBuffer[i] >= m) { _currentPalette[i] = MIN<int>(_paletteBuffer[i], _currentPalette[i] + 3); } } setPaletteRange(1, 245); _system->updateScreen(); _system->delayMillis(1000 / 60); } showCursor(); }