text stringlengths 2 1.04M | meta dict |
|---|---|
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
Created by : Hafiyyan
Created date : 08/06/2014
Last Updated date : 08/06/2014
Function : Model table Item Image
*/
class item_image extends CI_Model{
function __construct(){
parent::__construct();
$this->item_image_id = null;
$this->item_id = null;
$this->content = null;
$this->blur = 0;
$this->scratch = 0;
$this->load->database();
}
public function index(){ }
function insert_upload_data($data){
$this->item_id = $data['item_id'];
$this->item_image_id = null;
$this->content = $data['content'];
$this->blur = $data['blur'];
$this->scratch = $data['scratch'];
try{
$this->db->insert("item_image",$this);
return true;
}catch(Exception $e){
ob_end_clean();
displayErrorPage($e->getMessage());
}
}
} | {
"content_hash": "00dc6a68ceff381df4567ef43373424b",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 74,
"avg_line_length": 22.25,
"alnum_prop": 0.5820224719101124,
"repo_name": "OnBaseLabs/teangin",
"id": "38663c8478bc6ce1e246ef62a0599d1a8b83152d",
"size": "890",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/models/item_image.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "335389"
},
{
"name": "JavaScript",
"bytes": "22530"
},
{
"name": "PHP",
"bytes": "1283143"
}
],
"symlink_target": ""
} |
using System;
using System.Diagnostics;
using Deq.Search.Soe.Extensions;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.SOESupport;
namespace Deq.Search.Soe.Infastructure.Commands {
/// <summary>
/// A command with no return value
/// </summary>
public abstract class Command {
/// <summary>
/// The message code to be used for all failed commands
/// </summary>
internal const int MessageCode = 2472;
#if !DEBUG
internal ServerLogger Logger = new ServerLogger();
#endif
public void Run() {
var commandName = ToString();
try {
Debug.Print("Executing\r\n{0}".With(commandName));
#if !DEBUG
Logger.LogMessage(ServerLogger.msgType.debug, "{0}.{1}".With(commandName, "execute"), MessageCode,
"Executing\r\n{0}".With(commandName));
#endif
Execute();
Debug.Print("Done Executing\r\n{0}".With(commandName));
#if !DEBUG
Logger.LogMessage(ServerLogger.msgType.debug, "{0}.{1}".With(commandName, "execute"), MessageCode,
"Done Executing");
#endif
} catch (Exception ex) {
Debug.Print("Error processing task: {0}".With(commandName), ex);
throw ex;
#if !DEBUG
Logger.LogMessage(ServerLogger.msgType.error, "{0}.{1}".With(commandName, "execute"), MessageCode,
"Error running command");
#endif
} finally {
#if !DEBUG
Logger = null;
#endif
}
}
public abstract override string ToString();
/// <summary>
/// code to execute when command is run.
/// </summary>
protected abstract void Execute();
}
/// <summary>
/// A command with a return value
/// </summary>
/// <typeparam name="T"> </typeparam>
public abstract class Command<T> : Command {
public T Result { get; protected set; }
public IObject Row { get; set; }
public T GetResult() {
Run();
#if !DEBUG
Logger = new ServerLogger();
Logger.LogMessage(ServerLogger.msgType.debug, ToString(), MessageCode,
"Done Executing\r\n{0}\r\nResult: {1}".With(ToString(), Result));
Logger = null;
#endif
return Result;
}
}
}
| {
"content_hash": "4f55bba2760f9be6dd7e1191a059e9c7",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 114,
"avg_line_length": 29.325301204819276,
"alnum_prop": 0.5456039441248973,
"repo_name": "agrc/deq-enviro",
"id": "b01990bf18bc2107ddbb8a3af22d009712d2d887",
"size": "2436",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "api/Deq.Search.Soe/Infastructure/Commands/Command.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "89"
},
{
"name": "C#",
"bytes": "129352"
},
{
"name": "CSS",
"bytes": "13359"
},
{
"name": "HTML",
"bytes": "183735"
},
{
"name": "JavaScript",
"bytes": "386277"
},
{
"name": "Python",
"bytes": "108996"
}
],
"symlink_target": ""
} |
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\Url;
use yii\helpers\ArrayHelper;
use wbraganca\dynamicform\DynamicFormWidget;
use common\models\LookupState;
use backend\models\KdsProgram;
/* @var $this yii\web\View */
/* @var $model backend\modules\gallery\models\GalleryInfo */
/* @var $form yii\widgets\ActiveForm */
$js = '
jQuery(".dynamicform_wrapper").on("afterInsert", function(e, item) {
jQuery(".dynamicform_wrapper .panel-title-address").each(function(index) {
jQuery(this).html("Gambar: " + (index + 1))
});
});
jQuery(".dynamicform_wrapper").on("afterDelete", function(e) {
jQuery(".dynamicform_wrapper .panel-title-address").each(function(index) {
jQuery(this).html("Gambar: " + (index + 1))
});
});
';
$this->registerJs($js);
$state = ArrayHelper::map(LookupState::find()->where(['kawasan_perlaksanaan'=>'Ya'])->asArray()->all(), 'state_id', 'state');
?>
<div class="gallery-info-form">
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data','id' => 'dynamic-form']]); ?>
<?= $form->field($model, 'state_id')->dropDownList($state, ['prompt'=>'[Sila Pilih]']); ?>
<?= $form->field($model, 'program_id')->dropDownList(
ArrayHelper::map(
KdsProgram::find()->all(),
function ($model) {
return $model->_id->{'$id'};
},
'nama_program'
), ['prompt'=>'[Sila Pilih]']) ?>
<?php DynamicFormWidget::begin([
'widgetContainer' => 'dynamicform_wrapper', // required: only alphanumeric characters plus "_" [A-Za-z0-9_]
'widgetBody' => '.container-items-image', // required: css class selector
'widgetItem' => '.item-image', // required: css class
'limit' => 4, // the maximum times, an element can be cloned (default 999)
'min' => 0, // 0 or 1 (default 1)
'insertButton' => '.add-item-image', // css class
'deleteButton' => '.remove-item-image', // css class
'model' => $models[0],
'formId' => 'dynamic-form',
'formFields' => [
'path',
],
]); ?>
<div class="panel panel-default">
<div class="panel-heading">
<i class="fa fa-envelope"></i> Maklumat Gambar
<button type="button" class="pull-right add-item-image btn btn-success btn-xs"><span class="glyphicon glyphicon-plus"></span></button>
<div class="clearfix"></div>
</div>
<div class="panel-body container-items-image"><!-- widgetContainer -->
<?php foreach ($models as $index => $modelPasangan): ?>
<div class="item-image panel panel-default"><!-- widgetBody -->
<div class="panel-heading">
<span class="panel-title-address">Gambar: <?= ($index + 1) ?></span>
<button type="button" class="pull-right remove-item-image btn btn-danger btn-xs"><span class="glyphicon glyphicon-minus"></span></button>
<div class="clearfix"></div>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-6">
<?= $form->field($modelPasangan, "path[{$index}][path]")->label('Gambar')->fileInput(['class'=>'img-path']) ?>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<?= $form->field($modelPasangan, "path[{$index}][caption_1]")->label('Caption 1')->textInput() ?>
</div>
<div class="col-sm-6">
<?= $form->field($modelPasangan, "path[{$index}][caption_2]")->label('Caption 2')->textInput() ?>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php DynamicFormWidget::end(); ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
| {
"content_hash": "77b1a1866fcdf1f71ab896a45d1b1568",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 161,
"avg_line_length": 38.875,
"alnum_prop": 0.5146991272393202,
"repo_name": "development2016/cdsb",
"id": "2810e2f0f2dd8247674209618a6a820e7638d805",
"size": "4354",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "backend/modules/gallery/views/gallery-info/_form.php",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "1541"
},
{
"name": "CSS",
"bytes": "79434"
},
{
"name": "HTML",
"bytes": "1818"
},
{
"name": "JavaScript",
"bytes": "1096436"
},
{
"name": "PHP",
"bytes": "365860"
},
{
"name": "Shell",
"bytes": "3257"
}
],
"symlink_target": ""
} |
package com.vanniktech.vntfontlistpreference;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.Arrays;
import java.util.Collection;
import static org.junit.Assert.assertEquals;
@RunWith(Parameterized.class)
public class StringFormatUtilsTest {
@Parameterized.Parameters(name = "String = {0} Suffix = {1} Expected = {2}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] { { null, "/", "/" }, { "fonts", "/", "fonts/" }, { "fonts/", "/", "fonts/" }, });
}
private final String string;
private final String suffix;
private final String expected;
public StringFormatUtilsTest(final String string, final String suffix, final String expected) {
this.string = string;
this.suffix = suffix;
this.expected = expected;
}
@Test
public void testAddAtEndIfNotPresent() {
assertEquals(expected, StringFormatUtils.addAtEndIfNotPresent(string, suffix));
}
}
| {
"content_hash": "ddfd36450a189436f7e59a9645bb2fd3",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 126,
"avg_line_length": 31.181818181818183,
"alnum_prop": 0.685131195335277,
"repo_name": "vanniktech/VNTFontListPreference",
"id": "09268ef180f32f48e4a2ece3403677ab906fc1aa",
"size": "1029",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "library/src/test/java/com/vanniktech/vntfontlistpreference/StringFormatUtilsTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "19564"
},
{
"name": "Shell",
"bytes": "1050"
}
],
"symlink_target": ""
} |
START_ATF_NAMESPACE
void GUILD_BATTLE::CGuildBattleStateList::Advance(int iAdvance)
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*, int);
(org_ptr(0x1403df610L))(this, iAdvance);
};
GUILD_BATTLE::CGuildBattleStateList::CGuildBattleStateList(int iStateMax, int iLoopType, unsigned int uiLoopCnt)
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*, int, int, unsigned int);
(org_ptr(0x1403def90L))(this, iStateMax, iLoopType, uiLoopCnt);
};
void GUILD_BATTLE::CGuildBattleStateList::ctor_CGuildBattleStateList(int iStateMax, int iLoopType, unsigned int uiLoopCnt)
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*, int, int, unsigned int);
(org_ptr(0x1403def90L))(this, iStateMax, iLoopType, uiLoopCnt);
};
int GUILD_BATTLE::CGuildBattleStateList::CheckLoop()
{
using org_ptr = int (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*);
return (org_ptr(0x1403df4d0L))(this);
};
void GUILD_BATTLE::CGuildBattleStateList::Clear()
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*);
(org_ptr(0x1403df030L))(this);
};
void GUILD_BATTLE::CGuildBattleStateList::ForceNext()
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*);
(org_ptr(0x1403df6a0L))(this);
};
struct ::ATF::ATL::CTimeSpan* GUILD_BATTLE::CGuildBattleStateList::GetTerm(struct ::ATF::ATL::CTimeSpan* result)
{
using org_ptr = struct ::ATF::ATL::CTimeSpan* (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*, struct ::ATF::ATL::CTimeSpan*);
return (org_ptr(0x1403df470L))(this, result);
};
int GUILD_BATTLE::CGuildBattleStateList::Goto()
{
using org_ptr = int (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*);
return (org_ptr(0x1403df2c0L))(this);
};
bool GUILD_BATTLE::CGuildBattleStateList::GotoState(int iState)
{
using org_ptr = bool (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*, int);
return (org_ptr(0x1403f3370L))(this, iState);
};
bool GUILD_BATTLE::CGuildBattleStateList::IsEmpty()
{
using org_ptr = bool (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*);
return (org_ptr(0x1403df8e0L))(this);
};
bool GUILD_BATTLE::CGuildBattleStateList::IsProc()
{
using org_ptr = bool (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*);
return (org_ptr(0x1403d9250L))(this);
};
void GUILD_BATTLE::CGuildBattleStateList::Log(char* szMsg)
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*, char*);
(org_ptr(0x1403df340L))(this, szMsg);
};
int GUILD_BATTLE::CGuildBattleStateList::Next(bool bForce)
{
using org_ptr = int (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*, bool);
return (org_ptr(0x1403df220L))(this, bForce);
};
void GUILD_BATTLE::CGuildBattleStateList::Process(struct GUILD_BATTLE::CGuildBattle* pkBattle)
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*, struct GUILD_BATTLE::CGuildBattle*);
(org_ptr(0x1403df090L))(this, pkBattle);
};
void GUILD_BATTLE::CGuildBattleStateList::SetNextState()
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*);
(org_ptr(0x14007f830L))(this);
};
void GUILD_BATTLE::CGuildBattleStateList::SetReady()
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*);
(org_ptr(0x1403eb0d0L))(this);
};
void GUILD_BATTLE::CGuildBattleStateList::SetWait()
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*);
(org_ptr(0x1403eb110L))(this);
};
GUILD_BATTLE::CGuildBattleStateList::~CGuildBattleStateList()
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*);
(org_ptr(0x14007f810L))(this);
};
void GUILD_BATTLE::CGuildBattleStateList::dtor_CGuildBattleStateList()
{
using org_ptr = void (WINAPIV*)(struct GUILD_BATTLE::CGuildBattleStateList*);
(org_ptr(0x14007f810L))(this);
};
END_ATF_NAMESPACE
| {
"content_hash": "48b08aeb3004b796ec2979befdb88ba8",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 141,
"avg_line_length": 44.48979591836735,
"alnum_prop": 0.668348623853211,
"repo_name": "goodwinxp/Yorozuya",
"id": "6b12a2df0b66e5a6060854b022b8ca2524f3c0ed",
"size": "4413",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "YorozuyaGSLib/source/GUILD_BATTLE__CGuildBattleStateList.cpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "207291"
},
{
"name": "C++",
"bytes": "21670817"
}
],
"symlink_target": ""
} |
#include "environment.h"
#include <qdebug.h>
#include <qstringlist.h>
#include <qmap.h>
#include <qdir.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qstandardpaths.h>
#include <process.h>
#include <errno.h>
#include <iostream>
//#define CONFIGURE_DEBUG_EXECUTE
//#define CONFIGURE_DEBUG_CP_DIR
using namespace std;
#ifdef Q_OS_WIN32
#include <qt_windows.h>
#endif
#include <windows/registry_p.h> // from tools/shared
QT_BEGIN_NAMESPACE
struct CompilerInfo{
Compiler compiler;
const char *compilerStr;
const char *regKey;
const char *executable;
} compiler_info[] = {
// The compilers here are sorted in a reversed-preferred order
{CC_BORLAND, "Borland C++", 0, "bcc32.exe"},
{CC_MINGW, "MinGW (Minimalist GNU for Windows)", 0, "g++.exe"},
{CC_INTEL, "Intel(R) C++ Compiler for 32-bit applications", 0, "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe
{CC_NET2003, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2003 (7.1)", "Software\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir", "cl.exe"}, // link.exe, lib.exe
{CC_NET2003, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2003 (7.1)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir", "cl.exe"}, // link.exe, lib.exe
{CC_NET2005, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2005 (8.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe
{CC_NET2005, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2005 (8.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\8.0", "cl.exe"}, // link.exe, lib.exe
{CC_NET2008, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2008 (9.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe
{CC_NET2008, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2008 (9.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\9.0", "cl.exe"}, // link.exe, lib.exe
{CC_NET2010, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2010 (10.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\10.0", "cl.exe"}, // link.exe, lib.exe
{CC_NET2010, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2010 (10.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\10.0", "cl.exe"}, // link.exe, lib.exe
{CC_NET2012, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2012 (11.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\11.0", "cl.exe"}, // link.exe, lib.exe
{CC_NET2012, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2012 (11.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\11.0", "cl.exe"}, // link.exe, lib.exe
{CC_NET2013, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2013 (12.0)", "Software\\Microsoft\\VisualStudio\\SxS\\VC7\\12.0", "cl.exe"}, // link.exe, lib.exe
{CC_NET2013, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2013 (12.0)", "Software\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VC7\\12.0", "cl.exe"}, // link.exe, lib.exe
{CC_UNKNOWN, "Unknown", 0, 0},
};
// Initialize static variables
Compiler Environment::detectedCompiler = CC_UNKNOWN;
/*!
Returns the pointer to the CompilerInfo for a \a compiler.
*/
CompilerInfo *Environment::compilerInfo(Compiler compiler)
{
int i = 0;
while(compiler_info[i].compiler != compiler && compiler_info[i].compiler != CC_UNKNOWN)
++i;
return &(compiler_info[i]);
}
/*!
Returns the qmakespec for the compiler detected on the system.
*/
QString Environment::detectQMakeSpec()
{
QString spec;
switch (detectCompiler()) {
case CC_NET2013:
spec = "win32-msvc2013";
break;
case CC_NET2012:
spec = "win32-msvc2012";
break;
case CC_NET2010:
spec = "win32-msvc2010";
break;
case CC_NET2008:
spec = "win32-msvc2008";
break;
case CC_NET2005:
spec = "win32-msvc2005";
break;
case CC_NET2003:
spec = "win32-msvc2003";
break;
case CC_INTEL:
spec = "win32-icc";
break;
case CC_MINGW:
spec = "win32-g++";
break;
case CC_BORLAND:
spec = "win32-borland";
break;
default:
break;
}
return spec;
}
Compiler Environment::compilerFromQMakeSpec(const QString &qmakeSpec)
{
if (qmakeSpec == QLatin1String("win32-msvc2013"))
return CC_NET2013;
if (qmakeSpec == QLatin1String("win32-msvc2012"))
return CC_NET2012;
if (qmakeSpec == QLatin1String("win32-msvc2010"))
return CC_NET2010;
if (qmakeSpec == QLatin1String("win32-msvc2008"))
return CC_NET2008;
if (qmakeSpec == QLatin1String("win32-msvc2005"))
return CC_NET2005;
if (qmakeSpec == QLatin1String("win32-msvc2003"))
return CC_NET2003;
if (qmakeSpec == QLatin1String("win32-icc"))
return CC_INTEL;
if (qmakeSpec == QLatin1String("win32-g++"))
return CC_MINGW;
if (qmakeSpec == QLatin1String("win32-borland"))
return CC_BORLAND;
return CC_UNKNOWN;
}
/*!
Returns the enum of the compiler which was detected on the system.
The compilers are detected in the order as entered into the
compiler_info list.
If more than one compiler is found, CC_UNKNOWN is returned.
*/
Compiler Environment::detectCompiler()
{
#ifndef Q_OS_WIN32
return CC_UNKNOWN; // Always generate CC_UNKNOWN on other platforms
#else
if(detectedCompiler != CC_UNKNOWN)
return detectedCompiler;
int installed = 0;
// Check for compilers in registry first, to see which version is in PATH
QString paths = qgetenv("PATH");
QStringList pathlist = paths.toLower().split(";");
for(int i = 0; compiler_info[i].compiler; ++i) {
QString productPath = qt_readRegistryKey(HKEY_LOCAL_MACHINE, compiler_info[i].regKey).toLower();
if (productPath.length()) {
QStringList::iterator it;
for(it = pathlist.begin(); it != pathlist.end(); ++it) {
if((*it).contains(productPath)) {
if (detectedCompiler != compiler_info[i].compiler) {
++installed;
detectedCompiler = compiler_info[i].compiler;
}
/* else {
We detected the same compiler again, which happens when
configure is build with the 64-bit compiler. Skip the
duplicate so that we don't think it's installed twice.
}
*/
break;
}
}
}
}
// Now just go looking for the executables, and accept any executable as the lowest version
if (!installed) {
for(int i = 0; compiler_info[i].compiler; ++i) {
QString executable = QString(compiler_info[i].executable).toLower();
if (executable.length() && !QStandardPaths::findExecutable(executable).isEmpty()) {
if (detectedCompiler != compiler_info[i].compiler) {
++installed;
detectedCompiler = compiler_info[i].compiler;
}
/* else {
We detected the same compiler again, which happens when
configure is build with the 64-bit compiler. Skip the
duplicate so that we don't think it's installed twice.
}
*/
break;
}
}
}
if (installed > 1) {
cout << "Found more than one known compiler! Using \"" << compilerInfo(detectedCompiler)->compilerStr << "\"" << endl;
detectedCompiler = CC_UNKNOWN;
}
return detectedCompiler;
#endif
};
/*!
Creates a commandling from \a program and it \a arguments,
escaping characters that needs it.
*/
static QString qt_create_commandline(const QString &program, const QStringList &arguments)
{
QString programName = program;
if (!programName.startsWith("\"") && !programName.endsWith("\"") && programName.contains(" "))
programName = "\"" + programName + "\"";
programName.replace("/", "\\");
QString args;
// add the prgram as the first arrg ... it works better
args = programName + " ";
for (int i=0; i<arguments.size(); ++i) {
QString tmp = arguments.at(i);
// in the case of \" already being in the string the \ must also be escaped
tmp.replace( "\\\"", "\\\\\"" );
// escape a single " because the arguments will be parsed
tmp.replace( "\"", "\\\"" );
if (tmp.isEmpty() || tmp.contains(' ') || tmp.contains('\t')) {
// The argument must not end with a \ since this would be interpreted
// as escaping the quote -- rather put the \ behind the quote: e.g.
// rather use "foo"\ than "foo\"
QString endQuote("\"");
int i = tmp.length();
while (i>0 && tmp.at(i-1) == '\\') {
--i;
endQuote += "\\";
}
args += QString(" \"") + tmp.left(i) + endQuote;
} else {
args += ' ' + tmp;
}
}
return args;
}
/*!
Creates a QByteArray of the \a environment.
*/
static QByteArray qt_create_environment(const QStringList &environment)
{
QByteArray envlist;
if (environment.isEmpty())
return envlist;
int pos = 0;
// add PATH if necessary (for DLL loading)
QByteArray path = qgetenv("PATH");
if (environment.filter(QRegExp("^PATH=",Qt::CaseInsensitive)).isEmpty() && !path.isNull()) {
QString tmp = QString(QLatin1String("PATH=%1")).arg(QString::fromLocal8Bit(path));
uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
envlist.resize(envlist.size() + tmpSize);
memcpy(envlist.data() + pos, tmp.utf16(), tmpSize);
pos += tmpSize;
}
// add the user environment
foreach (const QString &tmp, environment) {
uint tmpSize = sizeof(wchar_t) * (tmp.length() + 1);
envlist.resize(envlist.size() + tmpSize);
memcpy(envlist.data() + pos, tmp.utf16(), tmpSize);
pos += tmpSize;
}
// add the 2 terminating 0 (actually 4, just to be on the safe side)
envlist.resize(envlist.size() + 4);
envlist[pos++] = 0;
envlist[pos++] = 0;
envlist[pos++] = 0;
envlist[pos++] = 0;
return envlist;
}
/*!
Executes the command described in \a arguments, in the
environment inherited from the parent process, with the
\a additionalEnv settings applied.
\a removeEnv removes the specified environment variables from
the environment of the executed process.
Returns the exit value of the process, or -1 if the command could
not be executed.
This function uses _(w)spawnvpe to spawn a process by searching
through the PATH environment variable.
*/
int Environment::execute(QStringList arguments, const QStringList &additionalEnv, const QStringList &removeEnv)
{
#ifdef CONFIGURE_DEBUG_EXECUTE
qDebug() << "About to Execute: " << arguments;
qDebug() << " " << QDir::currentPath();
qDebug() << " " << additionalEnv;
qDebug() << " " << removeEnv;
#endif
// Create the full environment from the current environment and
// the additionalEnv strings, then remove all variables defined
// in removeEnv
QMap<QString, QString> fullEnvMap;
LPWSTR envStrings = GetEnvironmentStrings();
if (envStrings) {
int strLen = 0;
for (LPWSTR envString = envStrings; *(envString); envString += strLen + 1) {
strLen = int(wcslen(envString));
QString str = QString((const QChar*)envString, strLen);
if (!str.startsWith("=")) { // These are added by the system
int sepIndex = str.indexOf('=');
fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1));
}
}
}
FreeEnvironmentStrings(envStrings);
// Add additionalEnv variables
for (int i = 0; i < additionalEnv.count(); ++i) {
const QString &str = additionalEnv.at(i);
int sepIndex = str.indexOf('=');
fullEnvMap.insert(str.left(sepIndex).toUpper(), str.mid(sepIndex +1));
}
// Remove removeEnv variables
for (int j = 0; j < removeEnv.count(); ++j)
fullEnvMap.remove(removeEnv.at(j).toUpper());
// Add all variables to a QStringList
QStringList fullEnv;
QMapIterator<QString, QString> it(fullEnvMap);
while (it.hasNext()) {
it.next();
fullEnv += QString(it.key() + "=" + it.value());
}
// ----------------------------
QString program = arguments.takeAt(0);
QString args = qt_create_commandline(program, arguments);
QByteArray envlist = qt_create_environment(fullEnv);
DWORD exitCode = DWORD(-1);
PROCESS_INFORMATION procInfo;
memset(&procInfo, 0, sizeof(procInfo));
STARTUPINFO startInfo;
memset(&startInfo, 0, sizeof(startInfo));
startInfo.cb = sizeof(startInfo);
bool couldExecute = CreateProcess(0, (wchar_t*)args.utf16(),
0, 0, true, CREATE_UNICODE_ENVIRONMENT,
envlist.isEmpty() ? 0 : envlist.data(),
0, &startInfo, &procInfo);
if (couldExecute) {
WaitForSingleObject(procInfo.hProcess, INFINITE);
GetExitCodeProcess(procInfo.hProcess, &exitCode);
CloseHandle(procInfo.hThread);
CloseHandle(procInfo.hProcess);
}
if (exitCode == DWORD(-1)) {
switch(GetLastError()) {
case E2BIG:
cerr << "execute: Argument list exceeds 1024 bytes" << endl;
foreach (const QString &arg, arguments)
cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl;
break;
case ENOENT:
cerr << "execute: File or path is not found (" << program.toLocal8Bit().constData() << ")" << endl;
break;
case ENOEXEC:
cerr << "execute: Specified file is not executable or has invalid executable-file format (" << program.toLocal8Bit().constData() << ")" << endl;
break;
case ENOMEM:
cerr << "execute: Not enough memory is available to execute new process." << endl;
break;
default:
cerr << "execute: Unknown error" << endl;
foreach (const QString &arg, arguments)
cerr << " (" << arg.toLocal8Bit().constData() << ")" << endl;
break;
}
}
return exitCode;
}
/*!
Executes \a command with _popen() and returns the stdout of the command.
Taken from qmake's system() command.
*/
QString Environment::execute(const QString &command, int *returnCode)
{
QString output;
FILE *proc = _popen(command.toLatin1().constData(), "r");
char buff[256];
while (proc && !feof(proc)) {
int read_in = int(fread(buff, 1, 255, proc));
if (!read_in)
break;
buff[read_in] = '\0';
output += buff;
}
if (proc) {
int r = _pclose(proc);
if (returnCode)
*returnCode = r;
}
return output;
}
/*!
Copies the \a srcDir contents into \a destDir.
Returns true if copying was successful.
*/
bool Environment::cpdir(const QString &srcDir, const QString &destDir)
{
QString cleanSrcName = QDir::cleanPath(srcDir);
QString cleanDstName = QDir::cleanPath(destDir);
#ifdef CONFIGURE_DEBUG_CP_DIR
qDebug() << "Attempt to cpdir " << cleanSrcName << "->" << cleanDstName;
#endif
if(!QFile::exists(cleanDstName) && !QDir().mkpath(cleanDstName)) {
qDebug() << "cpdir: Failure to create " << cleanDstName;
return false;
}
bool result = true;
QDir dir = QDir(cleanSrcName);
QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
for (int i = 0; result && (i < allEntries.count()); ++i) {
QFileInfo entry = allEntries.at(i);
bool intermediate = true;
if (entry.isDir()) {
intermediate = cpdir(QString("%1/%2").arg(cleanSrcName).arg(entry.fileName()),
QString("%1/%2").arg(cleanDstName).arg(entry.fileName()));
} else {
QString destFile = QString("%1/%2").arg(cleanDstName).arg(entry.fileName());
#ifdef CONFIGURE_DEBUG_CP_DIR
qDebug() << "About to cp (file)" << entry.absoluteFilePath() << "->" << destFile;
#endif
QFile::remove(destFile);
intermediate = QFile::copy(entry.absoluteFilePath(), destFile);
SetFileAttributes((wchar_t*)destFile.utf16(), FILE_ATTRIBUTE_NORMAL);
}
if(!intermediate) {
qDebug() << "cpdir: Failure for " << entry.fileName() << entry.isDir();
result = false;
}
}
return result;
}
bool Environment::rmdir(const QString &name)
{
bool result = true;
QString cleanName = QDir::cleanPath(name);
QDir dir = QDir(cleanName);
QFileInfoList allEntries = dir.entryInfoList(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
for (int i = 0; result && (i < allEntries.count()); ++i) {
QFileInfo entry = allEntries.at(i);
if (entry.isDir()) {
result &= rmdir(entry.absoluteFilePath());
} else {
result &= QFile::remove(entry.absoluteFilePath());
}
}
result &= dir.rmdir(cleanName);
return result;
}
static QStringList splitPathList(const QString &path)
{
#if defined(Q_OS_WIN)
QRegExp splitReg(QStringLiteral("[;,]"));
#else
QRegExp splitReg(QStringLiteral("[:]"));
#endif
QStringList result = path.split(splitReg, QString::SkipEmptyParts);
const QStringList::iterator end = result.end();
for (QStringList::iterator it = result.begin(); it != end; ++it) {
// Remove any leading or trailing ", this is commonly used in the environment
// variables
if (it->startsWith('"'))
it->remove(0, 1);
if (it->endsWith('"'))
it->chop(1);
*it = QDir::cleanPath(*it);
if (it->endsWith(QLatin1Char('/')))
it->chop(1);
}
return result;
}
QString Environment::findFileInPaths(const QString &fileName, const QStringList &paths)
{
if (!paths.isEmpty()) {
QDir d;
const QChar separator = QDir::separator();
foreach (const QString &path, paths)
if (d.exists(path + separator + fileName))
return path;
}
return QString();
}
QStringList Environment::path()
{
return splitPathList(QString::fromLocal8Bit(qgetenv("PATH")));
}
static QStringList mingwPaths(const QString &mingwPath, const QString &pathName)
{
QStringList ret;
QDir mingwDir(mingwPath);
const QFileInfoList subdirs = mingwDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
for (int i = 0 ;i < subdirs.length(); ++i) {
const QFileInfo &fi = subdirs.at(i);
const QString name = fi.fileName();
if (name == pathName)
ret += fi.absoluteFilePath();
else if (name.contains(QLatin1String("mingw"))) {
ret += fi.absoluteFilePath() + QLatin1Char('/') + pathName;
}
}
return ret;
}
// Return MinGW location from "c:\mingw\bin" -> "c:\mingw"
static inline QString detectMinGW()
{
const QString gcc = QStandardPaths::findExecutable(QLatin1String("g++.exe"));
return gcc.isEmpty() ?
gcc : QFileInfo(QFileInfo(gcc).absolutePath()).absolutePath();
}
// Detect Direct X SDK up tp June 2010. Included in Windows Kit 8.
QString Environment::detectDirectXSdk()
{
const QByteArray directXSdkEnv = qgetenv("DXSDK_DIR");
if (directXSdkEnv.isEmpty())
return QString();
QString directXSdk = QDir::cleanPath(QString::fromLocal8Bit(directXSdkEnv));
if (directXSdk.endsWith(QLatin1Char('/')))
directXSdk.truncate(directXSdk.size() - 1);
return directXSdk;
}
QStringList Environment::headerPaths(Compiler compiler)
{
QStringList headerPaths;
if (compiler == CC_MINGW) {
const QString mingwPath = detectMinGW();
headerPaths = mingwPaths(mingwPath, QLatin1String("include"));
// Additional compiler paths
const QFileInfoList mingwConfigs = QDir(mingwPath + QLatin1String("/lib/gcc")).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
for (int i = 0; i < mingwConfigs.length(); ++i) {
const QDir mingwLibDir = mingwConfigs.at(i).absoluteFilePath();
foreach (const QFileInfo &version, mingwLibDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot))
headerPaths += version.absoluteFilePath() + QLatin1String("/include");
}
}
// MinGW: Although gcc doesn't care about INCLUDE, qmake automatically adds it via -I
headerPaths += splitPathList(QString::fromLocal8Bit(getenv("INCLUDE")));
// Add Direct X SDK for ANGLE
const QString directXSdk = detectDirectXSdk();
if (!directXSdk.isEmpty()) // Add Direct X SDK for ANGLE
headerPaths += directXSdk + QLatin1String("/include");
return headerPaths;
}
QStringList Environment::libraryPaths(Compiler compiler)
{
QStringList libraryPaths;
if (compiler == CC_MINGW) {
libraryPaths = mingwPaths(detectMinGW(), "lib");
}
// MinGW: Although gcc doesn't care about LIB, qmake automatically adds it via -L
libraryPaths += splitPathList(QString::fromLocal8Bit(qgetenv("LIB")));
// Add Direct X SDK for ANGLE
const QString directXSdk = detectDirectXSdk();
if (!directXSdk.isEmpty()) {
#ifdef Q_OS_WIN64
libraryPaths += directXSdk + QLatin1String("/lib/x64");
#else
libraryPaths += directXSdk + QLatin1String("/lib/x86");
#endif
}
return libraryPaths;
}
QT_END_NAMESPACE
| {
"content_hash": "fb476cdaf070acda6c2d359f6eb82169",
"timestamp": "",
"source": "github",
"line_count": 602,
"max_line_length": 192,
"avg_line_length": 36.49501661129568,
"alnum_prop": 0.6033682294037324,
"repo_name": "klim-iv/phantomjs-qt5",
"id": "81769aa043ce7e8da74736a4f1b97e7d71b13311",
"size": "23942",
"binary": false,
"copies": "3",
"ref": "refs/heads/qt5",
"path": "src/qt/qtbase/tools/configure/environment.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Assembly",
"bytes": "291913"
},
{
"name": "Awk",
"bytes": "3965"
},
{
"name": "C",
"bytes": "42431954"
},
{
"name": "C++",
"bytes": "128347641"
},
{
"name": "CSS",
"bytes": "778535"
},
{
"name": "CoffeeScript",
"bytes": "46367"
},
{
"name": "D",
"bytes": "1931"
},
{
"name": "Emacs Lisp",
"bytes": "8191"
},
{
"name": "IDL",
"bytes": "191984"
},
{
"name": "Java",
"bytes": "232840"
},
{
"name": "JavaScript",
"bytes": "16127527"
},
{
"name": "Objective-C",
"bytes": "10465655"
},
{
"name": "PHP",
"bytes": "1223"
},
{
"name": "Perl",
"bytes": "1296504"
},
{
"name": "Python",
"bytes": "5916339"
},
{
"name": "Ruby",
"bytes": "381483"
},
{
"name": "Shell",
"bytes": "1005210"
},
{
"name": "Smalltalk",
"bytes": "1308"
},
{
"name": "VimL",
"bytes": "3731"
},
{
"name": "XSLT",
"bytes": "50637"
}
],
"symlink_target": ""
} |
include ActionDispatch::TestProcess
FactoryGirl.define do
factory :feedback do
scheme_id 1
score 1
description "They provide good knowledge base"
end
end
| {
"content_hash": "8dc712a4bf5761cfecda5a077646a171",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 50,
"avg_line_length": 19,
"alnum_prop": 0.7485380116959064,
"repo_name": "bitzesty/scheme-finder-frontend",
"id": "9ff07ab6255332b0376d9d67abb80e4664f8e415",
"size": "171",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/factories/feedbacks.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "88964"
},
{
"name": "CoffeeScript",
"bytes": "14453"
},
{
"name": "HTML",
"bytes": "31049"
},
{
"name": "JavaScript",
"bytes": "6013"
},
{
"name": "Ruby",
"bytes": "69598"
}
],
"symlink_target": ""
} |
require 'spec_helper'
packages = [
'ntp'
]
dependencies = [
'cowsay',
'toilet',
'fortune-mod'
]
describe 'Packages' do
packages.each do |pkg|
describe package(pkg) do
it { should be_installed }
end
end
dependencies.each do |pkg|
describe package(pkg) do
it { should be_installed }
end
end
end
describe 'Files' do
describe file('/tmp/config') do
it { should exist }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 700 }
its(:content) do
should contain \
'### Files generated by Puppet, please do not edit manually'
end
end
describe file('/tmp/sysconfig') do
it { should exist }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
it { should be_mode 644 }
its(:content) do
should contain \
'### Files generated by Puppet, please do not edit manually'
end
end
end
| {
"content_hash": "d72dc33c73cffee253a1c6af3cd3f351",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 68,
"avg_line_length": 20.717391304347824,
"alnum_prop": 0.6107030430220357,
"repo_name": "Yueyehua/puppet_template",
"id": "1d608676f089b04587b95a83d312e359c8420049",
"size": "1543",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/integration/default/serverspec/default_spec.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "575"
},
{
"name": "Puppet",
"bytes": "5741"
},
{
"name": "Ruby",
"bytes": "2487"
}
],
"symlink_target": ""
} |
/*
* For comments regarding functions please see the header file.
*/
#include <sstream>
#include "guichan/exception.h"
#include "guichan/imagefont.h"
#include "guichan/image.h"
namespace gcn
{
ImageFont::ImageFont(const std::string& filename, const std::string& glyphs)
{
if (Image::_getImageLoader() == NULL)
{
throw GCN_EXCEPTION("I have no ImageLoader!");
}
ImageLoader* imageLoader = Image::_getImageLoader();
mFilename = filename;
Image::_getImageLoader()->prepare(filename);
Color separator = Image::_getImageLoader()->getPixel(0, 0);
int i = 0;
for (i=0; separator == imageLoader->getPixel(i, 0)
&& i < imageLoader->getWidth(); ++i)
{
}
if (i >= imageLoader->getWidth())
{
throw GCN_EXCEPTION("Corrupt image.");
}
int j = 0;
for (j = 0; j < imageLoader->getHeight(); ++j)
{
if (separator == imageLoader->getPixel(i, j))
{
break;
}
}
mHeight = j;
int x = 0, y = 0;
unsigned char k;
for (i=0; i < (int)glyphs.size(); ++i)
{
k = glyphs.at(i);
addGlyph(k, x, y, separator);
}
int w = imageLoader->getWidth();
int h = imageLoader->getHeight();
void* data = imageLoader->finalize();
mImage = new Image(data, w, h);
mRowSpacing = 0;
mGlyphSpacing = 0;
}
ImageFont::ImageFont(const std::string& filename, unsigned char glyphsFrom, unsigned char glyphsTo)
{
if (Image::_getImageLoader() == NULL)
{
throw GCN_EXCEPTION("I have no ImageLoader!");
}
ImageLoader* imageLoader = Image::_getImageLoader();
mFilename = filename;
Image::_getImageLoader()->prepare(filename);
Color separator = Image::_getImageLoader()->getPixel(0, 0);
int i = 0;
for (i=0; separator == imageLoader->getPixel(i, 0)
&& i < imageLoader->getWidth(); ++i)
{
}
if (i >= imageLoader->getWidth())
{
throw GCN_EXCEPTION("Corrupt image.");
}
int j = 0;
for (j = 0; j < imageLoader->getHeight(); ++j)
{
if (separator == imageLoader->getPixel(i, j))
{
break;
}
}
mHeight = j;
int x = 0, y = 0;
for (i=glyphsFrom; i<glyphsTo+1; i++)
{
addGlyph(i, x, y, separator);
}
int w = imageLoader->getWidth();
int h = imageLoader->getHeight();
void* data = imageLoader->finalize();
mImage = new Image(data, w, h);
mRowSpacing = 0;
mGlyphSpacing = 0;
}
ImageFont::~ImageFont()
{
Image::_getImageLoader()->free(mImage);
delete mImage;
}
int ImageFont::getWidth(unsigned char glyph) const
{
if (mGlyph[glyph].width == 0)
{
return mGlyph[(int)(' ')].width + mGlyphSpacing;
}
return mGlyph[glyph].width + mGlyphSpacing;
}
int ImageFont::getHeight() const
{
return mHeight + mRowSpacing;
}
int ImageFont::drawGlyph(Graphics* graphics, unsigned char glyph, int x, int y)
{
// This is needed for drawing the Glyph in the middle if we have spacing
int yoffset = getRowSpacing() >> 1;
if (mGlyph[glyph].width == 0)
{
graphics->drawRectangle(Rectangle(x, y + 1 + yoffset, mGlyph[(int)(' ')].width - 1,
mGlyph[(int)(' ')].height - 2));
return mGlyph[(int)(' ')].width + mGlyphSpacing;
}
graphics->drawImage(mImage, mGlyph[glyph].x, mGlyph[glyph].y, x,
y + yoffset, mGlyph[glyph].width, mGlyph[glyph].height);
return mGlyph[glyph].width + mGlyphSpacing;
}
void ImageFont::drawString(Graphics* graphics, const std::string& text, int x, int y)
{
unsigned int i;
for (i = 0; i< text.size(); ++i)
{
drawGlyph(graphics, text.at(i), x, y);
x += getWidth(text.at(i));
}
}
void ImageFont::setRowSpacing(int spacing)
{
mRowSpacing = spacing;
}
int ImageFont::getRowSpacing()
{
return mRowSpacing;
}
void ImageFont::setGlyphSpacing(int spacing)
{
mGlyphSpacing = spacing;
}
int ImageFont::getGlyphSpacing()
{
return mGlyphSpacing;
}
void ImageFont::addGlyph(unsigned char c, int &x,
int &y, const Color& separator)
{
ImageLoader* il = Image::_getImageLoader();
Color color;
do
{
++x;
if (x >= il->getWidth())
{
y += mHeight + 1;
x = 0;
if (y >= il->getHeight())
{
std::string str;
std::ostringstream os(str);
os << "Image ";
os << mFilename;
os << " with font is corrupt near character '";
os << c;
os << "'";
throw GCN_EXCEPTION(os.str());
}
}
color = il->getPixel(x, y);
} while (color == separator);
int w = 0;
do
{
++w;
if (x+w >= il->getWidth())
{
std::string str;
std::ostringstream os(str);
os << "Image ";
os << mFilename;
os << " with font is corrupt near character '";
os << c;
os << "'";
throw GCN_EXCEPTION(os.str());
}
color = il->getPixel(x + w, y);
} while (color != separator);
mGlyph[c] = Rectangle(x, y, w, mHeight);
x += w;
}
int ImageFont::getWidth(const std::string& text) const
{
unsigned int i;
int size = 0;
for (i = 0; i < text.size(); ++i)
{
size += getWidth(text.at(i));
}
return size;
}
int ImageFont::getStringIndexAt(const std::string& text, int x)
{
unsigned int i;
int size = 0;
for (i = 0; i < text.size(); ++i)
{
size += getWidth(text.at(i));
if (size > x)
{
return i;
}
}
return text.size();
}
}
| {
"content_hash": "19471e0ada1e688fb2715cf0cf4f877c",
"timestamp": "",
"source": "github",
"line_count": 275,
"max_line_length": 103,
"avg_line_length": 26.592727272727274,
"alnum_prop": 0.42444961028305755,
"repo_name": "k1643/StratagusAI",
"id": "52f22af4fe6c762bbd634f142686a3b72eed12c1",
"size": "11038",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "engine/code/src/guichan/imagefont.cpp",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1471691"
},
{
"name": "C++",
"bytes": "4010215"
},
{
"name": "Java",
"bytes": "810158"
},
{
"name": "Lua",
"bytes": "4050"
},
{
"name": "Objective-C",
"bytes": "111499"
},
{
"name": "Python",
"bytes": "105086"
},
{
"name": "Shell",
"bytes": "2476"
}
],
"symlink_target": ""
} |
FROM balenalib/up-board-fedora:34-run
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
RUN dnf install -y \
python3-pip \
python3-dbus \
&& dnf clean all
# install "virtualenv", since the vast majority of users of this image will want it
RUN pip3 install -U --no-cache-dir --ignore-installed pip setuptools \
&& pip3 install --no-cache-dir virtualenv
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'As of January 1st, 2020, Python 2 was end-of-life, we will change the latest tag for Balenalib Python base image to Python 3.x and drop support for Python 2 soon. So after 1st July, 2020, all the balenalib Python latest tag will point to the latest Python 3 version and no changes, or fixes will be made to balenalib Python 2 base image. If you are using Python 2 for your application, please upgrade to Python 3 before 1st July.' > /.balena/messages/python-deprecation-warnin
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: Intel 64-bit (x86-64) \nOS: Fedora 34 \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.8.6, Pip v20.3.1, Setuptools v51.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo $'#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | {
"content_hash": "df21e1d9ff337de065f33806ade641f3",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 720,
"avg_line_length": 78.19354838709677,
"alnum_prop": 0.7322607260726073,
"repo_name": "nghiant2710/base-images",
"id": "0c546909f32cbf9a9c27d50778984c5366b4c460",
"size": "2445",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/python/up-board/fedora/34/3.8.6/run/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "144558581"
},
{
"name": "JavaScript",
"bytes": "16316"
},
{
"name": "Shell",
"bytes": "368690"
}
],
"symlink_target": ""
} |
define(['marionette',
'./footerTemplate.hbs'], function(Marionette, FooterTemplate){
var FooterView = Marionette.LayoutView.extend({
template: FooterTemplate
});
return FooterView;
});
| {
"content_hash": "28bb453e3c771fd846ce6844ee3341bc",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 63,
"avg_line_length": 19.4,
"alnum_prop": 0.7319587628865979,
"repo_name": "UDA-EJIE/uda-rup",
"id": "5ec6d6a2a888f6c6df44c416242459552d452862",
"size": "195",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "demo/app/shared/footer/footerView.js",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
#ifndef DeviceMotionEvent_h
#define DeviceMotionEvent_h
#include "Event.h"
namespace WebCore {
class DeviceMotionData;
class DeviceMotionEvent : public Event {
public:
~DeviceMotionEvent();
static PassRefPtr<DeviceMotionEvent> create()
{
return adoptRef(new DeviceMotionEvent);
}
static PassRefPtr<DeviceMotionEvent> create(const AtomicString& eventType, DeviceMotionData* deviceMotionData)
{
return adoptRef(new DeviceMotionEvent(eventType, deviceMotionData));
}
void initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceMotionData*);
DeviceMotionData* deviceMotionData() const { return m_deviceMotionData.get(); }
virtual EventInterface eventInterface() const override;
private:
DeviceMotionEvent();
DeviceMotionEvent(const AtomicString& eventType, DeviceMotionData*);
RefPtr<DeviceMotionData> m_deviceMotionData;
};
} // namespace WebCore
#endif // DeviceMotionEvent_h
| {
"content_hash": "8f9ea15c55006735ae3fc5fa1f8dc2d2",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 114,
"avg_line_length": 25.256410256410255,
"alnum_prop": 0.7532994923857868,
"repo_name": "aosm/WebCore",
"id": "f7080228652c7689b1eb74bf46e02485eeb6142d",
"size": "2316",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "dom/DeviceMotionEvent.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Assembly",
"bytes": "3242"
},
{
"name": "C",
"bytes": "3457587"
},
{
"name": "C++",
"bytes": "37868918"
},
{
"name": "CSS",
"bytes": "121894"
},
{
"name": "JavaScript",
"bytes": "131375"
},
{
"name": "Objective-C",
"bytes": "392661"
},
{
"name": "Objective-C++",
"bytes": "2868092"
},
{
"name": "Perl",
"bytes": "643657"
},
{
"name": "Python",
"bytes": "39670"
},
{
"name": "Ruby",
"bytes": "2718"
},
{
"name": "Shell",
"bytes": "12541"
}
],
"symlink_target": ""
} |
package org.spongepowered.api.entity.living.animal;
/**
* Represents a Pig.
*/
public interface Pig extends Animal {
}
| {
"content_hash": "90a3d50110be0c11f7bafa6f54146964",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 51,
"avg_line_length": 13.777777777777779,
"alnum_prop": 0.717741935483871,
"repo_name": "gabizou/SpongeAPI",
"id": "06c95222c0d99c431ff4c0f959c0350ff5339281",
"size": "1374",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "src/main/java/org/spongepowered/api/entity/living/animal/Pig.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "3241918"
},
{
"name": "Shell",
"bytes": "77"
}
],
"symlink_target": ""
} |
import os
import glob
import atexit
import random
import shutil
import string
import tempfile
from unittest import mock
import pytest
from libcloud.storage.drivers.local import LocalStorageDriver
def make_tmp_file(content=None):
content = content or b"1"
fd, path = tempfile.mkstemp()
with os.fdopen(fd, "wb") as fp:
fp.write(content)
return path
def clean_up_lock_files():
for file_path in glob.glob("/tmp/*.lock"):
os.remove(file_path)
# fmt: off
@pytest.mark.parametrize(
"object_count",
[
100,
1000,
10000,
10000,
100000,
],
ids=[
"100",
"1000",
"10k",
"100k",
"1mil",
],
)
@pytest.mark.parametrize(
"sort_objects",
[
True,
False,
],
ids=[
"sort_objects",
"no_sort",
],
)
# fmt: on
def test_list_objects_with_filtering(benchmark, object_count, sort_objects):
"""
Micro benchmark which measures how long list_container_objects takes with a lot of objects.
NOTE: To avoid issues with tons of lock files laying around we don't use locking for this
benchmark since we are not woried about race conditions and we don't benchmark locking
scenario.
"""
base_path = tempfile.mkdtemp()
def clean_up_base_path():
if os.path.exists(base_path):
shutil.rmtree(base_path)
atexit.register(clean_up_base_path)
atexit.register(clean_up_lock_files)
driver = LocalStorageDriver(base_path, ex_use_locking=False)
def run_benchmark():
objects = driver.list_container_objects(container=container)
assert len(objects) == object_count
return objects
# 1. Create mock objects
container = driver.create_container("test_container_1")
tmppath = make_tmp_file()
for index in range(0, object_count):
# To actually exercise overhead of sorting we use random objects name and not sequential
# pre-sorted object names
name = "".join(random.choices(string.ascii_uppercase + string.digits, k=10))
obj = container.upload_object(tmppath, name)
assert obj.name == name
# 2. Run the actual benchmark
try:
if sort_objects:
result = benchmark(run_benchmark)
else:
with mock.patch("libcloud.storage.drivers.local.sorted", lambda values, key: values):
result = benchmark(run_benchmark)
assert len(result) == object_count
finally:
clean_up_base_path()
clean_up_lock_files()
| {
"content_hash": "5ea7416d2acaec36f415c03223ec201d",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 97,
"avg_line_length": 24.339622641509433,
"alnum_prop": 0.6236434108527131,
"repo_name": "apache/libcloud",
"id": "9425cb43e81c681a7c187c2d8cc24c9d9db273f0",
"size": "3362",
"binary": false,
"copies": "2",
"ref": "refs/heads/trunk",
"path": "libcloud/test/benchmarks/test_list_objects_filtering_performance.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "2155"
},
{
"name": "HTML",
"bytes": "2545"
},
{
"name": "PowerShell",
"bytes": "410"
},
{
"name": "Python",
"bytes": "9105547"
},
{
"name": "Shell",
"bytes": "12994"
}
],
"symlink_target": ""
} |
package tw.kewang.cwb.utils;
public class Constants {
public static final String NOT_FOUND = "找不到資料";
public static final int ONE_HOUR = 60 * 60 * 1000;
}
| {
"content_hash": "7b0c721105d0ca6cdbb6b43629a77521",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 54,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.6951219512195121,
"repo_name": "kewang/cwb-lib-java",
"id": "ca6a26aa7286cc04ee2eb3dce3c2c394db47ec43",
"size": "174",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/tw/kewang/cwb/utils/Constants.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "40927"
}
],
"symlink_target": ""
} |
<?php
namespace Cerad\Bundle\TournBundle\Controller\Schedule;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Cerad\Bundle\TournBundle\Controller\BaseController as MyBaseController;
class ScheduleOfficialListController extends MyBaseController
{
const SESSION_SCHEDULE_OFFICIAL_SEARCH = 'scheduleOfficialSearch';
/* =====================================================
* Wanted to just use GET but the dates mess up
* Use the session trick for now
*/
public function listAction(Request $request, $_format = 'html')
{
// The search model
$model = $this->getModel($request);
// The form stuff
$searchFormType = $this->get('cerad_tourn.schedule_official_search.form_type');
$searchForm = $this->createForm($searchFormType,$model);
$searchForm->handleRequest($request);
if ($searchForm->isValid()) // GET Request
{
$modelPosted = $searchForm->getData();
$request->getSession()->set(self::SESSION_SCHEDULE_OFFICIAL_SEARCH,$modelPosted);
return $this->redirect('cerad_tourn_schedule_official_list');
}
// Hack in levels for now
$levelRepo = $this->get('cerad_level.level_repository');
$levelKeys = $levelRepo->queryKeys($model);
if (count($levelKeys))
{
$model['levels'] = $levelKeys;
}
// Query for the games
$gameRepo = $this->get('cerad_game.game_repository');
$games = $gameRepo->queryGameSchedule($model);
// Spreadsheet
if ($_format == 'xls')
{
$export = $this->get('cerad_tourn.schedule_official.export_xls');
$response = new Response($export->generate($games));
$outFileName = 'RefSched' . date('YmdHi') . '.xls';
$response->headers->set('Content-Type', 'application/vnd.ms-excel');
$response->headers->set('Content-Disposition', sprintf('attachment; filename="%s"',$outFileName));
return $response;
}
// csv processing
if ($_format == 'csv')
{
$export = $this->get('cerad_tourn.schedule_official.export_csv');
$response = new Response($export->generate($games));
$outFileName = 'RefSched' . date('YmdHi') . '.csv';
$response->headers->set('Content-Type', 'text/csv;');
$response->headers->set('Content-Disposition', sprintf('attachment; filename="%s"',$outFileName));
return $response;
}
// And render
$tplData = array();
$tplData['searchForm'] = $searchForm->createView();
$tplData['games'] = $games;
$tplData['isAdmin'] = $this->hasRoleAdmin();
$tplData['project'] = $this->getProject();
return $this->render($request->get('_template'),$tplData);
}
public function getModel(Request $request)
{
$model = array();
$project = $this->getProject();
$model['projects'] = array($project->getId());
$model['teams' ] = array();
$model['fields'] = array();
$searches = $project->getSearches();
//unset($searches['levels']);
//unset($searches['fields']);
//echo implode(',',array_keys($searches)); die();
foreach($searches as $name => $search)
{
$model[$name] = $search['default']; // Array of defaults
}
//print_r($model['searches']); die();
// Merge form session
$session = $request->getSession();
if ($session->has(self::SESSION_SCHEDULE_OFFICIAL_SEARCH))
{
$modelSession = $session->get(self::SESSION_SCHEDULE_OFFICIAL_SEARCH);
$model = array_merge($model,$modelSession);
}
// Do this after merge, otherwise changes get overwritten
$model['searches'] = $searches;
// Done
return $model;
}
}
| {
"content_hash": "b967ee082d98185ae947494882ecc67f",
"timestamp": "",
"source": "github",
"line_count": 117,
"max_line_length": 110,
"avg_line_length": 35.333333333333336,
"alnum_prop": 0.5483792936623125,
"repo_name": "cerad/cerad2",
"id": "e7bbf790c42e9baa61f01420f5421a792f9120aa",
"size": "4134",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/Cerad/Bundle/TournBundle/Controller/Schedule/ScheduleOfficialListController.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "2614"
},
{
"name": "PHP",
"bytes": "1279235"
},
{
"name": "Shell",
"bytes": "188"
}
],
"symlink_target": ""
} |
package com.facebook.imagepipeline.producers;
import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Mockito.*;
import org.junit.*;
import org.junit.runner.*;
import org.mockito.*;
import org.robolectric.*;
@RunWith(RobolectricTestRunner.class)
public class BaseConsumerTest {
@Mock public Consumer mDelegatedConsumer;
private Object mResult;
private Object mResult2;
private Exception mException;
private BaseConsumer mBaseConsumer;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mResult = new Object();
mResult2 = new Object();
mException = new RuntimeException();
mBaseConsumer = new BaseConsumer() {
@Override
protected void onNewResultImpl(Object newResult, @Status int status) {
mDelegatedConsumer.onNewResult(newResult, status);
}
@Override
protected void onFailureImpl(Throwable t) {
mDelegatedConsumer.onFailure(t);
}
@Override
protected void onCancellationImpl() {
mDelegatedConsumer.onCancellation();
}
};
}
@Test
public void testOnNewResultDoesNotThrow() {
doThrow(new RuntimeException())
.when(mDelegatedConsumer)
.onNewResult(anyObject(), anyInt());
mBaseConsumer.onNewResult(mResult, 0);
verify(mDelegatedConsumer).onNewResult(mResult, 0);
}
@Test
public void testOnFailureDoesNotThrow() {
doThrow(new RuntimeException())
.when(mDelegatedConsumer)
.onFailure(any(Throwable.class));
mBaseConsumer.onFailure(mException);
verify(mDelegatedConsumer).onFailure(mException);
}
@Test
public void testOnCancellationDoesNotThrow() {
doThrow(new RuntimeException())
.when(mDelegatedConsumer)
.onCancellation();
mBaseConsumer.onCancellation();
verify(mDelegatedConsumer).onCancellation();
}
@Test
public void testDoesNotForwardAfterFinalResult() {
mBaseConsumer.onNewResult(mResult, Consumer.IS_LAST);
mBaseConsumer.onFailure(mException);
mBaseConsumer.onCancellation();
verify(mDelegatedConsumer).onNewResult(mResult, Consumer.IS_LAST);
verifyNoMoreInteractions(mDelegatedConsumer);
}
@Test
public void testDoesNotForwardAfterOnFailure() {
mBaseConsumer.onFailure(mException);
mBaseConsumer.onNewResult(mResult, Consumer.IS_LAST);
mBaseConsumer.onCancellation();
verify(mDelegatedConsumer).onFailure(mException);
verifyNoMoreInteractions(mDelegatedConsumer);
}
@Test
public void testDoesNotForwardAfterOnCancellation() {
mBaseConsumer.onCancellation();
mBaseConsumer.onNewResult(mResult, Consumer.IS_LAST);
mBaseConsumer.onFailure(mException);
verify(mDelegatedConsumer).onCancellation();
verifyNoMoreInteractions(mDelegatedConsumer);
}
@Test
public void testDoesForwardAfterIntermediateResult() {
mBaseConsumer.onNewResult(mResult, 0);
mBaseConsumer.onNewResult(mResult2, Consumer.IS_LAST);
verify(mDelegatedConsumer).onNewResult(mResult2, Consumer.IS_LAST);
}
@Test
public void testIsLast() {
assertThat(BaseConsumer.isLast(Consumer.IS_LAST)).isTrue();
assertThat(BaseConsumer.isLast(Consumer.NO_FLAGS)).isFalse();
}
@Test
public void testIsNotLast() {
assertThat(BaseConsumer.isNotLast(Consumer.IS_LAST)).isFalse();
assertThat(BaseConsumer.isNotLast(Consumer.NO_FLAGS)).isTrue();
}
@Test
public void testTurnOnStatusFlag() {
int turnedOn = BaseConsumer.turnOnStatusFlag(Consumer.NO_FLAGS, Consumer.IS_LAST);
assertThat(BaseConsumer.isLast(turnedOn)).isTrue();
}
@Test
public void testTurnOffStatusFlag() {
int turnedOff = BaseConsumer.turnOffStatusFlag(Consumer.IS_LAST, Consumer.IS_LAST);
assertThat(BaseConsumer.isNotLast(turnedOff)).isTrue();
}
@Test
public void testStatusHasFlag() {
assertThat(BaseConsumer
.statusHasFlag(Consumer.IS_PLACEHOLDER | Consumer.IS_LAST, Consumer.IS_PLACEHOLDER))
.isTrue();
assertThat(BaseConsumer
.statusHasFlag(Consumer.DO_NOT_CACHE_ENCODED | Consumer.IS_LAST, Consumer.IS_PLACEHOLDER))
.isFalse();
}
@Test
public void testStatusHasAnyFlag() {
assertThat(BaseConsumer
.statusHasAnyFlag(
Consumer.IS_PLACEHOLDER | Consumer.IS_LAST,
Consumer.IS_PLACEHOLDER | Consumer.DO_NOT_CACHE_ENCODED))
.isTrue();
assertThat(BaseConsumer
.statusHasAnyFlag(
Consumer.IS_PLACEHOLDER | Consumer.IS_LAST,
Consumer.IS_PARTIAL_RESULT | Consumer.DO_NOT_CACHE_ENCODED))
.isFalse();
}
}
| {
"content_hash": "23b1a8fa51097ed3184f0d7140590115",
"timestamp": "",
"source": "github",
"line_count": 155,
"max_line_length": 98,
"avg_line_length": 29.638709677419357,
"alnum_prop": 0.7185459294732259,
"repo_name": "MaTriXy/fresco",
"id": "d82135163d89034a7a55714c3490f79bfd7d706e",
"size": "4901",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "imagepipeline/src/test/java/com/facebook/imagepipeline/producers/BaseConsumerTest.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "29963"
},
{
"name": "C++",
"bytes": "216192"
},
{
"name": "IDL",
"bytes": "1035"
},
{
"name": "Java",
"bytes": "2841741"
},
{
"name": "Makefile",
"bytes": "6897"
},
{
"name": "Prolog",
"bytes": "153"
},
{
"name": "Python",
"bytes": "10351"
},
{
"name": "Shell",
"bytes": "102"
}
],
"symlink_target": ""
} |
#pragma once
#include <aws/config/ConfigService_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace ConfigService
{
namespace Model
{
/**
* <p>Filters the results based on the account IDs and regions.</p><p><h3>See
* Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/config-2014-11-12/ConfigRuleComplianceSummaryFilters">AWS
* API Reference</a></p>
*/
class AWS_CONFIGSERVICE_API ConfigRuleComplianceSummaryFilters
{
public:
ConfigRuleComplianceSummaryFilters();
ConfigRuleComplianceSummaryFilters(Aws::Utils::Json::JsonView jsonValue);
ConfigRuleComplianceSummaryFilters& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The 12-digit account ID of the source account.</p>
*/
inline const Aws::String& GetAccountId() const{ return m_accountId; }
/**
* <p>The 12-digit account ID of the source account.</p>
*/
inline bool AccountIdHasBeenSet() const { return m_accountIdHasBeenSet; }
/**
* <p>The 12-digit account ID of the source account.</p>
*/
inline void SetAccountId(const Aws::String& value) { m_accountIdHasBeenSet = true; m_accountId = value; }
/**
* <p>The 12-digit account ID of the source account.</p>
*/
inline void SetAccountId(Aws::String&& value) { m_accountIdHasBeenSet = true; m_accountId = std::move(value); }
/**
* <p>The 12-digit account ID of the source account.</p>
*/
inline void SetAccountId(const char* value) { m_accountIdHasBeenSet = true; m_accountId.assign(value); }
/**
* <p>The 12-digit account ID of the source account.</p>
*/
inline ConfigRuleComplianceSummaryFilters& WithAccountId(const Aws::String& value) { SetAccountId(value); return *this;}
/**
* <p>The 12-digit account ID of the source account.</p>
*/
inline ConfigRuleComplianceSummaryFilters& WithAccountId(Aws::String&& value) { SetAccountId(std::move(value)); return *this;}
/**
* <p>The 12-digit account ID of the source account.</p>
*/
inline ConfigRuleComplianceSummaryFilters& WithAccountId(const char* value) { SetAccountId(value); return *this;}
/**
* <p>The source region where the data is aggregated.</p>
*/
inline const Aws::String& GetAwsRegion() const{ return m_awsRegion; }
/**
* <p>The source region where the data is aggregated.</p>
*/
inline bool AwsRegionHasBeenSet() const { return m_awsRegionHasBeenSet; }
/**
* <p>The source region where the data is aggregated.</p>
*/
inline void SetAwsRegion(const Aws::String& value) { m_awsRegionHasBeenSet = true; m_awsRegion = value; }
/**
* <p>The source region where the data is aggregated.</p>
*/
inline void SetAwsRegion(Aws::String&& value) { m_awsRegionHasBeenSet = true; m_awsRegion = std::move(value); }
/**
* <p>The source region where the data is aggregated.</p>
*/
inline void SetAwsRegion(const char* value) { m_awsRegionHasBeenSet = true; m_awsRegion.assign(value); }
/**
* <p>The source region where the data is aggregated.</p>
*/
inline ConfigRuleComplianceSummaryFilters& WithAwsRegion(const Aws::String& value) { SetAwsRegion(value); return *this;}
/**
* <p>The source region where the data is aggregated.</p>
*/
inline ConfigRuleComplianceSummaryFilters& WithAwsRegion(Aws::String&& value) { SetAwsRegion(std::move(value)); return *this;}
/**
* <p>The source region where the data is aggregated.</p>
*/
inline ConfigRuleComplianceSummaryFilters& WithAwsRegion(const char* value) { SetAwsRegion(value); return *this;}
private:
Aws::String m_accountId;
bool m_accountIdHasBeenSet;
Aws::String m_awsRegion;
bool m_awsRegionHasBeenSet;
};
} // namespace Model
} // namespace ConfigService
} // namespace Aws
| {
"content_hash": "90258cb5bd73031f4a5b331f783a09c1",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 130,
"avg_line_length": 31.392307692307693,
"alnum_prop": 0.6701788777260476,
"repo_name": "jt70471/aws-sdk-cpp",
"id": "3f74237f1f51f135e8f84d1fe46e52223c8ba894",
"size": "4200",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "aws-cpp-sdk-config/include/aws/config/model/ConfigRuleComplianceSummaryFilters.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "13452"
},
{
"name": "C++",
"bytes": "278594037"
},
{
"name": "CMake",
"bytes": "653931"
},
{
"name": "Dockerfile",
"bytes": "5555"
},
{
"name": "HTML",
"bytes": "4471"
},
{
"name": "Java",
"bytes": "302182"
},
{
"name": "Python",
"bytes": "110380"
},
{
"name": "Shell",
"bytes": "4674"
}
],
"symlink_target": ""
} |
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | {
"content_hash": "ea89acbcf859a31b3c65ab3b4cad19cc",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 68,
"avg_line_length": 68,
"alnum_prop": 0.6764705882352942,
"repo_name": "nate63179/downer",
"id": "8d075800569043102220ab6458100a883394131c",
"size": "68",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/downer/generator_spec.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "27090"
}
],
"symlink_target": ""
} |
"""Simple tools to query github.com and gather stats about issues.
Thanks to the IPython team for developing this!
python github_stats.py --milestone 2.0 --since-tag rel-1.0.0
"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from __future__ import print_function
import codecs
import sys
from argparse import ArgumentParser
from datetime import datetime, timedelta
from subprocess import check_output
from gh_api import (
get_paged_request, make_auth_header, get_pull_request, is_pull_request,
get_milestone_id, get_issues_list, get_authors,
)
#-----------------------------------------------------------------------------
# Globals
#-----------------------------------------------------------------------------
ISO8601 = "%Y-%m-%dT%H:%M:%SZ"
PER_PAGE = 100
#-----------------------------------------------------------------------------
# Functions
#-----------------------------------------------------------------------------
def round_hour(dt):
return dt.replace(minute=0,second=0,microsecond=0)
def _parse_datetime(s):
"""Parse dates in the format returned by the Github API."""
if s:
return datetime.strptime(s, ISO8601)
else:
return datetime.fromtimestamp(0)
def issues2dict(issues):
"""Convert a list of issues to a dict, keyed by issue number."""
idict = {}
for i in issues:
idict[i['number']] = i
return idict
def split_pulls(all_issues, project="arokem/python-matlab-bridge"):
"""split a list of closed issues into non-PR Issues and Pull Requests"""
pulls = []
issues = []
for i in all_issues:
if is_pull_request(i):
pull = get_pull_request(project, i['number'], auth=True)
pulls.append(pull)
else:
issues.append(i)
return issues, pulls
def issues_closed_since(period=timedelta(days=365), project="arokem/python-matlab-bridge", pulls=False):
"""Get all issues closed since a particular point in time. period
can either be a datetime object, or a timedelta object. In the
latter case, it is used as a time before the present.
"""
which = 'pulls' if pulls else 'issues'
if isinstance(period, timedelta):
since = round_hour(datetime.utcnow() - period)
else:
since = period
url = "https://api.github.com/repos/%s/%s?state=closed&sort=updated&since=%s&per_page=%i" % (project, which, since.strftime(ISO8601), PER_PAGE)
allclosed = get_paged_request(url, headers=make_auth_header())
filtered = [ i for i in allclosed if _parse_datetime(i['closed_at']) > since ]
if pulls:
filtered = [ i for i in filtered if _parse_datetime(i['merged_at']) > since ]
# filter out PRs not against master (backports)
filtered = [ i for i in filtered if i['base']['ref'] == 'master' ]
else:
filtered = [ i for i in filtered if not is_pull_request(i) ]
return filtered
def sorted_by_field(issues, field='closed_at', reverse=False):
"""Return a list of issues sorted by closing date date."""
return sorted(issues, key = lambda i:i[field], reverse=reverse)
def report(issues, show_urls=False):
"""Summary report about a list of issues, printing number and title.
"""
# titles may have unicode in them, so we must encode everything below
if show_urls:
for i in issues:
role = 'ghpull' if 'merged_at' in i else 'ghissue'
print(u'* :%s:`%d`: %s' % (role, i['number'],
i['title'].replace(u'`', u'``')))
else:
for i in issues:
print(u'* %d: %s' % (i['number'], i['title'].replace(u'`', u'``')))
#-----------------------------------------------------------------------------
# Main script
#-----------------------------------------------------------------------------
if __name__ == "__main__":
# deal with unicode
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
# Whether to add reST urls for all issues in printout.
show_urls = True
parser = ArgumentParser()
parser.add_argument('--since-tag', type=str,
help="The git tag to use for the starting point (typically the last major release)."
)
parser.add_argument('--milestone', type=str,
help="The GitHub milestone to use for filtering issues [optional]."
)
parser.add_argument('--days', type=int,
help="The number of days of data to summarize (use this or --since-tag)."
)
parser.add_argument('--project', type=str, default="arokem/python-matlab-bridge",
help="The project to summarize."
)
opts = parser.parse_args()
tag = opts.since_tag
# set `since` from days or git tag
if opts.days:
since = datetime.utcnow() - timedelta(days=opts.days)
else:
if not tag:
tag = check_output(['git', 'describe', '--abbrev=0']).strip()
cmd = ['git', 'log', '-1', '--format=%ai', tag]
tagday, tz = check_output(cmd).strip().rsplit(' ', 1)
since = datetime.strptime(tagday, "%Y-%m-%d %H:%M:%S")
h = int(tz[1:3])
m = int(tz[3:])
td = timedelta(hours=h, minutes=m)
if tz[0] == '-':
since += td
else:
since -= td
since = round_hour(since)
milestone = opts.milestone
project = opts.project
print("fetching GitHub stats since %s (tag: %s, milestone: %s)" % (since, tag, milestone), file=sys.stderr)
if milestone:
milestone_id = get_milestone_id(project=project, milestone=milestone,
auth=True)
issues_and_pulls = get_issues_list(project=project,
milestone=milestone_id,
state='closed',
auth=True,
)
issues, pulls = split_pulls(issues_and_pulls)
else:
issues = issues_closed_since(since, project=project, pulls=False)
pulls = issues_closed_since(since, project=project, pulls=True)
# For regular reports, it's nice to show them in reverse chronological order
issues = sorted_by_field(issues, reverse=True)
pulls = sorted_by_field(pulls, reverse=True)
n_issues, n_pulls = map(len, (issues, pulls))
n_total = n_issues + n_pulls
# Print summary report we can directly include into release notes.
print()
since_day = since.strftime("%Y/%m/%d")
today = datetime.today().strftime("%Y/%m/%d")
print("GitHub stats for %s - %s (tag: %s)" % (since_day, today, tag))
print()
print("These lists are automatically generated, and may be incomplete or contain duplicates.")
print()
ncommits = 0
all_authors = []
if tag:
# print git info, in addition to GitHub info:
since_tag = tag+'..'
cmd = ['git', 'log', '--oneline', since_tag]
ncommits += len(check_output(cmd).splitlines())
author_cmd = ['git', 'log', '--use-mailmap', "--format=* %aN", since_tag]
all_authors.extend(check_output(author_cmd).decode('utf-8', 'replace').splitlines())
pr_authors = []
for pr in pulls:
pr_authors.extend(get_authors(pr))
ncommits = len(pr_authors) + ncommits - len(pulls)
author_cmd = ['git', 'check-mailmap'] + pr_authors
with_email = check_output(author_cmd).decode('utf-8', 'replace').splitlines()
all_authors.extend([ u'* ' + a.split(' <')[0] for a in with_email ])
unique_authors = sorted(set(all_authors), key=lambda s: s.lower())
print("The following %i authors contributed %i commits." % (len(unique_authors), ncommits))
print()
print('\n'.join(unique_authors))
print()
print("We closed %d issues and merged %d pull requests;\n"
"this is the full list (generated with the script \n"
":file:`tools/github_stats.py`):" % (n_pulls, n_issues))
print()
print('Pull Requests (%d):\n' % n_pulls)
report(pulls, show_urls)
print()
print('Issues (%d):\n' % n_issues)
report(issues, show_urls)
| {
"content_hash": "49c3f4e5f91309cec641e04b7ce58592",
"timestamp": "",
"source": "github",
"line_count": 223,
"max_line_length": 147,
"avg_line_length": 36.44394618834081,
"alnum_prop": 0.5608465608465608,
"repo_name": "blink1073/python-matlab-bridge",
"id": "ba6e36707f728ac8fbce3d5c69ae5fbd46803e72",
"size": "8149",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "tools/github_stats.py",
"mode": "33261",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "4384"
},
{
"name": "Matlab",
"bytes": "31609"
},
{
"name": "Python",
"bytes": "60882"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.2.0
Version: 3.3.0
Author: KeenThemes
Website: http://www.keenthemes.com/
Contact: support@keenthemes.com
Follow: www.twitter.com/keenthemes
Like: www.facebook.com/keenthemes
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
-->
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8"/>
<title>Metronic | UI Features - Date Paginator</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta content="" name="description"/>
<meta content="" name="author"/>
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css"/>
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN DATE PAGINATOR PLUGIN -->
<link href="../../assets/global/plugins/bootstrap-datepicker/css/datepicker.css" rel="stylesheet" type="text/css"/>
<!-- END DATE PAGINATOR PLUGIN -->
<!-- BEGIN THEME STYLES -->
<link href="../../assets/global/css/components.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/css/plugins.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/admin/layout/css/layout.css" rel="stylesheet" type="text/css"/>
<link id="style_color" href="../../assets/admin/layout/css/themes/default.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/admin/layout/css/custom.css" rel="stylesheet" type="text/css"/>
<!-- END THEME STYLES -->
<link rel="shortcut icon" href="favicon.ico"/>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<!-- DOC: Apply "page-header-fixed-mobile" and "page-footer-fixed-mobile" class to body element to force fixed header or footer in mobile devices -->
<!-- DOC: Apply "page-sidebar-closed" class to the body and "page-sidebar-menu-closed" class to the sidebar menu element to hide the sidebar by default -->
<!-- DOC: Apply "page-sidebar-hide" class to the body to make the sidebar completely hidden on toggle -->
<!-- DOC: Apply "page-sidebar-closed-hide-logo" class to the body element to make the logo hidden on sidebar toggle -->
<!-- DOC: Apply "page-sidebar-hide" class to body element to completely hide the sidebar on sidebar toggle -->
<!-- DOC: Apply "page-sidebar-fixed" class to have fixed sidebar -->
<!-- DOC: Apply "page-footer-fixed" class to the body element to have fixed footer -->
<!-- DOC: Apply "page-sidebar-reversed" class to put the sidebar on the right side -->
<!-- DOC: Apply "page-full-width" class to the body element to have full width page without the sidebar menu -->
<body class="page-header-fixed page-quick-sidebar-over-content ">
<!-- BEGIN HEADER -->
<div class="page-header navbar navbar-fixed-top">
<!-- BEGIN HEADER INNER -->
<div class="page-header-inner">
<!-- BEGIN LOGO -->
<div class="page-logo">
<a href="index.html">
<img src="../../assets/admin/layout/img/logo.png" alt="logo" class="logo-default"/>
</a>
<div class="menu-toggler sidebar-toggler hide">
<!-- DOC: Remove the above "hide" to enable the sidebar toggler button on header -->
</div>
</div>
<!-- END LOGO -->
<!-- BEGIN RESPONSIVE MENU TOGGLER -->
<a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse">
</a>
<!-- END RESPONSIVE MENU TOGGLER -->
<!-- BEGIN TOP NAVIGATION MENU -->
<div class="top-menu">
<ul class="nav navbar-nav pull-right">
<!-- BEGIN NOTIFICATION DROPDOWN -->
<li class="dropdown dropdown-extended dropdown-notification" id="header_notification_bar">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-bell"></i>
<span class="badge badge-default">
7 </span>
</a>
<ul class="dropdown-menu">
<li>
<p>
You have 14 new notifications
</p>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 250px;">
<li>
<a href="#">
<span class="label label-sm label-icon label-success">
<i class="fa fa-plus"></i>
</span>
New user registered. <span class="time">
Just now </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
Server #12 overloaded. <span class="time">
15 mins </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-warning">
<i class="fa fa-bell-o"></i>
</span>
Server #2 not responding. <span class="time">
22 mins </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-info">
<i class="fa fa-bullhorn"></i>
</span>
Application error. <span class="time">
40 mins </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
Database overloaded 68%. <span class="time">
2 hrs </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
2 user IP blocked. <span class="time">
5 hrs </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-warning">
<i class="fa fa-bell-o"></i>
</span>
Storage Server #4 not responding. <span class="time">
45 mins </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-info">
<i class="fa fa-bullhorn"></i>
</span>
System Error. <span class="time">
55 mins </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
Database overloaded 68%. <span class="time">
2 hrs </span>
</a>
</li>
</ul>
</li>
<li class="external">
<a href="#">
See all notifications <i class="m-icon-swapright"></i>
</a>
</li>
</ul>
</li>
<!-- END NOTIFICATION DROPDOWN -->
<!-- BEGIN INBOX DROPDOWN -->
<li class="dropdown dropdown-extended dropdown-inbox" id="header_inbox_bar">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-envelope-open"></i>
<span class="badge badge-default">
4 </span>
</a>
<ul class="dropdown-menu">
<li>
<p>
You have 12 new messages
</p>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 250px;">
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout/img/avatar2.jpg" alt=""/>
</span>
<span class="subject">
<span class="from">
Lisa Wong </span>
<span class="time">
Just Now </span>
</span>
<span class="message">
Vivamus sed auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout/img/avatar3.jpg" alt=""/>
</span>
<span class="subject">
<span class="from">
Richard Doe </span>
<span class="time">
16 mins </span>
</span>
<span class="message">
Vivamus sed congue nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout/img/avatar1.jpg" alt=""/>
</span>
<span class="subject">
<span class="from">
Bob Nilson </span>
<span class="time">
2 hrs </span>
</span>
<span class="message">
Vivamus sed nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout/img/avatar2.jpg" alt=""/>
</span>
<span class="subject">
<span class="from">
Lisa Wong </span>
<span class="time">
40 mins </span>
</span>
<span class="message">
Vivamus sed auctor 40% nibh congue nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout/img/avatar3.jpg" alt=""/>
</span>
<span class="subject">
<span class="from">
Richard Doe </span>
<span class="time">
46 mins </span>
</span>
<span class="message">
Vivamus sed congue nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
</ul>
</li>
<li class="external">
<a href="inbox.html">
See all messages <i class="m-icon-swapright"></i>
</a>
</li>
</ul>
</li>
<!-- END INBOX DROPDOWN -->
<!-- BEGIN TODO DROPDOWN -->
<li class="dropdown dropdown-extended dropdown-tasks" id="header_task_bar">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-calendar"></i>
<span class="badge badge-default">
3 </span>
</a>
<ul class="dropdown-menu extended tasks">
<li>
<p>
You have 12 pending tasks
</p>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 250px;">
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
New release v1.2 </span>
<span class="percent">
30% </span>
</span>
<div class="progress">
<div style="width: 40%;" class="progress-bar progress-bar-success" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
40% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
Application deployment </span>
<span class="percent">
65% </span>
</span>
<div class="progress progress-striped">
<div style="width: 65%;" class="progress-bar progress-bar-danger" aria-valuenow="65" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
65% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
Mobile app release </span>
<span class="percent">
98% </span>
</span>
<div class="progress">
<div style="width: 98%;" class="progress-bar progress-bar-success" aria-valuenow="98" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
98% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
Database migration </span>
<span class="percent">
10% </span>
</span>
<div class="progress progress-striped">
<div style="width: 10%;" class="progress-bar progress-bar-warning" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
10% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
Web server upgrade </span>
<span class="percent">
58% </span>
</span>
<div class="progress progress-striped">
<div style="width: 58%;" class="progress-bar progress-bar-info" aria-valuenow="58" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
58% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
Mobile development </span>
<span class="percent">
85% </span>
</span>
<div class="progress progress-striped">
<div style="width: 85%;" class="progress-bar progress-bar-success" aria-valuenow="85" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
85% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
New UI release </span>
<span class="percent">
18% </span>
</span>
<div class="progress progress-striped">
<div style="width: 18%;" class="progress-bar progress-bar-important" aria-valuenow="18" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
18% Complete
</div>
</div>
</div>
</a>
</li>
</ul>
</li>
<li class="external">
<a href="page_todo.html">
See all tasks <i class="icon-arrow-right"></i>
</a>
</li>
</ul>
</li>
<!-- END TODO DROPDOWN -->
<!-- BEGIN USER LOGIN DROPDOWN -->
<li class="dropdown dropdown-user">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<img alt="" class="img-circle hide1" src="../../assets/admin/layout/img/avatar3_small.jpg"/>
<span class="username username-hide-on-mobile">
Nick </span>
<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu">
<li>
<a href="extra_profile.html">
<i class="icon-user"></i> My Profile </a>
</li>
<li>
<a href="page_calendar.html">
<i class="icon-calendar"></i> My Calendar </a>
</li>
<li>
<a href="inbox.html">
<i class="icon-envelope-open"></i> My Inbox <span class="badge badge-danger">
3 </span>
</a>
</li>
<li>
<a href="page_todo.html">
<i class="icon-rocket"></i> My Tasks <span class="badge badge-success">
7 </span>
</a>
</li>
<li class="divider">
</li>
<li>
<a href="extra_lock.html">
<i class="icon-lock"></i> Lock Screen </a>
</li>
<li>
<a href="login.html">
<i class="icon-key"></i> Log Out </a>
</li>
</ul>
</li>
<!-- END USER LOGIN DROPDOWN -->
<!-- BEGIN QUICK SIDEBAR TOGGLER -->
<li class="dropdown dropdown-quick-sidebar-toggler">
<a href="javascript:;" class="dropdown-toggle">
<i class="icon-logout"></i>
</a>
</li>
<!-- END QUICK SIDEBAR TOGGLER -->
</ul>
</div>
<!-- END TOP NAVIGATION MENU -->
</div>
<!-- END HEADER INNER -->
</div>
<!-- END HEADER -->
<div class="clearfix">
</div>
<!-- BEGIN CONTAINER -->
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper">
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<div class="page-sidebar navbar-collapse collapse">
<!-- BEGIN SIDEBAR MENU -->
<ul class="page-sidebar-menu " data-auto-scroll="true" data-slide-speed="200">
<!-- DOC: To remove the sidebar toggler from the sidebar you just need to completely remove the below "sidebar-toggler-wrapper" LI element -->
<li class="sidebar-toggler-wrapper">
<!-- BEGIN SIDEBAR TOGGLER BUTTON -->
<div class="sidebar-toggler">
</div>
<!-- END SIDEBAR TOGGLER BUTTON -->
</li>
<!-- DOC: To remove the search box from the sidebar you just need to completely remove the below "sidebar-search-wrapper" LI element -->
<li class="sidebar-search-wrapper">
<!-- BEGIN RESPONSIVE QUICK SEARCH FORM -->
<!-- DOC: Apply "sidebar-search-bordered" class the below search form to have bordered search box -->
<!-- DOC: Apply "sidebar-search-bordered sidebar-search-solid" class the below search form to have bordered & solid search box -->
<form class="sidebar-search " action="extra_search.html" method="POST">
<a href="javascript:;" class="remove">
<i class="icon-close"></i>
</a>
<div class="input-group">
<input type="text" class="form-control" placeholder="Search...">
<span class="input-group-btn">
<a href="javascript:;" class="btn submit"><i class="icon-magnifier"></i></a>
</span>
</div>
</form>
<!-- END RESPONSIVE QUICK SEARCH FORM -->
</li>
<li class="start ">
<a href="javascript:;">
<i class="icon-home"></i>
<span class="title">Dashboard</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="index.html">
<i class="icon-bar-chart"></i>
Default Dashboard</a>
</li>
<li>
<a href="index_2.html">
<i class="icon-bulb"></i>
New Dashboard #1</a>
</li>
<li>
<a href="index_3.html">
<i class="icon-graph"></i>
New Dashboard #2</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-basket"></i>
<span class="title">eCommerce</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="ecommerce_index.html">
<i class="icon-home"></i>
Dashboard</a>
</li>
<li>
<a href="ecommerce_orders.html">
<i class="icon-basket"></i>
Orders</a>
</li>
<li>
<a href="ecommerce_orders_view.html">
<i class="icon-tag"></i>
Order View</a>
</li>
<li>
<a href="ecommerce_products.html">
<i class="icon-handbag"></i>
Products</a>
</li>
<li>
<a href="ecommerce_products_edit.html">
<i class="icon-pencil"></i>
Product Edit</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-rocket"></i>
<span class="title">Page Layouts</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="layout_horizontal_sidebar_menu.html">
Horizontal & Sidebar Menu</a>
</li>
<li>
<a href="index_horizontal_menu.html">
Dashboard & Mega Menu</a>
</li>
<li>
<a href="layout_horizontal_menu1.html">
Horizontal Mega Menu 1</a>
</li>
<li>
<a href="layout_horizontal_menu2.html">
Horizontal Mega Menu 2</a>
</li>
<li>
<a href="layout_fontawesome_icons.html">
<span class="badge badge-roundless badge-danger">new</span>Layout with Fontawesome Icons</a>
</li>
<li>
<a href="layout_glyphicons.html">
Layout with Glyphicon</a>
</li>
<li>
<a href="layout_full_height_portlet.html">
<span class="badge badge-roundless badge-success">new</span>Full Height Portlet</a>
</li>
<li>
<a href="layout_full_height_content.html">
<span class="badge badge-roundless badge-warning">new</span>Full Height Content</a>
</li>
<li>
<a href="layout_search_on_header1.html">
Search Box On Header 1</a>
</li>
<li>
<a href="layout_search_on_header2.html">
Search Box On Header 2</a>
</li>
<li>
<a href="layout_sidebar_search_option1.html">
Sidebar Search Option 1</a>
</li>
<li>
<a href="layout_sidebar_search_option2.html">
Sidebar Search Option 2</a>
</li>
<li>
<a href="layout_sidebar_reversed.html">
<span class="badge badge-roundless badge-warning">new</span>Right Sidebar Page</a>
</li>
<li>
<a href="layout_sidebar_fixed.html">
Sidebar Fixed Page</a>
</li>
<li>
<a href="layout_sidebar_closed.html">
Sidebar Closed Page</a>
</li>
<li>
<a href="layout_ajax.html">
Content Loading via Ajax</a>
</li>
<li>
<a href="layout_disabled_menu.html">
Disabled Menu Links</a>
</li>
<li>
<a href="layout_blank_page.html">
Blank Page</a>
</li>
<li>
<a href="layout_boxed_page.html">
Boxed Page</a>
</li>
<li>
<a href="layout_language_bar.html">
Language Switch Bar</a>
</li>
</ul>
</li>
<!-- BEGIN FRONTEND THEME LINKS -->
<li>
<a href="javascript:;">
<i class="icon-star"></i>
<span class="title">
Frontend Themes </span>
<span class="arrow">
</span>
</a>
<ul class="sub-menu">
<li class="tooltips" data-container="body" data-placement="right" data-html="true" data-original-title="Complete eCommerce Frontend Theme For Metronic Admin">
<a href="http://keenthemes.com/preview/metronic/theme/templates/frontend/shop-index.html" target="_blank">
<span class="title">
eCommerce Frontend </span>
</a>
</li>
<li class="tooltips" data-container="body" data-placement="right" data-html="true" data-original-title="Complete Corporate Frontend Theme For Metronic Admin">
<a href="http://keenthemes.com/preview/metronic/theme/templates/frontend/" target="_blank">
<span class="title">
Corporate Frontend </span>
</a>
</li>
<li class="tooltips" data-container="body" data-placement="right" data-html="true" data-original-title="Complete One Page Parallax Frontend Theme For Metronic Admin">
<a href="http://keenthemes.com/preview/metronic/theme/templates/frontend/onepage-index.html" target="_blank">
<span class="title">
One Page Parallax Frontend </span>
</a>
</li>
</ul>
</li>
<!-- END FRONTEND THEME LINKS -->
<li class="active open">
<a href="javascript:;">
<i class="icon-diamond"></i>
<span class="title">UI Features</span>
<span class="selected"></span>
<span class="arrow open"></span>
</a>
<ul class="sub-menu">
<li>
<a href="ui_general.html">
General Components</a>
</li>
<li>
<a href="ui_buttons.html">
Buttons</a>
</li>
<li>
<a href="ui_icons.html">
<span class="badge badge-roundless badge-danger">new</span>Font Icons</a>
</li>
<li>
<a href="ui_colors.html">
Flat UI Colors</a>
</li>
<li>
<a href="ui_typography.html">
Typography</a>
</li>
<li>
<a href="ui_tabs_accordions_navs.html">
Tabs, Accordions & Navs</a>
</li>
<li>
<a href="ui_tree.html">
<span class="badge badge-roundless badge-danger">new</span>Tree View</a>
</li>
<li>
<a href="ui_page_progress_style_1.html">
<span class="badge badge-roundless badge-warning">new</span>Page Progress Bar</a>
</li>
<li>
<a href="ui_blockui.html">
Block UI</a>
</li>
<li>
<a href="ui_notific8.html">
Notific8 Notifications</a>
</li>
<li>
<a href="ui_toastr.html">
Toastr Notifications</a>
</li>
<li>
<a href="ui_alert_dialog_api.html">
<span class="badge badge-roundless badge-danger">new</span>Alerts & Dialogs API</a>
</li>
<li>
<a href="ui_session_timeout.html">
Session Timeout</a>
</li>
<li>
<a href="ui_idle_timeout.html">
User Idle Timeout</a>
</li>
<li>
<a href="ui_modals.html">
Modals</a>
</li>
<li>
<a href="ui_extended_modals.html">
Extended Modals</a>
</li>
<li>
<a href="ui_tiles.html">
Tiles</a>
</li>
<li class="active">
<a href="ui_datepaginator.html">
<span class="badge badge-roundless badge-success">new</span>Date Paginator</a>
</li>
<li>
<a href="ui_nestable.html">
Nestable List</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-puzzle"></i>
<span class="title">UI Components</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="components_pickers.html">
Pickers</a>
</li>
<li>
<a href="components_dropdowns.html">
Custom Dropdowns</a>
</li>
<li>
<a href="components_form_tools.html">
Form Tools</a>
</li>
<li>
<a href="components_editors.html">
Markdown & WYSIWYG Editors</a>
</li>
<li>
<a href="components_ion_sliders.html">
Ion Range Sliders</a>
</li>
<li>
<a href="components_noui_sliders.html">
NoUI Range Sliders</a>
</li>
<li>
<a href="components_jqueryui_sliders.html">
jQuery UI Sliders</a>
</li>
<li>
<a href="components_knob_dials.html">
Knob Circle Dials</a>
</li>
</ul>
</li>
<li class="heading">
<h3 class="uppercase">Features</h3>
</li>
<li>
<a href="javascript:;">
<i class="icon-settings"></i>
<span class="title">Form Stuff</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="form_controls.html">
Form Controls</a>
</li>
<li>
<a href="form_layouts.html">
Form Layouts</a>
</li>
<li>
<a href="form_editable.html">
<span class="badge badge-roundless badge-warning">new</span>Form X-editable</a>
</li>
<li>
<a href="form_wizard.html">
Form Wizard</a>
</li>
<li>
<a href="form_validation.html">
Form Validation</a>
</li>
<li>
<a href="form_image_crop.html">
<span class="badge badge-roundless badge-danger">new</span>Image Cropping</a>
</li>
<li>
<a href="form_fileupload.html">
Multiple File Upload</a>
</li>
<li>
<a href="form_dropzone.html">
Dropzone File Upload</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-briefcase"></i>
<span class="title">Data Tables</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="table_basic.html">
Basic Datatables</a>
</li>
<li>
<a href="table_responsive.html">
Responsive Datatables</a>
</li>
<li>
<a href="table_managed.html">
Managed Datatables</a>
</li>
<li>
<a href="table_editable.html">
Editable Datatables</a>
</li>
<li>
<a href="table_advanced.html">
Advanced Datatables</a>
</li>
<li>
<a href="table_ajax.html">
Ajax Datatables</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-wallet"></i>
<span class="title">Portlets</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="portlet_general.html">
General Portlets</a>
</li>
<li>
<a href="portlet_general2.html">
<span class="badge badge-roundless badge-danger">new</span>New Portlets #1</a>
</li>
<li>
<a href="portlet_general3.html">
<span class="badge badge-roundless badge-danger">new</span>New Portlets #2</a>
</li>
<li>
<a href="portlet_ajax.html">
Ajax Portlets</a>
</li>
<li>
<a href="portlet_draggable.html">
Draggable Portlets</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-docs"></i>
<span class="title">Pages</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="page_todo.html">
<i class="icon-check"></i>
<span class="badge badge-warning badge-roundless">new</span>Todo</a>
</li>
<li>
<a href="inbox.html">
<i class="icon-envelope"></i>
<span class="badge badge-danger">4</span>Inbox</a>
</li>
<li>
<a href="extra_profile.html">
<i class="icon-user"></i>
User Profile</a>
</li>
<li>
<a href="extra_lock.html">
<i class="icon-lock"></i>
Lock Screen</a>
</li>
<li>
<a href="extra_faq.html">
<i class="icon-question"></i>
FAQ</a>
</li>
<li>
<a href="page_calendar.html">
<i class="icon-calendar"></i>
<span class="badge badge-danger">14</span>Calendar</a>
</li>
<li>
<a href="page_timeline.html">
<i class="icon-clock"></i>
<span class="badge badge-info">4</span>Timeline</a>
</li>
<li>
<a href="page_coming_soon.html">
<i class="icon-flag"></i>
Coming Soon</a>
</li>
<li>
<a href="page_blog.html">
<i class="icon-speech"></i>
Blog</a>
</li>
<li>
<a href="page_blog_item.html">
<i class="icon-link"></i>
Blog Post</a>
</li>
<li>
<a href="page_news.html">
<i class="icon-eye"></i>
<span class="badge badge-success">9</span>News</a>
</li>
<li>
<a href="page_news_item.html">
<i class="icon-bell"></i>
News View</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-present"></i>
<span class="title">Extra</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="page_about.html">
About Us</a>
</li>
<li>
<a href="page_contact.html">
Contact Us</a>
</li>
<li>
<a href="extra_search.html">
Search Results</a>
</li>
<li>
<a href="extra_invoice.html">
Invoice</a>
</li>
<li>
<a href="page_portfolio.html">
Portfolio</a>
</li>
<li>
<a href="extra_pricing_table.html">
Pricing Tables</a>
</li>
<li>
<a href="extra_404_option1.html">
404 Page Option 1</a>
</li>
<li>
<a href="extra_404_option2.html">
404 Page Option 2</a>
</li>
<li>
<a href="extra_404_option3.html">
404 Page Option 3</a>
</li>
<li>
<a href="extra_500_option1.html">
500 Page Option 1</a>
</li>
<li>
<a href="extra_500_option2.html">
500 Page Option 2</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-folder"></i>
<span class="title">Multi Level Menu</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="javascript:;">
<i class="icon-settings"></i> Item 1 <span class="arrow"></span>
</a>
<ul class="sub-menu">
<li>
<a href="javascript:;">
<i class="icon-user"></i>
Sample Link 1 <span class="arrow"></span>
</a>
<ul class="sub-menu">
<li>
<a href="#"><i class="icon-power"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-paper-plane"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-star"></i> Sample Link 1</a>
</li>
</ul>
</li>
<li>
<a href="#"><i class="icon-camera"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-link"></i> Sample Link 2</a>
</li>
<li>
<a href="#"><i class="icon-pointer"></i> Sample Link 3</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-globe"></i> Item 2 <span class="arrow"></span>
</a>
<ul class="sub-menu">
<li>
<a href="#"><i class="icon-tag"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-pencil"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-graph"></i> Sample Link 1</a>
</li>
</ul>
</li>
<li>
<a href="#">
<i class="icon-bar-chart"></i>
Item 3 </a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-user"></i>
<span class="title">Login Options</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="login.html">
Login Form 1</a>
</li>
<li>
<a href="login_soft.html">
Login Form 2</a>
</li>
</ul>
</li>
<li class="heading">
<h3 class="uppercase">More</h3>
</li>
<li>
<a href="javascript:;">
<i class="icon-logout"></i>
<span class="title">Quick Sidebar</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="quick_sidebar_push_content.html">
Push Content</a>
</li>
<li>
<a href="quick_sidebar_over_content.html">
Over Content</a>
</li>
<li>
<a href="quick_sidebar_over_content_transparent.html">
Over Content & Transparent</a>
</li>
<li>
<a href="quick_sidebar_on_boxed_layout.html">
Boxed Layout</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-envelope-open"></i>
<span class="title">Email Templates</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="email_newsletter.html">
Responsive Newsletter<br>
Email Template</a>
</li>
<li>
<a href="email_system.html">
Responsive System<br>
Email Template</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-pointer"></i>
<span class="title">Maps</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="maps_google.html">
Google Maps</a>
</li>
<li>
<a href="maps_vector.html">
Vector Maps</a>
</li>
</ul>
</li>
<li class="last ">
<a href="charts.html">
<i class="icon-bar-chart"></i>
<span class="title">Visual Charts</span>
</a>
</li>
</ul>
<!-- END SIDEBAR MENU -->
</div>
</div>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">
<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
Widget settings form goes here
</div>
<div class="modal-footer">
<button type="button" class="btn blue">Save changes</button>
<button type="button" class="btn default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<!-- BEGIN STYLE CUSTOMIZER -->
<div class="theme-panel hidden-xs hidden-sm">
<div class="toggler">
</div>
<div class="toggler-close">
</div>
<div class="theme-options">
<div class="theme-option theme-colors clearfix">
<span>
THEME COLOR </span>
<ul>
<li class="color-default current tooltips" data-style="default" data-container="body" data-original-title="Default">
</li>
<li class="color-darkblue tooltips" data-style="darkblue" data-container="body" data-original-title="Dark Blue">
</li>
<li class="color-blue tooltips" data-style="blue" data-container="body" data-original-title="Blue">
</li>
<li class="color-grey tooltips" data-style="grey" data-container="body" data-original-title="Grey">
</li>
<li class="color-light tooltips" data-style="light" data-container="body" data-original-title="Light">
</li>
<li class="color-light2 tooltips" data-style="light2" data-container="body" data-html="true" data-original-title="Light 2">
</li>
</ul>
</div>
<div class="theme-option">
<span>
Layout </span>
<select class="layout-option form-control input-small">
<option value="fluid" selected="selected">Fluid</option>
<option value="boxed">Boxed</option>
</select>
</div>
<div class="theme-option">
<span>
Header </span>
<select class="page-header-option form-control input-small">
<option value="fixed" selected="selected">Fixed</option>
<option value="default">Default</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Mode</span>
<select class="sidebar-option form-control input-small">
<option value="fixed">Fixed</option>
<option value="default" selected="selected">Default</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Menu </span>
<select class="sidebar-menu-option form-control input-small">
<option value="accordion" selected="selected">Accordion</option>
<option value="hover">Hover</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Style </span>
<select class="sidebar-style-option form-control input-small">
<option value="default" selected="selected">Default</option>
<option value="light">Light</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Position </span>
<select class="sidebar-pos-option form-control input-small">
<option value="left" selected="selected">Left</option>
<option value="right">Right</option>
</select>
</div>
<div class="theme-option">
<span>
Footer </span>
<select class="page-footer-option form-control input-small">
<option value="fixed">Fixed</option>
<option value="default" selected="selected">Default</option>
</select>
</div>
</div>
</div>
<!-- END STYLE CUSTOMIZER -->
<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">
Date Paginator <small>scrollable & selectable date paginator</small>
</h3>
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="index.html">Home</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a href="#">UI Features</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a href="#">Date Paginator</a>
</li>
</ul>
<div class="page-toolbar">
<div class="btn-group pull-right">
<button type="button" class="btn btn-fit-height grey-salt dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true">
Actions <i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li>
<a href="#">Action</a>
</li>
<li>
<a href="#">Another action</a>
</li>
<li>
<a href="#">Something else here</a>
</li>
<li class="divider">
</li>
<li>
<a href="#">Separated link</a>
</li>
</ul>
</div>
</div>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<div class="row">
<div class="col-md-12">
<div class="note note-success">
<h4 class="block">Bootstrap Date Paginator</h4>
<p>
A jQuery plugin which takes Twitter Bootstrap's already great pagination component and injects a bit of date based magic. In the process creating a hugely simplified and modularised way of paging date based results in your application. For more info please check out <a href="http://jonathandanielmiles.com/bootstrap-datepaginator" target="_blank">
the official documentation </a>
.
</p>
</div>
<!-- BEGIN PORTLET-->
<div class="portlet box yellow">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Bootstrap Date Paginator Demo
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="javascript:;" class="reload">
</a>
</div>
</div>
<div class="portlet-body">
<h3>Default Date Paginator</h3>
<div id="datepaginator_sample_1">
</div>
<h3>On Date Selected Event Hanlder(try to select a date)</h3>
<div id="datepaginator_sample_4">
</div>
<h3>Large Date Paginator</h3>
<div id="datepaginator_sample_2">
</div>
<h3>Small Date Paginator</h3>
<div id="datepaginator_sample_3">
</div>
</div>
</div>
<!-- END PORTLET-->
</div>
</div>
<!-- END PAGE CONTENT-->
</div>
</div>
<!-- END CONTENT -->
<!-- BEGIN QUICK SIDEBAR -->
<a href="javascript:;" class="page-quick-sidebar-toggler"><i class="icon-close"></i></a>
<div class="page-quick-sidebar-wrapper">
<div class="page-quick-sidebar">
<div class="nav-justified">
<ul class="nav nav-tabs nav-justified">
<li class="active">
<a href="#quick_sidebar_tab_1" data-toggle="tab">
Users <span class="badge badge-danger">2</span>
</a>
</li>
<li>
<a href="#quick_sidebar_tab_2" data-toggle="tab">
Alerts <span class="badge badge-success">7</span>
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
More<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu pull-right" role="menu">
<li>
<a href="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-bell"></i> Alerts </a>
</li>
<li>
<a href="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-info"></i> Notifications </a>
</li>
<li>
<a href="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-speech"></i> Activities </a>
</li>
<li class="divider">
</li>
<li>
<a href="#quick_sidebar_tab_3" data-toggle="tab">
<i class="icon-settings"></i> Settings </a>
</li>
</ul>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active page-quick-sidebar-chat" id="quick_sidebar_tab_1">
<div class="page-quick-sidebar-chat-users" data-rail-color="#ddd" data-wrapper-class="page-quick-sidebar-list">
<h3 class="list-heading">Staff</h3>
<ul class="media-list list-items">
<li class="media">
<div class="media-status">
<span class="badge badge-success">8</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar3.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Bob Nilson</h4>
<div class="media-heading-sub">
Project Manager
</div>
</div>
</li>
<li class="media">
<img class="media-object" src="../../assets/admin/layout/img/avatar1.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Nick Larson</h4>
<div class="media-heading-sub">
Art Director
</div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-danger">3</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar4.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Deon Hubert</h4>
<div class="media-heading-sub">
CTO
</div>
</div>
</li>
<li class="media">
<img class="media-object" src="../../assets/admin/layout/img/avatar2.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Ella Wong</h4>
<div class="media-heading-sub">
CEO
</div>
</div>
</li>
</ul>
<h3 class="list-heading">Customers</h3>
<ul class="media-list list-items">
<li class="media">
<div class="media-status">
<span class="badge badge-warning">2</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar6.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Lara Kunis</h4>
<div class="media-heading-sub">
CEO, Loop Inc
</div>
<div class="media-heading-small">
Last seen 03:10 AM
</div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="label label-sm label-success">new</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar7.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Ernie Kyllonen</h4>
<div class="media-heading-sub">
Project Manager,<br>
SmartBizz PTL
</div>
</div>
</li>
<li class="media">
<img class="media-object" src="../../assets/admin/layout/img/avatar8.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Lisa Stone</h4>
<div class="media-heading-sub">
CTO, Keort Inc
</div>
<div class="media-heading-small">
Last seen 13:10 PM
</div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-success">7</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar9.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Deon Portalatin</h4>
<div class="media-heading-sub">
CFO, H&D LTD
</div>
</div>
</li>
<li class="media">
<img class="media-object" src="../../assets/admin/layout/img/avatar10.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Irina Savikova</h4>
<div class="media-heading-sub">
CEO, Tizda Motors Inc
</div>
</div>
</li>
<li class="media">
<div class="media-status">
<span class="badge badge-danger">4</span>
</div>
<img class="media-object" src="../../assets/admin/layout/img/avatar11.jpg" alt="...">
<div class="media-body">
<h4 class="media-heading">Maria Gomez</h4>
<div class="media-heading-sub">
Manager, Infomatic Inc
</div>
<div class="media-heading-small">
Last seen 03:10 AM
</div>
</div>
</li>
</ul>
</div>
<div class="page-quick-sidebar-item">
<div class="page-quick-sidebar-chat-user">
<div class="page-quick-sidebar-nav">
<a href="javascript:;" class="page-quick-sidebar-back-to-list"><i class="icon-arrow-left"></i>Back</a>
</div>
<div class="page-quick-sidebar-chat-user-messages">
<div class="post out">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar3.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Bob Nilson</a>
<span class="datetime">20:15</span>
<span class="body">
When could you send me the report ? </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar2.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Ella Wong</a>
<span class="datetime">20:15</span>
<span class="body">
Its almost done. I will be sending it shortly </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar3.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Bob Nilson</a>
<span class="datetime">20:15</span>
<span class="body">
Alright. Thanks! :) </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar2.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Ella Wong</a>
<span class="datetime">20:16</span>
<span class="body">
You are most welcome. Sorry for the delay. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar3.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body">
No probs. Just take your time :) </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar2.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Ella Wong</a>
<span class="datetime">20:40</span>
<span class="body">
Alright. I just emailed it to you. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar3.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body">
Great! Thanks. Will check it right away. </span>
</div>
</div>
<div class="post in">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar2.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Ella Wong</a>
<span class="datetime">20:40</span>
<span class="body">
Please let me know if you have any comment. </span>
</div>
</div>
<div class="post out">
<img class="avatar" alt="" src="../../assets/admin/layout/img/avatar3.jpg"/>
<div class="message">
<span class="arrow"></span>
<a href="#" class="name">Bob Nilson</a>
<span class="datetime">20:17</span>
<span class="body">
Sure. I will check and buzz you if anything needs to be corrected. </span>
</div>
</div>
</div>
<div class="page-quick-sidebar-chat-user-form">
<div class="input-group">
<input type="text" class="form-control" placeholder="Type a message here...">
<div class="input-group-btn">
<button type="button" class="btn blue"><i class="icon-paper-clip"></i></button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="tab-pane page-quick-sidebar-alerts" id="quick_sidebar_tab_2">
<div class="page-quick-sidebar-alerts-list">
<h3 class="list-heading">General</h3>
<ul class="feeds list-items">
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-check"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 4 pending tasks. <span class="label label-sm label-warning ">
Take action <i class="fa fa-share"></i>
</span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
Just now
</div>
</div>
</li>
<li>
<a href="#">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-bar-chart-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
Finance Report for year 2013 has been released.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
20 mins
</div>
</div>
</a>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-danger">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 5 pending membership that requires a quick review.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
24 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-shopping-cart"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
New order received with <span class="label label-sm label-success">
Reference Number: DR23923 </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
30 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 5 pending membership that requires a quick review.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
24 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-bell-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
Web server hardware needs to be upgraded. <span class="label label-sm label-warning">
Overdue </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
2 hours
</div>
</div>
</li>
<li>
<a href="#">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-default">
<i class="fa fa-briefcase"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
IPO Report for year 2013 has been released.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
20 mins
</div>
</div>
</a>
</li>
</ul>
<h3 class="list-heading">System</h3>
<ul class="feeds list-items">
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-check"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 4 pending tasks. <span class="label label-sm label-warning ">
Take action <i class="fa fa-share"></i>
</span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
Just now
</div>
</div>
</li>
<li>
<a href="#">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-danger">
<i class="fa fa-bar-chart-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
Finance Report for year 2013 has been released.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
20 mins
</div>
</div>
</a>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-default">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 5 pending membership that requires a quick review.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
24 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-shopping-cart"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
New order received with <span class="label label-sm label-success">
Reference Number: DR23923 </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
30 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-success">
<i class="fa fa-user"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
You have 5 pending membership that requires a quick review.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
24 mins
</div>
</div>
</li>
<li>
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-warning">
<i class="fa fa-bell-o"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
Web server hardware needs to be upgraded. <span class="label label-sm label-default ">
Overdue </span>
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
2 hours
</div>
</div>
</li>
<li>
<a href="#">
<div class="col1">
<div class="cont">
<div class="cont-col1">
<div class="label label-sm label-info">
<i class="fa fa-briefcase"></i>
</div>
</div>
<div class="cont-col2">
<div class="desc">
IPO Report for year 2013 has been released.
</div>
</div>
</div>
</div>
<div class="col2">
<div class="date">
20 mins
</div>
</div>
</a>
</li>
</ul>
</div>
</div>
<div class="tab-pane page-quick-sidebar-settings" id="quick_sidebar_tab_3">
<div class="page-quick-sidebar-settings-list">
<h3 class="list-heading">General Settings</h3>
<ul class="list-items borderless">
<li>
Enable Notifications <input type="checkbox" class="make-switch" checked data-size="small" data-on-color="success" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
<li>
Allow Tracking <input type="checkbox" class="make-switch" data-size="small" data-on-color="info" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
<li>
Log Errors <input type="checkbox" class="make-switch" checked data-size="small" data-on-color="danger" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
<li>
Auto Sumbit Issues <input type="checkbox" class="make-switch" data-size="small" data-on-color="warning" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
<li>
Enable SMS Alerts <input type="checkbox" class="make-switch" checked data-size="small" data-on-color="success" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
</ul>
<h3 class="list-heading">System Settings</h3>
<ul class="list-items borderless">
<li>
Security Level
<select class="form-control input-inline input-sm input-small">
<option value="1">Normal</option>
<option value="2" selected>Medium</option>
<option value="e">High</option>
</select>
</li>
<li>
Failed Email Attempts <input class="form-control input-inline input-sm input-small" value="5"/>
</li>
<li>
Secondary SMTP Port <input class="form-control input-inline input-sm input-small" value="3560"/>
</li>
<li>
Notify On System Error <input type="checkbox" class="make-switch" checked data-size="small" data-on-color="danger" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
<li>
Notify On SMTP Error <input type="checkbox" class="make-switch" checked data-size="small" data-on-color="warning" data-on-text="ON" data-off-color="default" data-off-text="OFF">
</li>
</ul>
<div class="inner-content">
<button class="btn btn-success"><i class="icon-settings"></i> Save Changes</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END QUICK SIDEBAR -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<div class="page-footer">
<div class="page-footer-inner">
2014 © Metronic by keenthemes.
</div>
<div class="scroll-to-top">
<i class="icon-arrow-up"></i>
</div>
</div>
<!-- END FOOTER -->
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]>
<script src="../../assets/global/plugins/respond.min.js"></script>
<script src="../../assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
<script src="../../assets/global/plugins/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui-1.10.3.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script src="../../assets/global/plugins/jquery-ui/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN DATE PAGINATOR PLUGIN -->
<script src="../../assets/global/plugins/moment.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap-datepaginator/bootstrap-datepaginator.min.js" type="text/javascript"></script>
<!-- END DATE PAGINATOR PLUGIN -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="../../assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="../../assets/admin/layout/scripts/layout.js" type="text/javascript"></script>
<script src="../../assets/admin/layout/scripts/quick-sidebar.js" type="text/javascript"></script>
<script src="../../assets/admin/layout/scripts/demo.js" type="text/javascript"></script>
<script src="../../assets/admin/pages/scripts/ui-datepaginator.js"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script>
jQuery(document).ready(function() {
// initiate layout and plugins
Metronic.init(); // init metronic core components
Layout.init(); // init current layout
QuickSidebar.init(); // init quick sidebar
Demo.init(); // init demo features
UIDatepaginator.init();
});
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html> | {
"content_hash": "7873f5787e515026fc969828f482898e",
"timestamp": "",
"source": "github",
"line_count": 2115,
"max_line_length": 356,
"avg_line_length": 32.24586288416076,
"alnum_prop": 0.5195601173020528,
"repo_name": "mono13th/mpo",
"id": "a3b2953bcbf9a2f94b0796e8111ab52d263507b1",
"size": "68200",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "theme/templates/admin/ui_datepaginator.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "290"
},
{
"name": "ApacheConf",
"bytes": "1003"
},
{
"name": "CSS",
"bytes": "2698634"
},
{
"name": "CoffeeScript",
"bytes": "83631"
},
{
"name": "Go",
"bytes": "7075"
},
{
"name": "HTML",
"bytes": "29610884"
},
{
"name": "Java",
"bytes": "102172"
},
{
"name": "JavaScript",
"bytes": "5245963"
},
{
"name": "PHP",
"bytes": "2194670"
},
{
"name": "Python",
"bytes": "5844"
},
{
"name": "Shell",
"bytes": "1934"
}
],
"symlink_target": ""
} |
################################################################################
## Makefile for compiling apps against the nRF51 SDK
################################################################################
################################################################################
## Usage
##
## In your application Makefile, set the following variables:
## - APPLICATION_SRCS : List of all .c files to be compiled.
## - LIBRARY_PATHS : List of directories with .h files
## - SOURCE_PATHS : List of directories with .c files
## - SOFTDEVICE_MODEL : s110 | s120 | s130 | s210 | s310 | or do not set for no softdevice
##
## Optional
## - SOFTDEVICE_VERSION : Full version number of the softdevice.
## - SOFTDEVICE : Path to the softdevice to use
## - START_CODE : .s file to execute first
## - SYSTEM_FILE : Base nRF .c file.
## - NRF_MODEL : nrf51 | nrf52 : Also set by the NRF_IC used
## - NRF_IC : nrf51422 | nrf51802 | nrf51822 | nrf52832 | nrf52840
## - BOARD : Hardware board being used. Will get set as #define.
## - RAM_KB : Size of RAM on chip
## - FLASH_KB : Size of flash on chip
## - SDK_VERSION : Major version number of the SDK to use. Defaults to 10 for nrf51, 12 for nrf52
## - GDB_PORT_NUMBER : Defaults to 2331
##
##
## Then at the end of the Makefile do something like:
## NRF_BASE_PATH ?= ../../nrf5x-base
## include $(NRF_BASE_PATH)/make/Makefile
# Helper for relative paths
BASE_DIR := $(dir $(lastword $(MAKEFILE_LIST)))..
# Setup the compilers to use
TOOLCHAIN_PREFIX ?= arm-none-eabi
AS = $(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)-as
CC = $(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)-gcc
LD = $(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)-gcc
OBJCOPY = $(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)-objcopy
OBJDUMP = $(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)-objdump
SIZE = $(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)-size
GDB = $(TOOLCHAIN_PATH)$(TOOLCHAIN_PREFIX)-gdb
# Set default board
BOARD ?= BOARD_NULL
# TODO: Guess NRF_MODEL from famous BOARD
# ---- Guess/Check NRF_MODEL from NRF_IC (if NRF_IC defined)
ifdef NRF_IC
#if NRF_IC == nrf51422 or nrf51802 or nrf51822
ifneq (,$(filter $(NRF_IC),nrf51422 nrf51802 nrf51822))
ifdef NRF_MODEL
ifneq ($(NRF_MODEL), nrf51)
$(error NRF_MODEL $(NRF_MODEL) is not valid for NRF_IC $(NRF_IC))
endif
endif
NRF_MODEL = nrf51
#else if NRF_IC == nrf52832 or nrf52840
else ifneq (,$(filter $(NRF_IC),nrf52832 nrf52840))
ifdef NRF_MODEL
ifneq ($(NRF_MODEL), nrf52)
$(error NRF_MODEL $(NRF_MODEL) is not valid for NRF_IC $(NRF_IC))
endif
endif
NRF_MODEL = nrf52
endif
endif
# ---- NRF_MODEL Default to nrf51
NRF_MODEL ?= nrf51
# ---- Force NRF_MODEL for OLD SDK
ifneq (,$(filter $(SDK_VERSION),9 10))
ifneq ($(NRF_MODEL), nrf51)
$(error NRF_MODEL $(NRF_MODEL) is not valid for SDK_VERSION $(SDK_VERSION))
endif
NRF_MODEL = nrf51
endif
# --- NRF_IC: Default to nrf51822 for nrf51
ifeq ($(NRF_MODEL), nrf51)
NRF_IC ?= nrf51822
# --- NRF_IC: Default to nrf52832 for nrf52
else ifeq ($(NRF_MODEL), nrf52)
NRF_IC ?= nrf52832
endif
# ---- Set hardware memory sizes
ifneq (,$(filter $(NRF_IC),nrf51422 nrf51802 nrf51822))
RAM_KB ?= 16# can be also 32
FLASH_KB ?= 256# can be also 128
else ifeq ($(NRF_IC), nrf52832)
RAM_KB ?= 64
FLASH_KB ?= 512
else ifeq ($(NRF_IC), nrf52840)
RAM_KB ?= 256
FLASH_KB ?= 1024
endif
# ---- Set SDK if not SET
# Default to SDK 10 for nrf51
ifeq ($(NRF_MODEL), nrf51)
SDK_VERSION ?= 10
# Default to SDK 12 for nrf52
else ifeq ($(NRF_MODEL), nrf52)
SDK_VERSION ?= 12
endif
# Set this for using GDB
GDB_PORT_NUMBER ?= 2331
#------ Now select/check SOFTDEVICE version if used (depending SDK version)
ifdef SOFTDEVICE_MODEL
# SDK 9 or 10
ifneq (,$(filter $(SDK_VERSION),9 10))
WAITED_NRF_MODEL = nrf51
ifeq ($(SOFTDEVICE_MODEL), s110)
USE_BLE = 1
WAITED_SOFTDEVICE_VERSION ?= 8.0.0
else ifeq ($(SOFTDEVICE_MODEL), s120)
USE_BLE = 1
WAITED_SOFTDEVICE_VERSION ?= 2.1.0
else ifeq ($(SOFTDEVICE_MODEL), s130)
USE_BLE = 1
WAITED_SOFTDEVICE_VERSION ?= 1.0.0
else ifeq ($(SOFTDEVICE_MODEL), s210)
# ANT only softDevice
WAITED_SOFTDEVICE_VERSION ?= 5.0.0
else ifeq ($(SOFTDEVICE_MODEL), s310)
USE_BLE = 1
WAITED_SOFTDEVICE_VERSION ?= 3.0.0
endif
endif
# SDK 11
ifeq ($(SDK_VERSION), 11)
ifeq ($(SOFTDEVICE_MODEL), s130)
USE_BLE = 1
WAITED_SOFTDEVICE_VERSION ?= 2.0.0
WAITED_NRF_MODEL = nrf51
else ifeq ($(SOFTDEVICE_MODEL), s132)
USE_BLE = 1
WAITED_SOFTDEVICE_VERSION ?= 2.0.0
WAITED_NRF_MODEL = nrf52
else ifeq ($(SOFTDEVICE_MODEL), s212)
# ANT only softDevice
WAITED_SOFTDEVICE_VERSION ?= 0.9.1
WAITED_NRF_MODEL = nrf52
else ifeq ($(SOFTDEVICE_MODEL), s332)
USE_BLE = 1
WAITED_SOFTDEVICE_VERSION ?= 0.9.1
WAITED_NRF_MODEL = nrf52
endif
endif
# SDK 12
ifeq ($(SDK_VERSION), 12)
ifeq ($(SOFTDEVICE_MODEL), s130)
USE_BLE = 1
WAITED_SOFTDEVICE_VERSION ?= 2.0.1
WAITED_NRF_MODEL = nrf51
else ifeq ($(SOFTDEVICE_MODEL), s132)
USE_BLE = 1
WAITED_SOFTDEVICE_VERSION ?= 3.0.0
WAITED_NRF_MODEL = nrf52
else ifeq ($(SOFTDEVICE_MODEL), s212)
# ANT only softDevice
WAITED_SOFTDEVICE_VERSION ?= 2.0.0
WAITED_NRF_MODEL = nrf52
else ifeq ($(SOFTDEVICE_MODEL), s332)
USE_BLE = 1
WAITED_SOFTDEVICE_VERSION ?= 2.0.0
WAITED_NRF_MODEL = nrf52
endif
endif
SOFTDEVICE_VERSION ?= $(WAITED_SOFTDEVICE_VERSION)
ifneq ($(SOFTDEVICE_VERSION), $(WAITED_SOFTDEVICE_VERSION))
$(error FOR SDK$(SDK_VERSION) Supported SoftDevice Version for $(SOFTDEVICE_MODEL) is $(WAITED_SOFTDEVICE_VERSION))
endif
ifneq ($(WAITED_NRF_MODEL), $(NRF_MODEL))
$(error SoftDevice $(SOFTDEVICE_MODEL) is only compatible with $(WAITED_NRF_MODEL))
endif
endif # ifdef SOFTDEVICE_MODEL
# Print some helpful info about what the user is compiling for
space :=
space +=
$(info BUILD OPTIONS:)
$(info $(space) SoftDevice $(SOFTDEVICE_MODEL))
$(info $(space) SDK $(SDK_VERSION))
$(info $(space) nRF $(NRF_IC))
$(info $(space) RAM $(RAM_KB) kB)
$(info $(space) FLASH $(FLASH_KB) kB)
$(info $(space) Board $(BOARD))
$(info $(space))
# Need capital letters for the device in GCC
DEVICE ?= $(shell echo $(NRF_MODEL) | tr a-z A-Z)
# Required files to compile
START_CODE ?= startup_$(NRF_MODEL).s
SYSTEM_FILE ?= system_$(NRF_MODEL).c
BOOTLOADER_REGION_START = $(addprefix 0x, $(shell echo "obase=16; (${FLASH_KB}-18)*1024" | bc ))
BOOTLOADER_SETTINGS_ADDRESS = $(addprefix 0x, $(shell echo "obase=16; (${FLASH_KB}-2)*1024" | bc))
# Need some common options for interacting with the chip over JTAG
ifeq ($(NRF_MODEL), nrf51)
JLINK_OPTIONS = -device $(NRF_IC) -if swd -speed 1000
# Default to SDK 12 for nrf52
else ifeq ($(NRF_MODEL), nrf52)
JLINK_OPTIONS = -device $(NRF_MODEL) -if swd -speed 1000
endif
# If not set in app makefile, lets optimize for size
CFLAGS += -Os
CFLAGS += -fomit-frame-pointer
# Add useful paths from nRF5x-base
LIBRARY_PATHS += $(BASE_DIR)/advertisement/
LIBRARY_PATHS += $(BASE_DIR)/devices/
LIBRARY_PATHS += $(BASE_DIR)/devices/tcmp441/
LIBRARY_PATHS += $(BASE_DIR)/devices/tcmp441/libqrencode/
LIBRARY_PATHS += $(BASE_DIR)/lib/
LIBRARY_PATHS += $(BASE_DIR)/lib/simple_logger/
LIBRARY_PATHS += $(BASE_DIR)/lib/simple_logger/chanfs
LIBRARY_PATHS += $(BASE_DIR)/lib/simple_logger/mem-ffs
LIBRARY_PATHS += $(BASE_DIR)/peripherals/
LIBRARY_PATHS += $(BASE_DIR)/services/
SOURCE_PATHS += $(BASE_DIR)/advertisement/
SOURCE_PATHS += $(BASE_DIR)/devices/
SOURCE_PATHS += $(BASE_DIR)/devices/tcmp441/
SOURCE_PATHS += $(BASE_DIR)/devices/tcmp441/libqrencode/
SOURCE_PATHS += $(BASE_DIR)/lib/
SOURCE_PATHS += $(BASE_DIR)/lib/simple_logger/
SOURCE_PATHS += $(BASE_DIR)/lib/simple_logger/chanfs
SOURCE_PATHS += $(BASE_DIR)/lib/simple_logger/mem-ffs
SOURCE_PATHS += $(BASE_DIR)/peripherals/
SOURCE_PATHS += $(BASE_DIR)/services/
SOURCE_PATHS += $(BASE_DIR)/startup/
# Add paths for each SDK version
ifeq ($(SDK_VERSION), 12)
# Set the path
SDK_PATH ?= $(BASE_DIR)/sdk/nrf5_sdk_12.2.0/
# Other knowns about the SDK paths
SDK_INCLUDE_PATH = $(SDK_PATH)components/
SDK_SOURCE_PATH = $(SDK_PATH)components/
CMSIS_INCLUDE_PATH = $(SDK_PATH)components/toolchain/gcc/
# Need to add the paths for all the directories in the SDK.
# Note that we do not use * because some folders have conflicting files.
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)libraries/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)libraries/*/src/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/adc/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/ble_flash/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/clock/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/common/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/delay/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/gpiote/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/hal/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/lpcomp/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/ppi/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/pstorage/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/pstorage/config/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/radio_config/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/rng/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/rtc/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/sdio/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/spi_master/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/spi_slave/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/swi/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/timer/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/twi_master/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/twis_slave/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/uart/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/wdt/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/validation/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_ext/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)device/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)boards/)
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)toolchain/gcc/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)toolchain/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)toolchain/cmsis/include/
SOURCE_PATHS += $(SDK_SOURCE_PATH)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)libraries/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)libraries/*/src/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)drivers_nrf/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)drivers_ext/*/)
ifdef SERIALIZATION_MODE
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/transport/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/common/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/hal/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/transport/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/transport/ser_phy/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/transport/ser_phy/config/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/transport/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/common/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/hal/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/transport/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/transport/ser_phy/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/transport/ser_phy/config/)
# Add defines based on if we are "connectivity" or "application"
ifeq ($(SERIALIZATION_MODE), connectivity)
CFLAGS += -DSER_CONNECTIVITY -DAPP_SCHEDULER_WITH_PAUSE -DBLE_STACK_SUPPORT_REQD -DHCI_TIMER2 -DSOFTDEVICE_PRESENT
endif
ifeq ($(SERIALIZATION_MODE), application)
CFLAGS += -DSVCALL_AS_NORMAL_FUNCTION -DBLE_STACK_SUPPORT_REQD
endif
endif
ifdef USE_BLE
# How many central/peripherals are defined changes how much memory the
# softdevice requires. Change the amount of memory allotted in a custom ld
# file if your configuration is different than default.
ifeq ($(RAM_KB), 16)
# limit 16 kB RAM nRFs to only act as peripherals. Doing otherwise
# requires careful balancing of memory requirements and should be done
# manually, not automatically
CENTRAL_LINK_COUNT ?= 0
PERIPHERAL_LINK_COUNT ?= 1
else
CENTRAL_LINK_COUNT ?= 1
PERIPHERAL_LINK_COUNT ?= 1
endif
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)ble/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)ble/ble_services/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)ble/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)ble/ble_services/*/)
CFLAGS += -DBLE_STACK_SUPPORT_REQD -DSOFTDEVICE_PRESENT -DCENTRAL_LINK_COUNT=$(CENTRAL_LINK_COUNT) -DPERIPHERAL_LINK_COUNT=$(PERIPHERAL_LINK_COUNT)
endif
ifdef USE_ANT
CFLAGS += -DANT_STACK_SUPPORT_REQD
endif
ifdef ENABLE_WIRELESS_DFU
CFLAGS += -DENABLE_DFU
APPLICATION_SRCS += bootloader_util.c
endif
ifdef SOFTDEVICE_MODEL
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)softdevice/common/softdevice_handler/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/nrf51
SOURCE_PATHS += $(SDK_SOURCE_PATH)softdevice/common/softdevice_handler/
SOURCE_PATHS += $(SDK_SOURCE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/
SOURCE_PATHS += $(SDK_SOURCE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/nrf51
ifdef SERIALIZATION_MODE
# Load the sources from the serialization library
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/middleware/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/serializers/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)serialization/common/struct_ser/$(SOFTDEVICE_MODEL)/
SOURCE_PATHS += $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/middleware/
SOURCE_PATHS += $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/serializers/
SOURCE_PATHS += $(SDK_SOURCE_PATH)serialization/common/struct_ser/$(SOFTDEVICE_MODEL)/
endif
else
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/nrf_soc_nosd/)
SOFTDEVICE_MODEL = blank
endif
endif # SDK 12
ifeq ($(SDK_VERSION), 11)
# Set the path
SDK_PATH ?= $(BASE_DIR)/sdk/nrf51_sdk_11.0.0/
# Other knowns about the SDK paths
SDK_INCLUDE_PATH = $(SDK_PATH)components/
SDK_SOURCE_PATH = $(SDK_PATH)components/
CMSIS_INCLUDE_PATH = $(SDK_PATH)components/toolchain/gcc/
# Need to add the paths for all the directories in the SDK.
# Note that we do not use * because some folders have conflicting files.
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)libraries/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/adc/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/ble_flash/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/clock/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/common/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/delay/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/gpiote/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/hal/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/lpcomp/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/ppi/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/pstorage/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/pstorage/config/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/radio_config/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/rng/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/rtc/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/sdio/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/spi_master/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/spi_slave/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/swi/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/timer/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/twi_master/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/twis_slave/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/uart/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/wdt/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/validation/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_ext/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)device/)
LIBRARY_PATHS += $(wildcard $(SDK_PATH)examples/bsp/)
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)toolchain/gcc/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)toolchain/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)toolchain/CMSIS/Include/
SOURCE_PATHS += $(SDK_SOURCE_PATH)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)libraries/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)drivers_nrf/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)drivers_ext/*/)
SOURCE_PATHS += $(wildcard $(SDK_PATH)examples/bsp/)
ifdef SERIALIZATION_MODE
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/transport/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/common/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/hal/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/transport/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/transport/ser_phy/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/transport/ser_phy/config/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/transport/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/common/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/hal/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/transport/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/transport/ser_phy/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/transport/ser_phy/config/)
# Add defines based on if we are "connectivity" or "application"
ifeq ($(SERIALIZATION_MODE), connectivity)
CFLAGS += -DSER_CONNECTIVITY -DAPP_SCHEDULER_WITH_PAUSE -DBLE_STACK_SUPPORT_REQD -DHCI_TIMER2 -DSOFTDEVICE_PRESENT
endif
ifeq ($(SERIALIZATION_MODE), application)
CFLAGS += -DSVCALL_AS_NORMAL_FUNCTION -DBLE_STACK_SUPPORT_REQD
endif
endif
ifdef USE_BLE
# How many central/peripherals are defined changes how much memory the
# softdevice requires. Change the amount of memory allotted in a custom ld
# file if your configuration is different than default.
ifeq ($(RAM_KB), 16)
# limit 16 kB RAM nRFs to only act as peripherals. Doing otherwise
# requires careful balancing of memory requirements and should be done
# manually, not automatically
CENTRAL_LINK_COUNT ?= 0
PERIPHERAL_LINK_COUNT ?= 1
else
CENTRAL_LINK_COUNT ?= 1
PERIPHERAL_LINK_COUNT ?= 1
endif
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)ble/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)ble/ble_services/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)ble/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)ble/ble_services/*/)
CFLAGS += -DBLE_STACK_SUPPORT_REQD -DSOFTDEVICE_PRESENT -DCENTRAL_LINK_COUNT=$(CENTRAL_LINK_COUNT) -DPERIPHERAL_LINK_COUNT=$(PERIPHERAL_LINK_COUNT)
endif
ifdef USE_ANT
CFLAGS += -DANT_STACK_SUPPORT_REQD
endif
ifdef ENABLE_WIRELESS_DFU
CFLAGS += -DENABLE_DFU
APPLICATION_SRCS += bootloader_util.c
endif
ifdef SOFTDEVICE_MODEL
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)softdevice/common/softdevice_handler/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/nrf51
SOURCE_PATHS += $(SDK_SOURCE_PATH)softdevice/common/softdevice_handler/
SOURCE_PATHS += $(SDK_SOURCE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/
SOURCE_PATHS += $(SDK_SOURCE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/nrf51
ifdef SERIALIZATION_MODE
# Load the sources from the serialization library
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/middleware/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/serializers/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)serialization/common/struct_ser/$(SOFTDEVICE_MODEL)/
SOURCE_PATHS += $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/middleware/
SOURCE_PATHS += $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/serializers/
SOURCE_PATHS += $(SDK_SOURCE_PATH)serialization/common/struct_ser/$(SOFTDEVICE_MODEL)/
endif
else
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/nrf_soc_nosd/)
SOFTDEVICE_MODEL = blank
endif
endif # SDK 11
ifeq ($(SDK_VERSION), 10)
# Set the path
SDK_PATH ?= $(BASE_DIR)/sdk/nrf51_sdk_10.0.0/
# Other knowns about the SDK paths
SDK_INCLUDE_PATH = $(SDK_PATH)components/
SDK_SOURCE_PATH = $(SDK_PATH)components/
CMSIS_INCLUDE_PATH = $(SDK_PATH)components/toolchain/gcc/
# Need to add the paths for all the directories in the SDK.
# Note that we do not use * because some folders have conflicting files.
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)libraries/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/ble_flash/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/clock/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/common/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/delay/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/gpiote/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/hal/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/lpcomp/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/ppi/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/pstorage/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/pstorage/config/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/radio_config/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/rng/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/rtc/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/sdio/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/spi_master/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/spi_slave/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/swi/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/timer/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/twi_master/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/uart/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/wdt/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/validation/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_ext/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)device/)
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)toolchain/gcc/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)toolchain/
SOURCE_PATHS += $(SDK_SOURCE_PATH)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)libraries/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)drivers_nrf/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)drivers_ext/*/)
ifdef SERIALIZATION_MODE
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/transport/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/common/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/hal/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/transport/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/transport/ser_phy/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/common/transport/ser_phy/config/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/transport/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/common/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/hal/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/transport/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/transport/ser_phy/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/common/transport/ser_phy/config/)
# Add defines based on if we are "connectivity" or "application"
ifeq ($(SERIALIZATION_MODE), connectivity)
CFLAGS += -DSER_CONNECTIVITY -DAPP_SCHEDULER_WITH_PAUSE -DBLE_STACK_SUPPORT_REQD -DHCI_TIMER2 -DSOFTDEVICE_PRESENT
endif
ifeq ($(SERIALIZATION_MODE), application)
CFLAGS += -DSVCALL_AS_NORMAL_FUNCTION -DBLE_STACK_SUPPORT_REQD
endif
else
ifdef SOFTDEVICE_MODEL
CFLAGS += -DSOFTDEVICE_PRESENT
endif
endif
ifdef USE_BLE
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)ble/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)ble/ble_services/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)ble/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)ble/ble_services/*/)
CFLAGS += -DBLE_STACK_SUPPORT_REQD
endif
ifdef USE_ANT
CFLAGS += -DANT_STACK_SUPPORT_REQD
endif
ifdef ENABLE_WIRELESS_DFU
CFLAGS += -DENABLE_DFU
APPLICATION_SRCS += bootloader_util.c
endif
ifdef SOFTDEVICE_MODEL
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)softdevice/common/softdevice_handler/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/
SOURCE_PATHS += $(SDK_SOURCE_PATH)softdevice/common/softdevice_handler/
SOURCE_PATHS += $(SDK_SOURCE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/
ifdef SERIALIZATION_MODE
# Load the sources from the serialization library
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/middleware/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/serializers/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)serialization/common/struct_ser/$(SOFTDEVICE_MODEL)/
SOURCE_PATHS += $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/middleware/
SOURCE_PATHS += $(SDK_SOURCE_PATH)serialization/$(SERIALIZATION_MODE)/codecs/$(SOFTDEVICE_MODEL)/serializers/
SOURCE_PATHS += $(SDK_SOURCE_PATH)serialization/common/struct_ser/$(SOFTDEVICE_MODEL)/
endif
else
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/nrf_soc_nosd/)
SOFTDEVICE_MODEL = blank
endif
endif # SDK 10
ifeq ($(SDK_VERSION), 9)
# Set the path
SDK_PATH ?= $(BASE_DIR)/sdk/nrf51_sdk_9.0.0/
SOFTDEVICE ?= $(SDK_PATH)/components/softdevice/$(SOFTDEVICE_MODEL)/hex/$(SOFTDEVICE_MODEL)_softdevice.hex
# Other knowns about the SDK paths
SDK_INCLUDE_PATH = $(SDK_PATH)components/
SDK_SOURCE_PATH = $(SDK_PATH)components/
CMSIS_INCLUDE_PATH = $(SDK_PATH)components/toolchain/gcc/
# Need to add the paths for all the directories in the SDK.
# Note that we do not use * because some folders have conflicting files.
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)libraries/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/ble_flash/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/clock/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/common/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/gpiote/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/hal/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/lpcomp/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/ppi/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/pstorage/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/radio_config/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/rng/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/rtc/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/sdio/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/spi_master/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/spi_slave/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/swi/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/timer/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/twi_master/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/uart/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/wdt/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_ext/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)device/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)serialization/*/)
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)toolchain/gcc/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)toolchain/
SOURCE_PATHS += $(SDK_SOURCE_PATH)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)libraries/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)drivers_nrf/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)drivers_ext/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)serialization/*/)
ifdef USE_BLE
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)ble/*/)
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)ble/ble_services/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)ble/*/)
SOURCE_PATHS += $(wildcard $(SDK_SOURCE_PATH)ble/ble_services/*/)
CFLAGS += -DBLE_STACK_SUPPORT_REQD
endif
ifdef USE_ANT
CFLAGS += -DANT_STACK_SUPPORT_REQD
endif
ifdef ENABLE_WIRELESS_DFU
CFLAGS += -DENABLE_DFU
APPLICATION_SRCS += bootloader_util.c
endif
ifdef SOFTDEVICE_MODEL
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)softdevice/common/softdevice_handler/
LIBRARY_PATHS += $(SDK_INCLUDE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/
SOURCE_PATHS += $(SDK_INCLUDE_PATH)softdevice/common/softdevice_handler/
SOURCE_PATHS += $(SDK_INCLUDE_PATH)softdevice/$(SOFTDEVICE_MODEL)/headers/
else
LIBRARY_PATHS += $(wildcard $(SDK_INCLUDE_PATH)drivers_nrf/nrf_soc_nosd/)
SOFTDEVICE_MODEL = blank
endif
endif # SDK 9
# Set the Softdevice path
SOFTDEVICE ?= $(SDK_PATH)/components/softdevice/$(SOFTDEVICE_MODEL)/hex/$(SOFTDEVICE_MODEL)_$(NRF_MODEL)_$(SOFTDEVICE_VERSION)_softdevice.hex
ifeq ($(SOFTDEVICE_MODEL), blank)
SOFTDEVICE_VERSION = 0
endif
# Location for BLE Address if stored in Flash
ifeq ($(FLASH_KB), 256)
# 256 KB Flash
CFLAGS += -DBLEADDR_FLASH_LOCATION=0x0003FFF8
BLEADDR_FLASH_LOCATION ?= 0x0003FFF8
else
# Assume 128 KB Flash
CFLAGS += -DBLEADDR_FLASH_LOCATION=0x0001FFF8
BLEADDR_FLASH_LOCATION ?= 0x0001FFF8
endif
# Hardware and Firmware version numbers
HW_REVISION ?= none
FW_REVISION ?= none
ENABLE_DIS ?= false
ifneq ($(HW_REVISION), none)
CFLAGS += -DHW_REVISION=\"$(HW_REVISION)\"
ENABLE_DIS = true
endif
ifneq ($(FW_REVISION), none)
CFLAGS += -DFW_REVISION=\"$(FW_REVISION)\"
ENABLE_DIS = true
endif
ifeq ($(ENABLE_DIS), true)
APPLICATION_SRCS += ble_dis.c
APPLICATION_SRCS += device_info_service.c
endif
# Needed for SDK12
NRF_IC_UPPER = $(shell echo $(NRF_IC) | tr a-z A-Z)
print-% : ; @echo $* = $($*)
LINKER_SCRIPT ?= $(BASE_DIR)/make/ld/gcc_$(NRF_MODEL)_$(SOFTDEVICE_MODEL)_$(SOFTDEVICE_VERSION)_$(RAM_KB)_$(FLASH_KB).ld
OUTPUT_NAME ?= $(addsuffix _$(SOFTDEVICE_MODEL), $(PROJECT_NAME))
DFU_OUTPUT_NAME ?= $(addsuffix _$(FLASH_KB), $(addsuffix _$(RAM_KB), $(addsuffix _$(SOFTDEVICE_MODEL), dfu)))
LIBRARY_INCLUDES = $(addprefix -I,$(LIBRARY_PATHS))
CMSIS_INCLUDE = $(addprefix -I,$(CMSIS_INCLUDE_PATH))
VPATH = $(SOURCE_PATHS)
OUTPUT_PATH ?= _build/
CPUFLAGS += -mthumb -mabi=aapcs
ifeq ($(NRF_MODEL), nrf51)
CPUFLAGS += -mcpu=cortex-m0 -march=armv6-m
endif
ifeq ($(NRF_MODEL), nrf52)
CPUFLAGS += -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
endif
CFLAGS += -std=gnu99 -c $(CPUFLAGS) -Wall -Wextra -Wno-unused-parameter -Werror=return-type -D$(DEVICE) -D$(BOARD) -D$(NRF_IC_UPPER) -DSDK_VERSION_$(SDK_VERSION) -DSOFTDEVICE_$(SOFTDEVICE_MODEL)
# keep every function in separate section. This will allow linker to dump unused functions
CFLAGS += -s -ffunction-sections -fdata-sections -fno-strict-aliasing
CFLAGS += -fno-builtin --short-enums
CFLAGS += -D$(shell echo $(SOFTDEVICE_MODEL) | tr a-z A-Z)
CFLAGS += $(CMSIS_INCLUDE) $(LIBRARY_INCLUDES) -MD
LDFLAGS += -Xlinker -Map=$(OUTPUT_PATH)$(OUTPUT_NAME).Map
LDFLAGS += $(CPUFLAGS) -L $(BASE_DIR)/make/ld -T $(LINKER_SCRIPT)
# let linker to dump unused sections
LDFLAGS += -Wl,--gc-sections
# use newlib in nano version
LDFLAGS += --specs=nano.specs -lc -lnosys
OBJDUMP_FLAGS += --disassemble-all --source --disassembler-options=force-thumb -C --section-headers
DFUHEX = $(BASE_DIR)/dfu/_build/$(DFU_OUTPUT_NAME).hex
DFUELF = $(BASE_DIR)/dfu/_build/$(DFU_OUTPUT_NAME).elf
DFUBIN = $(BASE_DIR)/dfu/_build/$(DFU_OUTPUT_NAME).bin
HEX = $(OUTPUT_PATH)$(OUTPUT_NAME).hex
ELF = $(OUTPUT_PATH)$(OUTPUT_NAME).elf
BIN = $(OUTPUT_PATH)$(OUTPUT_NAME).bin
LST = $(OUTPUT_PATH)$(OUTPUT_NAME).lst
SRCS = $(SYSTEM_FILE) $(notdir $(APPLICATION_SRCS))
OBJS = $(addprefix $(OUTPUT_PATH), $(SRCS:.c=.o)) $(addprefix $(OUTPUT_PATH),$(APPLICATION_LIBS))
DEPS = $(addprefix $(OUTPUT_PATH), $(SRCS:.c=.d))
SRCS_AS = $(START_CODE)
OBJS_AS = $(addprefix $(OUTPUT_PATH), $(SRCS_AS:.s=.os))
### Verbosity control. Use make V=1 to get verbose builds.
ifeq ($(V),1)
PRINT_CC =
PRINT_LD =
PRINT_AR =
PRINT_AS =
PRINT_HEX =
PRINT_BIN =
PRINT_SIZ =
Q=
else
PRINT_CC = @echo " CC " $<
PRINT_LD = @echo " LD " $(ELF)
PRINT_AR = @echo " AR " $@
PRINT_AS = @echo " AS " $<
PRINT_HEX = @echo " HEX " $(HEX)
PRINT_BIN = @echo " BIN " $(BIN)
PRINT_LST = @echo " LST " $(LST)
PRINT_SIZ = @echo " SIZE " $(ELF)
Q=@
endif
ifdef ENABLE_WIRELESS_DFU
all: $(OBJS) $(OBJS_AS) $(HEX) bootloader
else
all: $(OBJS) $(OBJS_AS) $(HEX)
endif
debug: CFLAGS += -g
ifdef ENABLE_WIRELESS_DFU
debug: $(OBJS) $(OBJS_AS) $(HEX) bootloader
else
debug: $(OBJS) $(OBJS_AS) $(HEX)
endif
rebuild: clean all
ifeq ($(OS),Windows_NT)
include $(BASE_DIR)/make/Makefile.windows
else
include $(BASE_DIR)/make/Makefile.posix
endif
$(HEX): $(OBJS) $(OBJS_AS)
$(PRINT_LD)
$(Q)$(LD) $(LDFLAGS) $(OBJS_AS) $(OBJS) -o $(ELF)
$(PRINT_HEX)
$(Q)$(OBJCOPY) -Oihex $(ELF) $(HEX)
$(PRINT_BIN)
$(Q)$(OBJCOPY) -Obinary $(ELF) $(BIN)
$(PRINT_LST)
$(Q)$(OBJDUMP) $(OBJDUMP_FLAGS) $(ELF) > $(LST)
$(PRINT_SIZ)
$(Q)$(SIZE) $(ELF)
size: $(ELF)
$(SIZE) $(ELF)
$(OUTPUT_PATH)%.o: %.c
@$(MAKE_BUILD_FOLDER)
$(PRINT_CC)
$(Q)$(CC) $(LDFLAGS) $(CFLAGS) $< -o $@
$(OUTPUT_PATH)%.os: %.s
@$(MAKE_BUILD_FOLDER)
$(PRINT_AS)
$(Q)$(AS) $< -o $@
-include $(DEPS)
.PHONY: all clean rebuild size
| {
"content_hash": "8fa11ad714b138216a0f56155fe0ca40",
"timestamp": "",
"source": "github",
"line_count": 888,
"max_line_length": 194,
"avg_line_length": 41.0731981981982,
"alnum_prop": 0.6929783675595647,
"repo_name": "Tech4Race/nrf5x-base",
"id": "3084875bb1ac0440fb6c3246d0a7be1f8f5dc704",
"size": "36473",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "make/Makefile",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "356869"
},
{
"name": "C",
"bytes": "43986144"
},
{
"name": "C++",
"bytes": "891552"
},
{
"name": "Makefile",
"bytes": "71157"
},
{
"name": "Objective-C",
"bytes": "31666"
},
{
"name": "Python",
"bytes": "1120"
},
{
"name": "Shell",
"bytes": "113"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CsBuilder.Statements;
namespace CsBuilder.DSL
{
public static class UsingStatementExtensions
{
public static UsingStatement WithAlias(this UsingStatement usingStatement, string alias)
{
usingStatement.Alias = alias;
return usingStatement;
}
}
}
| {
"content_hash": "de8b199c7e713fca0c24a26aa9e34e41",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 96,
"avg_line_length": 23.470588235294116,
"alnum_prop": 0.6967418546365914,
"repo_name": "jorgehmv/CsBuilder",
"id": "2a7ff07316b9c51f981e2d184f19cf6cdf29dacf",
"size": "401",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "CsBuilder/DSL/UsingStatementExtensions.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "97598"
}
],
"symlink_target": ""
} |
<?php
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/ads/googleads/v12/services/conversion_adjustment_upload_service.proto
namespace Google\Ads\GoogleAds\V12\Services;
use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;
/**
* Response message for
* [ConversionAdjustmentUploadService.UploadConversionAdjustments][google.ads.googleads.v12.services.ConversionAdjustmentUploadService.UploadConversionAdjustments].
*
* Generated from protobuf message <code>google.ads.googleads.v12.services.UploadConversionAdjustmentsResponse</code>
*/
class UploadConversionAdjustmentsResponse extends \Google\Protobuf\Internal\Message
{
/**
* Errors that pertain to conversion adjustment failures in the partial
* failure mode. Returned when all errors occur inside the adjustments. If any
* errors occur outside the adjustments (for example, auth errors), we return
* an RPC level error. See
* https://developers.google.com/google-ads/api/docs/best-practices/partial-failures
* for more information about partial failure.
*
* Generated from protobuf field <code>.google.rpc.Status partial_failure_error = 1;</code>
*/
protected $partial_failure_error = null;
/**
* Returned for successfully processed conversion adjustments. Proto will be
* empty for rows that received an error. Results are not returned when
* validate_only is true.
*
* Generated from protobuf field <code>repeated .google.ads.googleads.v12.services.ConversionAdjustmentResult results = 2;</code>
*/
private $results;
/**
* Constructor.
*
* @param array $data {
* Optional. Data for populating the Message object.
*
* @type \Google\Rpc\Status $partial_failure_error
* Errors that pertain to conversion adjustment failures in the partial
* failure mode. Returned when all errors occur inside the adjustments. If any
* errors occur outside the adjustments (for example, auth errors), we return
* an RPC level error. See
* https://developers.google.com/google-ads/api/docs/best-practices/partial-failures
* for more information about partial failure.
* @type array<\Google\Ads\GoogleAds\V12\Services\ConversionAdjustmentResult>|\Google\Protobuf\Internal\RepeatedField $results
* Returned for successfully processed conversion adjustments. Proto will be
* empty for rows that received an error. Results are not returned when
* validate_only is true.
* }
*/
public function __construct($data = NULL) {
\GPBMetadata\Google\Ads\GoogleAds\V12\Services\ConversionAdjustmentUploadService::initOnce();
parent::__construct($data);
}
/**
* Errors that pertain to conversion adjustment failures in the partial
* failure mode. Returned when all errors occur inside the adjustments. If any
* errors occur outside the adjustments (for example, auth errors), we return
* an RPC level error. See
* https://developers.google.com/google-ads/api/docs/best-practices/partial-failures
* for more information about partial failure.
*
* Generated from protobuf field <code>.google.rpc.Status partial_failure_error = 1;</code>
* @return \Google\Rpc\Status|null
*/
public function getPartialFailureError()
{
return $this->partial_failure_error;
}
public function hasPartialFailureError()
{
return isset($this->partial_failure_error);
}
public function clearPartialFailureError()
{
unset($this->partial_failure_error);
}
/**
* Errors that pertain to conversion adjustment failures in the partial
* failure mode. Returned when all errors occur inside the adjustments. If any
* errors occur outside the adjustments (for example, auth errors), we return
* an RPC level error. See
* https://developers.google.com/google-ads/api/docs/best-practices/partial-failures
* for more information about partial failure.
*
* Generated from protobuf field <code>.google.rpc.Status partial_failure_error = 1;</code>
* @param \Google\Rpc\Status $var
* @return $this
*/
public function setPartialFailureError($var)
{
GPBUtil::checkMessage($var, \Google\Rpc\Status::class);
$this->partial_failure_error = $var;
return $this;
}
/**
* Returned for successfully processed conversion adjustments. Proto will be
* empty for rows that received an error. Results are not returned when
* validate_only is true.
*
* Generated from protobuf field <code>repeated .google.ads.googleads.v12.services.ConversionAdjustmentResult results = 2;</code>
* @return \Google\Protobuf\Internal\RepeatedField
*/
public function getResults()
{
return $this->results;
}
/**
* Returned for successfully processed conversion adjustments. Proto will be
* empty for rows that received an error. Results are not returned when
* validate_only is true.
*
* Generated from protobuf field <code>repeated .google.ads.googleads.v12.services.ConversionAdjustmentResult results = 2;</code>
* @param array<\Google\Ads\GoogleAds\V12\Services\ConversionAdjustmentResult>|\Google\Protobuf\Internal\RepeatedField $var
* @return $this
*/
public function setResults($var)
{
$arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Ads\GoogleAds\V12\Services\ConversionAdjustmentResult::class);
$this->results = $arr;
return $this;
}
}
| {
"content_hash": "17b6045a3d8724368dc354774ad7a72f",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 164,
"avg_line_length": 41.45,
"alnum_prop": 0.6944683784249526,
"repo_name": "googleads/google-ads-php",
"id": "c90dd8d32f6aac3f8b582e24c7b11e0869f962bd",
"size": "5803",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/Google/Ads/GoogleAds/V12/Services/UploadConversionAdjustmentsResponse.php",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "899"
},
{
"name": "PHP",
"bytes": "9952711"
},
{
"name": "Shell",
"bytes": "338"
}
],
"symlink_target": ""
} |
const _plotly_attr = merge_with_base_supported([
:annotations,
:background_color_legend, :background_color_inside, :background_color_outside,
:foreground_color_legend, :foreground_color_guide,
# :foreground_color_grid, :foreground_color_axis,
:foreground_color_text, :foreground_color_border,
:foreground_color_title,
:label,
:seriescolor, :seriesalpha,
:linecolor, :linestyle, :linewidth, :linealpha,
:markershape, :markercolor, :markersize, :markeralpha,
:markerstrokewidth, :markerstrokecolor, :markerstrokealpha, :markerstrokestyle,
:fillrange, :fillcolor, :fillalpha,
:bins,
:title, :title_location, :titlefont,
:window_title,
:guide, :lims, :ticks, :scale, :flip, :rotation,
:tickfont, :guidefont, :legendfont,
:grid, :legend, :colorbar,
:marker_z, :levels,
:ribbon, :quiver,
:orientation,
# :overwrite_figure,
:polar,
:normalize, :weights,
# :contours,
:aspect_ratio,
:hover,
:inset_subplots,
:bar_width,
])
const _plotly_seriestype = [
:path, :scatter, :bar, :pie, :heatmap,
:contour, :surface, :wireframe, :path3d, :scatter3d, :shape, :scattergl,
]
const _plotly_style = [:auto, :solid, :dash, :dot, :dashdot]
const _plotly_marker = [
:none, :auto, :circle, :rect, :diamond, :utriangle, :dtriangle,
:cross, :xcross, :pentagon, :hexagon, :octagon, :vline, :hline
]
const _plotly_scale = [:identity, :log10]
is_subplot_supported(::PlotlyBackend) = true
# is_string_supported(::PlotlyBackend) = true
# --------------------------------------------------------------------------------------
function add_backend_string(::PlotlyBackend)
"""
Pkg.build("Plots")
"""
end
const _plotly_js_path = joinpath(dirname(@__FILE__), "..", "..", "deps", "plotly-latest.min.js")
function _initialize_backend(::PlotlyBackend; kw...)
@eval begin
import JSON
_js_code = open(readstring, _plotly_js_path, "r")
# borrowed from https://github.com/plotly/plotly.py/blob/2594076e29584ede2d09f2aa40a8a195b3f3fc66/plotly/offline/offline.py#L64-L71 c/o @spencerlyon2
_js_script = """
<script type='text/javascript'>
define('plotly', function(require, exports, module) {
$(_js_code)
});
require(['plotly'], function(Plotly) {
window.Plotly = Plotly;
});
</script>
"""
# if we're in IJulia call setupnotebook to load js and css
if isijulia()
display("text/html", _js_script)
end
# if isatom()
# import Atom
# Atom.@msg evaljs(_js_code)
# end
end
# TODO: other initialization
end
# ----------------------------------------------------------------
function plotly_font(font::Font, color = font.color)
KW(
:family => font.family,
:size => round(Int, font.pointsize*1.4),
:color => rgba_string(color),
)
end
function plotly_annotation_dict(x, y, val; xref="paper", yref="paper")
KW(
:text => val,
:xref => xref,
:x => x,
:yref => xref,
:y => y,
:showarrow => false,
)
end
function plotly_annotation_dict(x, y, ptxt::PlotText; xref="paper", yref="paper")
merge(plotly_annotation_dict(x, y, ptxt.str; xref=xref, yref=yref), KW(
:font => plotly_font(ptxt.font),
:xanchor => ptxt.font.halign == :hcenter ? :center : ptxt.font.halign,
:yanchor => ptxt.font.valign == :vcenter ? :middle : ptxt.font.valign,
:rotation => -ptxt.font.rotation,
))
end
# function get_annotation_dict_for_arrow(d::KW, xyprev::Tuple, xy::Tuple, a::Arrow)
# xdiff = xyprev[1] - xy[1]
# ydiff = xyprev[2] - xy[2]
# dist = sqrt(xdiff^2 + ydiff^2)
# KW(
# :showarrow => true,
# :x => xy[1],
# :y => xy[2],
# # :ax => xyprev[1] - xy[1],
# # :ay => xy[2] - xyprev[2],
# # :ax => 0,
# # :ay => -40,
# :ax => 10xdiff / dist,
# :ay => -10ydiff / dist,
# :arrowcolor => rgba_string(d[:linecolor]),
# :xref => "x",
# :yref => "y",
# :arrowsize => 10a.headwidth,
# # :arrowwidth => a.headlength,
# :arrowwidth => 0.1,
# )
# end
function plotly_scale(scale::Symbol)
if scale == :log10
"log"
else
"-"
end
end
function shrink_by(lo, sz, ratio)
amt = 0.5 * (1.0 - ratio) * sz
lo + amt, sz - 2amt
end
function plotly_apply_aspect_ratio(sp::Subplot, plotarea, pcts)
aspect_ratio = sp[:aspect_ratio]
if aspect_ratio != :none
if aspect_ratio == :equal
aspect_ratio = 1.0
end
xmin,xmax = axis_limits(sp[:xaxis])
ymin,ymax = axis_limits(sp[:yaxis])
want_ratio = ((xmax-xmin) / (ymax-ymin)) / aspect_ratio
parea_ratio = width(plotarea) / height(plotarea)
if want_ratio > parea_ratio
# need to shrink y
ratio = parea_ratio / want_ratio
pcts[2], pcts[4] = shrink_by(pcts[2], pcts[4], ratio)
elseif want_ratio < parea_ratio
# need to shrink x
ratio = want_ratio / parea_ratio
pcts[1], pcts[3] = shrink_by(pcts[1], pcts[3], ratio)
end
pcts
end
pcts
end
# this method gets the start/end in percentage of the canvas for this axis direction
function plotly_domain(sp::Subplot, letter)
figw, figh = sp.plt[:size]
pcts = bbox_to_pcts(sp.plotarea, figw*px, figh*px)
pcts = plotly_apply_aspect_ratio(sp, sp.plotarea, pcts)
i1,i2 = (letter == :x ? (1,3) : (2,4))
[pcts[i1], pcts[i1]+pcts[i2]]
end
function plotly_axis(axis::Axis, sp::Subplot)
letter = axis[:letter]
ax = KW(
:title => axis[:guide],
:showgrid => sp[:grid],
:zeroline => false,
:ticks => "inside",
)
if letter in (:x,:y)
ax[:domain] = plotly_domain(sp, letter)
ax[:anchor] = "$(letter==:x ? :y : :x)$(plotly_subplot_index(sp))"
end
ax[:tickangle] = -axis[:rotation]
if !(axis[:ticks] in (nothing, :none))
ax[:titlefont] = plotly_font(axis[:guidefont], axis[:foreground_color_guide])
ax[:type] = plotly_scale(axis[:scale])
ax[:tickfont] = plotly_font(axis[:tickfont], axis[:foreground_color_text])
ax[:tickcolor] = rgba_string(axis[:foreground_color_border])
ax[:linecolor] = rgba_string(axis[:foreground_color_border])
# lims
lims = axis[:lims]
if lims != :auto && limsType(lims) == :limits
ax[:range] = map(scalefunc(axis[:scale]), lims)
end
# flip
if axis[:flip]
ax[:autorange] = "reversed"
end
# ticks
ticks = get_ticks(axis)
if ticks != :auto
ttype = ticksType(ticks)
if ttype == :ticks
ax[:tickmode] = "array"
ax[:tickvals] = ticks
elseif ttype == :ticks_and_labels
ax[:tickmode] = "array"
ax[:tickvals], ax[:ticktext] = ticks
end
end
else
ax[:showticklabels] = false
ax[:showgrid] = false
end
ax
end
function plotly_layout(plt::Plot)
d_out = KW()
w, h = plt[:size]
d_out[:width], d_out[:height] = w, h
d_out[:paper_bgcolor] = rgba_string(plt[:background_color_outside])
d_out[:margin] = KW(:l=>0, :b=>0, :r=>0, :t=>20)
d_out[:annotations] = KW[]
for sp in plt.subplots
spidx = plotly_subplot_index(sp)
# add an annotation for the title... positioned horizontally relative to plotarea,
# but vertically just below the top of the subplot bounding box
if sp[:title] != ""
bb = plotarea(sp)
tpos = sp[:title_location]
xmm = if tpos == :left
left(bb)
elseif tpos == :right
right(bb)
else
0.5 * (left(bb) + right(bb))
end
titlex, titley = xy_mm_to_pcts(xmm, top(bbox(sp)), w*px, h*px)
titlefont = font(sp[:titlefont], :top, sp[:foreground_color_title])
push!(d_out[:annotations], plotly_annotation_dict(titlex, titley, text(sp[:title], titlefont)))
end
d_out[:plot_bgcolor] = rgba_string(sp[:background_color_inside])
# if any(is3d, seriesargs)
if is3d(sp)
d_out[:scene] = KW(
Symbol("xaxis$spidx") => plotly_axis(sp[:xaxis], sp),
Symbol("yaxis$spidx") => plotly_axis(sp[:yaxis], sp),
Symbol("zaxis$spidx") => plotly_axis(sp[:zaxis], sp),
)
else
d_out[Symbol("xaxis$spidx")] = plotly_axis(sp[:xaxis], sp)
d_out[Symbol("yaxis$spidx")] = plotly_axis(sp[:yaxis], sp)
end
# legend
d_out[:showlegend] = sp[:legend] != :none
if sp[:legend] != :none
d_out[:legend] = KW(
:bgcolor => rgba_string(sp[:background_color_legend]),
:bordercolor => rgba_string(sp[:foreground_color_legend]),
:font => plotly_font(sp[:legendfont], sp[:foreground_color_legend]),
)
end
# annotations
append!(d_out[:annotations], KW[plotly_annotation_dict(ann...; xref = "x$spidx", yref = "y$spidx") for ann in sp[:annotations]])
# # arrows
# for sargs in seriesargs
# a = sargs[:arrow]
# if sargs[:seriestype] in (:path, :line) && typeof(a) <: Arrow
# add_arrows(sargs[:x], sargs[:y]) do xyprev, xy
# push!(d_out[:annotations], get_annotation_dict_for_arrow(sargs, xyprev, xy, a))
# end
# end
# end
if ispolar(sp)
d_out[:direction] = "counterclockwise"
end
d_out
end
# turn off hover if nothing's using it
if all(series -> series.d[:hover] in (false,:none), plt.series_list)
d_out[:hovermode] = "none"
end
d_out
end
function plotly_layout_json(plt::Plot)
JSON.json(plotly_layout(plt))
end
function plotly_colorscale(grad::ColorGradient, α)
[[grad.values[i], rgb_string(grad.colors[i])] for i in 1:length(grad.colors)]
end
plotly_colorscale(c, α) = plotly_colorscale(cgrad(alpha=α), α)
# plotly_colorscale(c, alpha = nothing) = plotly_colorscale(cgrad(), alpha)
const _plotly_markers = KW(
:rect => "square",
:xcross => "x",
:x => "x",
:utriangle => "triangle-up",
:dtriangle => "triangle-down",
:star5 => "star-triangle-up",
:vline => "line-ns",
:hline => "line-ew",
)
function plotly_subplot_index(sp::Subplot)
spidx = sp[:subplot_index]
spidx == 1 ? "" : spidx
end
# the Shape contructor will automatically close the shape. since we need it closed,
# we split by NaNs and then construct/destruct the shapes to get the closed coords
function plotly_close_shapes(x, y)
xs, ys = nansplit(x), nansplit(y)
for i=1:length(xs)
shape = Shape(xs[i], ys[i])
xs[i], ys[i] = shape_coords(shape)
end
nanvcat(xs), nanvcat(ys)
end
plotly_data(v) = collect(v)
plotly_data(surf::Surface) = surf.surf
plotly_data{R<:Rational}(v::AbstractArray{R}) = float(v)
plotly_surface_data(series::Series, a::AbstractVector) = a
plotly_surface_data(series::Series, a::AbstractMatrix) = transpose_z(series, a, false)
plotly_surface_data(series::Series, a::Surface) = plotly_surface_data(series, a.surf)
# get a dictionary representing the series params (d is the Plots-dict, d_out is the Plotly-dict)
function plotly_series(plt::Plot, series::Series)
st = series[:seriestype]
if st == :shape
return plotly_series_shapes(plt, series)
end
sp = series[:subplot]
d_out = KW()
# these are the axes that the series should be mapped to
spidx = plotly_subplot_index(sp)
d_out[:xaxis] = "x$spidx"
d_out[:yaxis] = "y$spidx"
d_out[:showlegend] = should_add_to_legend(series)
x, y = plotly_data(series[:x]), plotly_data(series[:y])
d_out[:name] = series[:label]
isscatter = st in (:scatter, :scatter3d, :scattergl)
hasmarker = isscatter || series[:markershape] != :none
hasline = st in (:path, :path3d)
# for surface types, set the data
if st in (:heatmap, :contour, :surface, :wireframe)
for letter in [:x,:y,:z]
d_out[letter] = plotly_surface_data(series, series[letter])
end
end
# set the "type"
if st in (:path, :scatter, :scattergl)
d_out[:type] = st==:scattergl ? "scattergl" : "scatter"
d_out[:mode] = if hasmarker
hasline ? "lines+markers" : "markers"
else
hasline ? "lines" : "none"
end
if series[:fillrange] == true || series[:fillrange] == 0
d_out[:fill] = "tozeroy"
d_out[:fillcolor] = rgba_string(series[:fillcolor])
elseif !(series[:fillrange] in (false, nothing))
warn("fillrange ignored... plotly only supports filling to zero. fillrange: $(series[:fillrange])")
end
d_out[:x], d_out[:y] = x, y
elseif st == :bar
d_out[:type] = "bar"
d_out[:x], d_out[:y], d_out[:orientation] = if isvertical(series)
x, y, "v"
else
y, x, "h"
end
d_out[:marker] = KW(:color => rgba_string(series[:fillcolor]))
elseif st == :heatmap
d_out[:type] = "heatmap"
# d_out[:x], d_out[:y], d_out[:z] = series[:x], series[:y], transpose_z(series, series[:z].surf, false)
d_out[:colorscale] = plotly_colorscale(series[:fillcolor], series[:fillalpha])
elseif st == :contour
d_out[:type] = "contour"
# d_out[:x], d_out[:y], d_out[:z] = series[:x], series[:y], transpose_z(series, series[:z].surf, false)
# d_out[:showscale] = series[:colorbar] != :none
d_out[:ncontours] = series[:levels]
d_out[:contours] = KW(:coloring => series[:fillrange] != nothing ? "fill" : "lines")
d_out[:colorscale] = plotly_colorscale(series[:linecolor], series[:linealpha])
elseif st in (:surface, :wireframe)
d_out[:type] = "surface"
# d_out[:x], d_out[:y], d_out[:z] = series[:x], series[:y], transpose_z(series, series[:z].surf, false)
if st == :wireframe
d_out[:hidesurface] = true
wirelines = KW(
:show => true,
:color => rgba_string(series[:linecolor]),
:highlightwidth => series[:linewidth],
)
d_out[:contours] = KW(:x => wirelines, :y => wirelines, :z => wirelines)
else
d_out[:colorscale] = plotly_colorscale(series[:fillcolor], series[:fillalpha])
end
elseif st == :pie
d_out[:type] = "pie"
d_out[:labels] = pie_labels(sp, series)
d_out[:values] = y
d_out[:hoverinfo] = "label+percent+name"
elseif st in (:path3d, :scatter3d)
d_out[:type] = "scatter3d"
d_out[:mode] = if hasmarker
hasline ? "lines+markers" : "markers"
else
hasline ? "lines" : "none"
end
d_out[:x], d_out[:y] = x, y
d_out[:z] = plotly_data(series[:z])
else
warn("Plotly: seriestype $st isn't supported.")
return KW()
end
# add "marker"
if hasmarker
d_out[:marker] = KW(
:symbol => get(_plotly_markers, series[:markershape], string(series[:markershape])),
# :opacity => series[:markeralpha],
:size => 2 * series[:markersize],
# :color => rgba_string(series[:markercolor]),
:line => KW(
:color => rgba_string(series[:markerstrokecolor]),
:width => series[:markerstrokewidth],
),
)
# gotta hack this (for now?) since plotly can't handle rgba values inside the gradient
d_out[:marker][:color] = if series[:marker_z] == nothing
rgba_string(series[:markercolor])
else
# grad = ColorGradient(series[:markercolor], alpha=series[:markeralpha])
grad = series[:markercolor]
zmin, zmax = extrema(series[:marker_z])
[rgba_string(grad[(zi - zmin) / (zmax - zmin)]) for zi in series[:marker_z]]
end
end
# add "line"
if hasline
d_out[:line] = KW(
:color => rgba_string(series[:linecolor]),
:width => series[:linewidth],
:shape => if st == :steppre
"vh"
elseif st == :steppost
"hv"
else
"linear"
end,
:dash => string(series[:linestyle]),
# :dash => "solid",
)
end
plotly_polar!(d_out, series)
plotly_hover!(d_out, series[:hover])
[d_out]
end
function plotly_series_shapes(plt::Plot, series::Series)
d_outs = []
# TODO: create a d_out for each polygon
# x, y = series[:x], series[:y]
# these are the axes that the series should be mapped to
spidx = plotly_subplot_index(series[:subplot])
base_d = KW()
base_d[:xaxis] = "x$spidx"
base_d[:yaxis] = "y$spidx"
base_d[:name] = series[:label]
# base_d[:legendgroup] = series[:label]
x, y = plotly_data(series[:x]), plotly_data(series[:y])
for (i,rng) in enumerate(iter_segments(x,y))
length(rng) < 2 && continue
# to draw polygons, we actually draw lines with fill
d_out = merge(base_d, KW(
:type => "scatter",
:mode => "lines",
:x => vcat(x[rng], x[rng[1]]),
:y => vcat(y[rng], y[rng[1]]),
:fill => "tozeroy",
:fillcolor => rgba_string(cycle(series[:fillcolor], i)),
))
if series[:markerstrokewidth] > 0
d_out[:line] = KW(
:color => rgba_string(cycle(series[:linecolor], i)),
:width => series[:linewidth],
:dash => string(series[:linestyle]),
)
end
d_out[:showlegend] = i==1 ? should_add_to_legend(series) : false
plotly_polar!(d_out, series)
plotly_hover!(d_out, cycle(series[:hover], i))
push!(d_outs, d_out)
end
d_outs
end
function plotly_polar!(d_out::KW, series::Series)
# convert polar plots x/y to theta/radius
if ispolar(series[:subplot])
d_out[:t] = rad2deg(pop!(d_out, :x))
d_out[:r] = pop!(d_out, :y)
end
end
function plotly_hover!(d_out::KW, hover)
# hover text
if hover in (:none, false)
d_out[:hoverinfo] = "none"
elseif hover != nothing
d_out[:hoverinfo] = "text"
d_out[:text] = hover
end
end
# get a list of dictionaries, each representing the series params
function plotly_series_json(plt::Plot)
slist = []
for series in plt.series_list
append!(slist, plotly_series(plt, series))
end
JSON.json(slist)
# JSON.json(map(series -> plotly_series(plt, series), plt.series_list))
end
# ----------------------------------------------------------------
function html_head(plt::Plot{PlotlyBackend})
"<script src=\"$(joinpath(dirname(@__FILE__),"..","..","deps","plotly-latest.min.js"))\"></script>"
end
function html_body(plt::Plot{PlotlyBackend}, style = nothing)
if style == nothing
w, h = plt[:size]
style = "width:$(w)px;height:$(h)px;"
end
uuid = Base.Random.uuid4()
html = """
<div id=\"$(uuid)\" style=\"$(style)\"></div>
<script>
PLOT = document.getElementById('$(uuid)');
Plotly.plot(PLOT, $(plotly_series_json(plt)), $(plotly_layout_json(plt)));
</script>
"""
html
end
function js_body(plt::Plot{PlotlyBackend}, uuid)
js = """
PLOT = document.getElementById('$(uuid)');
Plotly.plot(PLOT, $(plotly_series_json(plt)), $(plotly_layout_json(plt)));
"""
end
# ----------------------------------------------------------------
function _show(io::IO, ::MIME"image/png", plt::Plot{PlotlyBackend})
# show_png_from_html(io, plt)
error("png output from the plotly backend is not supported. Please use plotlyjs instead.")
end
function _show(io::IO, ::MIME"image/svg+xml", plt::Plot{PlotlyBackend})
write(io, html_head(plt) * html_body(plt))
end
function _display(plt::Plot{PlotlyBackend})
standalone_html_window(plt)
end
| {
"content_hash": "76e9994034a60eba3cf2e76096014949",
"timestamp": "",
"source": "github",
"line_count": 641,
"max_line_length": 153,
"avg_line_length": 31.906396255850233,
"alnum_prop": 0.5489927635439077,
"repo_name": "JuliaPackageMirrors/Plots.jl",
"id": "3ad993f376961107dd3f05a2c33ee9491492a1ab",
"size": "20503",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/backends/plotly.jl",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Julia",
"bytes": "528348"
},
{
"name": "Shell",
"bytes": "750"
}
],
"symlink_target": ""
} |
(function($) {
$.fn.DynamicScrollspy = function(opts) {
//define opts
opts = (typeof(opts) == 'undefined') ? {} : opts;
this.isinit = (typeof(this.isinit) == 'undefined') ? false : self.isinit;
//destroy scrollspy ooption
if (opts == 'destroy') {
this.isinit = false;
this.empty();
this.off('activate.bs.scrollspy');
$('body').removeAttr('data-spy');
return this;
}
//extend options priorities: passed, existing, defaults
this.options = $.extend({}, {
affix: true, //use affix by default, doesn't work for Bootstrap 4
tH: 2, //lowest-level header to be included (H2)
bH: 6, //highest-level header to be included (H6)
exclude: false, //jquery filter
genIDs: false, //generate random IDs?
offset: 100, //offset for scrollspy
ulClassNames: 'hidden-print', //add this class to top-most UL
activeClass: '', //active class (besides .active) to add
testing: false //if testing, show heading tagName and ID
}, this.options, opts);
var self = this;
//store tree and used random numbers
this.tree = {};
this.rands = [];
//encode any text in header title to HTML entities
function encodeHTML(value) {
return $('<div></div>').text(value).html();
}
//returns jQuery object of all headers between tH and bH
function selectAllH() {
var st = [];
for (var i = self.options.tH; i <= self.options.bH; i++) {
st.push('H' + i);
}
return $(st.join(',')).not(self.options.exclude);
}
//generate random numbers; save and check saved to keep them unique
function randID() {
var r;
function rand() {
r = Math.floor(Math.random() * (1000 - 100)) + 100;
}
//get first random number
rand();
while (self.rands.indexOf(r) >= 0) {
//when that random is found, try again until it isn't
rand();
}
//save random for later
self.rands.push(r);
return r;
}
//generate random IDs for elements if requested
function genIDs() {
selectAllH().prop('id', function() {
// if no id prop for this header, return a random id
return ($(this).prop('id') === '') ? $(this).prop('tagName') + (randID()) : $(this).prop('id');
});
}
//check that all have id attribute
function checkIDs() {
var missing = 0;
//check they exist first
selectAllH().each(function() {
if ($(this).prop('id') === '') {
missing++;
} else {
if ($('[id="' + $(this).prop('id') + '"]').length > 1) throw new Error("DynamicScrollspy: Error! Duplicate id " + $(this).prop('id'));
}
});
if (missing > 0) {
var msg = "DynamicScrollspy: Not all headers have ids and genIDs: false.";
throw new Error(msg);
}
return missing;
}
//testing - show IDs and tag types
function showTesting() {
selectAllH().append(function() {
// let's see the tag names (for test)
return ' (' + $(this).prop('tagName') + ', ' + $(this).prop('id') + ')';
});
}
//setup the tree, (first level)
function makeTree() {
var tree = self.tree;
$('H' + self.options.tH).not(self.options.exclude).each(function() {
//run the first level
tree[$(this).prop('id')] = {
dstext: encodeHTML($(this).text()),
jqel: $(this)
};
});
if (self.options.tH + 1 <= self.options.bH) {
//only recurse if more than one level requested
itCreateTree(tree);
}
return tree;
}
//iterate through each grandchild+ level of the tree
function itCreateTree(what) {
for (var k in what) {
//skip empty items
if (k === '') continue;
// skip if text or element
if (k == 'dstext' || k == 'jqel') continue;
//get the current level
var lvl = Number($('#' + k).prop('tagName').replace('H', ''));
//end if we are at the final level
if (lvl >= self.options.bH) return false;
//next until
$('#' + k).nextUntil('H' + lvl).filter('H' + (lvl + 1)).not(self.options.exclude).each(function() {
what[k][$(this).prop('id')] = {
dstext: encodeHTML($(this).text()),
jqel: $(this)
};
});
//keep recursing if necessary
if (lvl < self.options.bH) itCreateTree(what[k]);
}
}
//render tree (setup first level)
function renderTree() {
var ul = $('<ul class="nav ' + self.options.ulClassNames + '"></ul>');
self.append(ul);
//then iterate three tree
$.each(self.tree, function(k) {
var c = self.tree[k];
var li = '<li id="dsli' + k + '" class="nav-item"><a href="#' + k + '" class="nav-link">' + c.dstext + '</a></li>';
ul.append(li);
itRenderTree(self.tree[k]);
});
return self;
}
//iterate and render each subsequent level
function itRenderTree(what) {
//if no children, skip
if (Object.keys(what).length < 3) return false;
//parent element, append sub list
var parent = $('#dsli' + what.jqel.prop('id'));
var ul = $("<ul class='nav child'></ul>");
parent.append(ul);
for (var k in what) {
//skip if text or element
if (k == 'dstext' || k == 'jqel') continue;
var c = what[k];
ul.append('<li id="dsli' + k + '" class="nav-item"><a href="#' + k + '" class="nav-link">' + c.dstext + '</a></li>');
itRenderTree(what[k]);
}
}
//initialize plugin
function init() {
//first time (or after destroy)
if (self.isinit === false) {
//generate IDs
if (self.options.genIDs) {
genIDs();
} else {
checkIDs();
}
if (self.options.testing) showTesting();
//make the tree
makeTree();
//render it
renderTree();
//bootstrap 4 has no affix
if (self.options.affix && typeof(self.children('ul').affix) === 'function') {
var ul = self.children('ul');
self.children('ul').affix({
offset: {
top: function() {
var c = ul.offset().top,
d = parseInt(ul.children(0).css("margin-top"), 10),
e = $(self).height();
return this.top = c - e - d;
},
bottom: function() {
return this.bottom = $(self).outerHeight(!0);
}
}
});
}
$('body').attr('data-spy', 'true').scrollspy({
target: '#' + self.prop('id'),
offset: self.options.offset
});
self.isinit = true;
} else {
makeTree();
renderTree();
$('[data-spy="scroll"]').each(function() {
$(this).scrollspy('refresh');
});
}
return self;
}
return init();
};
}(jQuery));
| {
"content_hash": "f571d3b018f12fb8517d9cabe5ba2dba",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 144,
"avg_line_length": 28.621951219512194,
"alnum_prop": 0.5135634142877432,
"repo_name": "psalmody/dynamic-scrollspy",
"id": "216e3faa2833335cdd6d9f8cb0b0f561f35da3ac",
"size": "7041",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/dynamicscrollspy.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "284324"
},
{
"name": "JavaScript",
"bytes": "9176"
}
],
"symlink_target": ""
} |
ActiveRecord::Schema.define(version: 20160930190451) do
create_table "alerts", force: :cascade do |t|
t.integer "course_id", limit: 4
t.integer "user_id", limit: 4
t.integer "article_id", limit: 4
t.integer "revision_id", limit: 4
t.string "type", limit: 255
t.datetime "email_sent_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "message", limit: 65535
t.integer "target_user_id", limit: 4
end
add_index "alerts", ["article_id"], name: "index_alerts_on_article_id", using: :btree
add_index "alerts", ["course_id"], name: "index_alerts_on_course_id", using: :btree
add_index "alerts", ["revision_id"], name: "index_alerts_on_revision_id", using: :btree
add_index "alerts", ["target_user_id"], name: "index_alerts_on_target_user_id", using: :btree
add_index "alerts", ["user_id"], name: "index_alerts_on_user_id", using: :btree
create_table "articles", force: :cascade do |t|
t.string "title", limit: 255
t.integer "views", limit: 8, default: 0
t.datetime "created_at"
t.datetime "updated_at"
t.integer "character_sum", limit: 4, default: 0
t.integer "revision_count", limit: 4, default: 0
t.date "views_updated_at"
t.integer "namespace", limit: 4
t.string "rating", limit: 255
t.datetime "rating_updated_at"
t.boolean "deleted", default: false
t.string "language", limit: 10
t.float "average_views", limit: 24
t.date "average_views_updated_at"
t.integer "wiki_id", limit: 4
t.integer "mw_page_id", limit: 4
end
create_table "articles_courses", force: :cascade do |t|
t.datetime "created_at"
t.datetime "updated_at"
t.integer "article_id", limit: 4
t.integer "course_id", limit: 4
t.integer "view_count", limit: 8, default: 0
t.integer "character_sum", limit: 4, default: 0
t.boolean "new_article", default: false
end
create_table "assignments", force: :cascade do |t|
t.datetime "created_at"
t.datetime "updated_at"
t.integer "user_id", limit: 4
t.integer "course_id", limit: 4
t.integer "article_id", limit: 4
t.string "article_title", limit: 255
t.integer "role", limit: 4
t.integer "wiki_id", limit: 4
end
add_index "assignments", ["course_id", "user_id", "article_title", "role", "wiki_id"], name: "by_course_user_article_and_role", unique: true, using: :btree
create_table "blocks", force: :cascade do |t|
t.integer "kind", limit: 4
t.text "content", limit: 65535
t.integer "week_id", limit: 4
t.integer "gradeable_id", limit: 4
t.datetime "created_at"
t.datetime "updated_at"
t.string "title", limit: 255
t.integer "order", limit: 4
t.date "due_date"
t.text "training_module_ids", limit: 65535
end
create_table "cohorts", force: :cascade do |t|
t.string "title", limit: 255
t.string "slug", limit: 255
t.string "url", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "cohorts_courses", force: :cascade do |t|
t.integer "cohort_id", limit: 4
t.integer "course_id", limit: 4
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "cohorts_survey_assignments", id: false, force: :cascade do |t|
t.integer "survey_assignment_id", limit: 4
t.integer "cohort_id", limit: 4
end
add_index "cohorts_survey_assignments", ["cohort_id"], name: "index_cohorts_survey_assignments_on_cohort_id", using: :btree
add_index "cohorts_survey_assignments", ["survey_assignment_id"], name: "index_cohorts_survey_assignments_on_survey_assignment_id", using: :btree
create_table "commons_uploads", force: :cascade do |t|
t.integer "user_id", limit: 4
t.string "file_name", limit: 255
t.datetime "uploaded_at"
t.integer "usage_count", limit: 4
t.datetime "created_at"
t.datetime "updated_at"
t.string "thumburl", limit: 2000
t.string "thumbwidth", limit: 255
t.string "thumbheight", limit: 255
t.boolean "deleted", default: false
end
create_table "courses", force: :cascade do |t|
t.string "title", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "start"
t.datetime "end"
t.string "school", limit: 255
t.string "term", limit: 255
t.integer "character_sum", limit: 4, default: 0
t.integer "view_sum", limit: 8, default: 0
t.integer "user_count", limit: 4, default: 0
t.integer "article_count", limit: 4, default: 0
t.integer "revision_count", limit: 4, default: 0
t.string "slug", limit: 255
t.string "subject", limit: 255
t.integer "expected_students", limit: 4
t.text "description", limit: 65535
t.boolean "submitted", default: false
t.string "passcode", limit: 255
t.datetime "timeline_start"
t.datetime "timeline_end"
t.string "day_exceptions", limit: 2000, default: ""
t.string "weekdays", limit: 255, default: "0000000"
t.integer "new_article_count", limit: 4, default: 0
t.boolean "no_day_exceptions", default: false
t.integer "trained_count", limit: 4, default: 0
t.integer "cloned_status", limit: 4
t.string "type", limit: 255, default: "ClassroomProgramCourse"
t.integer "upload_count", limit: 4, default: 0
t.integer "uploads_in_use_count", limit: 4, default: 0
t.integer "upload_usages_count", limit: 4, default: 0
t.string "syllabus_file_name", limit: 255
t.string "syllabus_content_type", limit: 255
t.integer "syllabus_file_size", limit: 4
t.datetime "syllabus_updated_at"
t.integer "home_wiki_id", limit: 4
end
add_index "courses", ["slug"], name: "index_courses_on_slug", using: :btree
create_table "courses_users", force: :cascade do |t|
t.datetime "created_at"
t.datetime "updated_at"
t.integer "course_id", limit: 4
t.integer "user_id", limit: 4
t.integer "character_sum_ms", limit: 4, default: 0
t.integer "character_sum_us", limit: 4, default: 0
t.integer "revision_count", limit: 4, default: 0
t.string "assigned_article_title", limit: 255
t.integer "role", limit: 4, default: 0
end
create_table "feedback_form_responses", force: :cascade do |t|
t.string "subject", limit: 255
t.text "body", limit: 65535
t.integer "user_id", limit: 4
t.datetime "created_at"
end
create_table "gradeables", force: :cascade do |t|
t.string "title", limit: 255
t.integer "points", limit: 4
t.integer "gradeable_item_id", limit: 4
t.datetime "created_at"
t.datetime "updated_at"
t.string "gradeable_item_type", limit: 255
end
create_table "question_group_conditionals", force: :cascade do |t|
t.integer "rapidfire_question_group_id", limit: 4
t.integer "cohort_id", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "question_group_conditionals", ["cohort_id"], name: "index_question_group_conditionals_on_cohort_id", using: :btree
add_index "question_group_conditionals", ["rapidfire_question_group_id"], name: "index_question_group_conditionals_on_rapidfire_question_group_id", using: :btree
create_table "rapidfire_answer_groups", force: :cascade do |t|
t.integer "question_group_id", limit: 4
t.integer "user_id", limit: 4
t.string "user_type", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "rapidfire_answer_groups", ["question_group_id"], name: "index_rapidfire_answer_groups_on_question_group_id", using: :btree
add_index "rapidfire_answer_groups", ["user_id", "user_type"], name: "index_rapidfire_answer_groups_on_user_id_and_user_type", using: :btree
create_table "rapidfire_answers", force: :cascade do |t|
t.integer "answer_group_id", limit: 4
t.integer "question_id", limit: 4
t.text "answer_text", limit: 65535
t.datetime "created_at"
t.datetime "updated_at"
t.text "follow_up_answer_text", limit: 65535
end
add_index "rapidfire_answers", ["answer_group_id"], name: "index_rapidfire_answers_on_answer_group_id", using: :btree
add_index "rapidfire_answers", ["question_id"], name: "index_rapidfire_answers_on_question_id", using: :btree
create_table "rapidfire_question_groups", force: :cascade do |t|
t.string "name", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.string "tags", limit: 255
end
create_table "rapidfire_questions", force: :cascade do |t|
t.integer "question_group_id", limit: 4
t.string "type", limit: 255
t.text "question_text", limit: 65535
t.integer "position", limit: 4
t.text "answer_options", limit: 65535
t.text "validation_rules", limit: 65535
t.datetime "created_at"
t.datetime "updated_at"
t.text "follow_up_question_text", limit: 65535
t.text "conditionals", limit: 65535
t.boolean "multiple", default: false
t.string "course_data_type", limit: 255
t.string "placeholder_text", limit: 255
t.boolean "track_sentiment", default: false
end
add_index "rapidfire_questions", ["question_group_id"], name: "index_rapidfire_questions_on_question_group_id", using: :btree
create_table "revisions", force: :cascade do |t|
t.integer "characters", limit: 4, default: 0
t.datetime "created_at"
t.datetime "updated_at"
t.integer "user_id", limit: 4
t.integer "article_id", limit: 4
t.integer "views", limit: 8, default: 0
t.datetime "date"
t.boolean "new_article", default: false
t.boolean "deleted", default: false
t.float "wp10", limit: 24
t.float "wp10_previous", limit: 24
t.boolean "system", default: false
t.integer "ithenticate_id", limit: 4
t.integer "wiki_id", limit: 4
t.integer "mw_rev_id", limit: 4
t.integer "mw_page_id", limit: 4
t.text "features", limit: 65535
end
add_index "revisions", ["article_id", "date"], name: "index_revisions_on_article_id_and_date", using: :btree
create_table "survey_assignments", force: :cascade do |t|
t.integer "courses_user_role", limit: 4
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "send_date_days", limit: 4
t.integer "survey_id", limit: 4
t.boolean "send_before", default: true
t.string "send_date_relative_to", limit: 255
t.boolean "published", default: false
t.text "notes", limit: 65535
t.integer "follow_up_days_after_first_notification", limit: 4
t.boolean "send_email"
t.string "email_template", limit: 255
t.text "custom_email", limit: 65535
end
add_index "survey_assignments", ["survey_id"], name: "index_survey_assignments_on_survey_id", using: :btree
create_table "survey_notifications", force: :cascade do |t|
t.integer "courses_users_id", limit: 4
t.integer "course_id", limit: 4
t.integer "survey_assignment_id", limit: 4
t.boolean "dismissed", default: false
t.datetime "email_sent_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "completed", default: false
t.datetime "last_follow_up_sent_at"
t.integer "follow_up_count", limit: 4, default: 0
end
add_index "survey_notifications", ["course_id"], name: "index_survey_notifications_on_course_id", using: :btree
add_index "survey_notifications", ["courses_users_id"], name: "index_survey_notifications_on_courses_users_id", using: :btree
add_index "survey_notifications", ["survey_assignment_id"], name: "index_survey_notifications_on_survey_assignment_id", using: :btree
create_table "surveys", force: :cascade do |t|
t.string "name", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "intro", limit: 65535
t.text "thanks", limit: 65535
t.boolean "open", default: false
t.boolean "closed", default: false
t.boolean "confidential_results", default: false
t.text "optout", limit: 65535
end
create_table "surveys_question_groups", force: :cascade do |t|
t.integer "survey_id", limit: 4
t.integer "rapidfire_question_group_id", limit: 4
t.integer "position", limit: 4
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "surveys_question_groups", ["rapidfire_question_group_id"], name: "index_surveys_question_groups_on_rapidfire_question_group_id", using: :btree
add_index "surveys_question_groups", ["survey_id"], name: "index_surveys_question_groups_on_survey_id", using: :btree
create_table "tags", force: :cascade do |t|
t.integer "course_id", limit: 4
t.string "tag", limit: 255
t.string "key", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "tags", ["course_id", "key"], name: "index_tags_on_course_id_and_key", unique: true, using: :btree
create_table "training_modules_users", force: :cascade do |t|
t.integer "user_id", limit: 4
t.integer "training_module_id", limit: 4
t.string "last_slide_completed", limit: 255
t.datetime "completed_at"
end
create_table "users", force: :cascade do |t|
t.string "username", limit: 255
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "trained", default: false
t.integer "global_id", limit: 4
t.datetime "remember_created_at"
t.string "remember_token", limit: 255
t.string "wiki_token", limit: 255
t.string "wiki_secret", limit: 255
t.integer "permissions", limit: 4, default: 0
t.string "real_name", limit: 255
t.string "email", limit: 255
t.boolean "onboarded", default: false
t.boolean "greeted", default: false
t.boolean "greeter", default: false
t.string "locale", limit: 255
end
create_table "versions", force: :cascade do |t|
t.string "item_type", limit: 255, null: false
t.integer "item_id", limit: 4, null: false
t.string "event", limit: 255, null: false
t.string "whodunnit", limit: 255
t.text "object", limit: 4294967295
t.datetime "created_at"
end
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree
create_table "weeks", force: :cascade do |t|
t.string "title", limit: 255
t.integer "course_id", limit: 4
t.datetime "created_at"
t.datetime "updated_at"
t.integer "order", limit: 4, default: 1, null: false
end
create_table "wikis", force: :cascade do |t|
t.string "language", limit: 16
t.string "project", limit: 16
end
add_index "wikis", ["language", "project"], name: "index_wikis_on_language_and_project", unique: true, using: :btree
end
| {
"content_hash": "03597f6390dee69f82ce60de2f84a918",
"timestamp": "",
"source": "github",
"line_count": 382,
"max_line_length": 163,
"avg_line_length": 44.95811518324607,
"alnum_prop": 0.5609642482822872,
"repo_name": "MusikAnimal/WikiEduDashboard",
"id": "1672ef5c2bc777d296779b65fc9c70dfdcccb594",
"size": "17915",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/schema.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "7413"
},
{
"name": "CSS",
"bytes": "132452"
},
{
"name": "CoffeeScript",
"bytes": "130781"
},
{
"name": "HTML",
"bytes": "136490"
},
{
"name": "JavaScript",
"bytes": "370974"
},
{
"name": "Ruby",
"bytes": "1009160"
},
{
"name": "Shell",
"bytes": "2327"
}
],
"symlink_target": ""
} |
package org.apache.calcite.sql.validate;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.sql.SqlCall;
import org.apache.calcite.sql.SqlCallBinding;
import org.apache.calcite.sql.SqlNode;
import org.apache.calcite.sql.SqlOperator;
import org.apache.calcite.sql.type.SqlTypeName;
/**
* Namespace whose contents are defined by the result of a call to a
* user-defined procedure.
*/
public class ProcedureNamespace extends AbstractNamespace {
//~ Instance fields --------------------------------------------------------
private final SqlValidatorScope scope;
private final SqlCall call;
//~ Constructors -----------------------------------------------------------
ProcedureNamespace(
SqlValidatorImpl validator,
SqlValidatorScope scope,
SqlCall call,
SqlNode enclosingNode) {
super(validator, enclosingNode);
this.scope = scope;
this.call = call;
}
//~ Methods ----------------------------------------------------------------
public RelDataType validateImpl(RelDataType targetRowType) {
validator.inferUnknownTypes(validator.unknownType, scope, call);
final RelDataType type = validator.deriveTypeImpl(scope, call);
final SqlOperator operator = call.getOperator();
final SqlCallBinding callBinding =
new SqlCallBinding(validator, scope, call);
if (operator instanceof SqlUserDefinedTableFunction) {
assert type.getSqlTypeName() == SqlTypeName.CURSOR
: "User-defined table function should have CURSOR type, not " + type;
final SqlUserDefinedTableFunction udf =
(SqlUserDefinedTableFunction) operator;
return udf.getRowType(validator.typeFactory, callBinding.operands());
} else if (operator instanceof SqlUserDefinedTableMacro) {
assert type.getSqlTypeName() == SqlTypeName.CURSOR
: "User-defined table macro should have CURSOR type, not " + type;
final SqlUserDefinedTableMacro udf =
(SqlUserDefinedTableMacro) operator;
return udf.getTable(validator.typeFactory, callBinding.operands())
.getRowType(validator.typeFactory);
}
return type;
}
public SqlNode getNode() {
return call;
}
}
| {
"content_hash": "eec6f6ecb639bb3e8c7be0edab1bc3ca",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 79,
"avg_line_length": 35.61290322580645,
"alnum_prop": 0.6684782608695652,
"repo_name": "googleinterns/calcite",
"id": "46f4534a5e3a0e632a78384dc55f9364e770c6d9",
"size": "3005",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/main/java/org/apache/calcite/sql/validate/ProcedureNamespace.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "3674"
},
{
"name": "CSS",
"bytes": "36583"
},
{
"name": "FreeMarker",
"bytes": "359111"
},
{
"name": "HTML",
"bytes": "28321"
},
{
"name": "Java",
"bytes": "19344166"
},
{
"name": "Kotlin",
"bytes": "150911"
},
{
"name": "PigLatin",
"bytes": "1419"
},
{
"name": "Python",
"bytes": "1610"
},
{
"name": "Ruby",
"bytes": "1807"
},
{
"name": "Shell",
"bytes": "7078"
},
{
"name": "TSQL",
"bytes": "1761"
}
],
"symlink_target": ""
} |
ActiveRecord::Schema.define(version: 20140314225458) do
create_table "activities", force: true do |t|
t.integer "user_id"
t.string "name"
t.boolean "is_count"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "counts", force: true do |t|
t.integer "activity_id"
t.datetime "date"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "sessions", force: true do |t|
t.integer "activity_id"
t.datetime "start_date"
t.datetime "end_date"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", force: true do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
| {
"content_hash": "e55f3f36ebd0208f8c0f90b74b2ad861",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 104,
"avg_line_length": 30.295454545454547,
"alnum_prop": 0.6324081020255063,
"repo_name": "tommeng/LifeTapper-Web",
"id": "45ede5f8d4236adba28882c0d0817174310553d1",
"size": "2074",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/schema.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "12415"
},
{
"name": "CoffeeScript",
"bytes": "1150"
},
{
"name": "JavaScript",
"bytes": "992"
},
{
"name": "Ruby",
"bytes": "54739"
}
],
"symlink_target": ""
} |
import logging
import time
from flask import Flask
from gevent.pywsgi import WSGIServer
def create_app():
app = Flask(__name__)
@app.route('/hello/file/')
def index():
return 'hello'
return app
class DemoMiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
cur = time.time()
response = self.app(environ, start_response)
logging.error('elapse %s', time.time() - cur)
return response
if __name__ == '__main__':
application = create_app()
middleware = DemoMiddleware(application)
WSGIServer(('', 8080), application=middleware).serve_forever()
| {
"content_hash": "36b258c2643975d94b67d4fde6ba405e",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 66,
"avg_line_length": 22.46875,
"alnum_prop": 0.5924895688456189,
"repo_name": "by46/geek",
"id": "4024aaa8b7f7b1ba89e9cca09a6e331b87c11501",
"size": "719",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "thirdpart/middleware_demo.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "3308"
},
{
"name": "Python",
"bytes": "124535"
}
],
"symlink_target": ""
} |
@interface ViewController : UIViewController
@end
| {
"content_hash": "dac9bcb2fad1f06d838859933c5c4541",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 44,
"avg_line_length": 10.6,
"alnum_prop": 0.7924528301886793,
"repo_name": "base0225/clock",
"id": "706c62179fd53adc4204f7bfd13d697ea2773797",
"size": "212",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "0928ZJ时钟/ViewController.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "7671"
}
],
"symlink_target": ""
} |
/*
* Created on Nov 28, 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package sorting2014;
import java.lang.reflect.*;
/**
* @author rcs
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
@SuppressWarnings("unchecked")
public class SortFactory {
public static Sorter getSorter()
{
return new BubbleSort();
}
public static Sorter getSorter(String sorter)
{
Sorter sort=null;
try {
Class clas = Class.forName(sorter);
Class[] parms={};
Constructor cons = clas.getConstructor(parms);
Object obj = cons.newInstance();
if (obj instanceof Sorter)
{
sort=(Sorter)obj;
}
} catch (Exception e) {
e.printStackTrace();
}
return sort;
}
}
| {
"content_hash": "1dc025825bfab01ba85e9cf09411f6e0",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 72,
"avg_line_length": 21.738095238095237,
"alnum_prop": 0.6549835706462213,
"repo_name": "waxerclaxer/Holding",
"id": "32141a1431a32dce365e1a7c46825c5e3e4b27a8",
"size": "913",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "WorkSpaceHolding/Sorting1/sorting2014/SortFactory.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "1"
},
{
"name": "C++",
"bytes": "1"
},
{
"name": "CSS",
"bytes": "2078"
},
{
"name": "Java",
"bytes": "38350"
},
{
"name": "Python",
"bytes": "8009"
},
{
"name": "Shell",
"bytes": "0"
},
{
"name": "TeX",
"bytes": "34231"
}
],
"symlink_target": ""
} |
ikubeServices.service('resultsBuilderService', function($rootScope) {
this.buildResults = function(searchResults) {
var results = [];
// Iterate through the results from the Json data
angular.forEach(searchResults, function(key, value) {
var id = key['id'];
var fragment = key['fragment'];
if (!!fragment) {
var builder = [];
if (!!id) {
builder.push('<b>Id : </b>');
builder.push(id);
builder.push(', ');
}
builder.push('<b>Fragment : </b>');
builder.push(fragment);
var result = builder.join('').substring(0, 120);
results.push(result);
}
});
return results;
};
});
ikubeServices.service('autocompleteResultsBuilderService', function($rootScope) {
this.buildResults = function(searchResults) {
var results = [];
angular.forEach(searchResults, function(key, value) {
var fragment = key['fragment'];
if (!!fragment) {
results.push(fragment);
results.push(' ');
}
});
return results;
};
});
//function factory('someFactory', function($rootScope) {
// return {
// getEntities : function() {
// alert('Factory');
// return "Hello world";
// };
// };
//});
//
//function provider('someProvider', function($rootScope) {
// this.$get = function() {
// return {
// getEntities : function() {
// alert('Provider');
// return "Hello world";
// };
// };
// };
//}); | {
"content_hash": "c3de02f2fb4fb5888be54ec31262161b",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 81,
"avg_line_length": 24.228070175438596,
"alnum_prop": 0.6010137581462708,
"repo_name": "michaelcouck/ikube",
"id": "dcae406bdb02342bfacfe4ca391d9b0e192f61cd",
"size": "1381",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "code/war/src/main/webapp/assets/javascripts/services/results-builder-service.js",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2494283"
},
{
"name": "HTML",
"bytes": "993570"
},
{
"name": "Hack",
"bytes": "14940"
},
{
"name": "Java",
"bytes": "2903995"
},
{
"name": "JavaScript",
"bytes": "19368513"
},
{
"name": "PHP",
"bytes": "9287015"
},
{
"name": "Scala",
"bytes": "99"
},
{
"name": "Shell",
"bytes": "2675"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "2b04b50fbd2f0b6f4ec8091a6f9cf8cd",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "7bf5dde03f7d5f237590d0738c7212f9ea5b6277",
"size": "190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Saussurea/Saussurea eriocephala/ Syn. Saussurea pallidiceps/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_25) on Fri Jul 22 10:51:30 CEST 2011 -->
<TITLE>
CalendarUrl
</TITLE>
<META NAME="date" CONTENT="2011-07-22">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="CalendarUrl";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CalendarUrl.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../com/phonegap/calendar/android/model/CalendarFeed.html" title="class in com.phonegap.calendar.android.model"><B>PREV CLASS</B></A>
<A HREF="../../../../../com/phonegap/calendar/android/model/Category.html" title="class in com.phonegap.calendar.android.model"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?com/phonegap/calendar/android/model/CalendarUrl.html" target="_top"><B>FRAMES</B></A>
<A HREF="CalendarUrl.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_java.util.AbstractMap">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.phonegap.calendar.android.model</FONT>
<BR>
Class CalendarUrl</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by ">java.util.AbstractMap<java.lang.String,java.lang.Object>
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by ">com.google.api.client.util.GenericData
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by ">com.google.api.client.http.GenericUrl
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by ">com.google.api.client.googleapis.GoogleUrl
<IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>com.phonegap.calendar.android.model.CalendarUrl</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>java.lang.Cloneable, java.util.Map<java.lang.String,java.lang.Object></DD>
</DL>
<HR>
<DL>
<DT><PRE>public class <B>CalendarUrl</B><DT>extends com.google.api.client.googleapis.GoogleUrl</DL>
</PRE>
<P>
With this class we can instanciate a CalendarUrl object and
later obtain the requested feeds in each method corresponding to
the operation we want perform
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>Yaniv Inbar, Sergio Martinez Rodriguez</DD>
</DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<A NAME="nested_class_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TH>
</TR>
</TABLE>
<A NAME="nested_classes_inherited_from_class_java.util.AbstractMap"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Nested classes/interfaces inherited from class java.util.AbstractMap</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>java.util.AbstractMap.SimpleEntry<K,V>, java.util.AbstractMap.SimpleImmutableEntry<K,V></CODE></TD>
</TR>
</TABLE>
<A NAME="nested_classes_inherited_from_class_java.util.Map"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Nested classes/interfaces inherited from interface java.util.Map</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>java.util.Map.Entry<K,V></CODE></TD>
</TR>
</TABLE>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.Integer</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#maxResults">maxResults</A></B></CODE>
<BR>
Parameter max-results in CalendarUrl object,
represents the maximum results we can get
for the requested operation</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#ROOT_URL">ROOT_URL</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#startMax">startMax</A></B></CODE>
<BR>
Parameter start-max in CalendarUrl object, represents the
maximum start date of event for the requested search</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#startMin">startMin</A></B></CODE>
<BR>
Parameter start-min in CalendarUrl object, represents the
minimum start date of event for the requested search</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#title">title</A></B></CODE>
<BR>
Parameter q in CalendarUrl object, represents that the request
performed is going to be like a query at calendar asking just for
the events containing the given value for q as search parameter</TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_com.google.api.client.googleapis.GoogleUrl"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class com.google.api.client.googleapis.GoogleUrl</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>alt, fields, key, prettyprint, userip</CODE></TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_com.google.api.client.http.GenericUrl"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class com.google.api.client.http.GenericUrl</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>fragment, host, pathParts, port, scheme</CODE></TD>
</TR>
</TABLE>
<A NAME="fields_inherited_from_class_com.google.api.client.util.GenericData"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Fields inherited from class com.google.api.client.util.GenericData</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>unknownFields</CODE></TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#CalendarUrl(java.lang.String)">CalendarUrl</A></B>(java.lang.String url)</CODE>
<BR>
Constructor using an URL String</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#forAllCalendarsFeed()">forAllCalendarsFeed</A></B>()</CODE>
<BR>
Url for getting all user's calendars</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#forCalendarMetafeed()">forCalendarMetafeed</A></B>()</CODE>
<BR>
Default calendar Url</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#forDefaultPrivateFullEventFeed()">forDefaultPrivateFullEventFeed</A></B>()</CODE>
<BR>
Url for getting all authenticathed user events</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#forDefaultPrivateFullEventFeedBetweenDates(java.lang.String, java.lang.String)">forDefaultPrivateFullEventFeedBetweenDates</A></B>(java.lang.String startMin,
java.lang.String startMax)</CODE>
<BR>
Url for getting authenticathed user events between the given dates</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#forDefaultPrivateFullEventFeedueriedByTittle(java.lang.String)">forDefaultPrivateFullEventFeedueriedByTittle</A></B>(java.lang.String title)</CODE>
<BR>
Url for getting authenticathed user events with title search param</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#forEventFeed(java.lang.String, java.lang.String, java.lang.String)">forEventFeed</A></B>(java.lang.String userId,
java.lang.String visibility,
java.lang.String projection)</CODE>
<BR>
Url for getting provided user's calendar events with specified parameters</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html#forOwnCalendarsFeed()">forOwnCalendarsFeed</A></B>()</CODE>
<BR>
Url for getting owned user's calendars</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_com.google.api.client.googleapis.GoogleUrl"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.google.api.client.googleapis.GoogleUrl</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, create</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_com.google.api.client.http.GenericUrl"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.google.api.client.http.GenericUrl</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>appendRawPath, build, equals, getAll, getFirst, getRawPath, hashCode, setRawPath, toPathParts, toString</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_com.google.api.client.util.GenericData"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.google.api.client.util.GenericData</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>entrySet, get, put, putAll, remove, set</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.util.AbstractMap"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.util.AbstractMap</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clear, containsKey, containsValue, isEmpty, keySet, size, values</CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>getClass, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="ROOT_URL"><!-- --></A><H3>
ROOT_URL</H3>
<PRE>
public static final java.lang.String <B>ROOT_URL</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../constant-values.html#com.phonegap.calendar.android.model.CalendarUrl.ROOT_URL">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="maxResults"><!-- --></A><H3>
maxResults</H3>
<PRE>
public java.lang.Integer <B>maxResults</B></PRE>
<DL>
<DD>Parameter max-results in CalendarUrl object,
represents the maximum results we can get
for the requested operation
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="startMin"><!-- --></A><H3>
startMin</H3>
<PRE>
public java.lang.String <B>startMin</B></PRE>
<DL>
<DD>Parameter start-min in CalendarUrl object, represents the
minimum start date of event for the requested search
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="startMax"><!-- --></A><H3>
startMax</H3>
<PRE>
public java.lang.String <B>startMax</B></PRE>
<DL>
<DD>Parameter start-max in CalendarUrl object, represents the
maximum start date of event for the requested search
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="title"><!-- --></A><H3>
title</H3>
<PRE>
public java.lang.String <B>title</B></PRE>
<DL>
<DD>Parameter q in CalendarUrl object, represents that the request
performed is going to be like a query at calendar asking just for
the events containing the given value for q as search parameter
<P>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="CalendarUrl(java.lang.String)"><!-- --></A><H3>
CalendarUrl</H3>
<PRE>
public <B>CalendarUrl</B>(java.lang.String url)</PRE>
<DL>
<DD>Constructor using an URL String
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>url</CODE> - String with the provided URL</DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="forCalendarMetafeed()"><!-- --></A><H3>
forCalendarMetafeed</H3>
<PRE>
public static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A> <B>forCalendarMetafeed</B>()</PRE>
<DL>
<DD>Default calendar Url
<P>
<DD><DL>
<DT><B>Returns:</B><DD>CalendarUrl</DL>
</DD>
</DL>
<HR>
<A NAME="forAllCalendarsFeed()"><!-- --></A><H3>
forAllCalendarsFeed</H3>
<PRE>
public static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A> <B>forAllCalendarsFeed</B>()</PRE>
<DL>
<DD>Url for getting all user's calendars
<P>
<DD><DL>
<DT><B>Returns:</B><DD>CalendarUrl</DL>
</DD>
</DL>
<HR>
<A NAME="forOwnCalendarsFeed()"><!-- --></A><H3>
forOwnCalendarsFeed</H3>
<PRE>
public static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A> <B>forOwnCalendarsFeed</B>()</PRE>
<DL>
<DD>Url for getting owned user's calendars
<P>
<DD><DL>
<DT><B>Returns:</B><DD>CalendarUrl</DL>
</DD>
</DL>
<HR>
<A NAME="forEventFeed(java.lang.String, java.lang.String, java.lang.String)"><!-- --></A><H3>
forEventFeed</H3>
<PRE>
public static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A> <B>forEventFeed</B>(java.lang.String userId,
java.lang.String visibility,
java.lang.String projection)</PRE>
<DL>
<DD>Url for getting provided user's calendar events with specified parameters
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>userId</CODE> - authenticathed user<DD><CODE>visibility</CODE> - visibility<DD><CODE>projection</CODE> - projection
<DT><B>Returns:</B><DD>CalendarUrl</DL>
</DD>
</DL>
<HR>
<A NAME="forDefaultPrivateFullEventFeed()"><!-- --></A><H3>
forDefaultPrivateFullEventFeed</H3>
<PRE>
public static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A> <B>forDefaultPrivateFullEventFeed</B>()</PRE>
<DL>
<DD>Url for getting all authenticathed user events
<P>
<DD><DL>
<DT><B>Returns:</B><DD>CalendarUrl</DL>
</DD>
</DL>
<HR>
<A NAME="forDefaultPrivateFullEventFeedueriedByTittle(java.lang.String)"><!-- --></A><H3>
forDefaultPrivateFullEventFeedueriedByTittle</H3>
<PRE>
public static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A> <B>forDefaultPrivateFullEventFeedueriedByTittle</B>(java.lang.String title)</PRE>
<DL>
<DD>Url for getting authenticathed user events with title search param
<P>
<DD><DL>
<DT><B>Returns:</B><DD>CalendarUrl</DL>
</DD>
</DL>
<HR>
<A NAME="forDefaultPrivateFullEventFeedBetweenDates(java.lang.String, java.lang.String)"><!-- --></A><H3>
forDefaultPrivateFullEventFeedBetweenDates</H3>
<PRE>
public static <A HREF="../../../../../com/phonegap/calendar/android/model/CalendarUrl.html" title="class in com.phonegap.calendar.android.model">CalendarUrl</A> <B>forDefaultPrivateFullEventFeedBetweenDates</B>(java.lang.String startMin,
java.lang.String startMax)</PRE>
<DL>
<DD>Url for getting authenticathed user events between the given dates
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>startMin</CODE> - min startDate for retrieved events<DD><CODE>startMax</CODE> - max startDate for retrieved events
<DT><B>Returns:</B><DD>CalendarUrl</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/CalendarUrl.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../com/phonegap/calendar/android/model/CalendarFeed.html" title="class in com.phonegap.calendar.android.model"><B>PREV CLASS</B></A>
<A HREF="../../../../../com/phonegap/calendar/android/model/Category.html" title="class in com.phonegap.calendar.android.model"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?com/phonegap/calendar/android/model/CalendarUrl.html" target="_top"><B>FRAMES</B></A>
<A HREF="CalendarUrl.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_classes_inherited_from_class_java.util.AbstractMap">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| {
"content_hash": "53bbe9ca3243da69d3d73ce68923818a",
"timestamp": "",
"source": "github",
"line_count": 634,
"max_line_length": 257,
"avg_line_length": 43.572555205047315,
"alnum_prop": 0.6632036199095023,
"repo_name": "dcheng/PhoneGap-Calendar-Plugin",
"id": "f927f20325a44ffd88bb019f8d2640ad767ceb27",
"size": "27625",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "phoneGapCalendarAPI/CalendarLib/doc/com/phonegap/calendar/android/model/CalendarUrl.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "180652"
},
{
"name": "JavaScript",
"bytes": "139887"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_22) on Tue Nov 16 12:39:13 CET 2010 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
org.resthub.oauth2.filter.service Class Hierarchy (RESThub framework 1.0 API)
</TITLE>
<META NAME="date" CONTENT="2010-11-16">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="org.resthub.oauth2.filter.service Class Hierarchy (RESThub framework 1.0 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../org/resthub/oauth2/filter/front/package-tree.html"><B>PREV</B></A>
<A HREF="../../../../../org/resthub/oauth2/provider/dao/package-tree.html"><B>NEXT</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/resthub/oauth2/filter/service/package-tree.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-tree.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
Hierarchy For Package org.resthub.oauth2.filter.service
</H2>
</CENTER>
<DL>
<DT><B>Package Hierarchies:</B><DD><A HREF="../../../../../overview-tree.html">All Packages</A></DL>
<HR>
<H2>
Class Hierarchy
</H2>
<UL>
<LI TYPE="circle">java.lang.Object<UL>
<LI TYPE="circle">org.resthub.oauth2.filter.service.<A HREF="../../../../../org/resthub/oauth2/filter/service/ExternalValidationService.html" title="class in org.resthub.oauth2.filter.service"><B>ExternalValidationService</B></A> (implements org.resthub.oauth2.filter.service.<A HREF="../../../../../org/resthub/oauth2/filter/service/ValidationService.html" title="interface in org.resthub.oauth2.filter.service">ValidationService</A>)
<UL>
<LI TYPE="circle">org.resthub.oauth2.filter.service.<A HREF="../../../../../org/resthub/oauth2/filter/service/CachedExternalValidationService.html" title="class in org.resthub.oauth2.filter.service"><B>CachedExternalValidationService</B></A></UL>
</UL>
</UL>
<H2>
Interface Hierarchy
</H2>
<UL>
<LI TYPE="circle">org.resthub.oauth2.filter.service.<A HREF="../../../../../org/resthub/oauth2/filter/service/ValidationService.html" title="interface in org.resthub.oauth2.filter.service"><B>ValidationService</B></A></UL>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../org/resthub/oauth2/filter/front/package-tree.html"><B>PREV</B></A>
<A HREF="../../../../../org/resthub/oauth2/provider/dao/package-tree.html"><B>NEXT</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../index.html?org/resthub/oauth2/filter/service/package-tree.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-tree.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2009-2010. All Rights Reserved.
</BODY>
</HTML>
| {
"content_hash": "c4d875e1f9315570a7f9fa66deb7b62c",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 435,
"avg_line_length": 44.160493827160494,
"alnum_prop": 0.6312552418227565,
"repo_name": "resthub/resthub.github.io",
"id": "1c5a412f863364a3d51ad66c2f3071b75af85e8a",
"size": "7154",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "apidocs/spring/1.0/org/resthub/oauth2/filter/service/package-tree.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "265011"
},
{
"name": "HTML",
"bytes": "14909519"
},
{
"name": "JavaScript",
"bytes": "104585"
},
{
"name": "Ruby",
"bytes": "1676"
}
],
"symlink_target": ""
} |
package org.kie.api.runtime.rule;
import java.util.Iterator;
/**
* <p>
* Contains the results of a query. The identifiers is a map of the declarations for the query, only patterns or fields that are bound can
* be accessed in the QueryResultsRow. This class can be marshalled using the drools-drools-pipeline module in combination with the BatchExecutionHelper.
* See the BatchExecutionHelper for more details.
* </p>
*/
public interface QueryResults extends Iterable<QueryResultsRow> {
String[] getIdentifiers();
Iterator<QueryResultsRow> iterator();
int size();
}
| {
"content_hash": "891b711424b6965b26cec8ac9b7824d4",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 153,
"avg_line_length": 29.5,
"alnum_prop": 0.7508474576271187,
"repo_name": "reynoldsm88/droolsjbpm-knowledge",
"id": "e47a98bec386d368aab875e8e16977b10e300699",
"size": "1210",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "kie-api/src/main/java/org/kie/api/runtime/rule/QueryResults.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "HTML",
"bytes": "1561"
},
{
"name": "Java",
"bytes": "1199437"
}
],
"symlink_target": ""
} |
file(REMOVE_RECURSE
"CMakeFiles/runtest.dir/runtest.cpp.obj"
"runtest.pdb"
"runtest.exe"
"runtest.exe.manifest"
"libruntest.dll.a"
)
# Per-language clean rules from dependency scanning.
foreach(lang CXX)
include(CMakeFiles/runtest.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()
| {
"content_hash": "2279003856736b095d26cbe95c05aa35",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 68,
"avg_line_length": 24.75,
"alnum_prop": 0.7508417508417509,
"repo_name": "CFelipe/emmn",
"id": "c28dfc6754cbecffe88662d760c59fcd52ec109b",
"size": "297",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "sgp4/build/runtest/CMakeFiles/runtest.dir/cmake_clean.cmake",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "17774"
},
{
"name": "C++",
"bytes": "398471"
},
{
"name": "CMake",
"bytes": "33726"
},
{
"name": "Makefile",
"bytes": "111762"
},
{
"name": "QMake",
"bytes": "1499"
}
],
"symlink_target": ""
} |
{{ if .Site.Params.GA_KEY }}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ .Site.Params.GA_KEY }}']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
{{ end }}
| {
"content_hash": "1b102d5ebe9f2179985e3e9327f2d87f",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 117,
"avg_line_length": 35.06666666666667,
"alnum_prop": 0.6045627376425855,
"repo_name": "georgeyk/hugony",
"id": "1e699f407d96190f86a6ca86a04778bbbeee829a",
"size": "526",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "layouts/partials/google-analytics.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4836"
},
{
"name": "HTML",
"bytes": "9036"
},
{
"name": "JavaScript",
"bytes": "125"
}
],
"symlink_target": ""
} |
package schoperation.schopcraft.cap.thirst;
import net.minecraft.block.material.Material;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.BiomeBeach;
import net.minecraft.world.biome.BiomeOcean;
import net.minecraft.world.biome.BiomeSwamp;
import schoperation.schopcraft.cap.temperature.ITemperature;
import schoperation.schopcraft.cap.temperature.TemperatureProvider;
import schoperation.schopcraft.config.SchopConfig;
import schoperation.schopcraft.lib.ModDamageSources;
import schoperation.schopcraft.util.SchopServerEffects;
import schoperation.schopcraft.util.SchopServerParticles;
import schoperation.schopcraft.util.SchopServerSounds;
import java.util.Iterator;
/*
* Where thirst is modified.
*/
public class ThirstModifier {
public void onPlayerUpdate(EntityPlayer player) {
// Capabilities
IThirst thirst = player.getCapability(ThirstProvider.THIRST_CAP, null);
ITemperature temperature = player.getCapability(TemperatureProvider.TEMPERATURE_CAP, null);
// Modifier from config
float modifier = (float) SchopConfig.MECHANICS.thirstScale;
// Lava fries you well. Better grab a water.
if (player.isInLava()) {
thirst.decrease(0.5f);
}
// The nether is also good at frying.
else if (player.dimension == -1) {
thirst.decrease(0.006f * modifier);
}
// Overheating dehydrates very well.
else if (temperature.getTemperature() > 90.0f) {
float amountOfDehydration = temperature.getTemperature() / 10000;
thirst.decrease(amountOfDehydration);
}
// Natural dehydration. "Slow" is an understatement here.
else {
thirst.decrease(0.003f * modifier);
}
// =========================================================================================================
// The side effects of thirst.
// Side effects of dehydration include fatigue and dizzyness. Those are replicated here. Well, attempted.
// =========================================================================================================
// Does the player have existing attributes with the same name? Remove them.
// Iterate through all of modifiers. If one of them is a thirst one, delete it so another one can take its place.
Iterator<AttributeModifier> speedModifiers = player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getModifiers().iterator();
Iterator<AttributeModifier> damageModifiers = player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getModifiers().iterator();
Iterator<AttributeModifier> attackSpeedModifiers = player.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).getModifiers().iterator();
// Speed
while (speedModifiers.hasNext()) {
AttributeModifier element = speedModifiers.next();
if (element.getName().equals("thirstSpeedDebuff")) {
player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).removeModifier(element);
}
}
// Attack Damage
while (damageModifiers.hasNext()) {
AttributeModifier element = damageModifiers.next();
if (element.getName().equals("thirstDamageDebuff")) {
player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).removeModifier(element);
}
}
// Attack Speed
while (attackSpeedModifiers.hasNext()) {
AttributeModifier element = attackSpeedModifiers.next();
if (element.getName().equals("thirstAttackSpeedDebuff")) {
player.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).removeModifier(element);
}
}
// Scale the modifiers according to current thirst.
double speedDebuffAmount = (40 - thirst.getThirst()) * -0.002;
double damageDebuffAmount = (40 - thirst.getThirst()) * -0.02;
double attackSpeedDebuffAmount = (40 - thirst.getThirst()) * -0.08;
// Create attribute modifiers
AttributeModifier speedDebuff = new AttributeModifier("thirstSpeedDebuff", speedDebuffAmount, 0);
AttributeModifier damageDebuff = new AttributeModifier("thirstDamageDebuff", damageDebuffAmount, 0);
AttributeModifier attackSpeedDebuff = new AttributeModifier("thirstAttackSpeedDebuff", attackSpeedDebuffAmount, 0);
// Now determine when to debuff the player
if (thirst.getThirst() < 5.0f) {
player.attackEntityFrom(ModDamageSources.DEHYDRATION, 4.0f);
}
if (thirst.getThirst() < 15.0f) {
SchopServerEffects.affectPlayer(player.getCachedUniqueIdString(), "nausea", 100, 5, false, false);
SchopServerEffects.affectPlayer(player.getCachedUniqueIdString(), "mining_fatigue", 100, 3, false, false);
}
if (thirst.getThirst() < 40.0f) {
// Speed + damage + attack speed oh my!
player.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).applyModifier(speedDebuff);
player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).applyModifier(damageDebuff);
player.getEntityAttribute(SharedMonsterAttributes.ATTACK_SPEED).applyModifier(attackSpeedDebuff);
}
}
public void onPlayerInteract(EntityPlayer player) {
// Capability
IThirst thirst = player.getCapability(ThirstProvider.THIRST_CAP, null);
// Ray trace result for drinking with bare hands. pretty ineffective.
// First, some "boosts" to the vector.
double vecX = 0;
double vecZ = 0;
if (player.getLookVec().x < 0) { vecX = -0.5; }
else if (player.getLookVec().x > 0) { vecX = 0.5; }
if (player.getLookVec().z < 0) { vecZ = -0.5; }
else if (player.getLookVec().z > 0) { vecZ = 0.5; }
// Now the actual raytrace.
RayTraceResult raytrace = player.world.rayTraceBlocks(player.getPositionEyes(1.0f), player.getPositionEyes(1.0f).add(player.getLookVec().addVector(vecX, -1, vecZ)), true);
// Is there something?
if (raytrace != null) {
// Is it a block?
if (raytrace.typeOfHit == RayTraceResult.Type.BLOCK) {
BlockPos pos = raytrace.getBlockPos();
Iterator<ItemStack> handItems = player.getHeldEquipment().iterator();
// If it is water and the player isn't holding jack squat (main hand).
if (player.world.getBlockState(pos).getMaterial() == Material.WATER && handItems.next().isEmpty()) {
// Still more if statements. now see what biome the player is in, and quench thirst accordingly.
Biome biome = player.world.getBiome(pos);
if (biome instanceof BiomeOcean || biome instanceof BiomeBeach) {
thirst.decrease(0.5f);
}
else if (biome instanceof BiomeSwamp) {
thirst.increase(0.25f);
SchopServerEffects.affectPlayer(player.getCachedUniqueIdString(), "poison", 12, 3, false, false);
}
else {
thirst.increase(0.25f);
// Random chance to damage player
double randomNum = Math.random();
if (randomNum <= 0.50) { // 50% chance
SchopServerEffects.affectPlayer(player.getCachedUniqueIdString(), "poison", 12, 1, false, false);
}
}
// Spawn particles and sounds for drinking water
SchopServerParticles.summonParticle(player.getCachedUniqueIdString(), "DrinkWaterParticles", pos.getX(), pos.getY(), pos.getZ());
SchopServerSounds.playSound(player.getCachedUniqueIdString(), "WaterSound", pos.getX(), pos.getY(), pos.getZ());
}
}
}
}
} | {
"content_hash": "8e1459311595d7f9c7162765c5bf7806",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 179,
"avg_line_length": 42.15577889447236,
"alnum_prop": 0.6309452854929074,
"repo_name": "Schoperation/SchopCraft",
"id": "b3be3ae640cb020d51dec0e841d6690fc25f1ecc",
"size": "8389",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/schoperation/schopcraft/cap/thirst/ThirstModifier.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "330920"
}
],
"symlink_target": ""
} |
require 'rails_helper'
RSpec.describe ParametersList, type: :model do
describe 'Validations'
context 'With existing user' do
FactoryGirl.build(:user)
subject {FactoryGirl.build(:parameters_list)}
it {should validate_presence_of(:name)}
it {should validate_length_of(:name).is_at_least(5)}
it {should validate_presence_of(:user_id)}
it {should validate_presence_of(:owner_id)}
it {should validate_presence_of(:language)}
it {should validate_presence_of(:created_by)}
it {should validate_presence_of(:updated_by)}
it {should validate_presence_of(:session_id)}
it {should belong_to(:owner).class_name('User')}
it {should belong_to(:user)}
describe 'It can be created'
it 'has a valid factory' do
expect(create(:parameters_list)).to be_valid
end
it 'is invalid without a name' do
expect(build(:parameters_list, name: nil)).to_not be_valid
end
end
end
| {
"content_hash": "88ae1ab9c5edc7c99f9b72dd497a0b42",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 64,
"avg_line_length": 33.75,
"alnum_prop": 0.6783068783068783,
"repo_name": "fchampreux/Rendez-vous",
"id": "7467ee30f60160e0e4f272d409fc9674c19361a5",
"size": "1585",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "spec/models/parameters_list_spec.rb",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "6829"
},
{
"name": "CoffeeScript",
"bytes": "844"
},
{
"name": "HTML",
"bytes": "42283"
},
{
"name": "JavaScript",
"bytes": "759"
},
{
"name": "Ruby",
"bytes": "362262"
}
],
"symlink_target": ""
} |
<!-- ================================================================== -->
<!-- Title: HMP45C Air Temperature SensingProcedure File -->
<!-- Date: September 20, 2012 -->
<!-- Author: H. Brown -->
<!-- ================================================================== -->
<sfl:SensingProcedure gml:id="HMP45C_Temperature">
<sfl:method>The HMP45C uses a platinum resistance temperature detector.</sfl:method>
<sfl:observedProperty xlink:href="http://sawi.gst.com/nmpa/docs/terms.html#temperature" /> <!-- FIXME: Update Terms file -->
<sfl:unitOfMeasure uom="degK" />
<sfl:alternativeUnitOfMeasure uom="degC" />
<sfl:alternativeUnitOfMeasure uom="degF" />
<sfl:qualifiedBy>
<sfl:MeasurementCapability gml:id="AirTemperature">
<sfl:accuracy>
<sfl:value>
<swe:QuantityRange>
<swe:uom code="K" />
<swe:value>-0.3 0.3</swe:value>
</swe:QuantityRange>
</sfl:value>
</sfl:accuracy>
<sfl:range>
<swe:QuantityRange>
<swe:uom code="K"/>
<swe:value>233.15 333.15</swe:value> <!-- -40C to 60C -->
</swe:QuantityRange>
</sfl:range>
<sfl:resolution>
<swe:Quantity>
<swe:uom code="degK" />
<swe:value>0.00992</swe:value>
</swe:Quantity>
</sfl:resolution>
<sfl:extension>
<!-- Does this need surrounding tags? Should this be moved to the SensorCharacteristic file? -->
<!-- <swe:QuantityRange gml:id="outputSignalRange">
<swe:uom code="V" />
<swe:value>0.008 1.0</swe:value>
</swe:QuantityRange>
-->
</sfl:extension>
</sfl:MeasurementCapability>
</sfl:qualifiedBy>
<sfl:implementedBy xlink:href="http://sawi.gst.com/nmpa/sensor/characteristic/sc_Vaisala_HMP45C.xml" />
</sfl:SensingProcedure>
| {
"content_hash": "bdf56a77d390ed00c2a516065c01d28e",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 128,
"avg_line_length": 39.450980392156865,
"alnum_prop": 0.5089463220675944,
"repo_name": "akrherz/iem",
"id": "43c996bf2709bd741d50436272dc1be0c83d2c36",
"size": "2012",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "htdocs/metadata/xml/sp_CS_CS215_Temp.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "16912"
},
{
"name": "HTML",
"bytes": "1092923"
},
{
"name": "Hack",
"bytes": "7078"
},
{
"name": "JavaScript",
"bytes": "244253"
},
{
"name": "PHP",
"bytes": "3492474"
},
{
"name": "Python",
"bytes": "3279270"
},
{
"name": "Rich Text Format",
"bytes": "30075"
},
{
"name": "Shell",
"bytes": "72284"
}
],
"symlink_target": ""
} |
import {Component} from "@angular/core";
@Component({
templateUrl: './demo.component.html',
styles: [`
.live-demo-wrap h4 {
font-size: 20px;
margin-bottom: 20px;
}
.live-demo-wrap p {
font-size: 14px;
margin: 10px 0 20px 0
}
`]
})
export class DatePickerLimitComponent {
date1 = "now";
limitStartList = ['now-1d', 'now-5d', 'now-10d'];
limitEndList = ['now', 'now+5d', 'now+10d'];
limitStart = 'now-10d';
limitEnd = 'now+5d';
// ====================================================================
// ignore the following lines, they are not important to this demo
// ====================================================================
summary: string = '';
description: string = '';
}
| {
"content_hash": "1e9d4bd89f4d9a84686349bde065923d",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 75,
"avg_line_length": 28.344827586206897,
"alnum_prop": 0.44525547445255476,
"repo_name": "rdkmaster/jigsaw",
"id": "415c399cd0d4b8306c07953b7521e6f9f621ea83",
"size": "822",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/for-internal/demo/pc/date-picker/limit/demo.component.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AutoIt",
"bytes": "7636"
},
{
"name": "CSS",
"bytes": "3231221"
},
{
"name": "HTML",
"bytes": "10423519"
},
{
"name": "JavaScript",
"bytes": "1132519"
},
{
"name": "SCSS",
"bytes": "535631"
},
{
"name": "Shell",
"bytes": "12910"
},
{
"name": "TypeScript",
"bytes": "4455145"
}
],
"symlink_target": ""
} |
'use strict'
/*
* Serves as a gate for the synced ports.
*
* chi: {
* <nodeId>: <uuid>
* }
*/
function PortSyncer (originId, syncPorts) {
this.syncPorts = syncPorts
this.originId = originId
this.store = {}
}
PortSyncer.prototype.add = function (link, p) {
if (!p.chi.hasOwnProperty(this.originId)) {
throw new Error([
'Origin Node',
this.originId,
'not found within chi'
].join(' '))
}
if (this.syncPorts.indexOf(link.target.port) === -1) {
throw new Error([
'Refuse to handle data for unknown port:',
link.target.port
].join('')
)
}
var itemId = p.chi[this.originId]
if (!this.store.hasOwnProperty(itemId)) {
this.store[itemId] = {}
}
this.store[itemId][link.target.port] = { link: link, p: p }
if (Object.keys(this.store[itemId]).length === this.syncPorts.length) {
var dat = this.store[itemId]
delete this.store[itemId]
return dat
} else {
return undefined
}
}
module.exports = PortSyncer
| {
"content_hash": "01407e13a3dcc075d187a0d41088ef60",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 73,
"avg_line_length": 19.037735849056602,
"alnum_prop": 0.6105054509415263,
"repo_name": "psichi/chix",
"id": "a0a4d68418d35519af0afd60de0e8a921a3ee9f0",
"size": "1009",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "packages/chix-chi/lib/portSyncer.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1417898"
},
{
"name": "CoffeeScript",
"bytes": "762"
},
{
"name": "HTML",
"bytes": "761416"
},
{
"name": "JavaScript",
"bytes": "10492371"
},
{
"name": "Makefile",
"bytes": "1452"
},
{
"name": "PHP",
"bytes": "7869"
},
{
"name": "PowerShell",
"bytes": "471"
},
{
"name": "Ruby",
"bytes": "2556"
},
{
"name": "Shell",
"bytes": "1114"
},
{
"name": "Smarty",
"bytes": "10533"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html>
<head>
<title>Bézier Fun</title>
<script type="text/javascript" src="bezier-fun.js"></script>
<meta charset="utf-8">
</head>
<body style="margin: 0">
<canvas id="bezier-canvas" width="1280" height="720" style="border: 1px solid black"></canvas>
</body>
</html>
| {
"content_hash": "773b4aae17fc5504593c2c9545eb9cff",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 98,
"avg_line_length": 27.272727272727273,
"alnum_prop": 0.6433333333333333,
"repo_name": "KarlZylinski/bezier-fun",
"id": "81cd68efb1d53473aa58a1b90231fdf4e2fab3ef",
"size": "301",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "301"
},
{
"name": "JavaScript",
"bytes": "5951"
}
],
"symlink_target": ""
} |
from __future__ import division, unicode_literals
"""
This module contains some math utils that are used in the chemenv package.
"""
__author__ = "David Waroquiers"
__copyright__ = "Copyright 2012, The Materials Project"
__credits__ = "Geoffroy Hautier"
__version__ = "2.0"
__maintainer__ = "David Waroquiers"
__email__ = "david.waroquiers@gmail.com"
__date__ = "Feb 20, 2016"
from math import sqrt
import numpy as np
from functools import reduce
##############################################################
### cartesian product of lists ##################################
##############################################################
def _append_es2sequences(sequences, es):
result = []
if not sequences:
for e in es:
result.append([e])
else:
for e in es:
result += [seq+[e] for seq in sequences]
return result
def _cartesian_product(lists):
"""
given a list of lists,
returns all the possible combinations taking one element from each list
The list does not have to be of equal length
"""
return reduce(_append_es2sequences, lists, [])
def prime_factors(n):
"""Lists prime factors of a given natural integer, from greatest to smallest
:param n: Natural integer
:rtype : list of all prime factors of the given natural n
"""
i = 2
while i <= sqrt(n):
if n % i == 0:
l = prime_factors(n/i)
l.append(i)
return l
i += 1
return [n] # n is prime
def _factor_generator(n):
"""
From a given natural integer, returns the prime factors and their multiplicity
:param n: Natural integer
:return:
"""
p = prime_factors(n)
factors = {}
for p1 in p:
try:
factors[p1] += 1
except KeyError:
factors[p1] = 1
return factors
def divisors(n):
"""
From a given natural integer, returns the list of divisors in ascending order
:param n: Natural integer
:return: List of divisors of n in ascending order
"""
factors = _factor_generator(n)
_divisors = []
listexponents = [[k**x for x in range(0, factors[k]+1)] for k in list(factors.keys())]
listfactors = _cartesian_product(listexponents)
for f in listfactors:
_divisors.append(reduce(lambda x, y: x*y, f, 1))
_divisors.sort()
return _divisors
def get_center_of_arc(p1, p2, radius):
dx = p2[0] - p1[0]
dy = p2[1] - p1[1]
dd = np.sqrt(dx*dx + dy*dy)
radical = np.power((radius / dd), 2) - 0.25
if radical < 0:
raise ValueError("Impossible to find center of arc because the arc is ill-defined")
tt = np.sqrt(radical)
if radius > 0:
tt = -tt
return (p1[0] + p2[0]) / 2 - tt * dy, (p1[1] + p2[1]) / 2 + tt * dx
def get_linearly_independent_vectors(vectors_list):
independent_vectors_list = []
for vector in vectors_list:
if np.any(vector != 0):
if len(independent_vectors_list) == 0:
independent_vectors_list.append(np.array(vector))
elif len(independent_vectors_list) == 1:
rank = np.linalg.matrix_rank(np.array([independent_vectors_list[0], vector, [0, 0, 0]]))
if rank == 2:
independent_vectors_list.append(np.array(vector))
elif len(independent_vectors_list) == 2:
mm = np.array([independent_vectors_list[0], independent_vectors_list[1], vector])
if np.linalg.det(mm) != 0:
independent_vectors_list.append(np.array(vector))
if len(independent_vectors_list) == 3:
break
return independent_vectors_list
def scale_and_clamp(xx, edge0, edge1, clamp0, clamp1):
return np.clip((xx-edge0) / (edge1-edge0), clamp0, clamp1)
#SMOOTH STEP FUNCTIONS
#Set of smooth step functions that allow to smoothly go from y = 0.0 (1.0) to y = 1.0 (0.0) by changing x
# from 0.0 to 1.0 respectively when inverse is False (True).
# (except if edges is given in which case a the values are first scaled and clamped to the interval given by edges)
#The derivative at x = 0.0 and x = 1.0 have to be 0.0
def smoothstep(xx, edges=None, inverse=False):
if edges is None:
xx_clipped = np.clip(xx, 0.0, 1.0)
if inverse:
return 1.0-xx_clipped*xx_clipped*(3.0-2.0*xx_clipped)
else:
return xx_clipped*xx_clipped*(3.0-2.0*xx_clipped)
else:
xx_scaled_and_clamped = scale_and_clamp(xx, edges[0], edges[1], 0.0, 1.0)
return smoothstep(xx_scaled_and_clamped, inverse=inverse)
def smootherstep(xx, edges=None, inverse=False):
if edges is None:
xx_clipped = np.clip(xx, 0.0, 1.0)
if inverse:
return 1.0-xx_clipped*xx_clipped*xx_clipped*(xx_clipped*(xx_clipped*6-15)+10)
else:
return xx_clipped*xx_clipped*xx_clipped*(xx_clipped*(xx_clipped*6-15)+10)
else:
xx_scaled_and_clamped = scale_and_clamp(xx, edges[0], edges[1], 0.0, 1.0)
return smootherstep(xx_scaled_and_clamped, inverse=inverse)
def cosinus_step(xx, edges=None, inverse=False):
if edges is None:
xx_clipped = np.clip(xx, 0.0, 1.0)
if inverse:
return (np.cos(xx_clipped*np.pi) + 1.0) / 2.0
else:
return 1.0-(np.cos(xx_clipped*np.pi) + 1.0) / 2.0
else:
xx_scaled_and_clamped = scale_and_clamp(xx, edges[0], edges[1], 0.0, 1.0)
return cosinus_step(xx_scaled_and_clamped, inverse=inverse)
def power3_step(xx, edges=None, inverse=False):
return smoothstep(xx, edges=edges, inverse=inverse)
def powern_parts_step(xx, edges=None, inverse=False, nn=2):
if edges is None:
aa = np.power(0.5, 1.0-nn)
xx_clipped = np.clip(xx, 0.0, 1.0)
if np.mod(nn, 2) == 0:
if inverse:
return 1.0-np.where(xx_clipped < 0.5, aa*np.power(xx_clipped, nn), 1.0-aa*np.power(xx_clipped-1.0, nn))
else:
return np.where(xx_clipped < 0.5, aa*np.power(xx_clipped, nn), 1.0-aa*np.power(xx_clipped-1.0, nn))
else:
if inverse:
return 1.0-np.where(xx_clipped < 0.5, aa*np.power(xx_clipped, nn), 1.0+aa*np.power(xx_clipped-1.0, nn))
else:
return np.where(xx_clipped < 0.5, aa*np.power(xx_clipped, nn), 1.0+aa*np.power(xx_clipped-1.0, nn))
else:
xx_scaled_and_clamped = scale_and_clamp(xx, edges[0], edges[1], 0.0, 1.0)
return powern_parts_step(xx_scaled_and_clamped, inverse=inverse, nn=nn)
#FINITE DECREASING FUNCTIONS
#Set of decreasing functions that allow to smoothly go from y = 1.0 to y = 0.0 by changing x from 0.0 to 1.0
#The derivative at x = 1.0 has to be 0.0
def powern_decreasing(xx, edges=None, nn=2):
if edges is None:
aa = 1.0/np.power(-1.0, nn)
return aa * np.power(xx-1.0, nn)
else:
xx_scaled_and_clamped = scale_and_clamp(xx, edges[0], edges[1], 0.0, 1.0)
return powern_decreasing(xx_scaled_and_clamped, nn=nn)
def power2_decreasing_exp(xx, edges=None, alpha=1.0):
if edges is None:
aa = 1.0/np.power(-1.0, 2)
return aa * np.power(xx-1.0, 2) * np.exp(-alpha*xx)
else:
xx_scaled_and_clamped = scale_and_clamp(xx, edges[0], edges[1], 0.0, 1.0)
return power2_decreasing_exp(xx_scaled_and_clamped, alpha=alpha)
#INFINITE TO FINITE DECREASING FUNCTIONS
#Set of decreasing functions that allow to smoothly go from y = + Inf to y = 0.0 by changing x from 0.0 to 1.0
#The derivative at x = 1.0 has to be 0.0
def power2_tangent_decreasing(xx, edges=None, prefactor=None):
if edges is None:
if prefactor is None:
aa = 1.0/np.power(-1.0, 2)
else:
aa = prefactor
return -aa * np.power(xx-1.0, 2) * np.tan((xx-1.0) * np.pi / 2.0)
else:
xx_scaled_and_clamped = scale_and_clamp(xx, edges[0], edges[1], 0.0, 1.0)
return power2_tangent_decreasing(xx_scaled_and_clamped, prefactor=prefactor)
def power2_inverse_decreasing(xx, edges=None, prefactor=None):
if edges is None:
if prefactor is None:
aa = 1.0/np.power(-1.0, 2)
else:
aa = prefactor
return aa * np.power(xx-1.0, 2) / xx if xx != 0 else aa * float("inf")
else:
xx_scaled_and_clamped = scale_and_clamp(xx, edges[0], edges[1], 0.0, 1.0)
return power2_inverse_decreasing(xx_scaled_and_clamped, prefactor=prefactor)
def power2_inverse_power2_decreasing(xx, edges=None, prefactor=None):
if edges is None:
if prefactor is None:
aa = 1.0/np.power(-1.0, 2)
else:
aa = prefactor
return aa * np.power(xx-1.0, 2) / xx ** 2.0 if xx != 0 else aa * float("inf")
else:
xx_scaled_and_clamped = scale_and_clamp(xx, edges[0], edges[1], 0.0, 1.0)
return power2_inverse_power2_decreasing(xx_scaled_and_clamped, prefactor=prefactor)
def power2_inverse_powern_decreasing(xx, edges=None, prefactor=None, powern=2.0):
if edges is None:
if prefactor is None:
aa = 1.0/np.power(-1.0, 2)
else:
aa = prefactor
return aa * np.power(xx-1.0, 2) / xx ** powern
else:
xx_scaled_and_clamped = scale_and_clamp(xx, edges[0], edges[1], 0.0, 1.0)
return power2_inverse_powern_decreasing(xx_scaled_and_clamped, prefactor=prefactor, powern=powern) | {
"content_hash": "7deb8ba278fd69b261ef9452cf72513e",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 119,
"avg_line_length": 35.42481203007519,
"alnum_prop": 0.59471505889844,
"repo_name": "matk86/pymatgen",
"id": "c52c5a411af9ea81afa3b50481b48e2388f503e2",
"size": "9533",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pymatgen/analysis/chemenv/utils/math_utils.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "5938"
},
{
"name": "CSS",
"bytes": "7550"
},
{
"name": "Common Lisp",
"bytes": "3029065"
},
{
"name": "HTML",
"bytes": "4886182"
},
{
"name": "Makefile",
"bytes": "5573"
},
{
"name": "Perl",
"bytes": "229104"
},
{
"name": "Propeller Spin",
"bytes": "4026362"
},
{
"name": "Python",
"bytes": "6054951"
},
{
"name": "Roff",
"bytes": "868"
}
],
"symlink_target": ""
} |
import os
import sys
import array
import getopt
import math
import random
import networkx
# Maximum weight for an edge
MAX_WEIGHT = 100
class GenGraphScript:
def __init__(self, argv):
self.argc = len(argv)
self.argv = argv
def usage(self):
print "Usage: " + sys.argv[0] + " [-w] [-g gtype] <nodes> <edges> <outfile>"
print "Example: " + sys.argv[0] + " 1000 2 graph.txt\n"
print "\t[-h] : This help message"
print "\t[-w] : Assign random weights"
print "\t[-g] : Select graph type (ba only right now)"
print "\t<nodes> : Number of nodes"
print "\t<edges> : Number of edges for each new node"
print "\t<outfile> : Output graph filename"
sys.exit(1)
def main(self):
# Parse options
try:
opts, args = getopt.getopt(self.argv[1:], "wg:h", ["weight","graph","help"])
except getopt.GetoptError, err:
print str(err)
self.usage()
return(1)
# Defaults
graphtype = "ba"
useweight = False
for o, a in opts:
if o in ("-h", "--help"):
self.usage()
return(0)
elif o in ("-g", "--graph"):
graphtype = a
elif o in ("-w", "--weight"):
useweight = True
else:
print "Invalid option %s" % (o)
return(1)
# Check command-line arguments
if (len(args) != 3):
self.usage()
return(1)
nodes = int(args[0])
edges = int(args[1])
outfile = args[2]
print "Generating %s graph with %d nodes and %d new edges per node" % (graphtype, nodes, edges)
if (graphtype == "ba"):
g = networkx.barabasi_albert_graph(nodes, edges)
else:
print "Invalid graph type: " + graphtype
return(1)
# Assign random weights
if (useweight):
print "Assigning weights"
for (u, v) in g.edges():
weight = int(random.random() * MAX_WEIGHT) + 1
g[u][v]['weight'] = weight
# Save to file
print "Saving graph to file %s" % (outfile)
f = open(outfile, "wb")
for (u,v,w) in g.edges(data=True):
f.write("%d %d %d\n" % (u+1, v+1, w['weight']));
#networkx.write_weighted_edgelist(g, f);
f.close()
else:
# Save to file
print "Saving graph to file %s" % (outfile)
f = open(outfile, "wb")
for (u,v) in g.edges(data=False):
f.write("%d %d\n" % (u+1, v+1));
#networkx.write_edgelist(g, f, data=False);
f.close()
print "Done"
return 0
if __name__ == '__main__':
prog = GenGraphScript(sys.argv)
sys.exit(prog.main())
| {
"content_hash": "a7f7a2eecea6e556c52c7776f2bac8ad",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 103,
"avg_line_length": 28.815533980582526,
"alnum_prop": 0.47607816711590295,
"repo_name": "usc-cloud/parallel-louvain-modularity",
"id": "edfbd817062fc8c4ab995b7a075b9ebd1fbb3104",
"size": "2991",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/tools/gengraph/gengraph.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "28613"
},
{
"name": "C++",
"bytes": "206336"
},
{
"name": "Java",
"bytes": "11787"
},
{
"name": "Objective-C",
"bytes": "1912"
},
{
"name": "Python",
"bytes": "10097"
},
{
"name": "Shell",
"bytes": "20780"
}
],
"symlink_target": ""
} |
package org.apache.cassandra.db.guardrails;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.function.Consumer;
import org.junit.Assert;
import org.junit.Test;
import static java.lang.String.format;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public class GuardrailsTest extends GuardrailTester
{
public static final int DISABLED = -1;
@Test
public void testDisabledThreshold() throws Throwable
{
Threshold.ErrorMessageProvider errorMessageProvider = (isWarn, what, v, t) -> "Should never trigger";
testDisabledThreshold(new Threshold(state -> DISABLED, state -> DISABLED, errorMessageProvider));
}
private void testDisabledThreshold(Threshold guard) throws Throwable
{
assertFalse(guard.enabled(userClientState));
assertValid(() -> guard.guard(5, "Z", null));
assertValid(() -> guard.guard(25, "A", userClientState));
assertValid(() -> guard.guard(100, "B", userClientState));
assertValid(() -> guard.guard(101, "X", userClientState));
assertValid(() -> guard.guard(200, "Y", userClientState));
}
@Test
public void testThreshold() throws Throwable
{
Threshold guard = new Threshold(state -> 10,
state -> 100,
(isWarn, what, v, t) -> format("%s: for %s, %s > %s",
isWarn ? "Warning" : "Aborting", what, v, t));
assertTrue(guard.enabled(userClientState));
assertValid(() -> guard.guard(5, "Z", userClientState));
assertWarns(() -> guard.guard(25, "A", userClientState), "Warning: for A, 25 > 10");
assertWarns(() -> guard.guard(100, "B", userClientState), "Warning: for B, 100 > 10");
assertFails(() -> guard.guard(101, "X", userClientState), "Aborting: for X, 101 > 100");
assertFails(() -> guard.guard(200, "Y", userClientState), "Aborting: for Y, 200 > 100");
assertValid(() -> guard.guard(5, "Z", userClientState));
}
@Test
public void testWarnOnlyThreshold() throws Throwable
{
Threshold guard = new Threshold(state -> 10,
state -> DISABLED,
(isWarn, what, v, t) -> format("%s: for %s, %s > %s",
isWarn ? "Warning" : "Aborting", what, v, t));
assertTrue(guard.enabled(userClientState));
assertValid(() -> guard.guard(5, "Z", userClientState));
assertWarns(() -> guard.guard(11, "A", userClientState), "Warning: for A, 11 > 10");
}
@Test
public void testFailOnlyThreshold() throws Throwable
{
Threshold guard = new Threshold(state -> DISABLED,
state -> 10,
(isWarn, what, v, t) -> format("%s: for %s, %s > %s",
isWarn ? "Warning" : "Aborting", what, v, t));
assertTrue(guard.enabled(userClientState));
assertValid(() -> guard.guard(5, "Z", userClientState));
assertFails(() -> guard.guard(11, "A", userClientState), "Aborting: for A, 11 > 10");
}
@Test
public void testThresholdUsers() throws Throwable
{
Threshold guard = new Threshold(state -> 10,
state -> 100,
(isWarn, what, v, t) -> format("%s: for %s, %s > %s",
isWarn ? "Warning" : "Aborting", what, v, t));
// value under both thresholds
assertValid(() -> guard.guard(5, "x", null));
assertValid(() -> guard.guard(5, "x", userClientState));
assertValid(() -> guard.guard(5, "x", systemClientState));
assertValid(() -> guard.guard(5, "x", superClientState));
// value over warning threshold
assertWarns(() -> guard.guard(100, "y", null), "Warning: for y, 100 > 10");
assertWarns(() -> guard.guard(100, "y", userClientState), "Warning: for y, 100 > 10");
assertValid(() -> guard.guard(100, "y", systemClientState));
assertValid(() -> guard.guard(100, "y", superClientState));
// value over fail threshold
assertFails(() -> guard.guard(101, "z", null), "Aborting: for z, 101 > 100");
assertFails(() -> guard.guard(101, "z", userClientState), "Aborting: for z, 101 > 100");
assertValid(() -> guard.guard(101, "z", systemClientState));
assertValid(() -> guard.guard(101, "z", superClientState));
}
@Test
public void testDisableFlag() throws Throwable
{
assertFails(() -> new DisableFlag(state -> true, "X").ensureEnabled(userClientState), "X is not allowed");
assertValid(() -> new DisableFlag(state -> false, "X").ensureEnabled(userClientState));
assertFails(() -> new DisableFlag(state -> true, "X").ensureEnabled("Y", userClientState), "Y is not allowed");
assertValid(() -> new DisableFlag(state -> false, "X").ensureEnabled("Y", userClientState));
}
@Test
public void testDisableFlagUsers() throws Throwable
{
DisableFlag enabled = new DisableFlag(state -> false, "X");
assertValid(() -> enabled.ensureEnabled(null));
assertValid(() -> enabled.ensureEnabled(userClientState));
assertValid(() -> enabled.ensureEnabled(systemClientState));
assertValid(() -> enabled.ensureEnabled(superClientState));
DisableFlag disabled = new DisableFlag(state -> true, "X");
assertFails(() -> disabled.ensureEnabled(null), "X is not allowed");
assertFails(() -> disabled.ensureEnabled(userClientState), "X is not allowed");
assertValid(() -> disabled.ensureEnabled(systemClientState));
assertValid(() -> disabled.ensureEnabled(superClientState));
}
@Test
public void testDisallowedValues() throws Throwable
{
// Using a sorted set below to ensure the order in the error message checked below are not random
Values<Integer> disallowed = new Values<>(state -> Collections.emptySet(),
state -> insertionOrderedSet(4, 6, 20),
"integer");
Consumer<Integer> action = i -> Assert.fail("The ignore action shouldn't have been triggered");
assertValid(() -> disallowed.guard(set(3), action, userClientState));
assertFails(() -> disallowed.guard(set(4), action, userClientState),
"Provided values [4] are not allowed for integer (disallowed values are: [4, 6, 20])");
assertValid(() -> disallowed.guard(set(10), action, userClientState));
assertFails(() -> disallowed.guard(set(20), action, userClientState),
"Provided values [20] are not allowed for integer (disallowed values are: [4, 6, 20])");
assertValid(() -> disallowed.guard(set(200), action, userClientState));
assertValid(() -> disallowed.guard(set(1, 2, 3), action, userClientState));
assertFails(() -> disallowed.guard(set(4, 6), action, null),
"Provided values [4, 6] are not allowed for integer (disallowed values are: [4, 6, 20])");
assertFails(() -> disallowed.guard(set(4, 5, 6, 7), action, null),
"Provided values [4, 6] are not allowed for integer (disallowed values are: [4, 6, 20])");
}
@Test
public void testDisallowedValuesUsers() throws Throwable
{
Values<Integer> disallowed = new Values<>(state -> Collections.emptySet(),
state -> Collections.singleton(2),
"integer");
Consumer<Integer> action = i -> Assert.fail("The ignore action shouldn't have been triggered");
assertValid(() -> disallowed.guard(set(1), action, null));
assertValid(() -> disallowed.guard(set(1), action, userClientState));
assertValid(() -> disallowed.guard(set(1), action, systemClientState));
assertValid(() -> disallowed.guard(set(1), action, superClientState));
String message = "Provided values [2] are not allowed for integer (disallowed values are: [2])";
assertFails(() -> disallowed.guard(set(2), action, null), message);
assertFails(() -> disallowed.guard(set(2), action, userClientState), message);
assertValid(() -> disallowed.guard(set(2), action, systemClientState));
assertValid(() -> disallowed.guard(set(2), action, superClientState));
Set<Integer> allowedValues = set(1);
assertValid(() -> disallowed.guard(allowedValues, action, null));
assertValid(() -> disallowed.guard(allowedValues, action, userClientState));
assertValid(() -> disallowed.guard(allowedValues, action, systemClientState));
assertValid(() -> disallowed.guard(allowedValues, action, superClientState));
Set<Integer> disallowedValues = set(2);
message = "Provided values [2] are not allowed for integer (disallowed values are: [2])";
assertFails(() -> disallowed.guard(disallowedValues, action, null), message);
assertFails(() -> disallowed.guard(disallowedValues, action, userClientState), message);
assertValid(() -> disallowed.guard(disallowedValues, action, systemClientState));
assertValid(() -> disallowed.guard(disallowedValues, action, superClientState));
}
@Test
public void testIgnoredValues() throws Throwable
{
// Using a sorted set below to ensure the order in the error message checked below are not random
Values<Integer> ignored = new Values<>(state -> insertionOrderedSet(4, 6, 20),
state -> Collections.emptySet(),
"integer");
Set<Integer> triggeredOn = set();
assertValid(() -> ignored.guard(set(3), triggeredOn::add, userClientState));
assertEquals(set(), triggeredOn);
assertWarns(() -> ignored.guard(set(4), triggeredOn::add, userClientState),
"Ignoring provided values [4] as they are not supported for integer (ignored values are: [4, 6, 20])");
assertEquals(set(4), triggeredOn);
triggeredOn.clear();
assertWarns(() -> ignored.guard(set(4, 6), triggeredOn::add, null),
"Ignoring provided values [4, 6] as they are not supported for integer (ignored values are: [4, 6, 20])");
assertEquals(set(4, 6), triggeredOn);
triggeredOn.clear();
assertWarns(() -> ignored.guard(set(4, 5, 6, 7), triggeredOn::add, null),
"Ignoring provided values [4, 6] as they are not supported for integer (ignored values are: [4, 6, 20])");
assertEquals(set(4, 6), triggeredOn);
triggeredOn.clear();
}
private static Set<Integer> set(Integer value)
{
return Collections.singleton(value);
}
private static Set<Integer> set(Integer... values)
{
return new HashSet<>(Arrays.asList(values));
}
@SafeVarargs
private static <T> Set<T> insertionOrderedSet(T... values)
{
return new LinkedHashSet<>(Arrays.asList(values));
}
}
| {
"content_hash": "dffb6bb5188295e9b8df6842830de684",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 126,
"avg_line_length": 48.149377593360995,
"alnum_prop": 0.5878145467080317,
"repo_name": "belliottsmith/cassandra",
"id": "e7eaeb40161938a17727d476691fedbd44916360",
"size": "12409",
"binary": false,
"copies": "1",
"ref": "refs/heads/trunk",
"path": "test/unit/org/apache/cassandra/db/guardrails/GuardrailsTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "AMPL",
"bytes": "801"
},
{
"name": "GAP",
"bytes": "88999"
},
{
"name": "HTML",
"bytes": "265026"
},
{
"name": "Java",
"bytes": "30037923"
},
{
"name": "Lex",
"bytes": "10152"
},
{
"name": "Python",
"bytes": "538615"
},
{
"name": "Shell",
"bytes": "114913"
}
],
"symlink_target": ""
} |
#ifndef CSSInitialValue_h
#define CSSInitialValue_h
#include "CSSValue.h"
#include <wtf/PassRefPtr.h>
namespace WebCore {
class CSSInitialValue : public CSSValue {
public:
static PassRef<CSSInitialValue> createExplicit()
{
return adoptRef(*new CSSInitialValue(/* implicit */ false));
}
static PassRef<CSSInitialValue> createImplicit()
{
return adoptRef(*new CSSInitialValue(/* implicit */ true));
}
String customCSSText() const;
bool isImplicit() const { return m_isImplicit; }
bool equals(const CSSInitialValue&) const { return true; }
private:
CSSInitialValue(bool implicit)
: CSSValue(InitialClass)
, m_isImplicit(implicit)
{
}
bool m_isImplicit;
};
CSS_VALUE_TYPE_CASTS(CSSInitialValue, isInitialValue())
} // namespace WebCore
#endif // CSSInitialValue_h
| {
"content_hash": "06f6623c78fd69604e2bec5d88effe8a",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 68,
"avg_line_length": 20.404761904761905,
"alnum_prop": 0.6837806301050176,
"repo_name": "aosm/WebCore",
"id": "a0a6e554885fa1081560cab68442d7797ae2fe1b",
"size": "1754",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "css/CSSInitialValue.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Assembly",
"bytes": "3242"
},
{
"name": "C",
"bytes": "3457587"
},
{
"name": "C++",
"bytes": "37868918"
},
{
"name": "CSS",
"bytes": "121894"
},
{
"name": "JavaScript",
"bytes": "131375"
},
{
"name": "Objective-C",
"bytes": "392661"
},
{
"name": "Objective-C++",
"bytes": "2868092"
},
{
"name": "Perl",
"bytes": "643657"
},
{
"name": "Python",
"bytes": "39670"
},
{
"name": "Ruby",
"bytes": "2718"
},
{
"name": "Shell",
"bytes": "12541"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "8492bea0a1daee7e3c2765931b61a2aa",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "be3ff464eb34f26f96ca6504e2df5945e3c144d1",
"size": "187",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Aristida/Aristida nemorivaga/ Syn. Aristida chrysochlaena/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
import { trouveTarification } from 'containers/CommandeEdit/components/components/AffichePrix';
import round from 'lodash/round';
import memoize from 'lodash/memoize';
import groupBy from 'lodash/groupBy';
/* calcule les totaux de la commande
* @utilisateurId commande contenus de(s) l'utilisateur(s)
* @commandeContenus tous les commandeContenus de la commande
* @offres offres de la commande
* @commandeId No commande
*/
const calculeTotauxCommandeFn = ({ utilisateurId, commandeContenus, offres, commandeId, filter }) => {
// le filtre par commandeId est toujours appliqué
const allCommandeContenus = Object.keys(commandeContenus)
.filter(id => commandeContenus[id].commandeId === commandeId)
.map(id => commandeContenus[id]);
// si filter est fournit l'appliquer
const filteredCommandeContenus = allCommandeContenus.filter(
commandeContenu => !filter || filter(commandeContenu)
);
const grouped = groupBy(filteredCommandeContenus, 'offreId');
// Pourquoi ??? normalement il ne peut y avoir qu'un offreId utilisateur par commande ...
// un map devrait suffir
const contenusAgg = Object.keys(grouped).map(offreId =>
grouped[offreId].reduce(
(m, c) => ({
offreId,
quantite: m.quantite + c.quantite,
qteRegul: m.qteRegul + c.qteRegul,
}),
{ offreId, quantite: 0, qteRegul: 0 }
)
);
const totaux = contenusAgg.reduce(
(memo, contenu) => {
const offre = offres[contenu.offreId];
const qteTotalOffre = allCommandeContenus
.filter(cc => cc.offreId === offre.id)
.reduce((mem, item) => mem + item.quantite, 0);
const tarif = trouveTarification(offre.tarifications, qteTotalOffre);
const qte = contenu.quantite + (contenu.qteRegul || 0);
return {
prixBase: memo.prixBase + round(offre.tarifications[0].prix * qte / 100, 2),
recolteFondBase: memo.recolteFondBase + round(offre.tarifications[0].recolteFond * qte / 100, 2),
prix: memo.prix + round(tarif.prix * qte / 100, 2),
recolteFond: memo.recolteFond + round(tarif.recolteFond * qte / 100, 2),
};
},
{ prix: 0, recolteFond: 0, prixBase: 0, recolteFondBase: 0 }
);
totaux.recolteFond = round(totaux.recolteFond, 2);
totaux.recolteFondBase = round(totaux.recolteFondBase, 2);
return totaux;
};
export const calculeTotauxCommande = memoize(calculeTotauxCommandeFn);
| {
"content_hash": "1883d32b60673b7d732376330daeec51",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 105,
"avg_line_length": 37.625,
"alnum_prop": 0.6914451827242525,
"repo_name": "Proxiweb/react-boilerplate",
"id": "2569be13e54593fb87f541be9c0996d2ae99c56f",
"size": "2409",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/containers/Commande/utils.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "1526"
},
{
"name": "CSS",
"bytes": "26087"
},
{
"name": "HTML",
"bytes": "17918"
},
{
"name": "JavaScript",
"bytes": "807168"
},
{
"name": "Shell",
"bytes": "82"
}
],
"symlink_target": ""
} |
import AvailablePlayersModule from './availablePlayers'
import AvailablePlayersController from './availablePlayers.controller';
import AvailablePlayersComponent from './availablePlayers.component';
import AvailablePlayersTemplate from './availablePlayers.html';
describe('AvailablePlayers', () => {
let $rootScope, makeController;
beforeEach(window.module(AvailablePlayersModule.name));
beforeEach(inject((_$rootScope_) => {
$rootScope = _$rootScope_;
makeController = () => {
return new AvailablePlayersController();
};
}));
describe('Module', () => {
// top-level specs: i.e., routes, injection, naming
});
describe('Controller', () => {
// controller specs
it('has a name property [REMOVE]', () => { // erase if removing this.name from the controller
let controller = makeController();
expect(controller).to.have.property('name');
});
});
describe('Template', () => {
// template specs
// tip: use regex to ensure correct bindings are used e.g., {{ }}
it('has name in template [REMOVE]', () => {
expect(AvailablePlayersTemplate).to.match(/{{\s?vm\.name\s?}}/g);
});
});
describe('Component', () => {
// component/directive specs
let component = AvailablePlayersComponent();
it('includes the intended template',() => {
expect(component.template).to.equal(AvailablePlayersTemplate);
});
it('uses `controllerAs` syntax', () => {
expect(component).to.have.property('controllerAs');
});
it('invokes the right controller', () => {
expect(component.controller).to.equal(AvailablePlayersController);
});
});
});
| {
"content_hash": "a1d59f8deb01575798d9bdd5ef93dcb1",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 97,
"avg_line_length": 31.71698113207547,
"alnum_prop": 0.6395002974419988,
"repo_name": "kanzelm3/Fantasy-Football-Draft-Companion",
"id": "a6ece0c2e1bcd2fcfa940286d00746c5d76c7fdb",
"size": "1681",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "client/app/components/main/availablePlayers/availablePlayers.spec.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "2150"
},
{
"name": "HTML",
"bytes": "10156"
},
{
"name": "JavaScript",
"bytes": "32499"
}
],
"symlink_target": ""
} |
'use strict';
/**
* Authorization middleware
*
* Check that the user is logged in
*/
const jwt_check = require('./jwt_check');
module.exports = {
// User has to be logged in to post
isAuthorized: function (req, res, next) {
jwt_check(req, res, function (err) {
if (err) return next(err);
if (!req.user || !req.user.id) {
return res.status(401).json({ error: 'Unauthorized, please log in first.' });
}
return next();
});
}
};
| {
"content_hash": "3299cec3af53017c271d406f3b77c1e4",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 85,
"avg_line_length": 21.727272727272727,
"alnum_prop": 0.5857740585774058,
"repo_name": "chamsocial/Chamsocial",
"id": "8e3f2f8e87bde6e55aff39271160bd47e99051a6",
"size": "478",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "routes/middleware/auth.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "64296"
},
{
"name": "HTML",
"bytes": "66291"
},
{
"name": "JavaScript",
"bytes": "233560"
},
{
"name": "Shell",
"bytes": "384"
}
],
"symlink_target": ""
} |
roFORWARD_DECL_PTR(RoButtonSound);
roFORWARD_DECL_PTR(RoLoginServerInterface);
struct RoPacketReceivedEvent;
struct RoServerConnectedEvent;
struct RoServerConnectRequestFailedEvent;
struct RoServerDisconnectedEvent;
enum class RoLoginStage
{
NONE,
LOGIN_PROMPT,
LOGIN_SERVER_CONNECTING,
LOGIN_SERVER_READY,
LOGIN_REQUEST_SENT,
LOGIN_SUCCEEDED,
LOGIN_FAILED,
LOGIN_CANCELLED
};
RoString to_string(RoLoginStage stage);
std::ostream& operator << (std::ostream& stream, const RoLoginStage& stage);
class RoLoginState : public RoGameStateT<RoLoginState>
{
public:
RoLoginState(RokLegendPtr game, RoBackgroundScorePtr backgroundScore, RoButtonSoundPtr buttonSound, RoLoginServerInterfacePtr loginServer);
protected:
virtual void addTaskHandlers() override;
virtual bool updateState(float timeSinceLastFrameInSecs) override;
private:
void loginPrompt(const RoTaskArgs& args);
RoLoginStage getCurrentStage() const;
bool changeStage(RoLoginStage& expectedState, const RoLoginStage newState);
private:
void serverConnectResponse(RoNetServerType type, RoOptionalString result);
void loginResponse(optional<RoLoginFailed> result);
private: // static
static const RoString LOGIN_PROMPT_TASK;
static const RoString LOGIN_SUCCESS_TASK;
static const RoString LOGIN_FAILED_TASK;
static const RoString LOGIN_SERVER_CONNECT_FAILED_TASK;
static const RoString LOGIN_SERVER_CONNECTED_TASK;
static const RoString LOGIN_SERVER_DISCONNECTED_TASK;
private:
using RoAtomicLoginStage = RoAtomic < RoLoginStage > ;
RoAtomicLoginStage mStage;
RoButtonSoundPtr mButtonSound;
RoLoginServerInterfacePtr mLoginServer;
RoOptionalString mUsername;
RoOptionalString mPassword;
}; | {
"content_hash": "9c1cb2d3619187c4cade0cf4a30a290b",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 143,
"avg_line_length": 30.43103448275862,
"alnum_prop": 0.7852691218130312,
"repo_name": "ViteFalcon/RokLegend",
"id": "0be31b79c10a232f3d1ea5ecd3270efa73cebdf8",
"size": "1920",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/application/gamestates/RoLoginState.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "49163"
},
{
"name": "C++",
"bytes": "3629542"
},
{
"name": "CMake",
"bytes": "182398"
},
{
"name": "Objective-C",
"bytes": "420"
}
],
"symlink_target": ""
} |
var app;
(function (app) {
var movieList;
(function (movieList) {
// Controller class
var MovieListCtrl = (function () {
function MovieListCtrl(dataAccessService, title, showImage, message, movies) {
var _this = this;
this.dataAccessService = dataAccessService;
this.title = title;
this.showImage = showImage;
this.message = message;
this.movies = movies;
this.title = "Movie Hunter";
this.showImage = false;
var movieResource = dataAccessService.getMovieResource();
movieResource.query(function (data) {
_this.movies = data;
});
}
MovieListCtrl.prototype.toggleImage = function () {
this.showImage = !this.showImage;
};
MovieListCtrl.$inject = ["dataAccessService"];
return MovieListCtrl;
})();
angular
.module("movieHunter")
.controller("MovieListCtrl", MovieListCtrl);
})(movieList = app.movieList || (app.movieList = {}));
})(app || (app = {}));
| {
"content_hash": "ea29737a19dba59a0d26c71cca077c3b",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 90,
"avg_line_length": 38.774193548387096,
"alnum_prop": 0.5166389351081531,
"repo_name": "DeborahK/Angular3Flavors",
"id": "a48a91758e532b85b338864e5b9473218623332e",
"size": "1202",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MovieHunter 1-x TS/app/movies/movieListCtrl.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "251"
},
{
"name": "HTML",
"bytes": "12435"
},
{
"name": "JavaScript",
"bytes": "16066"
},
{
"name": "TypeScript",
"bytes": "11422"
}
],
"symlink_target": ""
} |
#ifndef PCH_H
#define PCH_H
// add headers that you want to pre-compile here
#include "framework.hpp"
#ifdef _DEBUG
#pragma comment(lib, "Boring32d.lib")
#else
#pragma comment(lib, "Boring32.lib")
#endif
#endif //PCH_H
| {
"content_hash": "5892f3db1eed3e14973d093c9aa4844b",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 48,
"avg_line_length": 16.928571428571427,
"alnum_prop": 0.6708860759493671,
"repo_name": "yottaawesome/Onyx32",
"id": "087c1b8075e8156442ad64eb7fa4dcbd272e92ec",
"size": "687",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Onyx32.Core/src/pch.hpp",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "2090"
},
{
"name": "C++",
"bytes": "22950"
}
],
"symlink_target": ""
} |
"""Implements an |Edge| that receives messages with the HTTP protocol. WSGI_ is
a Python specification for defining communication between web servers and the
application.
The resulting edge can be used by any HTTP client, like curl::
$ curl -v -X POST -H 'Content-Type: message/rfc822' \\
--data-binary @test.eml \\
-H 'X-Envelope-Sender: c2VuZGVyQGV4YW1wbGUuY29t' \\
-H 'X-Envelope-Recipient: cmVjaXBpZW50QGV4YW1wbGUuY29t' \\
http://localhost:8080/
* About to connect() to localhost port 8080 (#0)
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: localhost:8080
> Accept: */*
> Content-Type: message/rfc822
> X-Envelope-Sender: c2VuZGVyQGV4YW1wbGUuY29t
> X-Envelope-Recipient: cmVjaXBpZW50QGV4YW1wbGUuY29t
> Content-Length: 99
>
* upload completely sent off: 99 out of 99 bytes
< HTTP/1.1 200 OK
< X-Smtp-Reply: 250; message="2.6.0 Message accepted for delivery"
< Date: Mon, 29 Jul 2013 20:11:55 GMT
< Content-Length: 0
<
* Connection #0 to host localhost left intact
.. _WSGI: http://wsgi.readthedocs.org/en/latest/
.. _variables: http://www.python.org/dev/peps/pep-0333/#environ-variables
"""
from __future__ import absolute_import
import re
from base64 import b64decode
from wsgiref.headers import Headers
from slimta import logging
from slimta.http.wsgi import WsgiServer
from slimta.envelope import Envelope
from slimta.smtp.reply import Reply
from slimta.queue import QueueError
from slimta.relay import RelayError
from slimta.util.ptrlookup import PtrLookup
from . import EdgeServer
__all__ = ['WsgiResponse', 'WsgiEdge', 'WsgiValidators']
class WsgiResponse(Exception):
"""This exception can be explicitly raised to end the WSGI request and
return the given response.
:param status: The HTTP status string to return, e.g. ``200 OK``.
:param headers: List of ``(name, value)`` header tuples to return.
:param data: Optional raw data string to return.
"""
def __init__(self, status, headers=None, data=None):
super(WsgiResponse, self).__init__(status)
self.status = status
self.headers = headers or []
self.data = data or []
def _header_name_to_cgi(name):
return 'HTTP_{0}'.format(name.upper().replace('-', '_'))
def _build_http_response(smtp_reply):
code = smtp_reply.code
headers = []
info = {'message': smtp_reply.message}
if smtp_reply.command:
info['command'] = smtp_reply.command
Headers(headers).add_header('X-Smtp-Reply', code, **info)
if code.startswith('2'):
return WsgiResponse('204 No Content', headers)
elif code.startswith('4'):
return WsgiResponse('503 Service Unavailable', headers)
elif code == '535':
return WsgiResponse('401 Unauthorized', headers)
else:
return WsgiResponse('500 Internal Server Error', headers)
class WsgiEdge(EdgeServer, WsgiServer):
"""This class is intended to be instantiated and used as an app on top of a
WSGI server engine such as :class:`gevent.pywsgi.WSGIServer`. It will only
acccept ``POST`` requests that provide a ``message/rfc822`` payload.
.. note::
If ``listener`` is not provided, use
:meth:`~slimta.http.WsgiServer.build_server` to build and manage the
server manually.
:param queue: |Queue| object used by :meth:`.handoff()` to ensure the
envelope is properly queued before acknowledged by the edge
service.
:param hostname: String identifying the local machine. See |Edge| for more
details.
:param validator_class: A class inherited from :class:`WsgiValidators`
whose methods will be executed on various request
headers to validate the request.
:param uri_pattern: If given, only URI paths that match the given pattern
will be allowed.
:type uri_pattern: :py:class:`~re.RegexObject` or :py:obj:`str`
:param listener: Usually a ``(ip, port)`` tuple defining the interface
and port upon which to listen for connections.
:param pool: If given, defines a specific :class:`gevent.pool.Pool` to
use for new greenlets.
:param context: Enables SSL encryption on connected sockets using the
information given in the context.
:type context: :py:class:`~ssl.SSLContext`
"""
split_pattern = re.compile(r'\s*[,;]\s*')
#: The HTTP verb that clients will use with the requests. This may be
#: changed with caution.
http_verb = 'POST'
#: The header name that clients will use to provide the envelope sender
#: address.
sender_header = 'X-Envelope-Sender'
#: The header name that clients will use to provide the envelope recipient
#: addresses. This header may be given multiple times, for each recipient.
rcpt_header = 'X-Envelope-Recipient'
#: The header name that clients will use to provide the EHLO identifier
#: string, as in an SMTP session.
ehlo_header = 'X-Ehlo'
def __init__(self, queue, hostname=None, validator_class=None,
uri_pattern=None, listener=None, pool=None, context=None):
super(WsgiEdge, self).__init__(None, queue, hostname=hostname)
self.validator_class = validator_class
if isinstance(uri_pattern, str):
self.uri_pattern = re.compile(uri_pattern)
else:
self.uri_pattern = uri_pattern
if listener:
ssl_args = {'ssl_context': context}
self.server = self.build_server(listener, pool, ssl_args)
else:
self.server = None
def __call__(self, environ, start_response):
ptr_lookup = PtrLookup(environ.get('REMOTE_ADDR', '0.0.0.0'))
ptr_lookup.start()
try:
self._validate_request(environ)
env = self._get_envelope(environ)
self._add_envelope_extras(environ, env, ptr_lookup)
self._enqueue_envelope(env)
except WsgiResponse as res:
start_response(res.status, res.headers)
return res.data
except Exception as exc:
logging.log_exception(__name__)
msg = '{0!s}\n'.format(exc)
content_length = str(len(msg))
headers = [('Content-Length', content_length),
('Content-Type', 'text/plain')]
start_response('500 Internal Server Error', headers)
return [msg]
finally:
ptr_lookup.kill(block=False)
def _validate_request(self, environ):
if self.uri_pattern:
path = environ.get('PATH_INFO', '')
if not re.match(self.uri_pattern, path):
raise WsgiResponse('404 Not Found')
method = environ['REQUEST_METHOD'].upper()
if method != self.http_verb:
headers = [('Allow', self.http_verb)]
raise WsgiResponse('405 Method Not Allowed', headers)
ctype = environ.get('CONTENT_TYPE', 'message/rfc822')
if ctype != 'message/rfc822':
raise WsgiResponse('415 Unsupported Media Type')
if self.validator_class:
self._run_validators(environ)
def _run_validators(self, environ):
assert self.validator_class is not None
validators = self.validator_class(environ)
validators.validate_ehlo(self._get_ehlo(environ))
validators.validate_sender(self._get_sender(environ))
recipients = self._get_recipients(environ)
for rcpt in recipients:
validators.validate_recipient(rcpt)
for name in validators.custom_headers:
cgi_name = _header_name_to_cgi(name)
validators.validate_custom(name, environ.get(cgi_name))
def _b64decode(self, b64str):
return b64decode(b64str.encode('ascii')).decode('utf-8')
def _get_sender(self, environ):
sender_header = _header_name_to_cgi(self.sender_header)
return self._b64decode(environ.get(sender_header, ''))
def _get_recipients(self, environ):
rcpt_header = _header_name_to_cgi(self.rcpt_header)
rcpts_raw = environ.get(rcpt_header, None)
if not rcpts_raw:
return []
rcpts_split = self.split_pattern.split(rcpts_raw)
return [self._b64decode(rcpt_b64) for rcpt_b64 in rcpts_split]
def _get_ehlo(self, environ):
ehlo_header = _header_name_to_cgi(self.ehlo_header)
default = '[{0}]'.format(environ.get('REMOTE_ADDR', 'unknown'))
return environ.get(ehlo_header, default)
def _get_envelope(self, environ):
sender = self._get_sender(environ)
recipients = self._get_recipients(environ)
env = Envelope(sender, recipients)
content_length = int(environ.get('CONTENT_LENGTH', 0))
data = environ['wsgi.input'].read(content_length)
env.parse(data)
return env
def _add_envelope_extras(self, environ, env, ptr_lookup):
env.client['ip'] = environ.get('REMOTE_ADDR', 'unknown')
env.client['host'] = ptr_lookup.finish()
env.client['name'] = self._get_ehlo(environ)
env.client['protocol'] = environ.get('wsgi.url_scheme', 'http').upper()
def _enqueue_envelope(self, env):
results = self.handoff(env)
if isinstance(results[0][1], QueueError):
default_reply = Reply('451', '4.3.0 Error queuing message')
reply = getattr(results[0][1], 'reply', default_reply)
raise _build_http_response(reply)
elif isinstance(results[0][1], RelayError):
relay_reply = results[0][1].reply
raise _build_http_response(relay_reply)
reply = Reply('250', '2.6.0 Message accepted for delivery')
raise _build_http_response(reply)
class WsgiValidators(object):
"""Base class for implementing WSGI request validation. Instances will be
created for each WSGI request.
To terminate the current WSGI request with a response, raise the
:exc:`WsgiResponse` exception from with the validator methods.
:param environ: The environment variables_ for the current session.
"""
#: A static list of headers that should be passed in to
#: :meth:`validate_custom()`.
custom_headers = []
def __init__(self, environ):
#: Stores the environment variables_ for the current session.
self.environ = environ
def validate_ehlo(self, ehlo):
"""Override this method to validate the EHLO string passed in by the
client in the ``X-Ehlo`` (or equivalent) header.
:param ehlo: The value of the EHLO header.
"""
pass
def validate_sender(self, sender):
"""Override this method to validate the sender address passed in by the
client in the ``X-Envelope-Sender`` (or equivalent) header.
:param sender: The decoded value of the sender header.
"""
pass
def validate_recipient(self, recipient):
"""Override this method to validate each recipient address passed in by
the client in the ``X-Envelope-Recipient`` (or equivalent) headers.
This method will be called for each occurence of the header.
:param recipient: The decoded value of one recipient header.
"""
pass
def validate_custom(self, name, value):
"""Override this method to validate custom headers sent in by the
client. This method will be called exactly once for each header listed
in the :attr:`custom_headers` class attribute.
:param name: The name of the header.
:param value: The raw value of the header, or ``None`` if the client
did not provide the header.
"""
pass
# vim:et:fdm=marker:sts=4:sw=4:ts=4
| {
"content_hash": "04f2e1520cd568b02e8a6f5c2b9c00b8",
"timestamp": "",
"source": "github",
"line_count": 315,
"max_line_length": 79,
"avg_line_length": 37.96825396825397,
"alnum_prop": 0.6341137123745819,
"repo_name": "slimta/python-slimta",
"id": "2738325f86bc0e4ccfa85719fedd92dfe672bdf0",
"size": "13053",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "slimta/edge/wsgi.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Python",
"bytes": "606434"
}
],
"symlink_target": ""
} |
"""
Support for controlling GPIO pins of a Raspberry Pi.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/rpi_gpio/
"""
# pylint: disable=import-error
import logging
from homeassistant.const import (
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP)
DOMAIN = "rpi_gpio"
_LOGGER = logging.getLogger(__name__)
# pylint: disable=no-member
def setup(hass, config):
"""Setup the Raspberry PI GPIO component."""
import RPi.GPIO as GPIO
def cleanup_gpio(event):
"""Stuff to do before stopping."""
GPIO.cleanup()
def prepare_gpio(event):
"""Stuff to do when home assistant starts."""
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, cleanup_gpio)
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, prepare_gpio)
GPIO.setmode(GPIO.BCM)
return True
def setup_output(port):
"""Setup a GPIO as output."""
import RPi.GPIO as GPIO
GPIO.setup(port, GPIO.OUT)
def setup_input(port, pull_mode):
"""Setup a GPIO as input."""
import RPi.GPIO as GPIO
GPIO.setup(port, GPIO.IN,
GPIO.PUD_DOWN if pull_mode == 'DOWN' else GPIO.PUD_UP)
def write_output(port, value):
"""Write a value to a GPIO."""
import RPi.GPIO as GPIO
GPIO.output(port, value)
def read_input(port):
"""Read a value from a GPIO."""
import RPi.GPIO as GPIO
return GPIO.input(port)
def edge_detect(port, event_callback, bounce):
"""Add detection for RISING and FALLING events."""
import RPi.GPIO as GPIO
GPIO.add_event_detect(
port,
GPIO.BOTH,
callback=event_callback,
bouncetime=bounce)
| {
"content_hash": "8150f80f10c8975f88d97f76a290d051",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 74,
"avg_line_length": 24.735294117647058,
"alnum_prop": 0.6646848989298454,
"repo_name": "Julian/home-assistant",
"id": "ab31378fb0b3c01c50769aebdd81df2d5f4454d2",
"size": "1682",
"binary": false,
"copies": "1",
"ref": "refs/heads/py2",
"path": "homeassistant/components/rpi_gpio.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "1354942"
},
{
"name": "Python",
"bytes": "2755966"
},
{
"name": "Ruby",
"bytes": "379"
},
{
"name": "Shell",
"bytes": "6430"
}
],
"symlink_target": ""
} |
using MasterDevs.ChromeDevTools;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace MasterDevs.ChromeDevTools.Protocol.CSS
{
/// <summary>
/// Modifies the rule selector.
/// </summary>
[Command(ProtocolName.CSS.SetMediaText)]
public class SetMediaTextCommand
{
/// <summary>
/// Gets or sets StyleSheetId
/// </summary>
public string StyleSheetId { get; set; }
/// <summary>
/// Gets or sets Range
/// </summary>
public SourceRange Range { get; set; }
/// <summary>
/// Gets or sets Text
/// </summary>
public string Text { get; set; }
}
}
| {
"content_hash": "29cfaefd8a51d02173732fc352048e44",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 48,
"avg_line_length": 22.653846153846153,
"alnum_prop": 0.6706281833616299,
"repo_name": "brewdente/AutoWebPerf",
"id": "b955c2245778938508a97320494023e9113ffc4b",
"size": "589",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "MasterDevs.ChromeDevTools/Protocol/CSS/SetMediaTextCommand.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "513410"
}
],
"symlink_target": ""
} |
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.nalloc.impl;
import static com.github.nalloc.impl.PointerArithmetics.UNSAFE;
import java.util.HashMap;
import java.util.Map;
import com.github.nalloc.Array;
import com.github.nalloc.NativeHeapAllocator;
import com.github.nalloc.Pointer;
/**
* {@link NativeHeapAllocator} implementation using sun.misc.Unsafe.
*
* @author Antti Laisi
*/
@SuppressWarnings("restriction")
public class UnsafeNativeHeapAllocator implements NativeHeapAllocator {
private final Map<Class<?>, Class<? extends NativeStruct>> implementations = new HashMap<>();
public UnsafeNativeHeapAllocator(final Class<?>... structTypes) {
StructClassGenerator generator = new StructClassGenerator(structTypes);
for(Class<?> struct : structTypes) {
implementations.put(struct, generator.generate(struct));
}
}
@Override
public <T> Pointer<T> malloc(final Class<T> structType) {
NativeStruct struct = NativeStruct.create(implementations.get(structType));
struct.address = UNSAFE.allocateMemory(struct.getSize());
return new HeapPointer<T>(struct);
}
@Override
public <T> Array<T> calloc(final long nmemb, final Class<T> structType) {
if(nmemb < 1) {
throw new IllegalArgumentException("nmemb must be > 0");
}
NativeStruct struct = NativeStruct.create(implementations.get(structType));
long address = UNSAFE.allocateMemory(nmemb * struct.getSize());
UNSAFE.setMemory(address, nmemb * struct.getSize(), (byte) 0);
return new HeapArray<T>(address, nmemb, struct);
}
@Override
public <T> Array<T> realloc(final Array<T> pointer, final long nmemb) {
NativeStruct struct = (NativeStruct) pointer.deref();
HeapArray<T> array = (HeapArray<T>) pointer;
array.address(UNSAFE.reallocateMemory(struct.address, nmemb * struct.getSize()));
array.size = nmemb;
struct.address = array.address();
return pointer;
}
}
| {
"content_hash": "19ee5d962cd16e778f6e81a0cd1103cb",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 94,
"avg_line_length": 33.88732394366197,
"alnum_prop": 0.7460515378221114,
"repo_name": "alaisi/nalloc",
"id": "40e6ea85ea79eebf834b8702b46169a3b919fed9",
"size": "2406",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/com/github/nalloc/impl/UnsafeNativeHeapAllocator.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "60529"
}
],
"symlink_target": ""
} |
package stackongo
import (
"fmt"
"strings"
)
// AllComments returns all comments in site
func (session Session) AllComments(params map[string]string) (output *Comments, error error) {
output = new(Comments)
error = session.get("comments", params, output)
return
}
// Comments returns the comments with the given ids
func (session Session) GetComments(ids []int, params map[string]string) (output *Comments, error error) {
string_ids := []string{}
for _, v := range ids {
string_ids = append(string_ids, fmt.Sprintf("%v", v))
}
request_path := strings.Join([]string{"comments", strings.Join(string_ids, ";")}, "/")
output = new(Comments)
error = session.get(request_path, params, output)
return
}
// CommentsForQuestions returns the comments for the questions identified with given ids
func (session Session) CommentsForQuestions(ids []int, params map[string]string) (output *Comments, error error) {
string_ids := []string{}
for _, v := range ids {
string_ids = append(string_ids, fmt.Sprintf("%v", v))
}
request_path := strings.Join([]string{"questions", strings.Join(string_ids, ";"), "comments"}, "/")
output = new(Comments)
error = session.get(request_path, params, output)
return
}
// CommentsForAnswers returns the comments for the answers identified with given ids
func (session Session) CommentsForAnswers(ids []int, params map[string]string) (output *Comments, error error) {
string_ids := []string{}
for _, v := range ids {
string_ids = append(string_ids, fmt.Sprintf("%v", v))
}
request_path := strings.Join([]string{"answers", strings.Join(string_ids, ";"), "comments"}, "/")
output = new(Comments)
error = session.get(request_path, params, output)
return
}
// CommentsForPosts returns the comments for the posts identified with given ids
func (session Session) CommentsForPosts(ids []int, params map[string]string) (output *Comments, error error) {
string_ids := []string{}
for _, v := range ids {
string_ids = append(string_ids, fmt.Sprintf("%v", v))
}
request_path := strings.Join([]string{"posts", strings.Join(string_ids, ";"), "comments"}, "/")
output = new(Comments)
error = session.get(request_path, params, output)
return
}
// CommentsFromUsers returns the comments from the users identified with given ids
func (session Session) CommentsFromUsers(ids []int, params map[string]string) (output *Comments, error error) {
string_ids := []string{}
for _, v := range ids {
string_ids = append(string_ids, fmt.Sprintf("%v", v))
}
request_path := strings.Join([]string{"users", strings.Join(string_ids, ";"), "comments"}, "/")
output = new(Comments)
error = session.get(request_path, params, output)
return
}
// CommentsMentionedUsers returns the comments mentioning the users identified with given ids
func (session Session) CommentsMentionedUsers(ids []int, params map[string]string) (output *Comments, error error) {
string_ids := []string{}
for _, v := range ids {
string_ids = append(string_ids, fmt.Sprintf("%v", v))
}
request_path := strings.Join([]string{"users", strings.Join(string_ids, ";"), "mentioned"}, "/")
output = new(Comments)
error = session.get(request_path, params, output)
return
}
// CommentsFromUsersTo returns the comments to a user from the users identified with given ids
func (session Session) CommentsFromUsersTo(ids []int, to int, params map[string]string) (output *Comments, error error) {
string_ids := []string{}
for _, v := range ids {
string_ids = append(string_ids, fmt.Sprintf("%v", v))
}
request_path := strings.Join([]string{"users", strings.Join(string_ids, ";"), "comments", fmt.Sprintf("%v", to)}, "/")
output = new(Comments)
error = session.get(request_path, params, output)
return
}
| {
"content_hash": "7b6eab2a0740a4a2dff2c3ef45e987c2",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 121,
"avg_line_length": 35.82692307692308,
"alnum_prop": 0.6980676328502415,
"repo_name": "laktek/Stack-on-Go",
"id": "2c3ead3eead0d9a8996aa518b615479194245e63",
"size": "3726",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "stackongo/comments.go",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Go",
"bytes": "138326"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en-gb" dir="ltr" class="no-js">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script>
window.frctl = {
env: 'static'
};
</script>
<script>var cl = document.querySelector('html').classList; cl.remove('no-js'); cl.add('has-js');</script>
<link rel="shortcut icon" href="../../assets/icons/icon.ico" type="image/ico">
<link rel="stylesheet" href="../../fractal/css/default.css?cachebust=1.4.0" type="text/css">
<link rel="stylesheet" href="../../assets/styles/theme.css?cachebust=1.4.0" type="text/css">
<link rel="stylesheet" href="../../fractal/css/highlight.css?cachebust=1.4.0" type="text/css">
<title>Search | Bits of 24 ways</title>
</head>
<body>
<div class="Frame" id="frame">
<div class="Frame-header">
<div class="Header">
<button class="Header-button Header-navToggle" data-action="toggle-sidebar">
<div class="Header-navToggleIcon Header-navToggleIcon--open">
<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M19 6.4L17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z"/>
</svg>
</div>
<div class="Header-navToggleIcon Header-navToggleIcon--closed">
<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/>
</svg>
</div>
</button>
<a href="../../.." class="Header-title" data-pjax>Bits of 24 ways</a>
</div>
</div>
<div class="Frame-body" data-role="body">
<div class="Frame-panel Frame-panel--main" data-role="main">
<div class="Frame-inner" id="pjax-container">
<div class="Pen" data-behaviour="pen" id="pen-eaa4b7d57fab70c2815b48b116de183f">
<div class="Pen-panel Pen-header">
<h1 class="Pen-title">
<a class="Pen-previewLink" href="../preview/search" title="Component preview">
Search
<svg fill="#000000" height="22" viewBox="0 0 24 24" width="22" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h4v-2H5V8h14v10h-4v2h4c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm-7 6l-4 4h3v6h2v-6h3l-4-4z"/>
</svg>
</a>
</h1>
</div>
<div class="Pen-panel Pen-preview Preview" data-behaviour="preview" id="preview-eaa4b7d57fab70c2815b48b116de183f">
<div class="Preview-wrapper" data-role="resizer">
<div class="Preview-resizer">
<iframe
class="Preview-iframe"
data-role="window"
src="../preview/search"
style=""
marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" scrolling="yes">
</iframe>
</div>
<div class="Preview-handle" data-role="resize-handle"></div>
<div class="Preview-overlay"></div>
</div>
</div>
<div class="Pen-handle Pen-handle--browser" data-role="resize-handle"></div>
<div class="Pen-panel Pen-info" data-role="info">
<div class="Browser" data-behaviour="browser" id="browser-eaa4b7d57fab70c2815b48b116de183f">
<div class="Browser-controls">
<ul class="Browser-tabs">
<li class="Browser-tab Browser-tab--html is-active " data-role="tab">
<a href="#browser-eaa4b7d57fab70c2815b48b116de183f-panel-html">HTML</a>
</li>
<li class="Browser-tab Browser-tab--view" data-role="tab">
<a href="#browser-eaa4b7d57fab70c2815b48b116de183f-panel-view">View</a>
</li>
<li class="Browser-tab Browser-tab--context" data-role="tab">
<a href="#browser-eaa4b7d57fab70c2815b48b116de183f-panel-context">Context</a>
</li>
<li class="Browser-tab Browser-tab--resources" data-role="tab">
<a href="#browser-eaa4b7d57fab70c2815b48b116de183f-panel-assets">Assets</a>
</li>
<li class="Browser-tab Browser-tab--info" data-role="tab">
<a href="#browser-eaa4b7d57fab70c2815b48b116de183f-panel-info">Info</a>
</li>
<li class="Browser-tab Browser-tab--notes" data-role="tab">
<a href="#browser-eaa4b7d57fab70c2815b48b116de183f-panel-notes">Notes</a>
</li>
</ul>
</div>
<div class="Browser-panel Browser-code is-active" data-role="tab-panel" id="browser-eaa4b7d57fab70c2815b48b116de183f-panel-html">
<code class="Code Code--lang-html hljs">
<pre><span class="hljs-tag"><<span class="hljs-name">form</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"c-search"</span> <span class="hljs-attr">role</span>=<span class="hljs-string">"search"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"search"</span> <span class="hljs-attr">action</span>=<span class="hljs-string">"/pages/search/"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">fieldset</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"c-field"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">legend</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"u-hidden"</span>></span>Search 24 ways<span class="hljs-tag"></<span class="hljs-name">legend</span>></span>
<span class="hljs-tag"><<span class="hljs-name">label</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"u-hidden"</span> <span class="hljs-attr">for</span>=<span class="hljs-string">"q"</span>></span>Keywords<span class="hljs-tag"></<span class="hljs-name">label</span>></span>
<span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"c-field__input"</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"search"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"q"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"q"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"e.g. CSS, Design, Research<span class="hljs-symbol">&#8230;</span>"</span> /></span>
<span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"c-field__button"</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span>></span><span class="hljs-tag"><<span class="hljs-name">svg</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"c-field__icon"</span> <span class="hljs-attr">width</span>=<span class="hljs-string">"20"</span> <span class="hljs-attr">height</span>=<span class="hljs-string">"20"</span> <span class="hljs-attr">viewBox</span>=<span class="hljs-string">"0 0 200 200"</span> <span class="hljs-attr">focusable</span>=<span class="hljs-string">"false"</span> <span class="hljs-attr">role</span>=<span class="hljs-string">"img"</span> <span class="hljs-attr">aria-label</span>=<span class="hljs-string">"Search"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">path</span> <span class="hljs-attr">role</span>=<span class="hljs-string">"presentation"</span> <span class="hljs-attr">d</span>=<span class="hljs-string">"M129 121C136 113 140 102 140 90c0-28-22-50-50-50S40 63 40 90s22 50 50 50c12 0 24-4 32-12L158 164l7-7-36-36zM90 130c-22 0-40-18-40-40s18-40 40-40 40 18 40 40-18 40-40 40z"</span> /></span>
<span class="hljs-tag"></<span class="hljs-name">svg</span>></span>
<span class="hljs-tag"></<span class="hljs-name">button</span>></span>
<span class="hljs-tag"></<span class="hljs-name">fieldset</span>></span>
<span class="hljs-tag"></<span class="hljs-name">form</span>></span></pre>
</code>
</div>
<div class="Browser-panel Browser-code" data-role="tab-panel" id="browser-eaa4b7d57fab70c2815b48b116de183f-panel-view">
<code class="Code Code--lang-html hljs">
<pre><span class="hljs-tag"><<span class="hljs-name">form</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"c-search"</span> <span class="hljs-attr">role</span>=<span class="hljs-string">"search"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"search"</span> <span class="hljs-attr">action</span>=<span class="hljs-string">"/pages/search/"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">fieldset</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"c-field"</span>></span>
<span class="hljs-tag"><<span class="hljs-name">legend</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"u-hidden"</span>></span>Search 24 ways<span class="hljs-tag"></<span class="hljs-name">legend</span>></span>
<span class="hljs-tag"><<span class="hljs-name">label</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"u-hidden"</span> <span class="hljs-attr">for</span>=<span class="hljs-string">"q"</span>></span>Keywords<span class="hljs-tag"></<span class="hljs-name">label</span>></span>
<span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"c-field__input"</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"search"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"q"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"q"</span> <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"e.g. CSS, Design, Research<span class="hljs-symbol">&#8230;</span>"</span>/></span>
<span class="hljs-tag"><<span class="hljs-name">button</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"c-field__button"</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span>></span>{% include "search.svg" %}<span class="hljs-tag"></<span class="hljs-name">button</span>></span>
<span class="hljs-tag"></<span class="hljs-name">fieldset</span>></span>
<span class="hljs-tag"></<span class="hljs-name">form</span>></span></pre>
</code>
</div>
<div class="Browser-panel Browser-code" data-role="tab-panel" id="browser-eaa4b7d57fab70c2815b48b116de183f-panel-context">
<code class="Code Code--lang-json hljs">
<pre>{
<span class="hljs-attr">"site"</span>: {
<span class="hljs-attr">"title"</span>: <span class="hljs-string">"24 ways"</span>,
<span class="hljs-attr">"handle"</span>: <span class="hljs-string">"24ways"</span>,
<span class="hljs-attr">"description"</span>: <span class="hljs-string">"24 ways is the advent calendar for web geeks. Each day throughout December we publish a daily dose of web design and development goodness to bring you all a little Christmas cheer."</span>,
<span class="hljs-attr">"url"</span>: <span class="hljs-string">"https://24ways.org"</span>,
<span class="hljs-attr">"feed"</span>: <span class="hljs-string">"https://feeds.feedburner.com/24ways"</span>,
<span class="hljs-attr">"theme_color"</span>: <span class="hljs-string">"#f04"</span>
},
<span class="hljs-attr">"theme"</span>: {
<span class="hljs-attr">"year"</span>: [
<span class="hljs-number">348</span>,
<span class="hljs-number">344</span>,
<span class="hljs-number">340</span>,
<span class="hljs-number">336</span>,
<span class="hljs-number">332</span>,
<span class="hljs-number">328</span>,
<span class="hljs-number">324</span>,
<span class="hljs-number">320</span>,
<span class="hljs-number">316</span>,
<span class="hljs-number">312</span>,
<span class="hljs-number">308</span>,
<span class="hljs-number">304</span>,
<span class="hljs-number">300</span>,
<span class="hljs-number">296</span>,
<span class="hljs-number">292</span>,
<span class="hljs-number">288</span>
],
<span class="hljs-attr">"day"</span>: [
<span class="hljs-number">360</span>,
<span class="hljs-number">353</span>,
<span class="hljs-number">346</span>,
<span class="hljs-number">339</span>,
<span class="hljs-number">332</span>,
<span class="hljs-number">325</span>,
<span class="hljs-number">318</span>,
<span class="hljs-number">311</span>,
<span class="hljs-number">304</span>,
<span class="hljs-number">297</span>,
<span class="hljs-number">290</span>,
<span class="hljs-number">283</span>,
<span class="hljs-number">276</span>,
<span class="hljs-number">269</span>,
<span class="hljs-number">262</span>,
<span class="hljs-number">255</span>,
<span class="hljs-number">248</span>,
<span class="hljs-number">241</span>,
<span class="hljs-number">234</span>,
<span class="hljs-number">227</span>,
<span class="hljs-number">220</span>,
<span class="hljs-number">213</span>,
<span class="hljs-number">206</span>,
<span class="hljs-number">199</span>
]
}
}</pre>
</code>
</div>
<div class="Browser-panel Browser-resources" data-role="tab-panel" id="browser-eaa4b7d57fab70c2815b48b116de183f-panel-assets">
<div class="FileBrowser">
<div class="FileBrowser-selectWrapper">
<label class="FileBrowser-select-label" for="filebrowser-select">File:</label>
<select class="FileBrowser-select" id="filebrowser-select">
<option value="file-ca6f270e87c43d0c81d2b797fdf7cf5f">search.css</option>
</select>
</div>
<div class="FileBrowser-item is-active" id="file-ca6f270e87c43d0c81d2b797fdf7cf5f" data-role="resource-preview">
<ul class="Meta">
<li class="Meta-item">
<strong class="Meta-key">Content:</strong>
<span class="Meta-value">
<div class="FileBrowser-itemPreview">
<code class="Code Code--lang-CSS FileBrowser-code hljs">
<pre>.c-search {
.c-field__input {
width: 100%;
box-shadow: inset 0 -1px 0 $navigation-color--offset;
padding-left: map(spaces, xlarge);
background-color: $navigation-color--offset;
&:not(:focus) {
box-shadow: none;
}
.has-js & {
@media (--from-medium-screen) {
height: $banner-height--large;
}
}
@media (-ms-high-contrast: active) {
border: 1px solid;
}
}
.c-field__button {
@apply --focusable;
position: absolute;
top: 0;
left: 0;
padding: map(spaces, xsmall) map(spaces, small);
.has-js & {
@media (--from-medium-screen) {
padding: map(spaces, medium) map(spaces, xsmall);
}
}
}
}
</pre>
</code>
</div>
</span>
</li>
<li class="Meta-item">
<strong class="Meta-key">URL:</strong>
<span class="Meta-value"><a data-no-pjax href="../raw/search/search.css"><span>/components/raw/search/search.css</span></a></span>
</li>
<li class="Meta-item">
<strong class="Meta-key">Filesystem Path:</strong>
<span class="Meta-value">src/components/global/search/search.css</span>
</li>
<li class="Meta-item">
<strong class="Meta-key">Size:</strong>
<span class="Meta-value">713 Bytes</span>
</li>
</ul>
</div>
</div>
</div>
<div class="Browser-panel" data-role="tab-panel" id="browser-eaa4b7d57fab70c2815b48b116de183f-panel-info">
<ul class="Meta">
<li class="Meta-item">
<strong class="Meta-key">Handle:</strong>
<span class="Meta-value">@search</span>
</li>
<li class="Meta-item">
<strong class="Meta-key">Preview:</strong>
<span class="Meta-value">
<ul>
<li><a data-no-pjax href="../preview/search"><span>With layout</span> <svg fill="#000000" height="22" viewBox="0 0 24 24" width="22" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h4v-2H5V8h14v10h-4v2h4c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm-7 6l-4 4h3v6h2v-6h3l-4-4z"/>
</svg>
</a></li>
<li><a data-no-pjax href="../render/search"><span>Component only</span> <svg fill="#000000" height="22" viewBox="0 0 24 24" width="22" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h4v-2H5V8h14v10h-4v2h4c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm-7 6l-4 4h3v6h2v-6h3l-4-4z"/>
</svg>
</a></li>
</ul>
</span>
</li>
<li class="Meta-item">
<strong class="Meta-key">Filesystem Path:</strong>
<span class="Meta-value">src/components/global/search/search.html</span>
</li>
<li class="Meta-item">
<strong class="Meta-key">Referenced by <em class="Meta-count">(1)</em>:</strong>
<span class="Meta-value Meta-value--linkList">
<a href="menu">@<span>menu</span></a>
</span>
</li>
</ul>
</div>
<div class="Browser-panel Browser-notes" data-role="tab-panel" id="browser-eaa4b7d57fab70c2815b48b116de183f-panel-notes">
<div class="Prose Prose--condensed">
<p class="Browser-isEmptyNote">There are no notes for this item.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="Frame-handle" data-role="frame-resize-handle"></div>
<div class="Frame-panel Frame-panel--sidebar" data-role="sidebar">
<nav class="Navigation">
<div class="Navigation-group Navigation-search">
<form action="" class="Search" data-behaviour="search">
<label class="Search-label" for="search-input">Search</label>
<input class="Search-input" id="search-input" type="search" placeholder="Search…" data-role="input">
<button type="button" data-behaviour="clear-search" class="Search-clearButton" aria-label="Clear search" hidden>
<svg height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M19 6.4L17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z"/>
</svg>
</button>
</form>
</div>
<div class="Navigation-group">
<div class="Tree" data-behaviour="tree" id="tree-components">
<div class="Tree-header">
<h3 class="Tree-title">components</h3>
<button type="button" data-behaviour="collapse-tree" class="Tree-collapse" title="Collapse tree" aria-label="Collapse tree" hidden>
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m9 11c-.6 0-1 .4-1 1s.4 1 1 1h6c.6 0 1-.4 1-1s-.4-1-1-1z"/><path d="m19 21h-14c-1.1 0-2-.9-2-2v-14c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2v14c0 1.1-.9 2-2 2zm-14-16v14h14v-14z"/></svg>
</button>
</div>
<ul class="Tree-items Tree-depth-1">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="og-image" data-pjax>
<span>OG Image</span>
</a>
</li>
<li class="Tree-item Tree-collection Tree-depth-2" data-behaviour="collection" id="tree-components-collection-utilities">
<button class="Tree-collectionLabel" data-role="toggle" aria-expanded="true" aria-controls="tree-components-collection-utilities-items">
Utilities
</button>
<ul class="Tree-collectionItems" data-role="items" id="tree-components-collection-utilities-items">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="hidden" data-pjax>
<span>Hidden</span>
</a>
</li>
</ul>
</li>
<li class="Tree-item Tree-collection Tree-depth-2" data-behaviour="collection" id="tree-components-collection-common">
<button class="Tree-collectionLabel" data-role="toggle" aria-expanded="true" aria-controls="tree-components-collection-common-items">
Common
</button>
<ul class="Tree-collectionItems" data-role="items" id="tree-components-collection-common-items">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="article" data-pjax>
<span>Article</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="author" data-pjax>
<span>Author</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="avatar" data-pjax>
<span>Avatar</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="backdrop" data-pjax>
<span>Backdrop</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="button" data-pjax>
<span>Button</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="comment" data-pjax>
<span>Comment</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="comment-form" data-pjax>
<span>Comment Form</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="continue" data-pjax>
<span>Continue</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="field" data-pjax>
<span>Field</span>
</a>
</li>
<li class="Tree-item Tree-collection Tree-depth-3" data-behaviour="collection" id="tree-components-collection-listing">
<button class="Tree-collectionLabel" data-role="toggle" aria-expanded="true" aria-controls="tree-components-collection-listing-items">
Listing
</button>
<ul class="Tree-collectionItems" data-role="items" id="tree-components-collection-listing-items">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="listing--default" data-pjax>
<span>Default</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="listing--inset" data-pjax>
<span>Inset</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="listing--authors" data-pjax>
<span>Authors</span>
</a>
</li>
</ul>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="meta" data-pjax>
<span>Meta</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="preface" data-pjax>
<span>Preface</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="promo" data-pjax>
<span>Promo</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="search-form" data-pjax>
<span>Search Form</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="section" data-pjax>
<span>Section</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="summary" data-pjax>
<span>Summary</span>
</a>
</li>
</ul>
</li>
<li class="Tree-item Tree-collection Tree-depth-2" data-behaviour="collection" id="tree-components-collection-global">
<button class="Tree-collectionLabel" data-role="toggle" aria-expanded="true" aria-controls="tree-components-collection-global-items">
Global
</button>
<ul class="Tree-collectionItems" data-role="items" id="tree-components-collection-global-items">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="banner" data-pjax>
<span>Banner</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="contentinfo" data-pjax>
<span>Contentinfo</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="menu" data-pjax>
<span>Menu</span>
</a>
</li>
<li class="Tree-item Tree-entity is-current" data-state="current" data-role="item">
<a class="Tree-entityLink" href="" data-pjax>
<span>Search</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="site-nav" data-pjax>
<span>Site Nav</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="topics-nav" data-pjax>
<span>Topics Nav</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="traverse-nav" data-pjax>
<span>Traverse Nav</span>
</a>
</li>
</ul>
</li>
<li class="Tree-item Tree-collection Tree-depth-2" data-behaviour="collection" id="tree-components-collection-scopes">
<button class="Tree-collectionLabel" data-role="toggle" aria-expanded="true" aria-controls="tree-components-collection-scopes-items">
Scopes
</button>
<ul class="Tree-collectionItems" data-role="items" id="tree-components-collection-scopes-items">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="embed" data-pjax>
<span>Embed</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="gallery" data-pjax>
<span>Gallery</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="note" data-pjax>
<span>Note</span>
</a>
</li>
<li class="Tree-item Tree-collection Tree-depth-3" data-behaviour="collection" id="tree-components-collection-prose">
<button class="Tree-collectionLabel" data-role="toggle" aria-expanded="true" aria-controls="tree-components-collection-prose-items">
Prose
</button>
<ul class="Tree-collectionItems" data-role="items" id="tree-components-collection-prose-items">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="prose--default" data-pjax>
<span>Default</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="prose--article" data-pjax>
<span>Article</span>
</a>
</li>
</ul>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="syntax" data-pjax>
<span>Syntax</span>
</a>
</li>
</ul>
</li>
<li class="Tree-item Tree-collection Tree-depth-2" data-behaviour="collection" id="tree-components-collection-templates">
<button class="Tree-collectionLabel" data-role="toggle" aria-expanded="true" aria-controls="tree-components-collection-templates-items">
Templates
</button>
<ul class="Tree-collectionItems" data-role="items" id="tree-components-collection-templates-items">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="article-template" data-pjax>
<span>Article Template</span>
</a>
</li>
<li class="Tree-item Tree-collection Tree-depth-3" data-behaviour="collection" id="tree-components-collection-content-template">
<button class="Tree-collectionLabel" data-role="toggle" aria-expanded="true" aria-controls="tree-components-collection-content-template-items">
Content Template
</button>
<ul class="Tree-collectionItems" data-role="items" id="tree-components-collection-content-template-items">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="content-template--about" data-pjax>
<span>About</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="content-template--404" data-pjax>
<span>404</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="content-template--sponsorship" data-pjax>
<span>Sponsorship</span>
</a>
</li>
</ul>
</li>
<li class="Tree-item Tree-collection Tree-depth-3" data-behaviour="collection" id="tree-components-collection-index-template">
<button class="Tree-collectionLabel" data-role="toggle" aria-expanded="true" aria-controls="tree-components-collection-index-template-items">
Index Template
</button>
<ul class="Tree-collectionItems" data-role="items" id="tree-components-collection-index-template-items">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="index-template--topics" data-pjax>
<span>Topics</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="index-template--archives" data-pjax>
<span>Archives</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="index-template--authors" data-pjax>
<span>Authors</span>
</a>
</li>
</ul>
</li>
<li class="Tree-item Tree-collection Tree-depth-3" data-behaviour="collection" id="tree-components-collection-listing-template">
<button class="Tree-collectionLabel" data-role="toggle" aria-expanded="true" aria-controls="tree-components-collection-listing-template-items">
Listing Template
</button>
<ul class="Tree-collectionItems" data-role="items" id="tree-components-collection-listing-template-items">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="listing-template--home" data-pjax>
<span>Home</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="listing-template--topic" data-pjax>
<span>Topic</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="listing-template--archive" data-pjax>
<span>Archive</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="listing-template--author" data-pjax>
<span>Author</span>
</a>
</li>
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="listing-template--search-results" data-pjax>
<span>Search Results</span>
</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="Navigation-group">
<div class="Tree" data-behaviour="tree" id="tree-docs">
<div class="Tree-header">
<h3 class="Tree-title">documentation</h3>
<button type="button" data-behaviour="collapse-tree" class="Tree-collapse" title="Collapse tree" aria-label="Collapse tree" hidden>
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m9 11c-.6 0-1 .4-1 1s.4 1 1 1h6c.6 0 1-.4 1-1s-.4-1-1-1z"/><path d="m19 21h-14c-1.1 0-2-.9-2-2v-14c0-1.1.9-2 2-2h14c1.1 0 2 .9 2 2v14c0 1.1-.9 2-2 2zm-14-16v14h14v-14z"/></svg>
</button>
</div>
<ul class="Tree-items Tree-depth-1">
<li class="Tree-item Tree-entity" data-role="item">
<a class="Tree-entityLink" href="../../docs/tokens" data-pjax>
<span>Design tokens</span>
</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
</div>
</div>
<script src="../../fractal/js/mandelbrot.js?cachebust=1.4.0"></script>
</body>
</html>
| {
"content_hash": "9d60d5c02def63d38fba63d590b01392",
"timestamp": "",
"source": "github",
"line_count": 1115,
"max_line_length": 885,
"avg_line_length": 34.017040358744396,
"alnum_prop": 0.5279337709931714,
"repo_name": "24ways/frontend",
"id": "d086a818ce3c42f57c7b339c715e7b3f6544268f",
"size": "37931",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "components/detail/search.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "50771"
},
{
"name": "HTML",
"bytes": "17767"
},
{
"name": "JavaScript",
"bytes": "15760"
}
],
"symlink_target": ""
} |
package asposefeatures.workingwithslides.slidecomments.java;
import com.aspose.slides.IComment;
import com.aspose.slides.ICommentAuthor;
import com.aspose.slides.ICommentCollection;
import com.aspose.slides.ISlide;
import com.aspose.slides.Presentation;
import com.aspose.slides.SaveFormat;
public class AsposeComments
{
public static void main(String[] args)
{
String dataPath = "src/asposefeatures/workingwithslides/slidecomments/data/";
// ======================================
// Adding Slide Comments
// ======================================
Presentation pres = new Presentation();
// Adding Empty slide
pres.getSlides().addEmptySlide(pres.getLayoutSlides().get_Item(0));
// Adding Author
ICommentAuthor author = pres.getCommentAuthors().addAuthor("Aspose", "AS");
// Position of comments
java.awt.geom.Point2D.Float point = new java.awt.geom.Point2D.Float(0.2f, 0.2f);
java.util.Date date = new java.util.Date();
// Adding slide comment for an author on slide 1
author.getComments().addComment("Hello Mudassir, this is slide comment",
pres.getSlides().get_Item(0), point, date);
// Adding slide comment for an author on slide 1
author.getComments().addComment("Hello Mudassir, this is second slide comment",
pres.getSlides().get_Item(1), point, date);
// Accessing ISlide 1
ISlide slide = pres.getSlides().get_Item(0);
// if null is passed as an argument then it will bring comments from all
// authors on selected slide
IComment[] Comments = slide.getSlideComments(author);
// Accessing the comment at index 0 for slide 1
String str = Comments[0].getText();
pres.save(dataPath + "AsposeComments_Out.pptx", SaveFormat.Pptx);
if (Comments.length > 0)
{
// Select comments collection of Author at index 0
ICommentCollection commentCollection = Comments[0].getAuthor().getComments();
String comment = commentCollection.get_Item(0).getText();
}
// ======================================
// Accessing Slide Comments
// ======================================
// Presentation pres = new Presentation("data/AsposeComments.pptx");
for (ICommentAuthor author1 : pres.getCommentAuthors())
{
for (IComment comment : author1.getComments())
{
System.out.println("ISlide :"
+ comment.getSlide().getSlideNumber()
+ " has comment: " + comment.getText()
+ " with Author: " + comment.getAuthor().getName()
+ " posted on time :" + comment.getCreatedTime() + "\n");
}
}
System.out.println("Done");
}
} | {
"content_hash": "38402c17ea2611707685efdef7657aa1",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 82,
"avg_line_length": 32.41772151898734,
"alnum_prop": 0.659117532213979,
"repo_name": "aspose-slides/Aspose.Slides-for-Java",
"id": "d81131aefd549c927cd12684cf763f741ba0ffd8",
"size": "3577",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "Plugins/Aspose.Slides Java for Pptx4j/Java/src/asposefeatures/workingwithslides/slidecomments/java/AsposeComments.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "27301"
},
{
"name": "Java",
"bytes": "692513"
},
{
"name": "PHP",
"bytes": "144457"
},
{
"name": "Python",
"bytes": "279574"
},
{
"name": "Ruby",
"bytes": "166824"
}
],
"symlink_target": ""
} |
package org.hisp.dhis.dxf2.dataset.streaming;
import com.fasterxml.jackson.core.JsonGenerator;
import org.hisp.dhis.dxf2.dataset.CompleteDataSetRegistration;
import java.io.IOException;
/**
* @author Halvdan Hoem Grelland
*/
public class StreamingJsonCompleteDataSetRegistration
extends CompleteDataSetRegistration
{
private JsonGenerator generator;
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
public StreamingJsonCompleteDataSetRegistration( JsonGenerator generator )
{
this.generator = generator;
}
// -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
@Override
protected void open()
{
try
{
generator.writeStartObject();
}
catch ( IOException e )
{
// Intentionally ignored
}
}
@Override
protected void close()
{
if ( generator == null )
{
return;
}
try
{
generator.writeEndObject();
}
catch ( IOException e )
{
// Intentionally ignored
}
}
// -------------------------------------------------------------------------
// Setters
// -------------------------------------------------------------------------
@Override
public void setDataSet( String dataSet )
{
writeField( FIELD_DATASET, dataSet );
}
@Override
public void setPeriod( String period )
{
writeField( FIELD_PERIOD, period );
}
@Override
public void setOrganisationUnit( String organisationUnit )
{
writeField( FIELD_ORGUNIT, organisationUnit );
}
@Override
public void setAttributeOptionCombo( String attributeOptionCombo )
{
writeField( FIELD_ATTR_OPTION_COMBO, attributeOptionCombo );
}
@Override
public void setDate( String date )
{
writeField( FIELD_DATE, date );
}
@Override
public void setStoredBy( String storedBy )
{
writeField( FIELD_STORED_BY, storedBy );
}
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
@Override
protected void writeField( String fieldName, String value )
{
if ( value == null )
{
return;
}
try
{
generator.writeObjectField( fieldName, value );
}
catch ( IOException e )
{
// Intentionally ignored
}
}
}
| {
"content_hash": "c81a841e570592964e534fee63d2d210",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 80,
"avg_line_length": 23.097560975609756,
"alnum_prop": 0.44456177402323127,
"repo_name": "vietnguyen/dhis2-core",
"id": "86fb799c749a1dec253369fd0694425829d4552f",
"size": "4397",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/dataset/streaming/StreamingJsonCompleteDataSetRegistration.java",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "CSS",
"bytes": "195574"
},
{
"name": "HTML",
"bytes": "68810"
},
{
"name": "Java",
"bytes": "18270594"
},
{
"name": "JavaScript",
"bytes": "995349"
},
{
"name": "PLpgSQL",
"bytes": "690824"
},
{
"name": "Ruby",
"bytes": "1011"
},
{
"name": "Shell",
"bytes": "394"
},
{
"name": "XSLT",
"bytes": "8281"
}
],
"symlink_target": ""
} |
void Install_Registry(bool erase=false, const char *key=DEFAULT_REGISTRY_LOCATION);
void Install_RegistryEnd();
extern TRegistry *settings;
struct filecopylist
{
const char *src;
const char *dest;
};
bool Install_InstallFiles( filecopylist * );
bool Install_DeleteFiles( filecopylist * );
bool Install_AddToRun( const char *key, const char *program );
bool Install_AddToRunOnce( const char *key, const char *program );
bool Install_RemoveFromRun( const char *key );
bool Install_RemoveFromRunOnce( const char *key );
bool Install_CalcPath( const char *orig, char *dest, int destlen );
HWND Install_CreateInvisibleWindow(
HINSTANCE instance,
const char *clsname,
const char *title,
WNDPROC proc
);
LRESULT Install_SendMsgToWindow(
const char *clsname,
const char *title,
UINT msg,
WPARAM wparam,
LPARAM lparam
);
#endif
| {
"content_hash": "f3cf7dfae1d1e41cd404af150502cfc1",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 83,
"avg_line_length": 30.55,
"alnum_prop": 0.5188216039279869,
"repo_name": "jdkoftinoff/if2kv2",
"id": "f6b327fa1288d0d7b952e0ccd8a053d9e7726e07",
"size": "1344",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "libwn/include/win32installutils.h",
"mode": "33261",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "764466"
},
{
"name": "C++",
"bytes": "3731234"
},
{
"name": "HTML",
"bytes": "60269"
},
{
"name": "JavaScript",
"bytes": "22354"
},
{
"name": "Makefile",
"bytes": "4869"
},
{
"name": "Objective-C",
"bytes": "43490"
},
{
"name": "Objective-C++",
"bytes": "26826"
},
{
"name": "PHP",
"bytes": "240"
},
{
"name": "Prolog",
"bytes": "3773"
},
{
"name": "QMake",
"bytes": "64"
},
{
"name": "Shell",
"bytes": "31729"
}
],
"symlink_target": ""
} |
[](https://travis-ci.org/smallhelm/droideka)
[](https://david-dm.org/smallhelm/droideka)
fight back against email scrapers
## What it does
* finds all `<a href="mailto:...` email addresses in your html
* encrypts them
* appends some JS to your html that decrypts them 1/2 second after the page loads
## How to use it
```js
var droideka = require('droideka');
```
### html = droideka(html[, seed])
Your HTML
```html
<p>
Here is my email:
<a href="mailto:some@email">some@email.com</a>
</p>
<p>
Here is some more html stuff
</p>
```
In node run it through droideka
```js
html = droideka(html);
```
Here is the output
```html
<p>
Here is my email:
<span id="cihzenf7j0000i4dxll7gftvj"><noscript>You must enable JavaScript to see the email.</noscript></span>
</p>
<p>
Here is some more html stuff
</p>
<script type="application/javascript">setTimeout(function(){var d=function(b){var c=b.substring(0,87);b=b.substring(c.length);var e,f,g,h='',d;for(e=0;e<b.length;e++)f=b.charAt(e),g=c.indexOf(f),d=(g-b.length+c.length)%c.length,d=0>d?c.length+d:d,h+=0<=g?c[d]:f;return h};(function(){var a=document.getElementById("cihzenf7j0000i4dxll7gftvj");if(!a)return;a.innerHTML=d("eY\"1]U.ZbrBtmCh[-:VpK!6WuXx8dlwM2GJ,kfT#(RHD&5L}I^o7~F*4S0{qzO%n3>gsQPvA'@cyjN<9=)a+iE$Gf S7H9,&*f#AFUq6U*HdH*f#A&K6U*HdH*f#AG/fK");}());}, 500);</script>
```
Take that spammers!
`seed` can be any string, i.e. your package.json's version string.
### encoded = droideka.encode(text[, seed])
Lightly encrypt some text. (not cryptographically secure)
### droideka.js\_code\_decode
A string of JS code that creates a local function `d` that can be used for decoding.
```js
haml += '<script>';
html += droideka.js_code_decode;//insert the decoding function
html += 'var email = d(' + JSON.stringify(encoded) + ');';//call it
html += '</script>';
```
## License
MIT
| {
"content_hash": "a1c2d95f4eb638148a40b0f81d9dace2",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 526,
"avg_line_length": 29.761194029850746,
"alnum_prop": 0.6880641925777332,
"repo_name": "smallhelm/droideka",
"id": "5b95c5a6f778eb2c2ed67e6a41f3bb6d674bc32e",
"size": "2006",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "2557"
}
],
"symlink_target": ""
} |
migrants-now
============
Forces an immediate migrant wave. Only works after migrants have
arrived naturally. Equivalent to `modtools/force` ``-eventType migrants``
]====]
df.global.timed_events:insert('#',{
new = true,
type = df.timed_event_type.Migrants,
season = df.global.cur_season,
season_ticks = df.global.cur_season_tick+1,
entity = df.historical_entity.find(df.global.ui.civ_id)
})
| {
"content_hash": "6333b4c84967eb73ed6adbb24024b921",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 74,
"avg_line_length": 30.642857142857142,
"alnum_prop": 0.6573426573426573,
"repo_name": "KohaiKhaos/modified-MWDF",
"id": "768fa0580812ffbada2aae29e707a2b53251a5d0",
"size": "493",
"binary": false,
"copies": "2",
"ref": "refs/heads/manual",
"path": "MWDF Project/Dwarf Fortress/hack/scripts/migrants-now.lua",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "118649"
},
{
"name": "AutoHotkey",
"bytes": "87107"
},
{
"name": "Batchfile",
"bytes": "6514"
},
{
"name": "C",
"bytes": "2878"
},
{
"name": "CSS",
"bytes": "43240"
},
{
"name": "HTML",
"bytes": "1962835"
},
{
"name": "JavaScript",
"bytes": "8816"
},
{
"name": "Lua",
"bytes": "2540934"
},
{
"name": "PLSQL",
"bytes": "266"
},
{
"name": "Python",
"bytes": "441828"
},
{
"name": "Ruby",
"bytes": "2400224"
},
{
"name": "Shell",
"bytes": "2300"
},
{
"name": "Tcl",
"bytes": "1278534"
}
],
"symlink_target": ""
} |
package se.softhouse.garden.orchid.spring.utils;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
/**
* This is class makes it possible to concatenate strings using multiple [] as
* follows ${url['/a/b']['/c']}
*
* @author Mikael Svahn
*
*/
public class StringMap implements Map<String, StringMap> {
protected final String string;
public StringMap(String string) {
this.string = string;
}
@Override
public int size() {
return 0;
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public boolean containsKey(Object key) {
return false;
}
@Override
public boolean containsValue(Object value) {
return false;
}
@Override
public StringMap get(Object link) {
return new StringMap(this.string + link);
}
@Override
public StringMap put(String key, StringMap value) {
return null;
}
@Override
public StringMap remove(Object key) {
return null;
}
@Override
public void putAll(Map<? extends String, ? extends StringMap> m) {
}
@Override
public void clear() {
}
@Override
public Set<String> keySet() {
return null;
}
@Override
public Collection<StringMap> values() {
return null;
}
@Override
public Set<java.util.Map.Entry<String, StringMap>> entrySet() {
return null;
}
@Override
public String toString() {
return this.string;
}
}
| {
"content_hash": "ffc1895faf8ae8a623927bb82e39edcc",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 78,
"avg_line_length": 15.720930232558139,
"alnum_prop": 0.6915680473372781,
"repo_name": "Softhouse/orchid",
"id": "caec1526db27f19c6b61d537bf7d3884097eb4a5",
"size": "2324",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "se.softhouse.garden.orchid.spring/src/main/java/se/softhouse/garden/orchid/spring/utils/StringMap.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Groovy",
"bytes": "10674"
},
{
"name": "Java",
"bytes": "607169"
},
{
"name": "Scala",
"bytes": "17588"
}
],
"symlink_target": ""
} |
// Created by Loïc Gardiol on 30.10.13.
#import "FoodRestaurantInfoCell.h"
#import "FoodService.h"
#import "MapController.h"
#import "FoodRestaurantViewController.h"
#import "UIImageView+AFNetworking.h"
static const CGFloat kTopBarHeight = 30.0;
@interface FoodRestaurantInfoCell ()
@property (nonatomic, strong) IBOutlet UIImageView* backgroundImageView;
@property (nonatomic, strong) IBOutlet UILabel* satRateLabel;
@property (nonatomic, strong) IBOutlet NSLayoutConstraint* satRateLabelLeftConstraint;
@property (nonatomic, strong) NSLayoutConstraint* satRatLabelNullWidthConstraint;
@property (nonatomic, strong) NSLayoutConstraint* backgroundImageViewHeightConstraint;
@end
@implementation FoodRestaurantInfoCell
#pragma mark - Init
- (instancetype)initWithEpflRestaurant:(EpflRestaurant*)restaurant
{
[PCUtils throwExceptionIfObject:restaurant notKindOfClass:[EpflRestaurant class]];
NSArray* elements = [[NSBundle mainBundle] loadNibNamed:@"FoodRestaurantInfoCell" owner:nil options:nil];
self = (FoodRestaurantInfoCell*)elements[0];
if (self) {
self.backgroundImageView.contentMode = UIViewContentModeScaleAspectFill;
self.backgroundImageView.clipsToBounds = YES;
self.satRateLabel.isAccessibilityElement = NO;
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.showOnMapButton.accessibilityHint = NSLocalizedStringFromTable(@"ShowsRestaurantOnMap", @"FoodPlugin", nil);
//self.separatorInset = UIEdgeInsetsMake(0, 1000, 0, 0);
[self.showOnMapButton setTitle:[NSString stringWithFormat:@" %@ ", NSLocalizedStringFromTable(@"ShowOnMap", @"FoodPlugin", nil)] forState:UIControlStateNormal];
_showRating = YES; //Default
self.restaurant = restaurant;
}
return self;
}
#pragma mark - Public properties and methods
+ (CGFloat)preferredHeightForRestaurant:(EpflRestaurant*)restaurant {
if (!restaurant.rPictureUrl) {
return kTopBarHeight + 0.5; //just top bar for satRateLabel and showOnMapButton. 0.5 (room for separator)
}
return [PCUtils isIdiomPad] ? 240.0 : 0.3 * [UIScreen mainScreen].bounds.size.height;
}
- (void)setRestaurant:(EpflRestaurant *)restaurant {
_restaurant = restaurant;
self.backgroundImageView.hidden = (self.restaurant.rPictureUrl == nil);
if (self.restaurant.rPictureUrl) {
FoodRestaurantInfoCell* welf __weak = self;
/*#warning REMOVE
NSURLRequest* request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:self.restaurant.rPictureUrl] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30.0];
id<AFImageCache> cache = [UIImageView sharedImageCache];
UIImage* cachedImage __block = [cache cachedImageForRequest:request];
cachedImage = nil;
#warning END OF REMOVE*/
NSURLRequest* request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:self.restaurant.rPictureUrl]];
id<AFImageCache> cache = [UIImageView sharedImageCache];
UIImage* cachedImage __block = [cache cachedImageForRequest:request];
if (cachedImage) {
[NSTimer scheduledTimerWithTimeInterval:0.0 block:^{
if (!welf.backgroundImageView) {
return;
}
welf.backgroundImageView.image = cachedImage;
} repeats:NO];
} else {
[self.backgroundImageView setImageWithURLRequest:request placeholderImage:nil success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image) {
if (!welf.backgroundImageView) {
return;
}
welf.backgroundImageView.image = image;
} failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error) {
//nothing to do
}];
}
}
self.satRateLabel.hidden = NO;
NSString* satRateTitleString = NSLocalizedStringFromTable(@"satisfaction", @"FoodPlugin", nil);
NSString* satRateString = self.restaurant.rRating.voteCount > 0 ? [NSString stringWithFormat:@"%.0lf%%", self.restaurant.rRating.ratingValue*100.0] : @"-%"; //show percentage
NSString* nbVotesString = [NSString stringWithFormat:@"(%d %@)", self.restaurant.rRating.voteCount, self.restaurant.rRating.voteCount > 1 ? NSLocalizedStringFromTable(@"ratings", @"FoodPlugin", nil) : NSLocalizedStringFromTable(@"rating", @"FoodPlugin", nil)];
NSString* fullSatRateString = [NSString stringWithFormat:@"%@ %@ %@", satRateString, satRateTitleString, nbVotesString];
NSMutableAttributedString* satAttrString = [[NSMutableAttributedString alloc] initWithString:fullSatRateString];
UIFont* rateFont = [UIFont systemFontOfSize:self.satRateLabel.font.fontDescriptor.pointSize];
NSRange satRateStringRange = [fullSatRateString rangeOfString:satRateString];
[satAttrString addAttribute:NSFontAttributeName value:rateFont range:satRateStringRange];
UIColor* color = [self colorForRating:self.restaurant.rRating];
[satAttrString addAttribute:NSForegroundColorAttributeName value:color range:satRateStringRange];
self.satRateLabel.attributedText = satAttrString;
}
- (void)setShowRating:(BOOL)showRating {
_showRating = showRating;
self.satRateLabel.hidden = !showRating;
if (!self.satRatLabelNullWidthConstraint) {
self.satRatLabelNullWidthConstraint = [NSLayoutConstraint widthConstraint:0.0 forView:self.satRateLabel];
}
if (showRating) {
self.satRateLabelLeftConstraint.constant = 5.0;
[self.satRateLabel removeConstraint:self.satRatLabelNullWidthConstraint];
} else {
self.satRateLabelLeftConstraint.constant = 0.0;
[self.satRateLabel addConstraint:self.satRatLabelNullWidthConstraint];
}
}
/*
* http://stackoverflow.com/questions/340209/generate-colors-between-red-and-green-for-a-power-meter
*/
- (UIColor*)colorForRating:(EpflRating*)rating {
[PCUtils throwExceptionIfObject:rating notKindOfClass:[EpflRating class]];
if (!rating.voteCount) {
return [UIColor blackColor];
}
double hue = rating.ratingValue * 0.3; // Hue (note 0.4 = Green)
double saturation = 1.0;
double brightness = 0.7;
return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1.0];
}
#pragma mark - Dealloc
- (void)dealloc {
[self.backgroundImageView cancelImageRequestOperation];
}
@end
| {
"content_hash": "39143ce2701c3cde19cb5d285b057b4a",
"timestamp": "",
"source": "github",
"line_count": 152,
"max_line_length": 264,
"avg_line_length": 42.723684210526315,
"alnum_prop": 0.7157376039421004,
"repo_name": "ValentinMinder/pocketcampus",
"id": "ad9ce8d3fbeefeea180ba69a5c23c7663e438af5",
"size": "8051",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ios/PocketCampus/Plugins/FoodPlugin/Views/FoodRestaurantInfoCell.m",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ApacheConf",
"bytes": "876"
},
{
"name": "C",
"bytes": "24548"
},
{
"name": "C#",
"bytes": "934103"
},
{
"name": "CSS",
"bytes": "33788"
},
{
"name": "HTML",
"bytes": "393132"
},
{
"name": "Java",
"bytes": "1971771"
},
{
"name": "JavaScript",
"bytes": "120550"
},
{
"name": "Objective-C",
"bytes": "3611367"
},
{
"name": "PHP",
"bytes": "363528"
},
{
"name": "Python",
"bytes": "52585"
},
{
"name": "Ruby",
"bytes": "6419"
},
{
"name": "Shell",
"bytes": "11498"
},
{
"name": "Thrift",
"bytes": "37896"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_29) on Mon Nov 26 17:20:50 MSK 2012 -->
<TITLE>
AreaFormatRecord (POI API Documentation)
</TITLE>
<META NAME="date" CONTENT="2012-11-26">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AreaFormatRecord (POI API Documentation)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AreaFormatRecord.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV CLASS
<A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaRecord.html" title="class in org.apache.poi.hssf.record.chart"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/poi/hssf/record/chart/AreaFormatRecord.html" target="_top"><B>FRAMES</B></A>
<A HREF="AreaFormatRecord.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.poi.hssf.record.chart</FONT>
<BR>
Class AreaFormatRecord</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../../../org/apache/poi/hssf/record/RecordBase.html" title="class in org.apache.poi.hssf.record">org.apache.poi.hssf.record.RecordBase</A>
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../../../org/apache/poi/hssf/record/Record.html" title="class in org.apache.poi.hssf.record">org.apache.poi.hssf.record.Record</A>
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../../../../org/apache/poi/hssf/record/StandardRecord.html" title="class in org.apache.poi.hssf.record">org.apache.poi.hssf.record.StandardRecord</A>
<IMG SRC="../../../../../../resources/inherit.gif" ALT="extended by "><B>org.apache.poi.hssf.record.chart.AreaFormatRecord</B>
</PRE>
<HR>
<DL>
<DT><PRE>public final class <B>AreaFormatRecord</B><DT>extends <A HREF="../../../../../../org/apache/poi/hssf/record/StandardRecord.html" title="class in org.apache.poi.hssf.record">StandardRecord</A></DL>
</PRE>
<P>
The area format record is used to define the colours and patterns for an area.<p/>
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>Glen Stampoultzis (glens at apache.org)</DD>
</DL>
<HR>
<P>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Field Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static short</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#sid">sid</A></B></CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#AreaFormatRecord()">AreaFormatRecord</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#AreaFormatRecord(org.apache.poi.hssf.record.RecordInputStream)">AreaFormatRecord</A></B>(<A HREF="../../../../../../org/apache/poi/hssf/record/RecordInputStream.html" title="class in org.apache.poi.hssf.record">RecordInputStream</A> in)</CODE>
<BR>
</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.Object</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#clone()">clone</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> short</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#getBackcolorIndex()">getBackcolorIndex</A></B>()</CODE>
<BR>
Get the backcolor index field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#getBackgroundColor()">getBackgroundColor</A></B>()</CODE>
<BR>
Get the background color field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#getDataSize()">getDataSize</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> short</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#getForecolorIndex()">getForecolorIndex</A></B>()</CODE>
<BR>
Get the forecolor index field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#getForegroundColor()">getForegroundColor</A></B>()</CODE>
<BR>
Get the foreground color field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> short</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#getFormatFlags()">getFormatFlags</A></B>()</CODE>
<BR>
Get the format flags field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> short</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#getPattern()">getPattern</A></B>()</CODE>
<BR>
Get the pattern field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> short</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#getSid()">getSid</A></B>()</CODE>
<BR>
return the non static version of the id for this record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#isAutomatic()">isAutomatic</A></B>()</CODE>
<BR>
automatic formatting</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#isInvert()">isInvert</A></B>()</CODE>
<BR>
swap foreground and background colours when data is negative</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#serialize(org.apache.poi.util.LittleEndianOutput)">serialize</A></B>(<A HREF="../../../../../../org/apache/poi/util/LittleEndianOutput.html" title="interface in org.apache.poi.util">LittleEndianOutput</A> out)</CODE>
<BR>
Write the data content of this BIFF record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#setAutomatic(boolean)">setAutomatic</A></B>(boolean value)</CODE>
<BR>
Sets the automatic field value.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#setBackcolorIndex(short)">setBackcolorIndex</A></B>(short field_6_backcolorIndex)</CODE>
<BR>
Set the backcolor index field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#setBackgroundColor(int)">setBackgroundColor</A></B>(int field_2_backgroundColor)</CODE>
<BR>
Set the background color field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#setForecolorIndex(short)">setForecolorIndex</A></B>(short field_5_forecolorIndex)</CODE>
<BR>
Set the forecolor index field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#setForegroundColor(int)">setForegroundColor</A></B>(int field_1_foregroundColor)</CODE>
<BR>
Set the foreground color field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#setFormatFlags(short)">setFormatFlags</A></B>(short field_4_formatFlags)</CODE>
<BR>
Set the format flags field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#setInvert(boolean)">setInvert</A></B>(boolean value)</CODE>
<BR>
Sets the invert field value.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#setPattern(short)">setPattern</A></B>(short field_3_pattern)</CODE>
<BR>
Set the pattern field for the AreaFormat record.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.lang.String</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaFormatRecord.html#toString()">toString</A></B>()</CODE>
<BR>
get a string representation of the record (for biffview/debugging)</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_org.apache.poi.hssf.record.StandardRecord"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class org.apache.poi.hssf.record.<A HREF="../../../../../../org/apache/poi/hssf/record/StandardRecord.html" title="class in org.apache.poi.hssf.record">StandardRecord</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../../org/apache/poi/hssf/record/StandardRecord.html#getRecordSize()">getRecordSize</A>, <A HREF="../../../../../../org/apache/poi/hssf/record/StandardRecord.html#serialize(int, byte[])">serialize</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_org.apache.poi.hssf.record.Record"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class org.apache.poi.hssf.record.<A HREF="../../../../../../org/apache/poi/hssf/record/Record.html" title="class in org.apache.poi.hssf.record">Record</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../../../org/apache/poi/hssf/record/Record.html#cloneViaReserialise()">cloneViaReserialise</A>, <A HREF="../../../../../../org/apache/poi/hssf/record/Record.html#serialize()">serialize</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Field Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="sid"><!-- --></A><H3>
sid</H3>
<PRE>
public static final short <B>sid</B></PRE>
<DL>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../../../constant-values.html#org.apache.poi.hssf.record.chart.AreaFormatRecord.sid">Constant Field Values</A></DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="AreaFormatRecord()"><!-- --></A><H3>
AreaFormatRecord</H3>
<PRE>
public <B>AreaFormatRecord</B>()</PRE>
<DL>
</DL>
<HR>
<A NAME="AreaFormatRecord(org.apache.poi.hssf.record.RecordInputStream)"><!-- --></A><H3>
AreaFormatRecord</H3>
<PRE>
public <B>AreaFormatRecord</B>(<A HREF="../../../../../../org/apache/poi/hssf/record/RecordInputStream.html" title="class in org.apache.poi.hssf.record">RecordInputStream</A> in)</PRE>
<DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public java.lang.String <B>toString</B>()</PRE>
<DL>
<DD><B>Description copied from class: <CODE><A HREF="../../../../../../org/apache/poi/hssf/record/Record.html#toString()">Record</A></CODE></B></DD>
<DD>get a string representation of the record (for biffview/debugging)
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../../../../org/apache/poi/hssf/record/Record.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../../../../../org/apache/poi/hssf/record/Record.html" title="class in org.apache.poi.hssf.record">Record</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="serialize(org.apache.poi.util.LittleEndianOutput)"><!-- --></A><H3>
serialize</H3>
<PRE>
public void <B>serialize</B>(<A HREF="../../../../../../org/apache/poi/util/LittleEndianOutput.html" title="interface in org.apache.poi.util">LittleEndianOutput</A> out)</PRE>
<DL>
<DD><B>Description copied from class: <CODE><A HREF="../../../../../../org/apache/poi/hssf/record/StandardRecord.html#serialize(org.apache.poi.util.LittleEndianOutput)">StandardRecord</A></CODE></B></DD>
<DD>Write the data content of this BIFF record. The 'ushort sid' and 'ushort size' header fields
have already been written by the superclass.<br/>
The number of bytes written must equal the record size reported by
<A HREF="../../../../../../org/apache/poi/hssf/record/RecordBase.html#getRecordSize()"><CODE>RecordBase.getRecordSize()</CODE></A>} minus four
( record header consiting of a 'ushort sid' and 'ushort reclength' has already been written
by thye superclass).
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/apache/poi/hssf/record/StandardRecord.html#serialize(org.apache.poi.util.LittleEndianOutput)">serialize</A></CODE> in class <CODE><A HREF="../../../../../../org/apache/poi/hssf/record/StandardRecord.html" title="class in org.apache.poi.hssf.record">StandardRecord</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getDataSize()"><!-- --></A><H3>
getDataSize</H3>
<PRE>
protected int <B>getDataSize</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/apache/poi/hssf/record/StandardRecord.html#getDataSize()">getDataSize</A></CODE> in class <CODE><A HREF="../../../../../../org/apache/poi/hssf/record/StandardRecord.html" title="class in org.apache.poi.hssf.record">StandardRecord</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getSid()"><!-- --></A><H3>
getSid</H3>
<PRE>
public short <B>getSid</B>()</PRE>
<DL>
<DD><B>Description copied from class: <CODE><A HREF="../../../../../../org/apache/poi/hssf/record/Record.html#getSid()">Record</A></CODE></B></DD>
<DD>return the non static version of the id for this record.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../../org/apache/poi/hssf/record/Record.html#getSid()">getSid</A></CODE> in class <CODE><A HREF="../../../../../../org/apache/poi/hssf/record/Record.html" title="class in org.apache.poi.hssf.record">Record</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="clone()"><!-- --></A><H3>
clone</H3>
<PRE>
public java.lang.Object <B>clone</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../../../../org/apache/poi/hssf/record/Record.html#clone()">clone</A></CODE> in class <CODE><A HREF="../../../../../../org/apache/poi/hssf/record/Record.html" title="class in org.apache.poi.hssf.record">Record</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getForegroundColor()"><!-- --></A><H3>
getForegroundColor</H3>
<PRE>
public int <B>getForegroundColor</B>()</PRE>
<DL>
<DD>Get the foreground color field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setForegroundColor(int)"><!-- --></A><H3>
setForegroundColor</H3>
<PRE>
public void <B>setForegroundColor</B>(int field_1_foregroundColor)</PRE>
<DL>
<DD>Set the foreground color field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getBackgroundColor()"><!-- --></A><H3>
getBackgroundColor</H3>
<PRE>
public int <B>getBackgroundColor</B>()</PRE>
<DL>
<DD>Get the background color field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setBackgroundColor(int)"><!-- --></A><H3>
setBackgroundColor</H3>
<PRE>
public void <B>setBackgroundColor</B>(int field_2_backgroundColor)</PRE>
<DL>
<DD>Set the background color field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getPattern()"><!-- --></A><H3>
getPattern</H3>
<PRE>
public short <B>getPattern</B>()</PRE>
<DL>
<DD>Get the pattern field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setPattern(short)"><!-- --></A><H3>
setPattern</H3>
<PRE>
public void <B>setPattern</B>(short field_3_pattern)</PRE>
<DL>
<DD>Set the pattern field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getFormatFlags()"><!-- --></A><H3>
getFormatFlags</H3>
<PRE>
public short <B>getFormatFlags</B>()</PRE>
<DL>
<DD>Get the format flags field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setFormatFlags(short)"><!-- --></A><H3>
setFormatFlags</H3>
<PRE>
public void <B>setFormatFlags</B>(short field_4_formatFlags)</PRE>
<DL>
<DD>Set the format flags field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getForecolorIndex()"><!-- --></A><H3>
getForecolorIndex</H3>
<PRE>
public short <B>getForecolorIndex</B>()</PRE>
<DL>
<DD>Get the forecolor index field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setForecolorIndex(short)"><!-- --></A><H3>
setForecolorIndex</H3>
<PRE>
public void <B>setForecolorIndex</B>(short field_5_forecolorIndex)</PRE>
<DL>
<DD>Set the forecolor index field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="getBackcolorIndex()"><!-- --></A><H3>
getBackcolorIndex</H3>
<PRE>
public short <B>getBackcolorIndex</B>()</PRE>
<DL>
<DD>Get the backcolor index field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setBackcolorIndex(short)"><!-- --></A><H3>
setBackcolorIndex</H3>
<PRE>
public void <B>setBackcolorIndex</B>(short field_6_backcolorIndex)</PRE>
<DL>
<DD>Set the backcolor index field for the AreaFormat record.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="setAutomatic(boolean)"><!-- --></A><H3>
setAutomatic</H3>
<PRE>
public void <B>setAutomatic</B>(boolean value)</PRE>
<DL>
<DD>Sets the automatic field value.
automatic formatting
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="isAutomatic()"><!-- --></A><H3>
isAutomatic</H3>
<PRE>
public boolean <B>isAutomatic</B>()</PRE>
<DL>
<DD>automatic formatting
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the automatic field value.</DL>
</DD>
</DL>
<HR>
<A NAME="setInvert(boolean)"><!-- --></A><H3>
setInvert</H3>
<PRE>
public void <B>setInvert</B>(boolean value)</PRE>
<DL>
<DD>Sets the invert field value.
swap foreground and background colours when data is negative
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="isInvert()"><!-- --></A><H3>
isInvert</H3>
<PRE>
public boolean <B>isInvert</B>()</PRE>
<DL>
<DD>swap foreground and background colours when data is negative
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the invert field value.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AreaFormatRecord.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV CLASS
<A HREF="../../../../../../org/apache/poi/hssf/record/chart/AreaRecord.html" title="class in org.apache.poi.hssf.record.chart"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?org/apache/poi/hssf/record/chart/AreaFormatRecord.html" target="_top"><B>FRAMES</B></A>
<A HREF="AreaFormatRecord.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<i>Copyright 2012 The Apache Software Foundation or
its licensors, as applicable.</i>
</BODY>
</HTML>
| {
"content_hash": "a30af9c3f6bc845573cce24ceb9cd1e6",
"timestamp": "",
"source": "github",
"line_count": 780,
"max_line_length": 344,
"avg_line_length": 39.93333333333333,
"alnum_prop": 0.6240208039039424,
"repo_name": "HRKN2245/CameraSunmoku",
"id": "f353fbdfdbfd4f934dee8c40b03366a5dcad890a",
"size": "31148",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "ExtractSample/poi-3.9/docs/apidocs/org/apache/poi/hssf/record/chart/AreaFormatRecord.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "16091"
},
{
"name": "Java",
"bytes": "126912"
}
],
"symlink_target": ""
} |
package scriptella.driver.text;
import scriptella.core.EtlCancelledException;
import scriptella.expression.PropertiesSubstitutor;
import scriptella.spi.AbstractConnection;
import scriptella.spi.ParametersCallback;
import scriptella.util.IOUtils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
/**
* Writes a text content to the output and performs properties expansion.
* <p>This class is a simplified template engine similar to Velocity,
* but of course less powerful. Nevertheless this executor
* is generally faster than external template engines and does not require any additional libraries.
* <p><u>Example:</u></p>
* <b>Script:</b>
* <code><pre>
* $rownum;$name;$surname;${email.trim().replaceAll('@','_at_')}
* </pre></code>
* <b>Parameters:</b>
* <table border=1>
* <tr>
* <th>rownum</th>
* <th>name</th>
* <th>surname</th>
* <th>email</th>
* </tr>
* <tr>
* <td>1</td>
* <td>John</td>
* <td>G</td>
* <td> john@nosuchhost.com</td>
* </tr>
* </table>
* <b>Result:</b>
* <code><pre>
* 1;John;G;john_at_nosuchhost.com
* </pre></code>
*
* @author Fyodor Kupolov
* @version 1.0
* @see PropertiesSubstitutor
*/
public class TextScriptExecutor implements Closeable, Flushable {
private BufferedWriter out;
private PropertiesSubstitutor ps;
private TextConnectionParameters textParams;
/**
* Creates an executor.
*
* @param out writer for output.
* @param textParams text connection parameters.
*/
public TextScriptExecutor(Writer out, TextConnectionParameters textParams) {
ps = new PropertiesSubstitutor();
this.out = IOUtils.asBuffered(out);
this.textParams = textParams;
}
/**
* Parses a script from read, expands properties and produces the output.
*
* @param reader script content.
* @param pc parameters for substitution.
* @param counter statements counter.
*/
public void execute(Reader reader, ParametersCallback pc, AbstractConnection.StatementCounter counter) {
ps.setParameters(textParams.getPropertyFormatter().format(pc));
BufferedReader r = IOUtils.asBuffered(reader);
final boolean trimLines = textParams.isTrimLines();
try {
for (String line; (line = r.readLine()) != null;) {
EtlCancelledException.checkEtlCancelled();
if (trimLines) {
line = line.trim();
}
//If trimming is disabled (keeping format) or if line is not empty
if (!trimLines || line.length() > 0) {
try {
out.write(ps.substitute(line));
out.write(textParams.getEol());
counter.statements++;
} catch (IOException e) {
throw new TextProviderException("Failed writing to a text file", e);
}
}
}
} catch (IOException e) {
throw new TextProviderException("Failed reading a script file", e);
}
}
public void flush() throws IOException {
out.flush();
}
public void close() throws IOException {
IOUtils.closeSilently(out);
out = null;
ps = null;
}
}
| {
"content_hash": "3d2c7b2a142f67bbe068dfb4822d306b",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 108,
"avg_line_length": 31.741071428571427,
"alnum_prop": 0.5969057665260197,
"repo_name": "scriptella/scriptella-etl",
"id": "0afc88e8d0ce9796258e0c65b617c98ab796a857",
"size": "4186",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "drivers/src/java/scriptella/driver/text/TextScriptExecutor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1794"
},
{
"name": "HTML",
"bytes": "90799"
},
{
"name": "Java",
"bytes": "1289261"
},
{
"name": "Shell",
"bytes": "1508"
}
],
"symlink_target": ""
} |
/*************************************************************************/
/* visual_script_flow_control.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef VISUAL_SCRIPT_FLOW_CONTROL_H
#define VISUAL_SCRIPT_FLOW_CONTROL_H
#include "visual_script.h"
class VisualScriptReturn : public VisualScriptNode {
GDCLASS(VisualScriptReturn, VisualScriptNode);
Variant::Type type;
bool with_value;
protected:
static void _bind_methods();
public:
virtual int get_output_sequence_port_count() const;
virtual bool has_input_sequence_port() const;
virtual String get_output_sequence_port_text(int p_port) const;
virtual int get_input_value_port_count() const;
virtual int get_output_value_port_count() const;
virtual PropertyInfo get_input_value_port_info(int p_idx) const;
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
virtual String get_text() const;
virtual String get_category() const { return "flow_control"; }
void set_return_type(Variant::Type);
Variant::Type get_return_type() const;
void set_enable_return_value(bool p_enable);
bool is_return_value_enabled() const;
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
VisualScriptReturn();
};
class VisualScriptCondition : public VisualScriptNode {
GDCLASS(VisualScriptCondition, VisualScriptNode);
protected:
static void _bind_methods();
public:
virtual int get_output_sequence_port_count() const;
virtual bool has_input_sequence_port() const;
virtual String get_output_sequence_port_text(int p_port) const;
virtual int get_input_value_port_count() const;
virtual int get_output_value_port_count() const;
virtual PropertyInfo get_input_value_port_info(int p_idx) const;
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
virtual String get_text() const;
virtual String get_category() const { return "flow_control"; }
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
VisualScriptCondition();
};
class VisualScriptWhile : public VisualScriptNode {
GDCLASS(VisualScriptWhile, VisualScriptNode);
protected:
static void _bind_methods();
public:
virtual int get_output_sequence_port_count() const;
virtual bool has_input_sequence_port() const;
virtual String get_output_sequence_port_text(int p_port) const;
virtual int get_input_value_port_count() const;
virtual int get_output_value_port_count() const;
virtual PropertyInfo get_input_value_port_info(int p_idx) const;
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
virtual String get_text() const;
virtual String get_category() const { return "flow_control"; }
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
VisualScriptWhile();
};
class VisualScriptIterator : public VisualScriptNode {
GDCLASS(VisualScriptIterator, VisualScriptNode);
protected:
static void _bind_methods();
public:
virtual int get_output_sequence_port_count() const;
virtual bool has_input_sequence_port() const;
virtual String get_output_sequence_port_text(int p_port) const;
virtual int get_input_value_port_count() const;
virtual int get_output_value_port_count() const;
virtual PropertyInfo get_input_value_port_info(int p_idx) const;
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
virtual String get_text() const;
virtual String get_category() const { return "flow_control"; }
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
VisualScriptIterator();
};
class VisualScriptSequence : public VisualScriptNode {
GDCLASS(VisualScriptSequence, VisualScriptNode);
int steps;
protected:
static void _bind_methods();
public:
virtual int get_output_sequence_port_count() const;
virtual bool has_input_sequence_port() const;
virtual String get_output_sequence_port_text(int p_port) const;
virtual int get_input_value_port_count() const;
virtual int get_output_value_port_count() const;
virtual PropertyInfo get_input_value_port_info(int p_idx) const;
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
virtual String get_text() const;
virtual String get_category() const { return "flow_control"; }
void set_steps(int p_steps);
int get_steps() const;
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
VisualScriptSequence();
};
class VisualScriptSwitch : public VisualScriptNode {
GDCLASS(VisualScriptSwitch, VisualScriptNode);
struct Case {
Variant::Type type;
Case() { type = Variant::NIL; }
};
Vector<Case> case_values;
friend class VisualScriptNodeInstanceSwitch;
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
static void _bind_methods();
public:
virtual int get_output_sequence_port_count() const;
virtual bool has_input_sequence_port() const;
virtual String get_output_sequence_port_text(int p_port) const;
virtual bool has_mixed_input_and_sequence_ports() const { return true; }
virtual int get_input_value_port_count() const;
virtual int get_output_value_port_count() const;
virtual PropertyInfo get_input_value_port_info(int p_idx) const;
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
virtual String get_text() const;
virtual String get_category() const { return "flow_control"; }
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
VisualScriptSwitch();
};
class VisualScriptTypeCast : public VisualScriptNode {
GDCLASS(VisualScriptTypeCast, VisualScriptNode);
StringName base_type;
String script;
protected:
static void _bind_methods();
public:
virtual int get_output_sequence_port_count() const;
virtual bool has_input_sequence_port() const;
virtual String get_output_sequence_port_text(int p_port) const;
virtual int get_input_value_port_count() const;
virtual int get_output_value_port_count() const;
virtual PropertyInfo get_input_value_port_info(int p_idx) const;
virtual PropertyInfo get_output_value_port_info(int p_idx) const;
virtual String get_caption() const;
virtual String get_text() const;
virtual String get_category() const { return "flow_control"; }
void set_base_type(const StringName &p_type);
StringName get_base_type() const;
void set_base_script(const String &p_path);
String get_base_script() const;
virtual TypeGuess guess_output_type(TypeGuess *p_inputs, int p_output) const;
virtual VisualScriptNodeInstance *instance(VisualScriptInstance *p_instance);
VisualScriptTypeCast();
};
void register_visual_script_flow_control_nodes();
#endif // VISUAL_SCRIPT_FLOW_CONTROL_H
| {
"content_hash": "3f39986b3c7c73a854e8d4b95c25b28e",
"timestamp": "",
"source": "github",
"line_count": 266,
"max_line_length": 78,
"avg_line_length": 33.67293233082707,
"alnum_prop": 0.6881768449257564,
"repo_name": "ex/godot",
"id": "91592d3d5504f2ad720a9b4f4d85e0f3a104699b",
"size": "8957",
"binary": false,
"copies": "1",
"ref": "refs/heads/3.5",
"path": "modules/visual_script/visual_script_flow_control.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AIDL",
"bytes": "1633"
},
{
"name": "Batchfile",
"bytes": "26"
},
{
"name": "C",
"bytes": "1045182"
},
{
"name": "C#",
"bytes": "1061492"
},
{
"name": "C++",
"bytes": "39315087"
},
{
"name": "CMake",
"bytes": "606"
},
{
"name": "GAP",
"bytes": "62"
},
{
"name": "GDScript",
"bytes": "323212"
},
{
"name": "GLSL",
"bytes": "836846"
},
{
"name": "Java",
"bytes": "595274"
},
{
"name": "JavaScript",
"bytes": "194742"
},
{
"name": "Kotlin",
"bytes": "84098"
},
{
"name": "Makefile",
"bytes": "1421"
},
{
"name": "Objective-C",
"bytes": "20550"
},
{
"name": "Objective-C++",
"bytes": "365306"
},
{
"name": "PowerShell",
"bytes": "2713"
},
{
"name": "Python",
"bytes": "475722"
},
{
"name": "Shell",
"bytes": "30899"
}
],
"symlink_target": ""
} |
<!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_151) on Thu Dec 05 05:02:04 MST 2019 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>SecretServerIdentityConsumer (BOM: * : All 2.6.0.Final API)</title>
<meta name="date" content="2019-12-05">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="SecretServerIdentityConsumer (BOM: * : All 2.6.0.Final API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":18};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],16:["t5","Default Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<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/SecretServerIdentityConsumer.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-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Thorntail API, 2.6.0.Final</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentity.html" title="class in org.wildfly.swarm.config.management.security_realm"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentitySupplier.html" title="interface in org.wildfly.swarm.config.management.security_realm"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" target="_top">Frames</a></li>
<li><a href="SecretServerIdentityConsumer.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">org.wildfly.swarm.config.management.security_realm</div>
<h2 title="Interface SecretServerIdentityConsumer" class="title">Interface SecretServerIdentityConsumer<T extends <a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentity.html" title="class in org.wildfly.swarm.config.management.security_realm">SecretServerIdentity</a><T>></h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Functional Interface:</dt>
<dd>This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.</dd>
</dl>
<hr>
<br>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/FunctionalInterface.html?is-external=true" title="class or interface in java.lang">@FunctionalInterface</a>
public interface <span class="typeNameLabel">SecretServerIdentityConsumer<T extends <a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentity.html" title="class in org.wildfly.swarm.config.management.security_realm">SecretServerIdentity</a><T>></span></pre>
</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="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span><span id="t5" class="tableTab"><span><a href="javascript:show(16);">Default Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html#accept-T-">accept</a></span>(<a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" title="type parameter in SecretServerIdentityConsumer">T</a> value)</code>
<div class="block">Configure a pre-constructed instance of SecretServerIdentity resource</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>default <a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" title="interface in org.wildfly.swarm.config.management.security_realm">SecretServerIdentityConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" title="type parameter in SecretServerIdentityConsumer">T</a>></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html#andThen-org.wildfly.swarm.config.management.security_realm.SecretServerIdentityConsumer-">andThen</a></span>(<a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" title="interface in org.wildfly.swarm.config.management.security_realm">SecretServerIdentityConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" title="type parameter in SecretServerIdentityConsumer">T</a>> after)</code> </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="accept-org.wildfly.swarm.config.management.security_realm.SecretServerIdentity-">
<!-- -->
</a><a name="accept-T-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>accept</h4>
<pre>void accept(<a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" title="type parameter in SecretServerIdentityConsumer">T</a> value)</pre>
<div class="block">Configure a pre-constructed instance of SecretServerIdentity resource</div>
</li>
</ul>
<a name="andThen-org.wildfly.swarm.config.management.security_realm.SecretServerIdentityConsumer-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>andThen</h4>
<pre>default <a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" title="interface in org.wildfly.swarm.config.management.security_realm">SecretServerIdentityConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" title="type parameter in SecretServerIdentityConsumer">T</a>> andThen(<a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" title="interface in org.wildfly.swarm.config.management.security_realm">SecretServerIdentityConsumer</a><<a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" title="type parameter in SecretServerIdentityConsumer">T</a>> after)</pre>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<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/SecretServerIdentityConsumer.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-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">Thorntail API, 2.6.0.Final</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentity.html" title="class in org.wildfly.swarm.config.management.security_realm"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../../org/wildfly/swarm/config/management/security_realm/SecretServerIdentitySupplier.html" title="interface in org.wildfly.swarm.config.management.security_realm"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html" target="_top">Frames</a></li>
<li><a href="SecretServerIdentityConsumer.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 ======= -->
<p class="legalCopy"><small>Copyright © 2019 <a href="http://www.jboss.org">JBoss by Red Hat</a>. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "9c8eec16b2b984dd7122c36d4742b5b5",
"timestamp": "",
"source": "github",
"line_count": 248,
"max_line_length": 846,
"avg_line_length": 49.778225806451616,
"alnum_prop": 0.6729850141757797,
"repo_name": "wildfly-swarm/wildfly-swarm-javadocs",
"id": "39accc0d5dd87505a3147827b0a51bef18706147",
"size": "12345",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "2.6.0.Final/apidocs/org/wildfly/swarm/config/management/security_realm/SecretServerIdentityConsumer.html",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package meta
import (
"testing"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
type fakeCodec struct{}
func (fakeCodec) Encode(runtime.Object) ([]byte, error) {
return []byte{}, nil
}
func (fakeCodec) Decode([]byte) (runtime.Object, error) {
return nil, nil
}
func (fakeCodec) DecodeInto([]byte, runtime.Object) error {
return nil
}
type fakeConvertor struct{}
func (fakeConvertor) Convert(in, out interface{}) error {
return nil
}
func (fakeConvertor) ConvertToVersion(in runtime.Object, _ string) (runtime.Object, error) {
return in, nil
}
func (fakeConvertor) ConvertFieldLabel(version, kind, label, value string) (string, string, error) {
return label, value, nil
}
var validCodec = fakeCodec{}
var validAccessor = resourceAccessor{}
var validConvertor = fakeConvertor{}
func fakeInterfaces(version string) (*VersionInterfaces, bool) {
return &VersionInterfaces{Codec: validCodec, ObjectConvertor: validConvertor, MetadataAccessor: validAccessor}, true
}
func unmatchedVersionInterfaces(version string) (*VersionInterfaces, bool) {
return nil, false
}
func TestRESTMapperVersionAndKindForResource(t *testing.T) {
testCases := []struct {
Resource string
Kind, APIVersion string
MixedCase bool
Err bool
}{
{Resource: "internalobjec", Err: true},
{Resource: "internalObjec", Err: true},
{Resource: "internalobject", Kind: "InternalObject", APIVersion: "test"},
{Resource: "internalobjects", Kind: "InternalObject", APIVersion: "test"},
{Resource: "internalobject", MixedCase: true, Kind: "InternalObject", APIVersion: "test"},
{Resource: "internalobjects", MixedCase: true, Kind: "InternalObject", APIVersion: "test"},
{Resource: "internalObject", MixedCase: true, Kind: "InternalObject", APIVersion: "test"},
{Resource: "internalObjects", MixedCase: true, Kind: "InternalObject", APIVersion: "test"},
}
for i, testCase := range testCases {
mapper := NewDefaultRESTMapper([]string{"test"}, fakeInterfaces)
mapper.Add(RESTScopeNamespace, testCase.Kind, testCase.APIVersion, testCase.MixedCase)
v, k, err := mapper.VersionAndKindForResource(testCase.Resource)
hasErr := err != nil
if hasErr != testCase.Err {
t.Errorf("%d: unexpected error behavior %t: %v", i, testCase.Err, err)
continue
}
if v != testCase.APIVersion || k != testCase.Kind {
t.Errorf("%d: unexpected version and kind: %s %s", i, v, k)
}
}
}
func TestKindToResource(t *testing.T) {
testCases := []struct {
Kind string
MixedCase bool
Plural, Singular string
}{
{Kind: "Pod", MixedCase: true, Plural: "pods", Singular: "pod"},
{Kind: "Pod", MixedCase: true, Plural: "pods", Singular: "pod"},
{Kind: "Pod", MixedCase: false, Plural: "pods", Singular: "pod"},
{Kind: "ReplicationController", MixedCase: true, Plural: "replicationControllers", Singular: "replicationController"},
{Kind: "ReplicationController", MixedCase: true, Plural: "replicationControllers", Singular: "replicationController"},
{Kind: "ReplicationController", MixedCase: false, Plural: "replicationcontrollers", Singular: "replicationcontroller"},
{Kind: "ImageRepository", MixedCase: true, Plural: "imageRepositories", Singular: "imageRepository"},
{Kind: "lowercase", MixedCase: false, Plural: "lowercases", Singular: "lowercase"},
// Don't add extra s if the original object is already plural
{Kind: "lowercases", MixedCase: false, Plural: "lowercases", Singular: "lowercases"},
}
for i, testCase := range testCases {
plural, singular := kindToResource(testCase.Kind, testCase.MixedCase)
if singular != testCase.Singular || plural != testCase.Plural {
t.Errorf("%d: unexpected plural and singular: %s %s", i, plural, singular)
}
}
}
func TestRESTMapperResourceSingularizer(t *testing.T) {
testCases := []struct {
Kind, APIVersion string
MixedCase bool
Plural string
Singular string
}{
{Kind: "Pod", APIVersion: "test", MixedCase: true, Plural: "pods", Singular: "pod"},
{Kind: "Pod", APIVersion: "test", MixedCase: false, Plural: "pods", Singular: "pod"},
{Kind: "ReplicationController", APIVersion: "test", MixedCase: true, Plural: "replicationControllers", Singular: "replicationController"},
{Kind: "ReplicationController", APIVersion: "test", MixedCase: false, Plural: "replicationcontrollers", Singular: "replicationcontroller"},
{Kind: "ImageRepository", APIVersion: "test", MixedCase: true, Plural: "imageRepositories", Singular: "imageRepository"},
{Kind: "ImageRepository", APIVersion: "test", MixedCase: false, Plural: "imagerepositories", Singular: "imagerepository"},
{Kind: "Status", APIVersion: "test", MixedCase: true, Plural: "statuses", Singular: "status"},
{Kind: "Status", APIVersion: "test", MixedCase: false, Plural: "statuses", Singular: "status"},
{Kind: "lowercase", APIVersion: "test", MixedCase: false, Plural: "lowercases", Singular: "lowercase"},
// Don't add extra s if the original object is already plural
{Kind: "lowercases", APIVersion: "test", MixedCase: false, Plural: "lowercases", Singular: "lowercases"},
}
for i, testCase := range testCases {
mapper := NewDefaultRESTMapper([]string{"test"}, fakeInterfaces)
// create singular/plural mapping
mapper.Add(RESTScopeNamespace, testCase.Kind, testCase.APIVersion, testCase.MixedCase)
singular, _ := mapper.ResourceSingularizer(testCase.Plural)
if singular != testCase.Singular {
t.Errorf("%d: mismatched singular: %s, should be %s", i, singular, testCase.Singular)
}
}
}
func TestRESTMapperRESTMapping(t *testing.T) {
testCases := []struct {
Kind string
APIVersions []string
MixedCase bool
DefaultVersions []string
Resource string
Version string
Err bool
}{
{Kind: "Unknown", Err: true},
{Kind: "InternalObject", Err: true},
{DefaultVersions: []string{"test"}, Kind: "Unknown", Err: true},
{DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{"test"}, Resource: "internalobjects"},
{DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{"test"}, Resource: "internalobjects"},
{DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{"test"}, Resource: "internalobjects"},
{DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{}, Resource: "internalobjects", Version: "test"},
{DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{"test"}, Resource: "internalobjects"},
{DefaultVersions: []string{"test"}, Kind: "InternalObject", APIVersions: []string{"test"}, MixedCase: true, Resource: "internalObjects"},
// TODO: add test for a resource that exists in one version but not another
}
for i, testCase := range testCases {
mapper := NewDefaultRESTMapper(testCase.DefaultVersions, fakeInterfaces)
mapper.Add(RESTScopeNamespace, "InternalObject", "test", testCase.MixedCase)
mapping, err := mapper.RESTMapping(testCase.Kind, testCase.APIVersions...)
hasErr := err != nil
if hasErr != testCase.Err {
t.Errorf("%d: unexpected error behavior %t: %v", i, testCase.Err, err)
}
if hasErr {
continue
}
if mapping.Resource != testCase.Resource {
t.Errorf("%d: unexpected resource: %#v", i, mapping)
}
version := testCase.Version
if version == "" {
version = testCase.APIVersions[0]
}
if mapping.APIVersion != version {
t.Errorf("%d: unexpected version: %#v", i, mapping)
}
if mapping.Codec == nil || mapping.MetadataAccessor == nil || mapping.ObjectConvertor == nil {
t.Errorf("%d: missing codec and accessor: %#v", i, mapping)
}
}
}
func TestRESTMapperRESTMappingSelectsVersion(t *testing.T) {
mapper := NewDefaultRESTMapper([]string{"test1", "test2"}, fakeInterfaces)
mapper.Add(RESTScopeNamespace, "InternalObject", "test1", false)
mapper.Add(RESTScopeNamespace, "OtherObject", "test2", false)
// pick default matching object kind based on search order
mapping, err := mapper.RESTMapping("OtherObject")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if mapping.Resource != "otherobjects" || mapping.APIVersion != "test2" {
t.Errorf("unexpected mapping: %#v", mapping)
}
mapping, err = mapper.RESTMapping("InternalObject")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if mapping.Resource != "internalobjects" || mapping.APIVersion != "test1" {
t.Errorf("unexpected mapping: %#v", mapping)
}
// mismatch of version
mapping, err = mapper.RESTMapping("InternalObject", "test2")
if err == nil {
t.Errorf("unexpected non-error")
}
mapping, err = mapper.RESTMapping("OtherObject", "test1")
if err == nil {
t.Errorf("unexpected non-error")
}
// not in the search versions
mapping, err = mapper.RESTMapping("OtherObject", "test3")
if err == nil {
t.Errorf("unexpected non-error")
}
// explicit search order
mapping, err = mapper.RESTMapping("OtherObject", "test3", "test1")
if err == nil {
t.Errorf("unexpected non-error")
}
mapping, err = mapper.RESTMapping("OtherObject", "test3", "test2")
if err != nil {
t.Fatalf("unexpected non-error")
}
if mapping.Resource != "otherobjects" || mapping.APIVersion != "test2" {
t.Errorf("unexpected mapping: %#v", mapping)
}
}
func TestRESTMapperReportsErrorOnBadVersion(t *testing.T) {
mapper := NewDefaultRESTMapper([]string{"test1", "test2"}, unmatchedVersionInterfaces)
mapper.Add(RESTScopeNamespace, "InternalObject", "test1", false)
_, err := mapper.RESTMapping("InternalObject", "test1")
if err == nil {
t.Errorf("unexpected non-error")
}
}
| {
"content_hash": "a542c173e957e6aa8653631dd19eb1be",
"timestamp": "",
"source": "github",
"line_count": 262,
"max_line_length": 141,
"avg_line_length": 36.66030534351145,
"alnum_prop": 0.6994273815720978,
"repo_name": "bnprss/kubernetes",
"id": "954f69c75917c167377fbbcc6be1bbbe2bc0638d",
"size": "10194",
"binary": false,
"copies": "5",
"ref": "refs/heads/master",
"path": "pkg/api/meta/restmapper_test.go",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "22704"
},
{
"name": "Go",
"bytes": "13160274"
},
{
"name": "HTML",
"bytes": "1264818"
},
{
"name": "Java",
"bytes": "5653"
},
{
"name": "JavaScript",
"bytes": "196313"
},
{
"name": "Makefile",
"bytes": "18350"
},
{
"name": "Nginx",
"bytes": "1013"
},
{
"name": "PHP",
"bytes": "736"
},
{
"name": "Python",
"bytes": "57166"
},
{
"name": "Ruby",
"bytes": "8715"
},
{
"name": "SaltStack",
"bytes": "32981"
},
{
"name": "Shell",
"bytes": "850867"
}
],
"symlink_target": ""
} |
<?php
/**
* ResetPasswordHandlerTest.php
* restfully
* Date: 23.09.17
*/
namespace Components\Tests\Interaction\Users\ResetPassword;
use AppBundle\Validator\Result;
use Components\Infrastructure\Events\INotifier;
use Components\Infrastructure\Events\ResourceMessage;
use Components\Infrastructure\Response\ErrorResponse;
use Components\Interaction\Users\ResetPassword\ResetPasswordHandler;
use Components\Interaction\Users\ResetPassword\ResetPasswordRequest;
use Components\Interaction\Users\ResetPassword\ResetPasswordResponse;
use Components\Model\User;
use Components\Resource\IUserManager;
use Components\Tests\TestCase;
use Prophecy\Argument;
class ResetPasswordHandlerTest extends TestCase
{
/**
*
*/
public function testItShouldCancelOnException()
{
$manager = $this->prophesize(IUserManager::class);
$result = $this->prophesize(Result::class);
$manager->startTransaction()->shouldBeCalled();
$manager->cancelTransaction()->shouldBeCalled();
$manager->save(Argument::type(User::class))->shouldBeCalled();
$notifier = $this->prophesize(INotifier::class);
$notifier->notify(Argument::type(ResourceMessage::class))->shouldBeCalled()->will(function(){
throw new \Exception('notification failure...');
});
$subject = new ResetPasswordHandler($notifier->reveal());
$subject->setManager($manager->reveal());
$user = new User();
$response = $subject->handle(new ResetPasswordRequest($user));
$this->assertInstanceOf(ErrorResponse::class, $response);
}
public function testItShouldFinalizeAndSave()
{
$manager = $this->prophesize(IUserManager::class);
$manager->startTransaction()->shouldBeCalled();
$manager->save(Argument::type(User::class))->shouldBeCalled();
$manager->commitTransaction()->shouldBeCalled();
$notifier = $this->prophesize(INotifier::class);
$notifier->notify(Argument::type(ResourceMessage::class))->shouldBeCalled();
$subject = new ResetPasswordHandler($notifier->reveal());
$subject->setManager($manager->reveal());
$user = new User();
$response = $subject->handle(new ResetPasswordRequest($user));
$this->assertInstanceOf(ResetPasswordResponse::class, $response);
$this->assertNotEmpty($user->getToken());
}
}
| {
"content_hash": "40404ff1342d54920c658a38a104ccb9",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 101,
"avg_line_length": 33.416666666666664,
"alnum_prop": 0.6928512053200333,
"repo_name": "avanzu/audiorama",
"id": "8d7b2b08d004fba4397931d7ea3f9ce4a892960b",
"size": "2406",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "src/Components/Tests/Interaction/Users/ResetPassword/ResetPasswordHandlerTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4742"
},
{
"name": "HTML",
"bytes": "43365"
},
{
"name": "JavaScript",
"bytes": "45780"
},
{
"name": "PHP",
"bytes": "322551"
}
],
"symlink_target": ""
} |
A Sample Node.js Rest API and a client app made with AngularJs
## Node.js REST API
## React Client (FLUX)
Made by Paulo Gabriel Poffal
| {
"content_hash": "f94bf94ba61657e484b54b7455067169",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 62,
"avg_line_length": 15.777777777777779,
"alnum_prop": 0.7183098591549296,
"repo_name": "pmajoras/pgp-logs",
"id": "dc32c7d2d492f2666b73f3f1994a55c405400021",
"size": "155",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1709"
},
{
"name": "HTML",
"bytes": "553"
},
{
"name": "JavaScript",
"bytes": "230976"
}
],
"symlink_target": ""
} |
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.string :username
t.string :password
t.timestamps
end
end
end
| {
"content_hash": "3d12dbeb8997d4780454e5bc569e8a9a",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 43,
"avg_line_length": 17.90909090909091,
"alnum_prop": 0.6395939086294417,
"repo_name": "mhyee/wishlist",
"id": "db1cf32724c694a2289bb5be80488cbd0a50c024",
"size": "197",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "db/migrate/20110911194833_create_users.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "916"
},
{
"name": "JavaScript",
"bytes": "463"
},
{
"name": "Ruby",
"bytes": "46857"
}
],
"symlink_target": ""
} |
<?php
class Staple_Form_CheckboxGroup extends Staple_Form_Element
{
/**
* An array that holds the Checkbox elements.
* @var array[Staple_Form_CheckboxElement]
*/
protected $boxes = array();
public function addCheckbox(Staple_Form_CheckboxElement $box)
{
$this->boxes[] = $box;
return $this;
}
/**
* Adds multiple checkboxes to the array of checkboxes;
* @param array $boxes
*/
public function addCheckboxArray(array $boxes)
{
foreach($boxes as $box)
{
if($box instanceof Staple_Form_CheckboxElement)
{
$this->addCheckbox($box);
}
}
return $this;
}
/**
* Return all the checkbox objects
* @return array[Staple_Form_CheckboxElement]
*/
public function getBoxes()
{
return $this->boxes;
}
/**
* Sorts the boxes by Label
*/
public function sortBoxesByLabel()
{
usort($this->boxes, array($this, 'sortCmpLabel'));
return $this;
}
/**
* Sorts the boxes by Name
*/
public function sortBoxesByName()
{
usort($this->boxes, array($this, 'sortCmpName'));
return $this;
}
/**
* This simple function resets the $boxes array.
*/
public function clearBoxes()
{
$this->boxes = array();
return $this;
}
/**
* Returns an associative array of
* @return array
*/
public function getValue()
{
$values = array();
foreach($this->boxes as $key=>$value)
{
$values[$value->getName()] = $value->getValue();
}
return $values;
}
/**
* This function requires an associative array composed of the form field names, followed by their values.
* @return Staple_Form_CheckboxGroup
*/
public function setValue(array $inserts)
{
foreach($this->boxes as $key=>$value)
{
if(array_key_exists($value->getName(), $inserts))
{
$this->boxes[$key]->setValue($inserts[$value->getName()]);
}
}
return $this;
}
/**
* Comparison function for sorting by names
* @param Staple_Form_CheckboxElement $a
* @param Staple_Form_CheckboxElement $b
*/
private function sortCmpName(Staple_Form_CheckboxElement $a, Staple_Form_CheckboxElement $b)
{
return strcmp($a->getName(), $b->getName());
}
/**
* Comparison function for sorting by labels
* @param Staple_Form_CheckboxElement $a
* @param Staple_Form_CheckboxElement $b
*/
private function sortCmpLabel(Staple_Form_CheckboxElement $a, Staple_Form_CheckboxElement $b)
{
return strcmp($a->getLabel(), $b->getLabel());
}
//-------------------------------------------------BUILDERS-------------------------------------------------
/**
*
* @see Staple_Form_Element::field()
*/
public function field()
{
$buff = '<div class="form_checkboxes">';
foreach ($this->boxes as $box)
{
$buff .= $box->build();
}
$buff .= '</div>';
return $buff;
}
public function errors()
{
$errors = implode(" ",$this->getErrors());
return $errors;
}
/**
*
* @see Staple_Form_Element::label()
*/
public function label()
{
return "<label".$this->getClassString().">".$this->escape($this->getLabel())."</label>";
}
/**
*
* @see Staple_Form_Element::build()
*/
public function build()
{
$buf = '';
$view = FORMS_ROOT.'/fields/CheckboxGroup.phtml';
if(file_exists($view))
{
ob_start();
include $view;
$buf = ob_get_contents();
ob_end_clean();
}
else
{
$this->addClass('form_element');
$this->addClass('element_checkboxgroup');
$classes = $this->getClassString();
$buf .= "<div$classes id=\"".$this->escape($this->id)."_element\">\n";
if(isset($this->label))
{
$buf .= $this->label();
}
if(isset($this->errors))
{
$buf .= $this->errors();
}
$buf .= $this->field();
$buf .= "</div>\n";
}
return $buf;
}
}
?> | {
"content_hash": "3667744f10f6d96af97ae90fc00ad4d7",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 109,
"avg_line_length": 20.122994652406415,
"alnum_prop": 0.59022056869519,
"repo_name": "advation/TimeTracker",
"id": "84904501c17e3ac671ed4646c5622604d32c4c68",
"size": "4588",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "library/Staple/Form/CheckboxGroup.class.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11690"
},
{
"name": "HTML",
"bytes": "263280"
},
{
"name": "JavaScript",
"bytes": "137556"
},
{
"name": "Less",
"bytes": "67102"
},
{
"name": "Makefile",
"bytes": "133"
},
{
"name": "PHP",
"bytes": "695436"
},
{
"name": "Ruby",
"bytes": "161"
},
{
"name": "SCSS",
"bytes": "181235"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Sydowia 5: 53 (1951)
#### Original name
Leptosphaeria tofieldiae E. Müll., 1951
### Remarks
null | {
"content_hash": "cf1d414c4fb27e7b0f1b675db249e1da",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 14.153846153846153,
"alnum_prop": 0.7065217391304348,
"repo_name": "mdoering/backbone",
"id": "24a24782c505f4203a0b3598c6441f5885e190d1",
"size": "249",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Fungi/Ascomycota/Dothideomycetes/Pleosporales/Phaeosphaeriaceae/Phaeosphaeria/Phaeosphaeria tofieldiae/ Syn. Leptosphaeria tofieldiae/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
package com.sksamuel.elastic4s.requests.searches.aggs.builders
import com.sksamuel.elastic4s.json.{XContentBuilder, XContentFactory}
import com.sksamuel.elastic4s.requests.searches.aggs.{AbstractAggregation, SamplerAggregation, SubAggsBuilderFn}
object SamplerAggregationBuilder {
def apply(agg: SamplerAggregation, customAggregations: PartialFunction[AbstractAggregation, XContentBuilder]): XContentBuilder = {
val builder = XContentFactory.jsonBuilder().startObject("sampler")
agg.shardSize.foreach(builder.field("shard_size", _))
builder.endObject()
SubAggsBuilderFn(agg, builder, customAggregations)
builder.endObject()
}
}
| {
"content_hash": "98090c638d0efb22291cb5ceed1aa7dc",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 132,
"avg_line_length": 41,
"alnum_prop": 0.801829268292683,
"repo_name": "sksamuel/elastic4s",
"id": "06d3e00450480639d6789a654ec7ac9abe112f7a",
"size": "656",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "elastic4s-core/src/main/scala/com/sksamuel/elastic4s/requests/searches/aggs/builders/SamplerAggregationBuilder.scala",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "93"
},
{
"name": "Scala",
"bytes": "1807156"
},
{
"name": "Shell",
"bytes": "121"
}
],
"symlink_target": ""
} |
using System;
using NUnit.Framework;
using Passenger.Attributes;
using Passenger.PageObjectInspections.UrlDiscovery;
using Passenger.PageObjectInspections.UrlVerification;
namespace Passenger.Test.Unit
{
[TestFixture]
public class PassengerConfigurationTests
{
[Test]
public void Ctor_DefaultConfiguration_HasUrlVerificationStrategyOfStringContainingStrategy()
{
var config = new PassengerConfiguration();
Assert.That(config.UrlVerificationStrategies[0], Is.TypeOf<RegexStrategy>());
Assert.That(config.UrlVerificationStrategies[1], Is.TypeOf<StringContainingStrategy>());
}
[Test]
public void UrlVerificationStrategiesStrategyFor_GivenPlainTextUrlAttribute_ReturnsStringContainingStrategy()
{
var discoveredUrl = new DiscoveredUrl(new Uri("http://tempuri.org"), new UriAttribute("http://tempuri.org", null));
var strat = new PassengerConfiguration().UrlVerificationStrategies.StrategyFor(discoveredUrl);
Assert.That(strat, Is.TypeOf<StringContainingStrategy>());
}
[Test]
public void UrlVerificationStrategiesStrategyFor_GivenUrlAttributeWithRegexPattern_ReturnsRegexStrategy()
{
var discoveredUrl = new DiscoveredUrl(new Uri("http://tempuri.org"), new UriAttribute("http://tempuri.org", "http://tempuri.org/[a-z]+"));
var strat = new PassengerConfiguration().UrlVerificationStrategies.StrategyFor(discoveredUrl);
Assert.That(strat, Is.TypeOf<RegexStrategy>());
}
}
}
| {
"content_hash": "f50024a2756d0860737b77496b1bab77",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 150,
"avg_line_length": 38.97560975609756,
"alnum_prop": 0.704630788485607,
"repo_name": "davidwhitney/Passenger",
"id": "fa62a574f1a0bed808b3544f93bdfbb8ba28a3ce",
"size": "1600",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/Passenger.Test.Unit/PassengerConfigurationTests.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "378"
},
{
"name": "C#",
"bytes": "93304"
}
],
"symlink_target": ""
} |
FROM balenalib/smarc-px30-ubuntu:focal-build
# remove several traces of debian python
RUN apt-get purge -y python.*
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
# key 63C7CC90: public key "Simon McVittie <smcv@pseudorandom.co.uk>" imported
# key 3372DCFA: public key "Donald Stufft (dstufft) <donald@stufft.io>" imported
RUN gpg --keyserver keyring.debian.org --recv-keys 4DE8FF2A63C7CC90 \
&& gpg --keyserver keyserver.ubuntu.com --recv-key 6E3CBCE93372DCFA \
&& gpg --keyserver keyserver.ubuntu.com --recv-keys 0x52a43a1e4b77b059
ENV PYTHON_VERSION 3.9.4
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 21.0.1
ENV SETUPTOOLS_VERSION 56.0.0
RUN set -x \
&& curl -SLO "http://resin-packages.s3.amazonaws.com/python/v$PYTHON_VERSION/Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" \
&& echo "6cb5376d0eb62e61085febdbeff72eaa8d80b3b535634144c364ba4be6052b17 Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" | sha256sum -c - \
&& tar -xzf "Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" --strip-components=1 \
&& rm -rf "Python-$PYTHON_VERSION.linux-aarch64-openssl1.1.tar.gz" \
&& ldconfig \
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
&& curl -SLO "https://raw.githubusercontent.com/pypa/get-pip/430ba37776ae2ad89f794c7a43b90dc23bac334c/get-pip.py" \
&& echo "19dae841a150c86e2a09d475b5eb0602861f2a5b7761ec268049a662dbd2bd0c get-pip.py" | sha256sum -c - \
&& python3 get-pip.py \
&& rm get-pip.py \
; fi \
&& pip3 install --no-cache-dir --upgrade --force-reinstall pip=="$PYTHON_PIP_VERSION" setuptools=="$SETUPTOOLS_VERSION" \
&& find /usr/local \
\( -type d -a -name test -o -name tests \) \
-o \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
-exec rm -rf '{}' + \
&& cd / \
&& rm -rf /usr/src/python ~/.cache
# install "virtualenv", since the vast majority of users of this image will want it
RUN pip3 install --no-cache-dir virtualenv
ENV PYTHON_DBUS_VERSION 1.2.8
# install dbus-python dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
libdbus-1-dev \
libdbus-glib-1-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get -y autoremove
# install dbus-python
RUN set -x \
&& mkdir -p /usr/src/dbus-python \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz" -o dbus-python.tar.gz \
&& curl -SL "http://dbus.freedesktop.org/releases/dbus-python/dbus-python-$PYTHON_DBUS_VERSION.tar.gz.asc" -o dbus-python.tar.gz.asc \
&& gpg --verify dbus-python.tar.gz.asc \
&& tar -xzC /usr/src/dbus-python --strip-components=1 -f dbus-python.tar.gz \
&& rm dbus-python.tar.gz* \
&& cd /usr/src/dbus-python \
&& PYTHON_VERSION=$(expr match "$PYTHON_VERSION" '\([0-9]*\.[0-9]*\)') ./configure \
&& make -j$(nproc) \
&& make install -j$(nproc) \
&& cd / \
&& rm -rf /usr/src/dbus-python
# make some useful symlinks that are expected to exist
RUN cd /usr/local/bin \
&& ln -sf pip3 pip \
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
&& ln -sf idle3 idle \
&& ln -sf pydoc3 pydoc \
&& ln -sf python3 python \
&& ln -sf python3-config python-config
# set PYTHONPATH to point to dist-packages
ENV PYTHONPATH /usr/lib/python3/dist-packages:$PYTHONPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/8accad6af708fca7271c5c65f18a86782e19f877/scripts/assets/tests/test-stack@python.sh" \
&& echo "Running test-stack@python" \
&& chmod +x test-stack@python.sh \
&& bash test-stack@python.sh \
&& rm -rf test-stack@python.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Ubuntu focal \nVariant: build variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nPython v3.9.4, Pip v21.0.1, Setuptools v56.0.0 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | {
"content_hash": "6cdc0f0cf665deff233068c81fa2be35",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 709,
"avg_line_length": 50.61052631578947,
"alnum_prop": 0.7038269550748752,
"repo_name": "nghiant2710/base-images",
"id": "73b08b1d2da5b2bd642e6f0bae6880287a33c9f6",
"size": "4829",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/python/smarc-px30/ubuntu/focal/3.9.4/build/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "144558581"
},
{
"name": "JavaScript",
"bytes": "16316"
},
{
"name": "Shell",
"bytes": "368690"
}
],
"symlink_target": ""
} |
@implementation EXProtocolImplementation
@end
| {
"content_hash": "1cb4b9a5c3a4ae6c4e5b96d031bca31d",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 40,
"avg_line_length": 15.666666666666666,
"alnum_prop": 0.8723404255319149,
"repo_name": "carabina/Depend",
"id": "28723d5441c700654e334f714d2487616dcfffe3",
"size": "244",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "DependTests/EXProtocolImplementation.m",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Objective-C",
"bytes": "28242"
},
{
"name": "Ruby",
"bytes": "1599"
}
],
"symlink_target": ""
} |
<?php
namespace SpomkyLabs\JoseBundle\DependencyInjection\Source;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
final class EncrypterSource implements SourceInterface
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'encrypters';
}
/**
* {@inheritdoc}
*/
public function createService($name, array $config, ContainerBuilder $container)
{
$service_id = sprintf('jose.encrypter.%s', $name);
$definition = new Definition('Jose\Encrypter');
$definition->setFactory([
new Reference('jose.factory.service'),
'createEncrypter',
]);
$definition->setArguments([
$config['key_encryption_algorithms'],
$config['content_encryption_algorithms'],
$config['compression_methods'],
]);
$definition->setPublic($config['is_public']);
$container->setDefinition($service_id, $definition);
}
/**
* {@inheritdoc}
*/
public function getNodeDefinition(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode($this->getName())
->useAttributeAsKey('name')
->prototype('array')
->children()
->booleanNode('is_public')
->info('If true, the service will be public, else private.')
->defaultTrue()
->end()
->arrayNode('key_encryption_algorithms')
->useAttributeAsKey('name')
->isRequired()
->prototype('scalar')->end()
->end()
->arrayNode('content_encryption_algorithms')
->useAttributeAsKey('name')
->isRequired()
->prototype('scalar')->end()
->end()
->arrayNode('compression_methods')
->useAttributeAsKey('name')
->defaultValue(['DEF'])
->prototype('scalar')->end()
->end()
->booleanNode('create_decrypter')
->defaultFalse()
->end()
->end()
->end()
->end()
->end();
}
/**
* {@inheritdoc}
*/
public function prepend(ContainerBuilder $container, array $config)
{
if (false === array_key_exists($this->getName(), $config)) {
return;
}
foreach ($config[$this->getName()] as $id => $section) {
if (true === $section['create_decrypter']) {
$values = $section;
unset($values['create_decrypter']);
$config['decrypters'] = array_merge(
array_key_exists('decrypters', $config) ? $config['decrypters'] : [],
[$id => $values]
);
}
}
return $config;
}
}
| {
"content_hash": "f07287e75199e923343c08b1446a9737",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 89,
"avg_line_length": 33.30769230769231,
"alnum_prop": 0.4581408775981524,
"repo_name": "Spomky-Labs/JoseBundle",
"id": "65e47dc2abaa9a4a326ebb064e5936272d3d89fb",
"size": "3663",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "DependencyInjection/Source/EncrypterSource.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Cucumber",
"bytes": "15177"
},
{
"name": "PHP",
"bytes": "160990"
}
],
"symlink_target": ""
} |
package org.pac4j.core.http.ajax;
import org.junit.Test;
import org.pac4j.core.context.MockWebContext;
import static org.junit.Assert.*;
/**
* Tests the {@link DefaultAjaxRequestResolver}.
*
* @author Jerome Leleu
* @since 1.8.0
*/
public final class DefaultAjaxRequestResolverTests {
private final AjaxRequestResolver resolver = new DefaultAjaxRequestResolver();
@Test
public void testRealAjaxRequest() {
final var context = MockWebContext.create().addRequestHeader("X-Requested-With", "XMLHttpRequest");
assertTrue(resolver.isAjax(context, null));
}
@Test
public void testForcedAjaxParameter() {
final var context = MockWebContext.create().addRequestParameter("is_ajax_request", "true");
assertTrue(resolver.isAjax(context, null));
}
@Test
public void testForcedAjaxHeader() {
final var context = MockWebContext.create().addRequestHeader("is_ajax_request", "true");
assertTrue(resolver.isAjax(context, null));
}
@Test
public void testNotAnAjaxRequest() {
assertFalse(resolver.isAjax(MockWebContext.create(), null));
}
}
| {
"content_hash": "71d967f3f5df7895a35392df326d5703",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 107,
"avg_line_length": 28.575,
"alnum_prop": 0.6981627296587927,
"repo_name": "pac4j/pac4j",
"id": "bbd61394637f37594f08b545ce1ce6ebb86ba350",
"size": "1143",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "pac4j-core/src/test/java/org/pac4j/core/http/ajax/DefaultAjaxRequestResolverTests.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "2467227"
},
{
"name": "Shell",
"bytes": "1609"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>zorns-lemma: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.5.0 / zorns-lemma - 9.0.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
zorns-lemma
<small>
9.0.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-03-30 01:13:34 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-03-30 01:13:34 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-num base Num library distributed with the OCaml compiler
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.5.0 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.05.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.05.0 Official 4.05.0 release
ocaml-config 1 OCaml Switch Configuration
# opam file:
opam-version: "2.0"
maintainer: "miloradovsky@gmail.com"
homepage: "https://github.com/coq-community/topology"
dev-repo: "git+https://github.com/coq-community/topology.git"
bug-reports: "https://github.com/coq-community/topology/issues"
license: "LGPL-2.1-or-later"
synopsis: "This library develops some basic set theory in Coq"
description: """
This Coq library develops some basic set theory.
The main purpose the author had in writing it
was as support for the Topology library.
"""
build: ["dune" "build" "-p" name "-j" jobs]
depends: [
"dune" {>= "2.5"}
"coq" {(>= "8.10" & < "8.15~") | (= "dev")}
]
tags: [
"category:Mathematics/Logic/Set theory"
"keyword:set theory"
"keyword:cardinals"
"keyword:ordinals"
"keyword:finite"
"keyword:countable"
"keyword:quotients"
"keyword:well-orders"
"keyword:Zorn's lemma"
"logpath:ZornsLemma"
]
authors: [
"Daniel Schepler"
]
url {
src: "https://github.com/coq-community/topology/archive/v9.0.0.tar.gz"
checksum: "sha512=35cdea3c4c1ca3792777c0864e5cdacd5f6dc1b8eebbb3a1d52a1f5e0fba21f7943a5186472eabba23a93ca6a37f8caecef3647e1fde3d09aae45f7e27c2f0ec"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-zorns-lemma.9.0.0 coq.8.5.0</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.5.0).
The following dependencies couldn't be met:
- coq-zorns-lemma -> coq >= dev
no matching version
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-zorns-lemma.9.0.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "1d59a11e927cc75dfa9b3299694762a9",
"timestamp": "",
"source": "github",
"line_count": 178,
"max_line_length": 159,
"avg_line_length": 40.449438202247194,
"alnum_prop": 0.5523611111111111,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "82e8cb081d00822cd133a46f3ef0b08c2cb45bb2",
"size": "7225",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.05.0-2.0.1/released/8.5.0/zorns-lemma/9.0.0.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package org.woltage.irssiconnectbot;
import java.util.List;
import org.woltage.irssiconnectbot.bean.HostBean;
import org.woltage.irssiconnectbot.service.TerminalBridge;
import org.woltage.irssiconnectbot.service.TerminalManager;
import org.woltage.irssiconnectbot.transport.TransportFactory;
import org.woltage.irssiconnectbot.util.HostDatabase;
import org.woltage.irssiconnectbot.util.PreferenceConstants;
import org.woltage.irssiconnectbot.util.UpdateHelper;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.Intent.ShortcutIconResource;
import android.content.SharedPreferences.Editor;
import android.content.res.ColorStateList;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.ContextMenu;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View.OnKeyListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
import com.nullwire.trace.ExceptionHandler;
public class HostListActivity extends ListActivity {
public final static int REQUEST_EDIT = 1;
public final static int REQUEST_EULA = 2;
protected TerminalManager bound = null;
protected HostDatabase hostdb;
private List<HostBean> hosts;
protected LayoutInflater inflater = null;
protected boolean sortedByColor = false;
private MenuItem sortcolor;
private MenuItem sortlast;
private Spinner transportSpinner;
private TextView quickconnect;
private SharedPreferences prefs = null;
protected boolean makingShortcut = false;
protected Handler updateHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
HostListActivity.this.updateList();
}
};
private ServiceConnection connection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
bound = ((TerminalManager.TerminalBinder) service).getService();
// update our listview binder to find the service
HostListActivity.this.updateList();
}
public void onServiceDisconnected(ComponentName className) {
bound = null;
HostListActivity.this.updateList();
}
};
@Override
public void onStart() {
super.onStart();
// start the terminal manager service
this.bindService(new Intent(this, TerminalManager.class), connection, Context.BIND_AUTO_CREATE);
if(this.hostdb == null)
this.hostdb = new HostDatabase(this);
}
@Override
public void onStop() {
super.onStop();
this.unbindService(connection);
if(this.hostdb != null) {
this.hostdb.close();
this.hostdb = null;
}
}
@Override
public void onResume() {
super.onResume();
ExceptionHandler.checkForTraces(this);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_EULA) {
if(resultCode == Activity.RESULT_OK) {
// yay they agreed, so store that info
Editor edit = prefs.edit();
edit.putBoolean(PreferenceConstants.EULA, true);
edit.commit();
} else {
// user didnt agree, so close
this.finish();
}
} else if (requestCode == REQUEST_EDIT) {
this.updateList();
}
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.act_hostlist);
this.setTitle(String.format("%s: %s",
getResources().getText(R.string.app_name),
getResources().getText(R.string.title_hosts_list)));
// check for eula agreement
this.prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean agreed = prefs.getBoolean(PreferenceConstants.EULA, false);
if(!agreed) {
this.startActivityForResult(new Intent(this, WizardActivity.class), REQUEST_EULA);
}
// start thread to check for new version
new UpdateHelper(this);
this.makingShortcut = Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())
|| Intent.ACTION_PICK.equals(getIntent().getAction());
// connect with hosts database and populate list
this.hostdb = new HostDatabase(this);
ListView list = this.getListView();
this.sortedByColor = prefs.getBoolean(PreferenceConstants.SORT_BY_COLOR, false);
//this.list.setSelector(R.drawable.highlight_disabled_pressed);
list.setOnItemClickListener(new OnItemClickListener() {
public synchronized void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// launch off to console details
HostBean host = (HostBean) parent.getAdapter().getItem(position);
Uri uri = host.getUri();
Intent contents = new Intent(Intent.ACTION_VIEW, uri);
contents.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (makingShortcut) {
// create shortcut if requested
ShortcutIconResource icon = Intent.ShortcutIconResource.fromContext(HostListActivity.this, R.drawable.icon);
Intent intent = new Intent();
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, contents);
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, host.getNickname());
intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
setResult(RESULT_OK, intent);
finish();
} else {
// otherwise just launch activity to show this host
HostListActivity.this.startActivity(contents);
}
}
});
this.registerForContextMenu(list);
quickconnect = (TextView) this.findViewById(R.id.front_quickconnect);
quickconnect.setVisibility(makingShortcut ? View.GONE : View.VISIBLE);
quickconnect.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if(event.getAction() == KeyEvent.ACTION_UP) return false;
if(keyCode != KeyEvent.KEYCODE_ENTER) return false;
return startConsoleActivity();
}
});
transportSpinner = (Spinner)findViewById(R.id.transport_selection);
transportSpinner.setVisibility(makingShortcut ? View.GONE : View.VISIBLE);
ArrayAdapter<String> transportSelection = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, TransportFactory.getTransportNames());
transportSelection.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
transportSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> arg0, View view, int position, long id) {
String formatHint = TransportFactory.getFormatHint(
(String) transportSpinner.getSelectedItem(),
HostListActivity.this);
quickconnect.setHint(formatHint);
quickconnect.setError(null);
quickconnect.requestFocus();
}
public void onNothingSelected(AdapterView<?> arg0) { }
});
transportSpinner.setAdapter(transportSelection);
this.inflater = LayoutInflater.from(this);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
// don't offer menus when creating shortcut
if (makingShortcut) return true;
sortcolor.setVisible(!sortedByColor);
sortlast.setVisible(sortedByColor);
return true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
// don't offer menus when creating shortcut
if(makingShortcut) return true;
// add host, ssh keys, about
sortcolor = menu.add(R.string.list_menu_sortcolor);
sortcolor.setIcon(android.R.drawable.ic_menu_share);
sortcolor.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
sortedByColor = true;
updateList();
return true;
}
});
sortlast = menu.add(R.string.list_menu_sortname);
sortlast.setIcon(android.R.drawable.ic_menu_share);
sortlast.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
sortedByColor = false;
updateList();
return true;
}
});
MenuItem keys = menu.add(R.string.list_menu_pubkeys);
keys.setIcon(android.R.drawable.ic_lock_lock);
keys.setIntent(new Intent(HostListActivity.this, PubkeyListActivity.class));
MenuItem colors = menu.add("Colors");
colors.setIcon(android.R.drawable.ic_menu_slideshow);
colors.setIntent(new Intent(HostListActivity.this, ColorsActivity.class));
MenuItem settings = menu.add(R.string.list_menu_settings);
settings.setIcon(android.R.drawable.ic_menu_preferences);
settings.setIntent(new Intent(HostListActivity.this, SettingsActivity.class));
MenuItem help = menu.add(R.string.title_help);
help.setIcon(android.R.drawable.ic_menu_help);
help.setIntent(new Intent(HostListActivity.this, HelpActivity.class));
return true;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
// create menu to handle hosts
// create menu to handle deleting and sharing lists
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
final HostBean host = (HostBean) this.getListView().getItemAtPosition(info.position);
menu.setHeaderTitle(host.getNickname());
// edit, disconnect, delete
MenuItem connect = menu.add(R.string.list_host_disconnect);
final TerminalBridge bridge = bound.getConnectedBridge(host);
connect.setEnabled((bridge != null));
connect.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
bridge.dispatchDisconnect(true);
updateHandler.sendEmptyMessage(-1);
return true;
}
});
MenuItem edit = menu.add(R.string.list_host_edit);
edit.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
Intent intent = new Intent(HostListActivity.this, HostEditorActivity.class);
intent.putExtra(Intent.EXTRA_TITLE, host.getId());
HostListActivity.this.startActivityForResult(intent, REQUEST_EDIT);
return true;
}
});
MenuItem portForwards = menu.add(R.string.list_host_portforwards);
portForwards.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
Intent intent = new Intent(HostListActivity.this, PortForwardListActivity.class);
intent.putExtra(Intent.EXTRA_TITLE, host.getId());
HostListActivity.this.startActivityForResult(intent, REQUEST_EDIT);
return true;
}
});
if (!TransportFactory.canForwardPorts(host.getProtocol()))
portForwards.setEnabled(false);
MenuItem delete = menu.add(R.string.list_host_delete);
delete.setOnMenuItemClickListener(new OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
// prompt user to make sure they really want this
new AlertDialog.Builder(HostListActivity.this)
.setMessage(getString(R.string.delete_message, host.getNickname()))
.setPositiveButton(R.string.delete_pos, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// make sure we disconnect
if(bridge != null)
bridge.dispatchDisconnect(true);
hostdb.deleteHost(host);
updateHandler.sendEmptyMessage(-1);
}
})
.setNegativeButton(R.string.delete_neg, null).create().show();
return true;
}
});
}
/**
* @param text
* @return
*/
private boolean startConsoleActivity() {
Uri uri = TransportFactory.getUri((String) transportSpinner
.getSelectedItem(), quickconnect.getText().toString());
if (uri == null) {
quickconnect.setError(getString(R.string.list_format_error,
TransportFactory.getFormatHint(
(String) transportSpinner.getSelectedItem(),
HostListActivity.this)));
return false;
}
if (hostdb == null)
hostdb = new HostDatabase(this);
HostBean host = TransportFactory.findHost(hostdb, uri);
if (host == null) {
host = TransportFactory.getTransport(uri.getScheme()).createHost(uri);
host.setColor(HostDatabase.COLOR_GRAY);
host.setPubkeyId(HostDatabase.PUBKEYID_ANY);
hostdb.saveHost(host);
}
Intent intent = new Intent(HostListActivity.this, ConsoleActivity.class);
intent.setData(uri);
startActivity(intent);
return true;
}
protected void updateList() {
if (prefs.getBoolean(PreferenceConstants.SORT_BY_COLOR, false) != sortedByColor) {
Editor edit = prefs.edit();
edit.putBoolean(PreferenceConstants.SORT_BY_COLOR, sortedByColor);
edit.commit();
}
if (hostdb == null)
hostdb = new HostDatabase(this);
hosts = hostdb.getHosts(sortedByColor);
// Don't lose hosts that are connected via shortcuts but not in the database.
if (bound != null) {
for (TerminalBridge bridge : bound.bridges) {
if (!hosts.contains(bridge.host))
hosts.add(0, bridge.host);
}
}
HostAdapter adapter = new HostAdapter(this, hosts, bound);
this.setListAdapter(adapter);
}
class HostAdapter extends ArrayAdapter<HostBean> {
private List<HostBean> hosts;
private final TerminalManager manager;
private final ColorStateList red, green, blue;
public final static int STATE_UNKNOWN = 1, STATE_CONNECTED = 2, STATE_DISCONNECTED = 3;
class ViewHolder {
public TextView nickname;
public TextView caption;
public ImageView icon;
}
public HostAdapter(Context context, List<HostBean> hosts, TerminalManager manager) {
super(context, R.layout.item_host, hosts);
this.hosts = hosts;
this.manager = manager;
red = context.getResources().getColorStateList(R.color.red);
green = context.getResources().getColorStateList(R.color.green);
blue = context.getResources().getColorStateList(R.color.blue);
}
/**
* Check if we're connected to a terminal with the given host.
*/
private int getConnectedState(HostBean host) {
// always disconnected if we dont have backend service
if (this.manager == null)
return STATE_UNKNOWN;
if (manager.getConnectedBridge(host) != null)
return STATE_CONNECTED;
if (manager.disconnected.contains(host))
return STATE_DISCONNECTED;
return STATE_UNKNOWN;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = inflater.inflate(R.layout.item_host, null, false);
holder = new ViewHolder();
holder.nickname = (TextView)convertView.findViewById(android.R.id.text1);
holder.caption = (TextView)convertView.findViewById(android.R.id.text2);
holder.icon = (ImageView)convertView.findViewById(android.R.id.icon);
convertView.setTag(holder);
} else
holder = (ViewHolder) convertView.getTag();
HostBean host = hosts.get(position);
if (host == null) {
// Well, something bad happened. We can't continue.
Log.e("HostAdapter", "Host bean is null!");
holder.nickname.setText("Error during lookup");
holder.caption.setText("see 'adb logcat' for more");
return convertView;
}
holder.nickname.setText(host.getNickname());
switch (this.getConnectedState(host)) {
case STATE_UNKNOWN:
holder.icon.setImageState(new int[] { }, true);
break;
case STATE_CONNECTED:
holder.icon.setImageState(new int[] { android.R.attr.state_checked }, true);
break;
case STATE_DISCONNECTED:
holder.icon.setImageState(new int[] { android.R.attr.state_expanded }, true);
break;
}
ColorStateList chosen = null;
if (HostDatabase.COLOR_RED.equals(host.getColor()))
chosen = this.red;
else if (HostDatabase.COLOR_GREEN.equals(host.getColor()))
chosen = this.green;
else if (HostDatabase.COLOR_BLUE.equals(host.getColor()))
chosen = this.blue;
Context context = convertView.getContext();
if (chosen != null) {
// set color normally if not selected
holder.nickname.setTextColor(chosen);
holder.caption.setTextColor(chosen);
} else {
// selected, so revert back to default black text
holder.nickname.setTextAppearance(context, android.R.attr.textAppearanceLarge);
holder.caption.setTextAppearance(context, android.R.attr.textAppearanceSmall);
}
long now = System.currentTimeMillis() / 1000;
String nice = context.getString(R.string.bind_never);
if (host.getLastConnect() > 0) {
int minutes = (int)((now - host.getLastConnect()) / 60);
if (minutes >= 60) {
int hours = (minutes / 60);
if (hours >= 24) {
int days = (hours / 24);
nice = context.getString(R.string.bind_days, days);
} else
nice = context.getString(R.string.bind_hours, hours);
} else
nice = context.getString(R.string.bind_minutes, minutes);
}
holder.caption.setText(nice);
return convertView;
}
}
}
| {
"content_hash": "45ab4fd89e60b46183907578387bce5a",
"timestamp": "",
"source": "github",
"line_count": 556,
"max_line_length": 113,
"avg_line_length": 30.902877697841728,
"alnum_prop": 0.7362937958328484,
"repo_name": "irssiconnectbot/irssiconnectbot",
"id": "47e9844dab6d9326e0b49d5326d65ca857a99708",
"size": "17860",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/org/woltage/irssiconnectbot/HostListActivity.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "5383"
},
{
"name": "Java",
"bytes": "1533952"
}
],
"symlink_target": ""
} |
package com.linecorp.armeria.internal.common;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.params.provider.Arguments.arguments;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.ArgumentsProvider;
import org.junit.jupiter.params.provider.ArgumentsSource;
import com.linecorp.armeria.common.AggregatedHttpRequest;
import com.linecorp.armeria.common.CommonPools;
import com.linecorp.armeria.common.HttpData;
import com.linecorp.armeria.common.HttpHeaderNames;
import com.linecorp.armeria.common.HttpHeaders;
import com.linecorp.armeria.common.HttpMethod;
import com.linecorp.armeria.common.HttpRequest;
import com.linecorp.armeria.common.HttpRequestWriter;
import com.linecorp.armeria.common.RequestHeaders;
import com.linecorp.armeria.common.stream.AbortedStreamException;
import io.netty.buffer.PooledByteBufAllocator;
class DefaultHttpRequestTest {
/**
* The aggregation future must be completed even if the request being aggregated has been aborted.
*/
@ParameterizedTest
@ArgumentsSource(ParametersProvider.class)
void abortedAggregation(boolean executorSpecified, boolean withPooledObjects, Throwable abortCause) {
final Thread mainThread = Thread.currentThread();
final DefaultHttpRequest req = new DefaultHttpRequest(RequestHeaders.of(HttpMethod.GET, "/foo"));
final CompletableFuture<? extends AggregatedHttpRequest> future;
// Practically same execution, but we need to test the both case due to code duplication.
if (executorSpecified) {
if (withPooledObjects) {
future = req.aggregateWithPooledObjects(
CommonPools.workerGroup().next(), PooledByteBufAllocator.DEFAULT);
} else {
future = req.aggregate(CommonPools.workerGroup().next());
}
} else {
if (withPooledObjects) {
future = req.aggregateWithPooledObjects(PooledByteBufAllocator.DEFAULT);
} else {
future = req.aggregate();
}
}
final AtomicReference<Thread> callbackThread = new AtomicReference<>();
if (abortCause == null) {
assertThatThrownBy(() -> {
final CompletableFuture<? extends AggregatedHttpRequest> f =
future.whenComplete((unused, cause) -> callbackThread.set(Thread.currentThread()));
req.abort();
f.join();
}).hasCauseInstanceOf(AbortedStreamException.class);
} else {
assertThatThrownBy(() -> {
final CompletableFuture<? extends AggregatedHttpRequest> f =
future.whenComplete((unused, cause) -> callbackThread.set(Thread.currentThread()));
req.abort(abortCause);
f.join();
}).hasCauseInstanceOf(abortCause.getClass());
}
assertThat(callbackThread.get()).isNotSameAs(mainThread);
}
@Test
void ignoresAfterTrailersIsWritten() {
final HttpRequestWriter req = HttpRequest.streaming(HttpMethod.GET, "/foo");
req.write(HttpData.ofUtf8("foo"));
req.write(HttpHeaders.of(HttpHeaderNames.of("a"), "b"));
req.write(HttpHeaders.of(HttpHeaderNames.of("c"), "d")); // Ignored.
req.close();
final AggregatedHttpRequest aggregated = req.aggregate().join();
// Request headers
assertThat(aggregated.headers()).isEqualTo(
RequestHeaders.of(HttpMethod.GET, "/foo",
HttpHeaderNames.CONTENT_LENGTH, "3"));
// Content
assertThat(aggregated.contentUtf8()).isEqualTo("foo");
// Trailers
assertThat(aggregated.trailers()).isEqualTo(HttpHeaders.of(HttpHeaderNames.of("a"), "b"));
}
private static class ParametersProvider implements ArgumentsProvider {
@Override
public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
return Stream.of(
arguments(true, true, null),
arguments(true, false, new IllegalStateException("abort stream with a specified cause")),
arguments(false, true, new IllegalStateException("abort stream with a specified cause")),
arguments(false, false, null));
}
}
}
| {
"content_hash": "35ae5ffe270dcbbb0fb61cc2299ab042",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 109,
"avg_line_length": 43.345454545454544,
"alnum_prop": 0.673238255033557,
"repo_name": "minwoox/armeria",
"id": "6b96c728e12ed971e93c9f753ddf7debda96dd40",
"size": "5401",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "core/src/test/java/com/linecorp/armeria/internal/common/DefaultHttpRequestTest.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "7197"
},
{
"name": "HTML",
"bytes": "1222"
},
{
"name": "Java",
"bytes": "16194263"
},
{
"name": "JavaScript",
"bytes": "26702"
},
{
"name": "Kotlin",
"bytes": "90127"
},
{
"name": "Less",
"bytes": "34341"
},
{
"name": "Scala",
"bytes": "209950"
},
{
"name": "Shell",
"bytes": "2062"
},
{
"name": "Thrift",
"bytes": "192676"
},
{
"name": "TypeScript",
"bytes": "243099"
}
],
"symlink_target": ""
} |
using Client.Web.Controllers;
using Grit.Utility.Authentication;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Client.Web
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
public class AuthAttribute : FilterAttribute, IAuthorizationFilter
{
public void OnAuthorization(AuthorizationContext filterContext)
{
var controller = filterContext.Controller as AuthorizeController;
if (controller == null)
{
throw new Exception("Invald authorize controller.");
}
HttpCookie cookie = filterContext.HttpContext.Request.Cookies.Get(controller.Authenticator.CookieTicketConfig.CookieName);
HttpCookie newCookie;
CookieTicket ticket;
if (controller.Authenticator.ValidateCookieTicket(cookie, out ticket, out newCookie))
{
controller.UserId = int.Parse(ticket.Name);
if (newCookie != null)
{
filterContext.HttpContext.Response.Cookies.Add(newCookie);
}
return;
}
filterContext.Result = new RedirectResult(controller.Authenticator.CookieTicketConfig.LoginUrl);
}
}
} | {
"content_hash": "bfaf826dc2b2d39b1ffeb762926d63dc",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 134,
"avg_line_length": 36.13157894736842,
"alnum_prop": 0.6460305899490167,
"repo_name": "hotjk/dotsso",
"id": "a3ec1485f4bb6634d3d568ac06d28897c62f9d50",
"size": "1375",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Client.Web/App_Start/AuthAttribute.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP",
"bytes": "204"
},
{
"name": "C#",
"bytes": "34672"
},
{
"name": "CSS",
"bytes": "1026"
},
{
"name": "HTML",
"bytes": "5127"
},
{
"name": "JavaScript",
"bytes": "21428"
}
],
"symlink_target": ""
} |
require 'shell_shock/context'
require 'songbirdsh/player'
require 'songbirdsh/preferences'
require 'songbirdsh/command'
require 'yaml'
module Songbirdsh
class Cli
include ShellShock::Context
def with name, *aliases
aliases << name.to_s if aliases.empty?
add_command Command.load(name, @player), *aliases
end
def with_all *names
names.each {|name| with name}
end
def initialize
preferences = Preferences.new
@player = Player.new preferences
at_exit { @player.stop }
@prompt = "songbirdsh > "
with :status, "'"
with :show_properties, 'show'
with :restart, 'next'
with :enqueue, '+'
with_all *%w{reload search start stop scrobbling shuffle list setup_scrobbling recent flush}
end
end
end | {
"content_hash": "182b6e17f84b80c8bb6cd86c7eeb6134",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 98,
"avg_line_length": 23.352941176470587,
"alnum_prop": 0.6586901763224181,
"repo_name": "markryall/songbirdsh",
"id": "ff43b0ac750e073b16d814560b10075cc4043a84",
"size": "794",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/songbirdsh/cli.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "24942"
}
],
"symlink_target": ""
} |
package ru.objective.jni.tasks.builders;
import org.apache.commons.bcel6.classfile.*;
import org.apache.commons.bcel6.generic.ArrayType;
import org.apache.commons.bcel6.generic.Type;
import org.apache.commons.lang3.StringUtils;
import ru.objective.jni.utils.MethodExportInfo;
import ru.objective.jni.utils.OJNIClassLoader;
import ru.objective.jni.utils.ResourceList;
import ru.objective.jni.utils.Utils;
import ru.objective.jni.constants.Constants;
import ru.objective.jni.exceptions.BadParsingException;
import ru.objective.jni.tasks.types.PrimitiveTypeConverter;
import java.util.ArrayList;
import java.util.HashSet;
/**
* Created by ashitikov on 04.12.15.
*/
public class ClassBuilder extends AbstractBuilder {
protected String header;
protected String implementation;
protected HashSet<String> dependencies;
public ClassBuilder(JavaClass javaClass, String prefix, String[] excludes, String[] excludedPackages) throws Exception {
super(javaClass, prefix, excludes, excludedPackages);
}
@Override
public String getHeader() {
return header;
}
@Override
public String getImplementation() {
return implementation;
}
@Override
protected void build(JavaClass javaClass) throws Exception {
if (javaClass.isInterface())
throw new BadParsingException("Cannot build class from interface " + javaClass.toString());
if (Utils.isExportClass(javaClass, excludes, excludedPackages)) {
StringBuilder declBuilder = new StringBuilder();
StringBuilder implBuilder = new StringBuilder();
Method[] methods = javaClass.getMethods();
Field[] fields = javaClass.getFields();
JavaClass[] interfaces = getInterfaces();
String[] classInterfacesNames = null;
if (interfaces != null) {
ArrayList<String> resultInterfaces = new ArrayList<>(interfaces.length);
for (JavaClass javaInterface : interfaces) {
resultInterfaces.add(Utils.getShortClassName(javaInterface.getClassName()));
}
if (resultInterfaces.size() > 0) {
classInterfacesNames = new String[resultInterfaces.size()];
resultInterfaces.toArray(classInterfacesNames);
}
}
HashSet<String> methodDependencies = new HashSet<>();
HashSet<Method> overloadedMethods = Utils.getOverloadedMethods(methods);
for (Field field : fields) {
// skip field if excluded
if (Utils.isClassNameExcluded(field.getType().toString(), excludes, excludedPackages))
continue;
String fieldName = Utils.getFieldExportName(field);
if (fieldName == null)
continue;
Type basicFieldType = Utils.basicTypeFromArrayType(field.getType());
if (!Utils.isPrimitive(basicFieldType))
methodDependencies.add(basicFieldType.toString());
String declgetter = getHeaderDeclarationField(fieldName, field, false);
String declsetter = getHeaderDeclarationField(fieldName, field, true);
declBuilder.append(declgetter);
declBuilder.append(System.lineSeparator());
declBuilder.append(declsetter);
declBuilder.append(System.lineSeparator());
String implgetter = getFieldImplementation(field, declgetter, false);
String implsetter = getFieldImplementation(field, declsetter, true);
implBuilder.append(implgetter);
implBuilder.append(System.lineSeparator());
implBuilder.append(implsetter);
implBuilder.append(System.lineSeparator());
}
for (Method method : methods) {
MethodExportInfo info = Utils.getMethodExportInfo(method);
String name = info.name;
if (name == null)
continue;
ArrayList<String> deps = Utils.getMethodNonPrimitiveDependencies(method);
if (deps != null) {
boolean found = false;
for (String dependency : deps) {
// skip method if excluded
if (Utils.isClassNameExcluded(dependency, excludes, excludedPackages)) {
found = true;
break;
}
}
if (found)
continue;
methodDependencies.addAll(deps);
}
String decl = getHeaderDeclarationMethod(info, method, overloadedMethods.contains(method));
declBuilder.append(decl);
declBuilder.append(System.lineSeparator());
String impl = getMethodImplementation(method, decl);
implBuilder.append(impl);
implBuilder.append(System.lineSeparator());
}
// add core string methods decls
if (getJavaClass().getClassName().equals("java.lang.String")) {
declBuilder.append("- (instancetype)initWithNSString:(NSString *)string;").append(System.lineSeparator()).
append("+ (instancetype)stringWithNSString:(NSString *)string;").append(System.lineSeparator()).
append("- (NSString *)toNSString;").append(System.lineSeparator());
}
if (methodDependencies.size() > 0) {
dependencies = methodDependencies;
}
String packageName = javaClass.getPackageName();
String shortClassName = Utils.getShortClassName(packageName, javaClass.getClassName());
String superClassName = Constants.OBJC_SYSTEM_CLASS;
String headerImportBlock = "";
String interfacesBlock = (interfaces != null ? getInterfacesBlock(interfaces) : "");
JavaClass superClass = getSuperClass();
if (superClass != null && Utils.isExportClass(superClass, excludes, excludedPackages)) {
superClassName = superClass.getClassName();
}
headerImportBlock = getHeaderImportBlock(superClassName, classInterfacesNames, dependencies, false);
String implImportBlock = "";
if (headerImportBlock != null && !headerImportBlock.equals(""))
implImportBlock = getHeaderImportBlock(superClassName, classInterfacesNames, dependencies, true);
implBuilder.append(getOJNIMethodsImplementations());
generate(packageName, shortClassName, interfacesBlock,
Utils.getShortClassName(superClassName), headerImportBlock,
declBuilder.toString(), "", implBuilder.toString(), implImportBlock);
}
}
private String getOJNIMethodsImplementations() {
StringBuilder builder = new StringBuilder();
String slashedClassName = Utils.getSlashedClassName(getJavaClass().getClassName());
builder.append("+ (NSString *)OJNIClassName {").append(System.lineSeparator()).
append("return @\"").append(slashedClassName).append("\";").append(System.lineSeparator()).
append("}").append(System.lineSeparator());
// special case for string
if (getJavaClass().getClassName().equals("java.lang.String")) {
builder.append("- (instancetype)initWithNSString:(NSString *)string {\n" +
" OJNIEnv *__env = [OJNIEnv currentEnv];\n" +
" OJNIJavaObject *__return = [self initWithJavaObject:[__env newJavaStringFromString:string utf8Encoding:NO]];\n" +
" \n" +
" return __return;\n" +
"}\n" +
"\n" +
"+ (instancetype)stringWithNSString:(NSString *)string {\n" +
" return [[self alloc] initWithNSString:string];\n" +
"}\n" +
"\n" +
"- (NSString *)toNSString {\n" +
" OJNIEnv *__env = [OJNIEnv currentEnv];\n" +
" NSString *__return = [__env newStringFromJavaString:[self javaObject] utf8Encoding:NO];\n" +
" \n" +
" return __return;\n" +
"}");
}
return builder.toString();
}
private String getFieldImplementation(Field field, String declaration, boolean setter) {
StringBuilder builder = new StringBuilder();
if (setter && field.isFinal())
return "";
builder.append(declaration).append(" {").append(System.lineSeparator());
builder.append("OJNIEnv *__env = [OJNIEnv currentEnv];").append(System.lineSeparator());
builder.append("jfieldID fid = [[OJNIMidManager sharedManager] fieldIDFor");
if (field.isStatic())
builder.append("Static");
builder.append("Method:@\""+field.getName()+"\" ");
builder.append("signature:@\""+field.getSignature()+"\" inClass:self.class];");
builder.append(System.lineSeparator());
Type returnType = field.getType();
String lowerCaseReturnType = (Utils.isPrimitive(returnType) && !Utils.isArrayType(returnType) ?
returnType.toString() : "object");
String capitalized = StringUtils.capitalize(lowerCaseReturnType);
String staticIdentifier = "";
String selfIdentitifer = "[self javaObject]";
if (field.isStatic()) {
staticIdentifier = "Static";
selfIdentitifer = "[self.class OJNIClass]";
}
if (setter) { // setter
builder.append("[__env set").append(staticIdentifier).append(capitalized).
append("Field:").append(selfIdentitifer).append(" field:fid value:");
String var_name = "property_" + field.getName();
if (Utils.isArrayType(returnType)) {
ArrayType arrayType = (ArrayType)returnType;
int dimensions = arrayType.getDimensions();
String typeString = arrayType.getBasicType().toString();
String capitalizedType = StringUtils.capitalize(typeString);
// fix Boolean = Bool conflicts
if (capitalizedType.equals("Bool"))
capitalizedType = "Boolean";
if (arrayType.getDimensions() == 1 && Utils.isPrimitive(arrayType)) {
builder.append("[__env newJava").append(capitalizedType).append("ArrayFromArray:").append(var_name).append("]");
} else {
if (Utils.isPrimitive(arrayType)) {
builder.append("[__env newJavaObjectArrayFromArray:").
append(var_name).append(" baseClass:[OJNIPrimitive").append(capitalizedType).
append("Array class]").
append(" dimensions:").append(dimensions).append("]");
} else {
JavaClass argTypeJavaClass = OJNIClassLoader.getInstance().loadClass(typeString);
String resultClassString = "";
if (argTypeJavaClass != null && argTypeJavaClass.isInterface())
resultClassString = "@\"" + Utils.getSlashedClassName(typeString) + "\"";
else
resultClassString = "[" + getPrefix() + Utils.getShortClassName(typeString) + " class]";
builder.append("[__env newJavaObjectArrayFromArray:").
append(var_name).append(" baseClass:").
append(resultClassString).
append(" dimensions:").append(dimensions).append("]");
}
}
} else {
if (Utils.isPrimitive(returnType)) {
builder.append(var_name);
} else {
builder.append("[").append(var_name).append(" javaObject]");
}
}
builder.append("];");
} else { // getter
builder.append("j").append(lowerCaseReturnType).append(" __obj = ").
append("[__env get").append(staticIdentifier).append(capitalized).
append("Field:").append(selfIdentitifer).append(" field:fid];").append(System.lineSeparator());
builder.append(generateReturnObject(field.getType()));
}
builder.append(System.lineSeparator()).append("}");
return builder.toString();
}
private String getMethodImplementation(Method method, String declaration) {
StringBuilder builder = new StringBuilder();
String vars = generateArgumentString(method);
builder.append(declaration).append(" {").append(System.lineSeparator());
builder.append("OJNIEnv *__env = [OJNIEnv currentEnv];").append(System.lineSeparator());
builder.append("jmethodID mid = [[OJNIMidManager sharedManager] methodIDFor");
if (method.isStatic())
builder.append("Static");
builder.append("Method:@\""+method.getName()+"\" ");
builder.append("signature:@\""+method.getSignature()+"\" inClass:self.class];");
builder.append(System.lineSeparator());
// todo remove [self.class OJNIClass];
if (method.getReturnType().equals(Type.VOID)) {
if (Utils.isConstructor(method)) {
builder.append("jobject __obj = [__env newObject:[self.class OJNIClass] method:mid");
builder.append(vars).append("];").append(System.lineSeparator());
builder.append("return [super initWithJavaObject:__obj];");
} else {
if (method.isStatic()) {
builder.append("[__env callStaticVoidMethodOnClass:[self.class OJNIClass] method:mid");
} else {
builder.append("[__env callVoidMethodOnObject:[self javaObject] method:mid");
}
builder.append(vars).append("];");
}
} else {
builder.append(generateCallMethod(method, vars));
builder.append(generateReturnObject(method.getReturnType()));
}
builder.append(System.lineSeparator()).append("}");
return builder.toString();
}
public String generateCallMethod(Method method, String vars) {
StringBuilder builder = new StringBuilder();
Type returnType = method.getReturnType();
if (Utils.isArrayType(returnType) || !Utils.isPrimitive(returnType)) {
if (method.isStatic())
builder.append("jobject __obj = [__env callStaticObject");
else
builder.append("jobject __obj = [__env callObject");
} else {
builder.append("j").append(returnType.toString()).append(" __obj = [__env call");
if (method.isStatic())
builder.append("Static");
builder.append(StringUtils.capitalize(returnType.toString()));
}
if (method.isStatic())
builder.append("MethodOnClass:[self.class OJNIClass] method:mid");
else
builder.append("MethodOnObject:[self javaObject] method:mid");
builder.append(vars).append("];").append(System.lineSeparator());
return builder.toString();
}
public String generateArgumentString(Method method) {
StringBuilder builder = new StringBuilder();
Type[] types = method.getArgumentTypes();
LocalVariableTable localVariableTable = method.getLocalVariableTable();
for (int i = 0, var_index = (method.isStatic() ? 0 : 1); i < types.length; i++, var_index++) {
// if (localVariableTable != null && localVariableTable.getLocalVariable(var_index, 0) == null)
// System.gc();
Type type = types[i];
String var_name = "";
if (localVariableTable == null) {
var_name = "arg" +var_index;
} else {
LocalVariable lv = localVariableTable.getLocalVariable(var_index, 0);
if (lv != null) {
var_name = lv.getName();
}
}
if (type.equals(Type.LONG) || type.equals(Type.DOUBLE))
var_index++;
if (Utils.isOccupiedWord(var_name)){
var_name = "_" + var_name;
}
builder.append(", ");
if (Utils.isArrayType(type)) {
ArrayType arrayType = (ArrayType)type;
int dimensions = arrayType.getDimensions();
String typeString = arrayType.getBasicType().toString();
String capitalizedType = StringUtils.capitalize(typeString);
// fix Boolean = Bool conflicts
if (capitalizedType.equals("Bool"))
capitalizedType = "Boolean";
if (arrayType.getDimensions() == 1 && Utils.isPrimitive(arrayType)) {
//builder.append("[").append(var_name).append(" rawArray]");
builder.append("[__env newJava").append(capitalizedType).append("ArrayFromArray:").append(var_name).append("]");
} else {
if (Utils.isPrimitive(arrayType)) {
builder.append("[__env newJavaObjectArrayFromArray:").
append(var_name).append(" baseClass:[OJNIPrimitive").append(capitalizedType).
append("Array class]").
append(" dimensions:").append(dimensions).append("]");
} else {
JavaClass argTypeJavaClass = OJNIClassLoader.getInstance().loadClass(typeString);
String resultClassString = "";
if (argTypeJavaClass != null && argTypeJavaClass.isInterface())
resultClassString = "@\"" + Utils.getSlashedClassName(typeString) + "\"";
else
resultClassString = "[" + getPrefix() + Utils.getShortClassName(typeString) + " class]";
builder.append("[__env newJavaObjectArrayFromArray:").
append(var_name).append(" baseClass:").
append(resultClassString).
append(" dimensions:").append(dimensions).append("]");
}
}
} else {
if (Utils.isPrimitive(type)) {
builder.append(var_name);
} else {
builder.append("[").append(var_name).append(" javaObject]");
}
}
}
return builder.toString();
}
public String generateReturnObject(Type returnType) {
StringBuilder builder = new StringBuilder();
if (Utils.isArrayType(returnType)) {
ArrayType arrReturnType = (ArrayType) returnType;
int dimensions = arrReturnType.getDimensions();
String capitalizedType = StringUtils.capitalize(arrReturnType.getBasicType().toString());
// fix Boolean = Bool conflicts
if (capitalizedType.equals("Bool"))
capitalizedType = "Boolean";
if (Utils.isPrimitive(arrReturnType)) {
if (dimensions == 1) {
builder.append("OJNIPrimitiveArray *__return = ");
builder.append("[__env primitive").
append(capitalizedType).
append("ArrayFromJavaArray:__obj];");
} else {
builder.append("NSArray *__return = ");
builder.append("[__env newArrayFromJavaObjectArray:__obj baseClass:[OJNIPrimitive").
append(capitalizedType).
append("Array class] classPrefix:@\"").append(getPrefix()).
append("\" dimensions:").append(dimensions).append("];");
}
} else {
builder.append("NSArray *__return = ");
builder.append("[__env newArrayFromJavaObjectArray:__obj baseClass:[OJNIJavaObject class] classPrefix:@\"").
append(getPrefix()).append("\" dimensions:").append(dimensions).append("];");
}
} else {
if (Utils.isPrimitive(returnType)) {
builder.append(PrimitiveTypeConverter.convertToOBJCType(returnType.toString())).append(" __return = ");
builder.append("__obj;");
} else {
builder.append("id __return = ");
builder.append("[OJNIJavaObject retrieveFromJavaObject:__obj classPrefix:@\"").
append(getPrefix()).
append("\"];");
}
}
builder.append(System.lineSeparator()).
append("return __return;");
return builder.toString();
}
public void generate(String packageName, String className,
String interfacesBlock, String superClassName,
String importBlock, String declarationBlock,
String deallocBlock, String implementationBlock,
String implementationImportBlock) throws Exception {
String headerTemplate = ResourceList.getStringContentFromResource(Constants.TEMPLATE_HEADER_FILENAME);
String superClassNameResult = (Utils.isOBJCSystemClass(superClassName) ? superClassName : getPrefix() + superClassName);
headerTemplate = headerTemplate.replace(Constants.CLASS_NAME, getPrefix()+className);
headerTemplate = headerTemplate.replace(Constants.SUPERCLASS_NAME, superClassNameResult);
headerTemplate = headerTemplate.replace(Constants.IMPORT_BLOCK, importBlock);
headerTemplate = headerTemplate.replace(Constants.DECLARATION_BLOCK, declarationBlock);
headerTemplate = headerTemplate.replace(Constants.INTERFACES_IMPLEMENTS, interfacesBlock);
String implementationTemplate = ResourceList.getStringContentFromResource(Constants.TEMPLATE_IMPLEMENTATION_FILENAME);
implementationTemplate = implementationTemplate.replace(Constants.CLASS_NAME, getPrefix()+className);
implementationTemplate = implementationTemplate.replace(Constants.DEALLOC_BLOCK, deallocBlock);
implementationTemplate = implementationTemplate.replace(Constants.IMPLEMENTATION_BLOCK, implementationBlock);
implementationTemplate = implementationTemplate.replace(Constants.IMPORT_BLOCK, implementationImportBlock);
header = headerTemplate;
implementation = implementationTemplate;
}
@Override
public HashSet<String> getDependencies() {
return dependencies;
}
}
| {
"content_hash": "443ba46f20c0491b7ddfda2ae14f3bf2",
"timestamp": "",
"source": "github",
"line_count": 529,
"max_line_length": 138,
"avg_line_length": 43.907372400756145,
"alnum_prop": 0.5715331295475093,
"repo_name": "ashitikov/Objective-JNI",
"id": "f3f346089a403db4bf3bd33080ecae9487e50c36",
"size": "23828",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/ru/objective/jni/tasks/builders/ClassBuilder.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "83753"
},
{
"name": "Objective-C",
"bytes": "2239"
}
],
"symlink_target": ""
} |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package net.kirauks.minigames.launcher.games;
/**
*
* @author Karl
*/
public interface OnGameStartListener {
public void onGameStart(GameModel game);
}
| {
"content_hash": "4ed7eb0f916205354fde703fb4d60e75",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 79,
"avg_line_length": 23.066666666666666,
"alnum_prop": 0.7341040462427746,
"repo_name": "Rauks/MiniGames",
"id": "0e075c7a22d7001c59c3c983036399b01887eb67",
"size": "346",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Games-Launcher/src/net/kirauks/minigames/launcher/games/OnGameStartListener.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "370"
},
{
"name": "Java",
"bytes": "146521"
}
],
"symlink_target": ""
} |
package org.conqat.lib.commons.reflect;
import org.conqat.lib.commons.assertion.CCSMPre;
import org.conqat.lib.commons.enums.EnumUtils;
/**
* Enumeration of Java primitives.
*
* @author deissenb
* @author $Author: kinnen $
* @version $Rev: 41751 $
* @ConQAT.Rating GREEN Hash: B6F3E3BF553614F037D41D71E5295463
*/
public enum EJavaPrimitive {
/** void */
VOID(void.class, Void.class),
/** byte */
BYTE(byte.class, Byte.class),
/** char */
CHAR(char.class, Character.class),
/** double */
DOUBLE(double.class, Double.class),
/** float */
FLOAT(float.class, Float.class),
/** int */
INT(int.class, Integer.class),
/** long */
LONG(long.class, Long.class),
/** short */
SHORT(short.class, Short.class),
/** boolean */
BOOLEAN(boolean.class, Boolean.class);
/** Class object of the primitive. */
private final Class<?> primitiveClass;
/** Class object of the wrapper type primitive. */
private final Class<?> wrapperClass;
/** Create new primitive. */
private EJavaPrimitive(Class<?> primitiveClass, Class<?> wrapperClass) {
CCSMPre.isTrue(primitiveClass.isPrimitive(),
"Clazz object must be a primitive.");
this.primitiveClass = primitiveClass;
this.wrapperClass = wrapperClass;
}
/** Get the class object of the primitive. */
public Class<?> getClassObject() {
return primitiveClass;
}
/** Returns the wrapper class for the primitive. */
public Class<?> getWrapperClass() {
return wrapperClass;
}
/**
* Get primitive by name.
*
* @return primitive or <code>null</code> if unknown primitive was
* requested
*/
public static EJavaPrimitive getPrimitive(String name) {
return EnumUtils.valueOf(EJavaPrimitive.class, name);
}
/**
* Get primitive by name ignoring case.
*
* @return primitive or <code>null</code> if unknown primitive was
* requested
*/
public static EJavaPrimitive getPrimitiveIgnoreCase(String name) {
return EnumUtils.valueOfIgnoreCase(EJavaPrimitive.class, name);
}
/**
* Returns the enum literal belonging to the given primitive class (or
* null).
*/
public static EJavaPrimitive getForPrimitiveClass(Class<?> clazz) {
for (EJavaPrimitive javaPrimitive : values()) {
if (javaPrimitive.primitiveClass.equals(clazz)) {
return javaPrimitive;
}
}
return null;
}
/** Returns the enum literal belonging to the given wrapper class (or null). */
public static EJavaPrimitive getForWrapperClass(Class<?> clazz) {
for (EJavaPrimitive javaPrimitive : values()) {
if (javaPrimitive.wrapperClass.equals(clazz)) {
return javaPrimitive;
}
}
return null;
}
/**
* Returns the enum literal belonging to the given primitive or wrapper
* class (or null).
*/
public static EJavaPrimitive getForPrimitiveOrWrapperClass(Class<?> clazz) {
for (EJavaPrimitive javaPrimitive : values()) {
if (javaPrimitive.primitiveClass.equals(clazz)
|| javaPrimitive.wrapperClass.equals(clazz)) {
return javaPrimitive;
}
}
return null;
}
/** Returns whether the given class is a wrapper type for a primitive. */
public static boolean isWrapperType(Class<?> clazz) {
return getForWrapperClass(clazz) != null;
}
} | {
"content_hash": "18b515ab02ce216932cfa6e322dc51bc",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 80,
"avg_line_length": 24.705426356589147,
"alnum_prop": 0.6968936303733919,
"repo_name": "vimaier/conqat",
"id": "7ed499c4e64e0e149a072fe9464467181886ebda",
"size": "4418",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "org.conqat.engine.core/external/commons-src/org/conqat/lib/commons/reflect/EJavaPrimitive.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ABAP",
"bytes": "83459"
},
{
"name": "Ada",
"bytes": "294088"
},
{
"name": "C",
"bytes": "35787"
},
{
"name": "C#",
"bytes": "2180092"
},
{
"name": "C++",
"bytes": "41027"
},
{
"name": "CSS",
"bytes": "1066"
},
{
"name": "DOT",
"bytes": "865"
},
{
"name": "Java",
"bytes": "12354598"
},
{
"name": "JavaScript",
"bytes": "563333"
},
{
"name": "Matlab",
"bytes": "2070"
},
{
"name": "Perl",
"bytes": "1612"
},
{
"name": "Python",
"bytes": "1646"
},
{
"name": "Scilab",
"bytes": "9"
},
{
"name": "Shell",
"bytes": "404"
},
{
"name": "Visual Basic",
"bytes": "183"
},
{
"name": "XSLT",
"bytes": "128360"
}
],
"symlink_target": ""
} |
from django.conf import settings
from django.contrib.auth.models import User, Group, Permission, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
class BackendTest(TestCase):
backend = 'django.contrib.auth.backends.ModelBackend'
def setUp(self):
self.curr_auth = settings.AUTHENTICATION_BACKENDS
settings.AUTHENTICATION_BACKENDS = (self.backend,)
User.objects.create_user('test', 'test@example.com', 'test')
User.objects.create_superuser('test2', 'test2@example.com', 'test')
def tearDown(self):
settings.AUTHENTICATION_BACKENDS = self.curr_auth
# The custom_perms test messes with ContentTypes, which will
# be cached; flush the cache to ensure there are no side effects
# Refs #14975, #14925
ContentType.objects.clear_cache()
def test_has_perm(self):
user = User.objects.get(username='test')
self.assertEqual(user.has_perm('auth.test'), False)
user.is_staff = True
user.save()
self.assertEqual(user.has_perm('auth.test'), False)
user.is_superuser = True
user.save()
self.assertEqual(user.has_perm('auth.test'), True)
user.is_staff = False
user.is_superuser = False
user.save()
self.assertEqual(user.has_perm('auth.test'), False)
user.is_staff = True
user.is_superuser = True
user.is_active = False
user.save()
self.assertEqual(user.has_perm('auth.test'), False)
def test_custom_perms(self):
user = User.objects.get(username='test')
content_type=ContentType.objects.get_for_model(Group)
perm = Permission.objects.create(name='test', content_type=content_type, codename='test')
user.user_permissions.add(perm)
user.save()
# reloading user to purge the _perm_cache
user = User.objects.get(username='test')
self.assertEqual(user.get_all_permissions() == set([u'auth.test']), True)
self.assertEqual(user.get_group_permissions(), set([]))
self.assertEqual(user.has_module_perms('Group'), False)
self.assertEqual(user.has_module_perms('auth'), True)
perm = Permission.objects.create(name='test2', content_type=content_type, codename='test2')
user.user_permissions.add(perm)
user.save()
perm = Permission.objects.create(name='test3', content_type=content_type, codename='test3')
user.user_permissions.add(perm)
user.save()
user = User.objects.get(username='test')
self.assertEqual(user.get_all_permissions(), set([u'auth.test2', u'auth.test', u'auth.test3']))
self.assertEqual(user.has_perm('test'), False)
self.assertEqual(user.has_perm('auth.test'), True)
self.assertEqual(user.has_perms(['auth.test2', 'auth.test3']), True)
perm = Permission.objects.create(name='test_group', content_type=content_type, codename='test_group')
group = Group.objects.create(name='test_group')
group.permissions.add(perm)
group.save()
user.groups.add(group)
user = User.objects.get(username='test')
exp = set([u'auth.test2', u'auth.test', u'auth.test3', u'auth.test_group'])
self.assertEqual(user.get_all_permissions(), exp)
self.assertEqual(user.get_group_permissions(), set([u'auth.test_group']))
self.assertEqual(user.has_perms(['auth.test3', 'auth.test_group']), True)
user = AnonymousUser()
self.assertEqual(user.has_perm('test'), False)
self.assertEqual(user.has_perms(['auth.test2', 'auth.test3']), False)
def test_has_no_object_perm(self):
"""Regressiontest for #12462"""
user = User.objects.get(username='test')
content_type=ContentType.objects.get_for_model(Group)
perm = Permission.objects.create(name='test', content_type=content_type, codename='test')
user.user_permissions.add(perm)
user.save()
self.assertEqual(user.has_perm('auth.test', 'object'), False)
self.assertEqual(user.get_all_permissions('object'), set([]))
self.assertEqual(user.has_perm('auth.test'), True)
self.assertEqual(user.get_all_permissions(), set(['auth.test']))
def test_get_all_superuser_permissions(self):
"A superuser has all permissions. Refs #14795"
user = User.objects.get(username='test2')
self.assertEqual(len(user.get_all_permissions()), len(Permission.objects.all()))
class TestObj(object):
pass
class SimpleRowlevelBackend(object):
supports_object_permissions = True
supports_inactive_user = False
# This class also supports tests for anonymous user permissions, and
# inactive user permissions via subclasses which just set the
# 'supports_anonymous_user' or 'supports_inactive_user' attribute.
def has_perm(self, user, perm, obj=None):
if not obj:
return # We only support row level perms
if isinstance(obj, TestObj):
if user.username == 'test2':
return True
elif user.is_anonymous() and perm == 'anon':
# not reached due to supports_anonymous_user = False
return True
elif not user.is_active and perm == 'inactive':
return True
return False
def has_module_perms(self, user, app_label):
if not user.is_anonymous() and not user.is_active:
return False
return app_label == "app1"
def get_all_permissions(self, user, obj=None):
if not obj:
return [] # We only support row level perms
if not isinstance(obj, TestObj):
return ['none']
if user.is_anonymous():
return ['anon']
if user.username == 'test2':
return ['simple', 'advanced']
else:
return ['simple']
def get_group_permissions(self, user, obj=None):
if not obj:
return # We only support row level perms
if not isinstance(obj, TestObj):
return ['none']
if 'test_group' in [group.name for group in user.groups.all()]:
return ['group_perm']
else:
return ['none']
class RowlevelBackendTest(TestCase):
"""
Tests for auth backend that supports object level permissions
"""
backend = 'django.contrib.auth.tests.auth_backends.SimpleRowlevelBackend'
def setUp(self):
self.curr_auth = settings.AUTHENTICATION_BACKENDS
settings.AUTHENTICATION_BACKENDS = tuple(self.curr_auth) + (self.backend,)
self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
self.user2 = User.objects.create_user('test2', 'test2@example.com', 'test')
self.user3 = User.objects.create_user('test3', 'test3@example.com', 'test')
def tearDown(self):
settings.AUTHENTICATION_BACKENDS = self.curr_auth
# The get_group_permissions test messes with ContentTypes, which will
# be cached; flush the cache to ensure there are no side effects
# Refs #14975, #14925
ContentType.objects.clear_cache()
def test_has_perm(self):
self.assertEqual(self.user1.has_perm('perm', TestObj()), False)
self.assertEqual(self.user2.has_perm('perm', TestObj()), True)
self.assertEqual(self.user2.has_perm('perm'), False)
self.assertEqual(self.user2.has_perms(['simple', 'advanced'], TestObj()), True)
self.assertEqual(self.user3.has_perm('perm', TestObj()), False)
self.assertEqual(self.user3.has_perm('anon', TestObj()), False)
self.assertEqual(self.user3.has_perms(['simple', 'advanced'], TestObj()), False)
def test_get_all_permissions(self):
self.assertEqual(self.user1.get_all_permissions(TestObj()), set(['simple']))
self.assertEqual(self.user2.get_all_permissions(TestObj()), set(['simple', 'advanced']))
self.assertEqual(self.user2.get_all_permissions(), set([]))
def test_get_group_permissions(self):
content_type=ContentType.objects.get_for_model(Group)
group = Group.objects.create(name='test_group')
self.user3.groups.add(group)
self.assertEqual(self.user3.get_group_permissions(TestObj()), set(['group_perm']))
class AnonymousUserBackend(SimpleRowlevelBackend):
supports_anonymous_user = True
supports_inactive_user = False
class NoAnonymousUserBackend(SimpleRowlevelBackend):
supports_anonymous_user = False
supports_inactive_user = False
class AnonymousUserBackendTest(TestCase):
"""
Tests for AnonymousUser delegating to backend if it has 'supports_anonymous_user' = True
"""
backend = 'django.contrib.auth.tests.auth_backends.AnonymousUserBackend'
def setUp(self):
self.curr_auth = settings.AUTHENTICATION_BACKENDS
settings.AUTHENTICATION_BACKENDS = (self.backend,)
self.user1 = AnonymousUser()
def tearDown(self):
settings.AUTHENTICATION_BACKENDS = self.curr_auth
def test_has_perm(self):
self.assertEqual(self.user1.has_perm('perm', TestObj()), False)
self.assertEqual(self.user1.has_perm('anon', TestObj()), True)
def test_has_perms(self):
self.assertEqual(self.user1.has_perms(['anon'], TestObj()), True)
self.assertEqual(self.user1.has_perms(['anon', 'perm'], TestObj()), False)
def test_has_module_perms(self):
self.assertEqual(self.user1.has_module_perms("app1"), True)
self.assertEqual(self.user1.has_module_perms("app2"), False)
def test_get_all_permissions(self):
self.assertEqual(self.user1.get_all_permissions(TestObj()), set(['anon']))
class NoAnonymousUserBackendTest(TestCase):
"""
Tests that AnonymousUser does not delegate to backend if it has 'supports_anonymous_user' = False
"""
backend = 'django.contrib.auth.tests.auth_backends.NoAnonymousUserBackend'
def setUp(self):
self.curr_auth = settings.AUTHENTICATION_BACKENDS
settings.AUTHENTICATION_BACKENDS = tuple(self.curr_auth) + (self.backend,)
self.user1 = AnonymousUser()
def tearDown(self):
settings.AUTHENTICATION_BACKENDS = self.curr_auth
def test_has_perm(self):
self.assertEqual(self.user1.has_perm('perm', TestObj()), False)
self.assertEqual(self.user1.has_perm('anon', TestObj()), False)
def test_has_perms(self):
self.assertEqual(self.user1.has_perms(['anon'], TestObj()), False)
def test_has_module_perms(self):
self.assertEqual(self.user1.has_module_perms("app1"), False)
self.assertEqual(self.user1.has_module_perms("app2"), False)
def test_get_all_permissions(self):
self.assertEqual(self.user1.get_all_permissions(TestObj()), set())
class NoBackendsTest(TestCase):
"""
Tests that an appropriate error is raised if no auth backends are provided.
"""
def setUp(self):
self.old_AUTHENTICATION_BACKENDS = settings.AUTHENTICATION_BACKENDS
settings.AUTHENTICATION_BACKENDS = []
self.user = User.objects.create_user('test', 'test@example.com', 'test')
def tearDown(self):
settings.AUTHENTICATION_BACKENDS = self.old_AUTHENTICATION_BACKENDS
def test_raises_exception(self):
self.assertRaises(ImproperlyConfigured, self.user.has_perm, ('perm', TestObj(),))
class InActiveUserBackend(SimpleRowlevelBackend):
supports_anonymous_user = False
supports_inactive_user = True
class NoInActiveUserBackend(SimpleRowlevelBackend):
supports_anonymous_user = False
supports_inactive_user = False
class InActiveUserBackendTest(TestCase):
"""
Tests for a inactive user delegating to backend if it has 'supports_inactive_user' = True
"""
backend = 'django.contrib.auth.tests.auth_backends.InActiveUserBackend'
def setUp(self):
self.curr_auth = settings.AUTHENTICATION_BACKENDS
settings.AUTHENTICATION_BACKENDS = (self.backend,)
self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
self.user1.is_active = False
self.user1.save()
def tearDown(self):
settings.AUTHENTICATION_BACKENDS = self.curr_auth
def test_has_perm(self):
self.assertEqual(self.user1.has_perm('perm', TestObj()), False)
self.assertEqual(self.user1.has_perm('inactive', TestObj()), True)
def test_has_module_perms(self):
self.assertEqual(self.user1.has_module_perms("app1"), False)
self.assertEqual(self.user1.has_module_perms("app2"), False)
class NoInActiveUserBackendTest(TestCase):
"""
Tests that an inactive user does not delegate to backend if it has 'supports_inactive_user' = False
"""
backend = 'django.contrib.auth.tests.auth_backends.NoInActiveUserBackend'
def setUp(self):
self.curr_auth = settings.AUTHENTICATION_BACKENDS
settings.AUTHENTICATION_BACKENDS = tuple(self.curr_auth) + (self.backend,)
self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
self.user1.is_active = False
self.user1.save()
def tearDown(self):
settings.AUTHENTICATION_BACKENDS = self.curr_auth
def test_has_perm(self):
self.assertEqual(self.user1.has_perm('perm', TestObj()), False)
self.assertEqual(self.user1.has_perm('inactive', TestObj()), True)
def test_has_module_perms(self):
self.assertEqual(self.user1.has_module_perms("app1"), False)
self.assertEqual(self.user1.has_module_perms("app2"), False)
| {
"content_hash": "0a5808476cc0b21295c15de53102d76a",
"timestamp": "",
"source": "github",
"line_count": 350,
"max_line_length": 109,
"avg_line_length": 39.011428571428574,
"alnum_prop": 0.6591475025633514,
"repo_name": "disqus/django-old",
"id": "5163943716a7320c8512d4dc09cb9414e012e41d",
"size": "13654",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "django/contrib/auth/tests/auth_backends.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "JavaScript",
"bytes": "85749"
},
{
"name": "Python",
"bytes": "7413553"
},
{
"name": "Shell",
"bytes": "9076"
}
],
"symlink_target": ""
} |
This is an awful Pong clone in Rust using SDL2. Gotta start somewhere.
## Font
The font used it Alterbro Pixel Font, which seems released under no license but looks great and is available here:
http://www.alterebro.com/works/design/alterebro-pixel-font.ae
| {
"content_hash": "1c3fb13743a3c5a396ed315af92017e0",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 114,
"avg_line_length": 37,
"alnum_prop": 0.7837837837837838,
"repo_name": "dpetersen/vbp",
"id": "5f4d189ecceb80c1bd502bb1c5d49c9f3dac75d1",
"size": "267",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Rust",
"bytes": "8076"
}
],
"symlink_target": ""
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("4. Palidromes 2.0")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("4. Palidromes 2.0")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e11b6ffb-e6f0-49c2-a935-4a129a0d4cb8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| {
"content_hash": "b0e07b23a8b7d619813d04deeee7a531",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 84,
"avg_line_length": 39.083333333333336,
"alnum_prop": 0.7412935323383084,
"repo_name": "DimitarIvanov8/software-university",
"id": "f2a11c69b91a895ede2e6649ebdb5ea8ffabd0bf",
"size": "1410",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Lab/Strings and Text Processing/4. Palidromes 2.0/Properties/AssemblyInfo.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1090849"
},
{
"name": "JavaScript",
"bytes": "62"
},
{
"name": "PLpgSQL",
"bytes": "1228"
},
{
"name": "SQLPL",
"bytes": "14614"
}
],
"symlink_target": ""
} |
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy import Column, Integer, String, Date
from server.data import db, CRUDMixin
import datetime
import sys, re
import simplejson as json
from flask import jsonify
from server.chartviewer.models import *
from server.data import db, compile_query, query_to_list_json, group_concat
from server.users.models import User, WaveMenuAdmin
from sqlalchemy.sql import text, exists, and_, or_, not_, func, operators, literal_column, union_all, distinct
from sqlalchemy.sql import tuple_
from sqlalchemy import cast, select, String
import sqlparse
class Menus(CRUDMixin, db.Model):
__tablename__ = 'menus'
id = db.Column(db.Integer, primary_key=True)
parent_id = db.Column(db.Integer)
name = db.Column(db.String)
url = db.Column(db.String)
svcname = db.Column(db.String)
def __repr__(self):
return '<Menus {0} {1} {2} {3} {4}>'.format(self.id, self.parent_id, self.name, self.url, self.svcname)
class MenusUsers(CRUDMixin, db.Model):
__tablename__ = 'menus_users'
menuid = db.Column(db.Integer, primary_key=True)
userid = db.Column(db.Integer)
crtdt = db.Column(db.Date)
crtid = db.Column(db.String)
def __repr__(self):
return '<Menus {0} {1} {2} {3} {4}>'.format(self.menuid, self.userid, self.crtdt, self.crdid)
def __list_menus(userId):
query = db.session.query().from_statement(
text(
"""
select concat(id,'-',name,'-',url) as parent, GetFamilyTree(id,'"""+userId+"""') as childs
from menus where parent_id = 0 and svcname = 'wave'
"""
))
a = []
for row in db.session.execute(query):
if len(row.childs) != 0:
c = []
for child in row.childs.split(','):
cc = child.split('-')
c.append({'id':cc[0], 'name':cc[1], 'url':cc[2], 'count':cc[3]})
aa = row.parent.split('-')
a.append({'id':aa[0], 'name':aa[1], 'url':aa[2], 'subs':c})
print a
return a
def __list_dswhcolumn(sqlid):
query = db.session.query().from_statement(
text(
"""
select whid, sqlid, colstr, colnm, operand, coltype, filtertype from dswhcolumn where sqlid = :sqlid
"""
)).params(sqlid=sqlid)
return query_to_list_json(query)
def __view_dswhcolumn(sqlid):
query = db.session.query().from_statement(
text(
"""
select whid, sqlid, colstr, colnm, operand, coltype, filtertype from dswhcolumn where sqlid = :sqlid and whid = :whid
"""
)).params(sqlid=sqlid).params(whid=whid)
return query_to_list_json(query)
def __list_dsselect(sqlid,selid):
selidstmt = ""
if selid > 0:
selidstmt = """ and d.selid = """ + str(selid)
query = db.session.query().from_statement(
text(
"""
select
d.sqlid, d.selid, d.selnm, d.seldesc, d.selcols, d.grpbystmt, d.havingstmt, d.orderbystmt, if(a.cnt is NULL, 0, a.cnt) as templates
from dsselect d left join (select sqlid, selid, count(*) cnt from viewtmpl v, dsviewtmpl m where v.tmplid = m.tmplid group by sqlid, selid) a on a.sqlid = d.sqlid and a.selid = d.selid
where 1=1
and d.sqlid = :sqlid
""" + selidstmt
)).params(sqlid=sqlid)
return query_to_list_json(query)
def __list_viewtmpl_sample():
query = db.session.query().from_statement(text(
""" select group_concat(concat(tmplnm,'->',sample) SEPARATOR '</br> *') as sample FROM viewtmpl """
))
return query_to_list_json(query)
def __list_viewtmpl(sqlid, selid):
selstmt = ""
if selid > 0:
selstmt = """ and selid = """ + str(selid)
query = db.session.query().from_statement(
text(
"""
select v.tmplid, v.tmplnm, v.tmpldesc, v.filepath, d.sqlid, d.selid
from viewtmpl v left join dsviewtmpl d on v.tmplid = d.tmplid and d.sqlid = :sqlid and selid = :selid
"""
)).params(sqlid=sqlid).params(selid=selid)
return query_to_list_json(query)
def __add_dsviewtmpl(sqlid, selid, templates):
print '__add_dsviewtmpl start ' + str(templates)
query = db.session.query().from_statement(
text(
"""
delete from dsviewtmpl where sqlid=:sqlid and selid=:selid
"""
)).params(sqlid=sqlid).params(selid=selid)
db.session.execute(query)
for t in templates.split(','):
print t
tmplid = t.split('_')[0]
kwargs = {'sqlid':sqlid, 'selid':selid, 'tmplid':tmplid}
aa = DsViewTmpl.get_or_create(**kwargs)
print aa
def __list_menus_for_admin(sqlid,userid,m_type):
chkquery = db.session.query().from_statement(
text(
"""
select * from wavemenu m1 where m1.parentid = 0 and m1.sqlid = :sqlid and m1.dspnm = :m_type
"""
)).params(sqlid=sqlid).params(m_type=m_type)
results = db.session.execute(chkquery)
if len(list(results)) == 0:
if m_type == 'metric':
dstbltype = 'dsselect'
elif m_type == 'condition':
dstbltype = 'dswhcolumn'
initData = {'parentid':0, 'dspnm':m_type, 'dstbltype':dstbltype, 'dstblid':0, 'sqlid':sqlid, 'leafyn':'N', 'multiselectyn':'N'}
wavemenu = WaveMenu.create(**initData)
print wavemenu
query = db.session.query().from_statement(
text(
"""
select concat( '{',m1,', "nodes":[', group_concat(m2), ']', '}' ) as data from (
select m1, if(m2 is NULL, NULL, if(m2!='', concat('{',m2,',"nodes":[', group_concat(m3) ,']','}' ), '')) as m2 from (
select
if(m1.menuid is not NULL, concat('"id":"',m1.menuid,'", "title":"',m1.dspnm,'","tbltype":"',m1.dstbltype,'","tblid":"',m1.dstblid,'", "multiselectyn":"',m1.multiselectyn,'"'),'') as m1,
if(m2.menuid is not NULL, concat('"id":"',m2.menuid,'", "title":"',m2.dspnm,'","tbltype":"',m2.dstbltype,'","tblid":"',m2.dstblid,'", "multiselectyn":"',m2.multiselectyn,'"'),'') as m2,
if(m3.menuid is not NULL, concat('{"id":"',m3.menuid,'", "title":"',m3.dspnm,'","tbltype":"',m3.dstbltype,'","tblid":"',m3.dstblid,'", "multiselectyn":"',m3.multiselectyn,'"}'), '') as m3
from wavemenu as m1
left join wavemenu as m2 on m2.parentid = m1.menuid
left join wavemenu as m3 on m3.parentid = m2.menuid
where m1.parentid = 0 and m1.sqlid = :sqlid and m1.dspnm = :m_type
) a group by m2
) a
"""
)).params(sqlid=sqlid).params(m_type=m_type)
return query_to_list_json(query)
def __list_dsquery_users(sqlid):
# print str(sqlid) + ' in __list_dsquery_users'
query = db.session.query().from_statement(
text(
"""
SELECT a.id, a.opnm, a.email, m.sqlid, a.orgprefix
FROM admin a LEFT JOIN dsquery_admin m ON m.adminid = a.id AND m.sqlid = :sqlid
where svcname = 'wave'
"""
)).params(sqlid=sqlid)
return query_to_list_json(query)
def __add_dsquery_admin(sqlid, users):
print '__add_dsquery_admin start ' + str(users)
query = db.session.query().from_statement(
text(
"""
delete from dsquery_admin where sqlid = :sqlid
"""
)).params(sqlid=sqlid)
db.session.execute(query)
for t in users.split(','):
print t
adminid = t.split('_')[0]
kwargs = {'adminid':adminid, 'sqlid':sqlid}
aa = DsQueryAdmin.get_or_create(**kwargs)
print aa
def __list_menu_users(menuid):
query = db.session.query().from_statement(
text(
"""
select a.id, a.opnm, a.email, m.menuid
from chartmaker a left join wavemenu_admin m on m.adminid = a.id and m.menuid = :menuid where a.svcname = 'wave'
"""
)).params(menuid=menuid)
return query_to_list_json(query)
def __add_wavemenu_admin(menuid, users):
print '__add_wavemenu_admin start ' + str(users)
query = db.session.query().from_statement(
text(
"""
delete from wavemenu_admin where menuid = :menuid
"""
)).params(menuid=menuid)
db.session.execute(query)
for t in users.split(','):
print t
adminid = t.split('_')[0]
kwargs = {'adminid':adminid, 'menuid':menuid}
aa = WaveMenuAdmin.get_or_create(**kwargs)
print aa
def __test_connection_execute(query_str):
query = db.session.query().from_statement(text(query_str + " limit 1 "))
syntax_err = False
try:
db.session.execute(query)
except Exception as e:
# print e
e_str = str(e.message)
print '------ e_str --------'
print e_str
print '------ e_str end --------'
syntax_err = True
pass
if syntax_err:
return jsonify({'result':'error', 'message':e_str, 'query':query_str})
else:
return jsonify({'result':'success'})
def _available_columns(sqlid):
print '__available_columns(' + str(sqlid) + ')'
query = DsQuery.query.filter(DsQuery.sqlid == sqlid)
data = query_to_list_json(query)
ret = []
for row in data:
query = db.session.query().from_statement(text(row['sqlstmt'] + " limit 1 "))
try:
result = db.session.execute(query)
row = result.fetchone()
# print result.keys()
return result.keys()
except Exception as e:
print e
return []
return []
def _test_dsselect_conntection(sqlid, selcols, grpbystmt, havingstmt, orderbystmt):
query_full_str = selcols+grpbystmt+havingstmt+orderbystmt + ' limit 1'
query = db.session.query().from_statement(text(query_full_str))
syntax_err = False
print query_full_str
try:
result = query_to_list_json(query_full_str)
except Exception as e:
e_str = str(e.message)
syntax_err = True
pass
if syntax_err:
return json.dumps({'result':'error', 'message':e_str, 'query':query_full_str})
else:
return json.dumps({'result':'success', 'resvalue':result, 'message':'', 'query':query_full_str })
# query = DsQuery.query.filter(DsQuery.sqlid == sqlid)
# data = query_to_list_json(query)
# syntax_err = False
# ret = []
# grpbystmt_str = ""
# orderbystmt_str = ""
# for row in data:
# if grpbystmt:
# grpbystmt_str = """ group by """ + grpbystmt
# if havingstmt:
# grpbystmt_str = grpbystmt_str + """ having """ + havingstmt
# if orderbystmt:
# orderbystmt_str = """ order by """ + orderbystmt
#
# query_full_str = """ select """ + selcols + """ from ( """ + row['sqlstmt'] + """ ) a """ + grpbystmt_str + """ """+ orderbystmt_str + """ limit 100 """
#
#
# delta = datetime.timedelta(days=-15)
# sdt = (datetime.datetime.now() + delta).strftime('%Y%m%d')
# edt = datetime.datetime.now().strftime('%Y%m%d')
# if '#sdt#' in query_full_str:
# query_full_str = query_full_str.replace('#sdt#',sdt)
# if '#edt#' in query_full_str:
# query_full_str = query_full_str.replace('#edt#',edt)
# if '#where#' in query_full_str:
# query_full_str = query_full_str.replace('#where#','')
#
# query = db.session.query().from_statement(text(query_full_str))
# print query_full_str
# try:
# result = query_to_list_json(query)
# # row = result.fetchone()
# except Exception as e:
# e_str = str(e.message)
# syntax_err = True
# pass
#
# # kkkk = json.dumps({'resvalue':result})
# # print kkkk
#
# if syntax_err:
# # return jsonify({'result':'error'})
# return json.dumps({'result':'error', 'message':e_str, 'query':query_full_str})
# else:
# return json.dumps({'result':'success', 'resvalue':result, 'message':'', 'query':query_full_str })
def _get_tablename_from_sqlid(sqlid):
query = DsQuery.query.filter(DsQuery.sqlid == sqlid)
datas = []
data = query_to_list_json(query)
for row in data:
sql = row['sqlstmt']
print sql.lower()
m = re.search('from\s+(^\s)*[^\(]*\s+where', sql.lower())
print m.group(0)
aa = m.group(0).replace('from','').replace('where','').strip()
if ',' in aa:
bb = aa.split(',')
else:
bb = [aa]
bb = [[ v for v in b.strip().split(' ') if ' ' in b][0] if ' ' in b else b.strip() for b in bb]
print bb
for b in bb:
query = db.session.query().from_statement(text("describe " + b))
result = db.session.execute(query)
for row in result:
# datas.append(b + "->" + row['Field'])
# print row['Field'] + '-' + row['Key']
if row['Key'] == 'PRI':
datas.append({'value':row['Field'] ,'dspnm':b + '.' +row['Field'] + '[primary key]'})
else:
datas.append({'value':row['Field'] ,'dspnm':b + '.' +row['Field']})
# print '_get_tablename_from_sqlid result ---->'
print datas
return datas
def __list_dsquery(userid):
query = db.session.query().from_statement(
text(
"""
select
q.*,
ifnull((select count(*) as cnt from dsselect t where t.sqlid = q.sqlid ),0) as selcnt,
ifnull((select count(*) as cnt from dswhcolumn t where t.sqlid = q.sqlid ),0) as colcnt,
ifnull((select count(*) as cnt from dswhvalue t where t.sqlid = q.sqlid ),0) as valcnt
from dsquery q , dsquery_admin qa
where 1
and q.sqlid = qa.sqlid
and qa.adminid = :userid
"""
)).params(userid=userid)
return query_to_list_json(query)
def __get_values_from_sqlid(sqlid, whid, valstr):
# print '===> begin __get_values_from_sqlid... ' + sqlid + ' / ' + whid + ' / ' + valstr
query = DsQuery.query.filter(DsQuery.sqlid == sqlid)
datas = []
data = query_to_list_json(query)
if whid is None:
wwhid = -1
else:
wwhid = whid
# print data
for row in data:
sql = row['sqlstmt']
print sql.lower()
m = re.search('from\s+(^\s)*[^\(]*\s+where', sql.lower())
# print m.group(0)
aa = m.group(0).replace('from','').replace('where','').strip()
print aa
if ',' in aa:
bb = aa.split(',')
cc = []
for b in bb:
if 'left join' in b:
cc.append(b.split('left join')[0].split(' ')[0])
cc.append(b.split('left join')[1].split(' ')[0])
else:
if ' ' in b:
cc.append(b.strip().split(' ')[0])
else:
print cc
print b
cc.append(b)
bb = cc
elif 'left join' in aa:
bb = [aa.split('left join')[0].strip().split(' ')[0], aa.split('left join')[1].strip().split(' ')[0]]
else:
bb = [aa]
bb = [[ v for v in b.strip().split(' ') if ' ' in b][0] if ' ' in b else b.strip() for b in bb]
print '====> now what contains in bb '
print bb
for b in bb:
query = db.session.query().from_statement(text("select a.valstr, b.valnm, if(b.valstr is NULL, 0, 1) as chk from ( select distinct "+valstr+" as valstr from "+b+" ) a left join (select * from dswhvalue where sqlid = "+str(sqlid)+" and whid= "+str(wwhid)+") b on a.valstr= b.valstr "))
try:
datas += query_to_list_json(query)
except:
print 'error'
print datas
return datas
def __update__whvalue(sqlid, whid, vallist):
print '__update__whvalue start ' + str(sqlid) + ' / ' + str(whid)
aa = DsWhValue.query.filter(DsWhValue.sqlid==sqlid).filter(DsWhValue.whid==whid).all()
newarr = []
print aa
for val in vallist:
exists = False;
for a in aa:
print '----- a is ----'
print a.valstr + ' --- ' + val['valstr']
if a.valstr == val['valstr']:
exists = True;
if exists is False:
newarr.append({'valstr':val['valstr'], 'valnm':val['valnm'], 'whid':whid, 'sqlid':sqlid})
print 'new array length is ' + str(len(newarr))
for arr in newarr:
t = arr
dsvalue = DsWhValue.create(**t)
print str(dsvalue)
| {
"content_hash": "9f134bbecd20eb69a5008601d3fe2129",
"timestamp": "",
"source": "github",
"line_count": 458,
"max_line_length": 296,
"avg_line_length": 37.31659388646288,
"alnum_prop": 0.5340237551927915,
"repo_name": "ddinsight/dd-analytics",
"id": "0d91974f33bb4161b5128996ed8b64ddb7eb88b8",
"size": "17682",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dataview/web/server/chartmaker/models.py",
"mode": "33261",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "348"
},
{
"name": "CSS",
"bytes": "73007"
},
{
"name": "HTML",
"bytes": "556393"
},
{
"name": "JavaScript",
"bytes": "1642669"
},
{
"name": "PHP",
"bytes": "4635"
},
{
"name": "Python",
"bytes": "302751"
},
{
"name": "Shell",
"bytes": "3038"
}
],
"symlink_target": ""
} |
Connected
=========
Connected! is a connected textures API for Minecraft 1.7.10 that allows your blocks to have connected textures in multiple forms.
The ones that are implemented right now are:
- Normal blocks
- FMP microblocks
- BuildCraft facades
- EnderIO painted blocks
- EnderIO conduit facades
- Blocks implementing CoFHLib's *IBlockAppearance* interface
Other mod blocks I'm going to try to add support for are:
- AE2 Facades (I'm currently working on a PR to get it working)
- Carpenter's Blocks
Usage in mods as an API
=========
DO NOT USE IT FOR NOW.
License
=========
This project is running under the MIT license, which states that you can copy and redistribute any of its code as long as I'm mentioned as an author and you have a link to the source (this repository).
| {
"content_hash": "aa30b1644f8d2e646b1725a0c0a4386f",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 201,
"avg_line_length": 35.86363636363637,
"alnum_prop": 0.7515842839036755,
"repo_name": "amadornes/Connected",
"id": "207e50d625f8646d9c4a1a6b422ed73280d91a5d",
"size": "789",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "182259"
}
],
"symlink_target": ""
} |
require File.expand_path('../../test_helper', __FILE__)
class AddressTest < ActiveSupport::TestCase
def test_should_generate_full_address
address = Address.new
address.street1 = "300 Boylston Ave E"
address.street2 = "Piso2 Dto.4"
address.city = "Seattle"
address.region = "WA"
address.postcode = "98102"
address.country_code = "US"
address.save
address.reload
assert_equal "300 Boylston Ave E, Piso2 Dto.4, Seattle, 98102, WA, United States", address.full_address
end
def test_should_generate_to_s
address = Address.new
address.street1 = "300 Boylston Ave E"
address.street2 = "Piso2 Dto.4"
address.city = "Seattle"
address.region = "WA"
address.postcode = "98102"
address.country_code = "US"
assert_equal "300 Boylston Ave E, Piso2 Dto.4, Seattle, 98102, WA, United States", address.to_s
end
def test_should_generate_particular_full_address
address = Address.new
address.street1 = "300 Boylston Ave E"
address.city = "Seattle"
address.postcode = "98102"
address.region = ""
address.country_code = "US"
address.save
address.reload
assert_equal "300 Boylston Ave E, Seattle, 98102, United States", address.full_address
end
def test_should_generate_us_post_address
address = Address.new
address.street1 = "300 Boylston Ave E"
address.city = "Seattle"
address.postcode = "98102"
address.region = "WA"
address.country_code = "US"
assert_equal "300 Boylston Ave E\nSeattle, 98102\nWA\nUnited States", address.post_address
end
def test_should_generate_us_post_address_with_double_spaces
Setting.plugin_redmine_contacts["post_address_format"] = "%street1%\n%street2%\n%city% %region% %postcode%\n%country%"
address = Address.new
address.street1 = "300 Boylston Ave E"
address.city = "Seattle"
address.postcode = "98102"
address.region = "WA"
address.country_code = "US"
assert_equal "300 Boylston Ave E\nSeattle WA 98102\nUnited States", address.post_address
end
def test_should_generate_ru_post_address
address = Address.new
address.street1 = "ул. Маршала Жукова, 6"
address.city = "г. Арзамас"
address.postcode = "611137"
address.region = "Нижегородская область"
address.country_code = "RU"
assert_equal "ул. Маршала Жукова, 6\nг. Арзамас, 611137\nНижегородская область\nRussia", address.post_address
end
def test_should_generate_ru_post_address_with_empty_region
address = Address.new
address.street1 = "ул. Новая Басманная, 14"
address.city = "г. Москва"
address.postcode = "145013"
address.country_code = "RU"
assert_equal "ул. Новая Басманная, 14\nг. Москва, 145013\nRussia", address.post_address
end
def test_should_strip_empty_lines_and_punctuation
Setting.plugin_redmine_contacts["post_address_format"] = "%street1%,\n,%street2%,,,\n%city%, %postcode%\n%region%\n%country%"
address = Address.new
address.city = "Seattle"
address.region = "WA"
address.country_code = "US"
assert_equal "Seattle\nWA\nUnited States", address.post_address
end
end
| {
"content_hash": "640c431f7e90bfffcceaaba4ebb0dadc",
"timestamp": "",
"source": "github",
"line_count": 101,
"max_line_length": 129,
"avg_line_length": 31.11881188118812,
"alnum_prop": 0.6862869869551385,
"repo_name": "cema-sp/docker-redmine",
"id": "797f7a4b7f82eec1aa29cbb1349ee67a31813383",
"size": "4153",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "to_data/plugins/redmine_contacts/test/unit/address_test.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "434821"
},
{
"name": "HTML",
"bytes": "278192"
},
{
"name": "JavaScript",
"bytes": "110649"
},
{
"name": "Makefile",
"bytes": "935"
},
{
"name": "Python",
"bytes": "89798"
},
{
"name": "Ruby",
"bytes": "1117865"
},
{
"name": "Shell",
"bytes": "40768"
}
],
"symlink_target": ""
} |
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Game.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Tests.Visual
{
[TestFixture]
public class TestCaseDialogOverlay : OsuTestCase
{
public TestCaseDialogOverlay()
{
DialogOverlay overlay;
Add(overlay = new DialogOverlay());
AddStep("dialog #1", () => overlay.Push(new PopupDialog
{
Icon = FontAwesome.fa_trash_o,
HeaderText = @"Confirm deletion of",
BodyText = @"Ayase Rie - Yuima-ru*World TVver.",
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"I never want to see this again.",
Action = () => System.Console.WriteLine(@"OK"),
},
new PopupDialogCancelButton
{
Text = @"Firetruck, I still want quick ranks!",
Action = () => System.Console.WriteLine(@"Cancel"),
},
},
}));
AddStep("dialog #2", () => overlay.Push(new PopupDialog
{
Icon = FontAwesome.fa_gear,
HeaderText = @"What do you want to do with",
BodyText = "Camellia as \"Bang Riot\" - Blastix Riotz",
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton
{
Text = @"Manage collections",
},
new PopupDialogOkButton
{
Text = @"Delete...",
},
new PopupDialogOkButton
{
Text = @"Remove from unplayed",
},
new PopupDialogOkButton
{
Text = @"Clear local scores",
},
new PopupDialogOkButton
{
Text = @"Edit",
},
new PopupDialogCancelButton
{
Text = @"Cancel",
},
},
}));
}
}
}
| {
"content_hash": "bbef01c37e261c009ee2f1b3c96832d5",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 79,
"avg_line_length": 33.77333333333333,
"alnum_prop": 0.416502171338334,
"repo_name": "naoey/osu",
"id": "e832793fc26237456999d01f70c3fa2b09ce9220",
"size": "2535",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "osu.Game.Tests/Visual/TestCaseDialogOverlay.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "4122627"
},
{
"name": "PowerShell",
"bytes": "2550"
},
{
"name": "Ruby",
"bytes": "6173"
},
{
"name": "Shell",
"bytes": "1031"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.