/*! Store inner type settings if exists. @param outerType reference to outertype @return false in case of failure. */ bool EapWizardPrivate::storeInnerTypeSettings(EapQtPluginHandle &outerType) { OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STOREINNERTYPESETTINGS_ENTRY ); bool ret = true; if (hasInnerMethod()) { EapQtPluginHandle inner = static_cast<EapQtPluginHandle::Plugin>( configurations(InnerType).toInt()); // All inner methods supported by wizard use password / username. EapQtConfig eapConfInner; eapConfInner.setValue(EapQtConfig::OuterType, qVariantFromValue(outerType)); eapConfInner.setValue(EapQtConfig::UsernameAutomatic, false); eapConfInner.setValue(EapQtConfig::Username, configurations(Username)); eapConfInner.setValue(EapQtConfig::PasswordPrompt, false); eapConfInner.setValue(EapQtConfig::Password, configurations(Password)); if (!mEapConfIf->saveConfiguration(inner, eapConfInner)){ mEapConfIf->deleteConfiguration(); ret = false; } } OstTraceFunctionExit0( EAPWIZARDPRIVATE_STOREINNERTYPESETTINGS_EXIT ); return ret; }
/*! Handles configurations for LEAP. @param [in,out] eapConf EAP Configuration */ void EapWizardPrivate::handleLeapSettings(EapQtConfig &eapConf) { OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLELEAPSETTINGS_ENTRY ); eapConf.setValue(EapQtConfig::UsernameAutomatic, false); eapConf.setValue(EapQtConfig::Username, configurations(Username)); eapConf.setValue(EapQtConfig::PasswordPrompt, false); eapConf.setValue(EapQtConfig::Password, configurations(Password)); OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLELEAPSETTINGS_EXIT ); }
void WServer::configureAuth() { _authService.setAuthTokensEnabled(_configurations->getBool("EnableTokens", ModuleDatabase::Authentication, true), _configurations->getStr("LoginCookie", ModuleDatabase::Authentication, "logintoken")); _authService.setEmailVerificationEnabled(_configurations->getBool("EmailVerification", ModuleDatabase::Authentication, false)); Wt::Auth::PasswordVerifier *verifier = new Wt::Auth::PasswordVerifier(); verifier->addHashFunction(new Wt::Auth::BCryptHashFunction(7)); _passwordService.setVerifier(verifier); _passwordService.setAttemptThrottlingEnabled(true); _passwordService.setStrengthValidator(new Wt::Auth::PasswordStrengthValidator()); if(Wt::Auth::GoogleService::configured() && configurations()->getBool("GoogleOAuth", ModuleDatabase::Authentication, false)) _oAuthServices.push_back(new Wt::Auth::GoogleService(_authService)); if(Wt::Auth::FacebookService::configured() && configurations()->getBool("FacebookOAuth", ModuleDatabase::Authentication, false)) _oAuthServices.push_back(new Wt::Auth::FacebookService(_authService)); }
void Arm::sendArmToPoses(std::vector<std::vector<double> > &poses, std::vector<double> move_times) { geometry_msgs::Pose pose_msg; btQuaternion quaternion; geometry_msgs::Quaternion quaternion_msg; std::vector<std::vector<double> > configurations(poses.size(), std::vector<double>(7, 0)); std::vector<double> jnt_pos(7, 0), solution(7, 0); for (unsigned int i = 0; i < poses.size(); i++) { quaternion.setRPY(poses[i][3], poses[i][4], poses[i][5]); tf::quaternionTFToMsg(quaternion, quaternion_msg); pose_msg.position.x = poses[i][0]; pose_msg.position.y = poses[i][1]; pose_msg.position.z = poses[i][2]; pose_msg.orientation = quaternion_msg; double start_time = ros::Time::now().toSec(); if (computeIK(pose_msg, jnt_pos, configurations[i])) ROS_DEBUG( "[sendArmToPoses] Computed IK solution in %0.3f seconds", ros::Duration(ros::Time::now().toSec() - start_time).toSec()); else return; } sendArmToConfigurations(configurations, move_times); }
/*! Store outer type settings. @param outerType reference to outertype @return false in case of failure. */ bool EapWizardPrivate::storeOuterTypeSettings(EapQtPluginHandle &outerType) { OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_ENTRY ); EapQtConfig eapConf; // 1. Store outer type settings switch (outerType.pluginId()) { case EapQtPluginHandle::PluginEapTtls: case EapQtPluginHandle::PluginPeap: case EapQtPluginHandle::PluginEapTls: handleTlsMethodsSettings(eapConf, outerType); break; case EapQtPluginHandle::PluginEapFast: if (!handleEapFastSettings(eapConf)) { OstTraceFunctionExit0( EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); return false; } break; case EapQtPluginHandle::PluginEapAka: case EapQtPluginHandle::PluginEapSim: handleEapAkaSimSettings(eapConf); break; default: Q_ASSERT(outerType == EapQtPluginHandle::PluginLeap); handleLeapSettings(eapConf); break; } if (hasInnerMethod()) { EapQtPluginHandle inner = static_cast<EapQtPluginHandle::Plugin>( configurations(InnerType).toInt()); QList<QVariant> innerType; innerType.append(qVariantFromValue(inner)); eapConf.setValue(EapQtConfig::InnerType, innerType); } // store outer type configurations if (!mEapConfIf->saveConfiguration(outerType, eapConf)){ mEapConfIf->deleteConfiguration(); OstTraceFunctionExit0( DUP1_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); return false; } QList<EapQtPluginHandle> selectedOuterTypes; selectedOuterTypes.append(outerType); if (!mEapConfIf->setSelectedOuterTypes(selectedOuterTypes)){ mEapConfIf->deleteConfiguration(); OstTraceFunctionExit0( DUP2_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); return false; } OstTraceFunctionExit0( DUP3_EAPWIZARDPRIVATE_STOREOUTERTYPESETTINGS_EXIT ); return true; }
/*! See EapWizard::summary(). */ bool EapWizardPrivate::summary( WlanWizardPlugin::Summary sum, QString &item, QString &value) { OstTraceFunctionEntry0( EAPWIZARDPRIVATE_SUMMARY_ENTRY ); bool ret = false; int outerType = configurations(EapWizardPrivate::OuterType).toInt(); switch (sum) { case WlanWizardPlugin::SummaryEapInnerType: if (hasInnerMethod()) { item = hbTrId("txt_occ_dblist_inner_eap"); value = eapTypeToString(configurations(EapWizardPrivate::InnerType).toInt()); ret = true; } break; case WlanWizardPlugin::SummaryEapFastProvisioningMode: if (outerType == EapQtPluginHandle::PluginEapFast) { item = hbTrId("txt_occ_dblist_provisioning_mode_for_eapfast"); value = hbTrId("txt_occ_dblist_provisioning_mode_for_val_unauthent"); ret = true; } break; default: Q_ASSERT(sum == WlanWizardPlugin::SummaryEapOuterType); item = hbTrId("txt_occ_dblist_outer_eap"); value = eapTypeToString(outerType); ret = true; break; } OstTraceFunctionExit0( EAPWIZARDPRIVATE_SUMMARY_EXIT ); return ret; }
/*! Handles configurations for EAP-FAST. @param [in,out] eapConf EAP Configuration @param false in case of failure. */ bool EapWizardPrivate::handleEapFastSettings(EapQtConfig &eapConf) { OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLEEAPFASTSETTINGS_ENTRY ); bool ret = true; EapQtPacStoreConfig pacStoreConf; eapConf.setValue(EapQtConfig::ProvisioningModeAuthenticated, true); eapConf.setValue(EapQtConfig::ProvisioningModeUnauthenticated, true); eapConf.setValue(EapQtConfig::VerifyServerRealm, false); eapConf.setValue(EapQtConfig::UseIdentityPrivacy, false); switch (configurations(PacStoreState).toInt()) { case EapQtPacStoreConfig::PacStoreStateStoreNotExists: case EapQtPacStoreConfig::PacStoreStatePasswordRequired: pacStoreConf.setValue( EapQtPacStoreConfig::PacStorePassword, configurations(PacStorePassword)); pacStoreConf.setValue( EapQtPacStoreConfig::PacStoreSavePassword, true); if (!mEapConfIf->savePacStoreConfiguration(pacStoreConf)) { // no cleaning required ret = false; } break; default: // Do nothing break; } OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLEEAPFASTSETTINGS_EXIT ); return ret; }
/* Handles TLS methods (PEAP, EAP-TLS and EAP-TTLS) settings. Stores configurations to eapConf @param [in,out] eapConf configuration is written to this object. @param [in] outerType Outer EAP method */ void EapWizardPrivate::handleTlsMethodsSettings( EapQtConfig &eapConf, EapQtPluginHandle &outerType) { OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HANDLETLSMETHODSSETTINGS_ENTRY ); // Common stuff for all tls methods eapConf.setValue(EapQtConfig::UseIdentityPrivacy, false); eapConf.setValue(EapQtConfig::VerifyServerRealm, false); eapConf.setValue(EapQtConfig::ClientAuthenticationRequired, false); eapConf.setValue(EapQtConfig::UsernameAutomatic, configurations(TunnelUsernameAutomatic)); eapConf.setValue(EapQtConfig::Username, configurations(TunnelUsername)); eapConf.setValue(EapQtConfig::RealmAutomatic, configurations(TunnelRealmAutomatic)); eapConf.setValue(EapQtConfig::Realm, configurations(TunnelRealm)); QVariant certVariant = configurations(CertificateCa); if (certVariant.canConvert<EapQtCertificateInfo> ()) { QList<QVariant> caCerts; caCerts.append(certVariant); eapConf.setValue(EapQtConfig::AuthorityCertificate, caCerts); eapConf.setValue(EapQtConfig::AuthorityCertificateAutomatic, false); } else { eapConf.setValue(EapQtConfig::AuthorityCertificateAutomatic, true); } // type specific configurations if (outerType == EapQtPluginHandle::PluginEapTls) { QList<QVariant> userCerts; userCerts.append(configurations(CertificateUser)); eapConf.setValue(EapQtConfig::ClientAuthenticationRequired, true); eapConf.setValue(EapQtConfig::UserCertificate, userCerts); } else if (outerType == EapQtPluginHandle::PluginPeap) { switch (configurations(InnerType).toInt()) { case EapQtPluginHandle::PluginEapMschapv2: // EAP-MSCHAPv2: enable v0 only eapConf.setValue(EapQtConfig::PeapVersion0Allowed, true); eapConf.setValue(EapQtConfig::PeapVersion1Allowed, false); break; case EapQtPluginHandle::PluginEapGtc: // EAP-GTC: enable v1 only eapConf.setValue(EapQtConfig::PeapVersion0Allowed, false); eapConf.setValue(EapQtConfig::PeapVersion1Allowed, true); break; } eapConf.setValue(EapQtConfig::PeapVersion2Allowed, false); } OstTraceFunctionExit0( EAPWIZARDPRIVATE_HANDLETLSMETHODSSETTINGS_EXIT ); }
/*! Check whether selected outer type has inner method. @return true if inner method exists, false otherwise. */ bool EapWizardPrivate::hasInnerMethod() const { OstTraceFunctionEntry0( EAPWIZARDPRIVATE_HASINNERMETHOD_ENTRY ); int outerType = configurations(EapWizardPrivate::OuterType).toInt(); bool ret = false; switch (outerType) { case EapQtPluginHandle::PluginEapTtls: case EapQtPluginHandle::PluginPeap: case EapQtPluginHandle::PluginEapFast: ret = true; break; } OstTraceFunctionExit0( EAPWIZARDPRIVATE_HASINNERMETHOD_EXIT ); return ret; }
/*! See EapWizard::storeSettings(). @return true - ok, false - failed */ bool EapWizardPrivate::storeSettings() { OstTraceFunctionEntry0( EAPWIZARDPRIVATE_STORESETTINGS_ENTRY ); bool ret = false; EapQtPluginHandle outerType(static_cast<EapQtPluginHandle::Plugin>( configurations(OuterType).toInt())); int iapId = mWizardHelper->configuration(WlanWizardHelper::ConfIapId).toInt(); if (mEapConfIf->setConfigurationReference(iapId) && storeOuterTypeSettings(outerType) && storeInnerTypeSettings(outerType)) { ret = true; } OstTraceFunctionExit0( EAPWIZARDPRIVATE_STORESETTINGS_EXIT ); return ret; }
/*! See WlanWizardPlugin::errorString(). Returns EAP spesific error string. */ QString EapWizardPrivate::errorString(int errorCode) { OstTraceFunctionEntry0( EAPWIZARDPRIVATE_ERRORSTRING_ENTRY ); char* textId = NULL; int eapType = EapQtPluginHandle::PluginUndefined; switch (errorCode){ case KErrWlanUserRejected: textId = "txt_occ_dialog_1_auth_failed_user_cert_rej"; eapType = configurations(OuterType).toInt(); break; case KErrWlanUserCertificateExpired: textId = "txt_occ_dialog_1_auth_failed_user_cert_exp"; eapType = configurations(OuterType).toInt(); break; case KErrWlanServerCertificateExpired: textId = "txt_occ_dialog_1_authentication_failed_server_ce"; eapType = configurations(OuterType).toInt(); break; case KErrWlanCerficateVerifyFailed: textId = "txt_occ_dialog_1_authentication_failed_could_not"; eapType = configurations(OuterType).toInt(); break; case KErrWlanNoCipherSuite: textId = "txt_occ_dialog_1_authentication_failed_cipher_su"; eapType = configurations(OuterType).toInt(); break; case KErrWlanSimNotInstalled: textId = "txt_occ_dialog_1_authentication_failed_check_sim"; eapType = configurations(OuterType).toInt(); break; case KErrWlanEapFastPacStoreCorrupted: textId = "txt_occ_dialog_1_authentication_failed_reset_pac"; eapType = EapQtPluginHandle::PluginEapFast; break; case KErrWlanEapSimFailed: case KErrWlanEapTlsFailed: case KErrWlanEapPeapFailed: case KErrWlanEapAkaFailed: case KErrWlanEapTtlsFailed: case KErrWlanLeapFailed: case KErrWlanNoUserCertificate: case KErrWlanEapFastTunnelCompromiseError: case KErrWlanEapFastUnexpextedTlvExhanged: case KErrWlanEapFastNoPacNorCertsToAuthenticateWithProvDisabled: case KErrWlanEapFastNoMatchingPacForAid: case KErrWlanEapFastAuthFailed: textId = "txt_occ_dialog_1_authentication_failed"; eapType = configurations(OuterType).toInt(); break; case KErrWlanEapMsChapv2: case KErrWlanEapGtcFailed: textId = "txt_occ_dialog_1_authentication_failed"; eapType = configurations(InnerType).toInt(); break; case KErrWlanNotSubscribed: case KErrWlanAccessBarred: case KErrWlanPasswordExpired: case KErrWlanNoDialinPermissions: case KErrWlanAccountDisabled: case KErrWlanRestrictedLogonHours: textId = "txt_occ_dialog_1_authentication_failed"; if (hasInnerMethod()){ eapType = configurations(InnerType).toInt(); } else { eapType = configurations(OuterType).toInt(); } break; default: // Return empty string break; } QString string; if (textId) { string = HbParameterLengthLimiter(textId).arg(eapTypeToString(eapType)); } OstTraceFunctionExit0( EAPWIZARDPRIVATE_ERRORSTRING_EXIT ); return string; }
RandomForestImage::RandomForestImage(const std::vector<std::string>& treeFiles, const std::vector<int>& deviceIds, const AccelerationMode accelerationMode, const double histogramBias) : configuration(), ensemble(treeFiles.size()), m_predictionAllocator(boost::make_shared<cuv::pooled_cuda_allocator>()) { if (treeFiles.empty()) { throw std::runtime_error("cannot construct empty forest"); } std::vector<TrainingConfiguration> configurations(treeFiles.size()); tbb::parallel_for(tbb::blocked_range<size_t>(0, treeFiles.size(), 1), [&](const tbb::blocked_range<size_t>& range) { for(size_t tree = range.begin(); tree != range.end(); tree++) { CURFIL_INFO("reading tree " << tree << " from " << treeFiles[tree]); boost::shared_ptr<RandomTreeImage> randomTree; std::string hostname; boost::filesystem::path folderTraining; boost::posix_time::ptime date; TrainingConfiguration configuration = RandomTreeImport::readJSON(treeFiles[tree], randomTree, hostname, folderTraining, date); CURFIL_INFO("trained " << date << " on " << hostname); CURFIL_INFO("training folder: " << folderTraining); assert(randomTree); ensemble[tree] = randomTree; configurations[tree] = configuration; CURFIL_INFO(*randomTree); } }); for (size_t i = 1; i < treeFiles.size(); i++) { bool strict = false; if (!configurations[0].equals(configurations[i], strict)) { CURFIL_ERROR("configuration of tree 0: " << configurations[0]); CURFIL_ERROR("configuration of tree " << i << ": " << configurations[i]); throw std::runtime_error("different configurations"); } if (ensemble[0]->getTree()->getNumClasses() != ensemble[i]->getTree()->getNumClasses()) { CURFIL_ERROR("number of classes of tree 0: " << ensemble[0]->getTree()->getNumClasses()); CURFIL_ERROR("number of classes of tree " << i << ": " << ensemble[i]->getTree()->getNumClasses()); throw std::runtime_error("different number of classes in trees"); } } CURFIL_INFO("training configuration " << configurations[0]); this->configuration = configurations[0]; this->configuration.setDeviceIds(deviceIds); this->configuration.setAccelerationMode(accelerationMode); normalizeHistograms(histogramBias); }
static int menu(Options *args) { int option; system("clear||cls"); /* Limpa a tela */ while(1) { /* Nossa ASCII Art: */ printf("........................ .........................................\n"); printf(":::::::::::::::::::::::::. '::::::::::::::::::::::::::::::::::::::\n"); printf(";;;;;;;;;;;;;;;;;;;;;;;;;;;. ::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"); printf("+++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++\n"); printf("+++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++\n"); printf("++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++\n"); printf("================================ =======================\n"); printf("=============================== =====================\n"); printf("oooooooooooooooooooooooooooooo ooooooooooooooooooo\n"); printf("oooooooooooooooooooooooooooo oooooooooooooooooo\n"); printf("$$$$$$$$$$$$$$$$$$$$$$$$$ , . $$$$$$$$$$$$$$$$$\n"); printf("$$$$$$$$$$$$$$$$$$$$$$$ ,´,'¨¨¨`.¨¨' $$$$$$$$$$$$$$$$$\n"); printf("$$$$$$$$$$$$$$$$$$$$ ,´Y|______Y`.| $$$$$$$$$$$$$$$$$\n"); printf("################## _,´,|______,´ `. ##################\n"); printf("############### | ,´ ,´ ,` |¨| ###################\n"); printf("############# ,´______,´ ,´ |_| #####################\n"); printf("@@@@@@@@@@ \\ / ,´ @@@@@@@@@@@@@@@@@@@@@@@\n"); printf("@@@@@@@ \\ / ,´ @@@@@@@@@@@@@@@@@@@@@@@@@\n"); printf("@@@@ `---'´ @@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); printf(" \n"); printf("--------------------------------------------------------------------\n"); printf(" JOGO DAS CANOAS! \n"); printf("--------------------------------------------------------------------\n"); printf(" \n"); printf(" 1) Jogar \n"); printf(" 2) Configurar jogo \n"); printf(" 3) Modo teste (simples) \n"); printf(" 4) Modo teste (completo) \n"); printf(" 5) Sair \n"); printf(" \n"); /* Seleciona opção */ while(1) { printf(" Selecione sua opção: "); scanf(" %d", &option); /* JOGAR */ if(option == 1) { return EXIT_SUCCESS; } /* CONFIGURAÇÕES */ else if(option == 2) { configurations(args); break; } /* MODO TESTE (SIMPLES) */ else if(option == 3) { args->t = 1; return EXIT_SUCCESS; } /* MODO TESTE (COMPLETO) */ else if(option == 4) { args->T = 2; return EXIT_SUCCESS; } /* SAIR */ else if(option == 5) { return EXIT_FAILURE; } /* ERRO */ else { printf(" Opção não reconhecida!\n"); } } /* while das opções */ } /* while do menu */ }