text
stringlengths 18
215k
|
|---|
b'What is (33 - (58 + -33)) + (4 - -3)?\n'
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<meta name="collection" content="api">
<!-- Generated by javadoc (build 1.5.0-rc) on Wed Aug 11 07:27:53 PDT 2004 -->
<TITLE>
Binding (Java 2 Platform SE 5.0)
</TITLE>
<META NAME="keywords" CONTENT="org.omg.CosNaming.Binding class">
<META NAME="keywords" CONTENT="binding_name">
<META NAME="keywords" CONTENT="binding_type">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Binding (Java 2 Platform SE 5.0)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= 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/Binding.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>
<b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Standard Ed. 5.0</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../org/omg/CosNaming/_NamingContextStub.html" title="class in org.omg.CosNaming"><B>PREV CLASS</B></A>
<A HREF="../../../org/omg/CosNaming/BindingHelper.html" title="class in org.omg.CosNaming"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/omg/CosNaming/Binding.html" target="_top"><B>FRAMES</B></A>
<A HREF="Binding.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="#methods_inherited_from_class_java.lang.Object">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> | METHOD</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.omg.CosNaming</FONT>
<BR>
Class Binding</H2>
<PRE>
<A HREF="../../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.omg.CosNaming.Binding</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../java/io/Serializable.html" title="interface in java.io">Serializable</A>, <A HREF="../../../org/omg/CORBA/portable/IDLEntity.html" title="interface in org.omg.CORBA.portable">IDLEntity</A></DD>
</DL>
<HR>
<DL>
<DT><PRE>public final class <B>Binding</B><DT>extends <A HREF="../../../java/lang/Object.html" title="class in java.lang">Object</A><DT>implements <A HREF="../../../org/omg/CORBA/portable/IDLEntity.html" title="interface in org.omg.CORBA.portable">IDLEntity</A></DL>
</PRE>
<P>
org/omg/CosNaming/Binding.java .
Generated by the IDL-to-Java compiler (portable), version "3.2"
from ../../../../src/share/classes/org/omg/CosNaming/nameservice.idl
Wednesday, August 11, 2004 5:04:12 AM GMT-08:00
<P>
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../serialized-form.html#org.omg.CosNaming.Binding">Serialized Form</A></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> <A HREF="../../../org/omg/CosNaming/NameComponent.html" title="class in org.omg.CosNaming">NameComponent</A>[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/omg/CosNaming/Binding.html#binding_name">binding_name</A></B></CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../org/omg/CosNaming/BindingType.html" title="class in org.omg.CosNaming">BindingType</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../org/omg/CosNaming/Binding.html#binding_type">binding_type</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/omg/CosNaming/Binding.html#Binding()">Binding</A></B>()</CODE>
<BR>
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../org/omg/CosNaming/Binding.html#Binding(org.omg.CosNaming.NameComponent[], org.omg.CosNaming.BindingType)">Binding</A></B>(<A HREF="../../../org/omg/CosNaming/NameComponent.html" title="class in org.omg.CosNaming">NameComponent</A>[] _binding_name,
<A HREF="../../../org/omg/CosNaming/BindingType.html" title="class in org.omg.CosNaming">BindingType</A> _binding_type)</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>
</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.<A HREF="../../../java/lang/Object.html" title="class in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../../java/lang/Object.html#toString()">toString</A>, <A HREF="../../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../../java/lang/Object.html#wait(long, int)">wait</A></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="binding_name"><!-- --></A><H3>
binding_name</H3>
<PRE>
public <A HREF="../../../org/omg/CosNaming/NameComponent.html" title="class in org.omg.CosNaming">NameComponent</A>[] <B>binding_name</B></PRE>
<DL>
<DL>
</DL>
</DL>
<HR>
<A NAME="binding_type"><!-- --></A><H3>
binding_type</H3>
<PRE>
public <A HREF="../../../org/omg/CosNaming/BindingType.html" title="class in org.omg.CosNaming">BindingType</A> <B>binding_type</B></PRE>
<DL>
<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="Binding()"><!-- --></A><H3>
Binding</H3>
<PRE>
public <B>Binding</B>()</PRE>
<DL>
</DL>
<HR>
<A NAME="Binding(org.omg.CosNaming.NameComponent[], org.omg.CosNaming.BindingType)"><!-- --></A><H3>
Binding</H3>
<PRE>
public <B>Binding</B>(<A HREF="../../../org/omg/CosNaming/NameComponent.html" title="class in org.omg.CosNaming">NameComponent</A>[] _binding_name,
<A HREF="../../../org/omg/CosNaming/BindingType.html" title="class in org.omg.CosNaming">BindingType</A> _binding_type)</PRE>
<DL>
</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/Binding.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>
<b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Standard Ed. 5.0</b></EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../org/omg/CosNaming/_NamingContextStub.html" title="class in org.omg.CosNaming"><B>PREV CLASS</B></A>
<A HREF="../../../org/omg/CosNaming/BindingHelper.html" title="class in org.omg.CosNaming"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?org/omg/CosNaming/Binding.html" target="_top"><B>FRAMES</B></A>
<A HREF="Binding.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="#methods_inherited_from_class_java.lang.Object">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> | METHOD</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
<font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="../../../../relnotes/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to <a href="../../../../relnotes/license.html">license terms</a>. Also see the <a href="http://java.sun.com/docs/redist.html">documentation redistribution policy</a>.</font>
<!-- Start SiteCatalyst code -->
<script language="JavaScript" src="http://www.oracle.com/ocom/groups/systemobject/@mktg_admin/documents/systemobject/s_code_download.js"></script>
<script language="JavaScript" src="http://www.oracle.com/ocom/groups/systemobject/@mktg_admin/documents/systemobject/s_code.js"></script>
<!-- ********** DO NOT ALTER ANYTHING BELOW THIS LINE ! *********** -->
<!-- Below code will send the info to Omniture server -->
<script language="javascript">var s_code=s.t();if(s_code)document.write(s_code)</script>
<!-- End SiteCatalyst code -->
</body>
</HTML>
|
<!DOCTYPE HTML>
<html>
<head>
<title>Gamecraft CI</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="/webjars/bootstrap/3.3.7-1/css/bootstrap.min.css"/>
<link rel="stylesheet" href="/css/dashboard.css"/>
<script src="/webjars/jquery/1.11.1/jquery.min.js"></script>
<script src="/webjars/bootstrap/3.3.7-1/js/bootstrap.min.js"></script>
<script src="/js/account_operations.js"></script>
<script src="/js/ui_operations.js"></script>
<script src="/js/validator.min.js"></script>
<script src="/js/lang_operations.js"></script>
<script>
checkAuthState();
setDefaultLanguage();
loadNavbar();
</script>
</head>
<body>
<div class="navbar-frame"></div>
<div class="container">
<!-- Main component for a primary marketing message or call to action -->
<div class="jumbotron">
<h1>Welcome to Gamecraft!</h1>
<div class="alert alert-success" role="alert">You are logged in as user "<script> document.write(getUsername())</script>".</div>
<p>If you have any question on Gamecraft:</p>
<ul>
<li><a href="https://github.com/iMartinezMateu/gamecraft/issues?state=open" target="_blank" rel="noopener" >Gamecraft bug tracker</a></li>
<li><a href="https://github.com/iMartinezMateu/gamecraft/wiki" target="_blank" rel="noopener" >Gamecraft wiki</a></li>
</ul>
<p>
<span jhiTranslate="home.like">If you like Gamecraft, don't forget to give us a star on</span> <a href="https://github.com/iMartinezMateu/gamecraft" target="_blank" rel="noopener" >GitHub</a>!
</p>
<img src="/img/gamecraft.png" alt="Gamecraft" class="center-block" />
</div>
</div> <!-- /container -->
</body>
</html>
|
var Struct = ( function()
{
return function ( members )
{
var mode = "default";
var ctor = function( values )
{
if ( mode === "new" )
{
mode = "void";
return new Struct();
}
if ( mode === "void" )
return;
mode = "new";
var instance = Struct();
mode = "default";
extend( instance, members, values || {} );
return instance;
};
var Struct = function() {
return ctor.apply( undefined, arguments );
};
return Struct;
};
function extend( instance, members, values )
{
var pending = [{
src: values,
tmpl: members,
dest: instance
}];
while ( pending.length )
{
var task = pending.shift();
if ( task.array )
{
var i = 0, len = task.array.length;
for ( ; i < len; i++ )
{
switch ( typeOf( task.array[ i ] ) )
{
case "object":
var template = task.array[ i ];
task.array[ i ] = {};
pending.push({
tmpl: template,
dest: task.array[ i ]
});
break;
case "array":
task.array[ i ] = task.array[ i ].slice( 0 );
pending.push({
array: task.array[ i ]
});
break;
}
}
}
else
{
for ( var prop in task.tmpl )
{
if ( task.src[ prop ] !== undefined )
task.dest[ prop ] = task.src[ prop ];
else
{
switch ( typeOf( task.tmpl[ prop ] ) )
{
case "object":
task.dest[ prop ] = {};
pending.push({
tmpl: task.tmpl[ prop ],
dest: task.dest[ prop ]
});
break;
case "array":
task.dest[ prop ] = task.tmpl[ prop ].slice( 0 );
pending.push({
array: task.dest[ prop ]
});
break;
default:
task.dest[ prop ] = task.tmpl[ prop ];
break;
}
}
}
}
}
}
} () );
|
b'4 - (-7 - -19 - 8 - (0 - 0))\n'
|
'use strict';
/* https://github.com/angular/protractor/blob/master/docs/toc.md */
describe('my app', function() {
browser.get('index.html');
it('should automatically redirect to /home when location hash/fragment is empty', function() {
expect(browser.getLocationAbsUrl()).toMatch("/home");
});
describe('view1', function() {
beforeEach(function() {
browser.get('index.html#/home');
});
it('should render home when user navigates to /home', function() {
expect(element.all(by.css('[ng-view] p')).first().getText()).
toMatch(/partial for view 1/);
});
});
describe('view2', function() {
beforeEach(function() {
browser.get('index.html#/view2');
});
it('should render view2 when user navigates to /view2', function() {
expect(element.all(by.css('[ng-view] p')).first().getText()).
toMatch(/partial for view 2/);
});
});
});
|
# Dreedi
To start your this app:
1. Install dependencies with `mix deps.get`
2. Create and migrate your database with `mix ecto.create && mix ecto.migrate`
3. Start Phoenix endpoint with `mix phoenix.server`
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
|
<?php
namespace infinitydevphp\gii\migration;
use infinitydevphp\MultipleModelValidator\MultipleModelValidator;
use infinitydevphp\tableBuilder\TableBuilder;
use infinitydevphp\tableBuilder\TableBuilderTemplateMigration;
use infinitydevphp\gii\models\Field;
use yii\db\ColumnSchema;
use yii\db\Schema;
use yii\db\TableSchema;
use yii\gii\CodeFile;
use yii\helpers\ArrayHelper;
use yii\gii\Generator as GeneratorBase;
use Yii;
use yii\validators\RangeValidator;
class Generator extends GeneratorBase
{
public $db = 'db';
public $fields = [];
public $tableName;
public $migrationPath = '@common/migrations/db';
public $fileName = '';
public $migrationName = '';
public $useTablePrefix = true;
public function init()
{
parent::init();
}
public function attributeHints()
{
return ArrayHelper::merge(parent::attributeHints(), [
'tableName' => 'Origin table name',
'fieldsOrigin' => 'Origin table fields for DB table creation',
'autoCreateTable' => 'Options for run create table query',
'migrationPath' => 'Migration path',
'fields' => 'Table fields'
]);
}
public function rules()
{
$rules = ArrayHelper::merge(parent::rules(), [
// [['tableName'], RangeValidator::className(), 'not' => true, 'range' => $this->tablesList, 'message' => 'Table name exists'],
[['tableName'], 'required'],
[['tableName'], 'match', 'pattern' => '/^(\w+\.)?([\w\*]+)$/', 'message' => 'Only word characters, and optionally an asterisk and/or a dot are allowed.'],
[['fields'], MultipleModelValidator::className(), 'baseModel' => Field::className()],
[['useTablePrefix'], 'boolean'],
[['migrationPath', 'migrationName'], 'safe'],
]);
return $rules;
}
public function attributeLabels()
{
return ArrayHelper::merge(parent::attributeLabels(), [
'fields' => 'Table fields'
]);
}
protected function getTableFields() {
if (sizeof($this->fields) > 1)
return;
$pks = [];
$table = Yii::$app->db->schema->getTableSchema($this->tableName);
if ($table && $columns = $table->columns) {
$pks = $table->primaryKey;
/** @var ColumnSchema[] $columns */
$this->fields = [];
foreach ($columns as $name => $column) {
$this->fields[] = new Field([
'name' => $name,
'length' => $column->size,
'type' => $column->phpType,
'precision' => $column->precision,
'scale' => $column->scale,
'comment' => $column->comment,
'is_not_null' => !$column->allowNull,
'isCompositeKey' => in_array($name, $pks),
]);
}
}
return $pks;
}
public function generate()
{
$this->tableName = preg_replace('/({{%)(\w+)(}})?/', "$2", $this->tableName);
$tableName = $this->tableName;
if ($this->useTablePrefix) {
$tableName = "{{%{$tableName}}}";
}
$primary = $this->getTableFields();
$files = [];
$this->migrationName = Yii::$app->session->get($this->tableName) ?: false;
$mCreate = new TableBuilderTemplateMigration([
'tableName' => $tableName,
'fields' => $this->fields,
'useTablePrefix' => $this->useTablePrefix,
]);
if (!$this->migrationName) {
Yii::$app->session->set($this->tableName, $mCreate->migrationName);
}
$this->migrationName = $this->migrationName ?: Yii::$app->session->get($this->tableName);
$mCreate->migrationName = $this->migrationName ?: $mCreate->migrationName;
$files[] = new CodeFile(
Yii::getAlias($this->migrationPath) . '/' . $mCreate->migrationName . '.php',
$mCreate->runQuery()
);
return $files;
}
public function getName()
{
return 'Migration Generator';
}
public function defaultTemplate()
{
return parent::defaultTemplate();
}
public function getDescription()
{
return 'This generator helps you create migration from existing table';
}
public function stickyAttributes()
{
return ArrayHelper::merge(parent::stickyAttributes(), ['db', 'migrationPath']);
}
}
|
package org.peerbox.presenter;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.layout.Pane;
public class MainController implements INavigatable {
@FXML
private Pane mainPane;
/*
* (non-Javadoc)
*
* @see org.peerbox.presenter.INavigatable#setContent(javafx.scene.Node)
*/
@Override
public void setContent(Node content) {
mainPane.getChildren().clear();
mainPane.getChildren().add(content);
mainPane.requestLayout();
}
}
|
b'(-12 - 2) + 2 - (-1174 - -1168)\n'
|
b'What is the value of 7 - (2 + (11 - -5) + -21)?\n'
|
<?php
/*
SQL Laboratory - Web based MySQL administration
http://projects.deepcode.net/sqllaboratory/
types.php
- list of data types
MIT-style license
2008 Calvin Lough <http://calv.in>, 2010 Steve Gricci <http://deepcode.net>
*/
$typeList[] = "varchar";
$typeList[] = "char";
$typeList[] = "text";
$typeList[] = "tinytext";
$typeList[] = "mediumtext";
$typeList[] = "longtext";
$typeList[] = "tinyint";
$typeList[] = "smallint";
$typeList[] = "mediumint";
$typeList[] = "int";
$typeList[] = "bigint";
$typeList[] = "real";
$typeList[] = "double";
$typeList[] = "float";
$typeList[] = "decimal";
$typeList[] = "numeric";
$typeList[] = "date";
$typeList[] = "time";
$typeList[] = "datetime";
$typeList[] = "timestamp";
$typeList[] = "tinyblob";
$typeList[] = "blob";
$typeList[] = "mediumblob";
$typeList[] = "longblob";
$typeList[] = "binary";
$typeList[] = "varbinary";
$typeList[] = "bit";
$typeList[] = "enum";
$typeList[] = "set";
$textDTs[] = "text";
$textDTs[] = "mediumtext";
$textDTs[] = "longtext";
$numericDTs[] = "tinyint";
$numericDTs[] = "smallint";
$numericDTs[] = "mediumint";
$numericDTs[] = "int";
$numericDTs[] = "bigint";
$numericDTs[] = "real";
$numericDTs[] = "double";
$numericDTs[] = "float";
$numericDTs[] = "decimal";
$numericDTs[] = "numeric";
$binaryDTs[] = "tinyblob";
$binaryDTs[] = "blob";
$binaryDTs[] = "mediumblob";
$binaryDTs[] = "longblob";
$binaryDTs[] = "binary";
$binaryDTs[] = "varbinary";
$sqliteTypeList[] = "varchar";
$sqliteTypeList[] = "integer";
$sqliteTypeList[] = "float";
$sqliteTypeList[] = "varchar";
$sqliteTypeList[] = "nvarchar";
$sqliteTypeList[] = "text";
$sqliteTypeList[] = "boolean";
$sqliteTypeList[] = "clob";
$sqliteTypeList[] = "blob";
$sqliteTypeList[] = "timestamp";
$sqliteTypeList[] = "numeric";
?>
|
b'What is the value of -5 - -1 - (-21 + (89 - 56))?\n'
|
#region License
// Distributed under the MIT License
// ============================================================
// Copyright (c) 2019 Hotcakes Commerce, LLC
//
// 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.
#endregion
using System;
using DotNetNuke.Entities.Host;
using Hotcakes.Commerce.Configuration;
namespace Hotcakes.Commerce.Dnn
{
[Serializable]
public class DnnConfigurationManager : IConfigurationManager
{
public SmtpSettings SmtpSettings
{
get
{
var smtpSettings = new SmtpSettings();
var smtpHostParts = Host.SMTPServer.Split(':');
smtpSettings.Host = smtpHostParts[0];
if (smtpHostParts.Length > 1)
{
smtpSettings.Port = smtpHostParts[1];
}
switch (Host.SMTPAuthentication)
{
case "":
case "0": //anonymous
smtpSettings.UseAuth = false;
break;
case "1": //basic
smtpSettings.UseAuth = true;
break;
case "2": //NTLM
smtpSettings.UseAuth = false;
break;
}
smtpSettings.EnableSsl = Host.EnableSMTPSSL;
smtpSettings.Username = Host.SMTPUsername;
smtpSettings.Password = Host.SMTPPassword;
return smtpSettings;
}
}
}
}
|
package se.dsv.waora.deviceinternetinformation;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.widget.TextView;
/**
* <code>ConnectionActivity</code> presents UI for showing if the device
* is connected to internet.
*
* @author Dushant Singh
*/
public class ConnectionActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Initiate view
TextView connectivityStatus = (TextView) findViewById(R.id.textViewDeviceConnectivity);
// Get connectivity service.
ConnectivityManager manager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
// Get active network information
NetworkInfo activeNetwork = manager.getActiveNetworkInfo();
// Check if active network is connected.
boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting();
if (isConnected) {
// Set status connected
connectivityStatus.setText(getString(R.string.online));
connectivityStatus.setTextColor(getResources().getColor(R.color.color_on));
// Check if connected with wifi
boolean isWifiOn = activeNetwork.getType() == ConnectivityManager.TYPE_WIFI;
if (isWifiOn) {
// Set wifi status on
TextView wifiTextView = (TextView) findViewById(R.id.textViewWifi);
wifiTextView.setText(getString(R.string.on));
wifiTextView.setTextColor(getResources().getColor(R.color.color_on));
} else {
// Set mobile data status on.
TextView mobileDataTextView = (TextView) findViewById(R.id.textViewMobileData);
mobileDataTextView.setText(getString(R.string.on));
mobileDataTextView.setTextColor(getResources().getColor(R.color.color_on));
}
}
}
}
|
/*
* COPYRIGHT: Stealthy Labs LLC
* DATE: 29th May 2015
* AUTHOR: Stealthy Labs
* SOFTWARE: Tea Time
*/
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <teatime.h>
static int teatime_check_gl_version(uint32_t *major, uint32_t *minor);
static int teatime_check_program_errors(GLuint program);
static int teatime_check_shader_errors(GLuint shader);
#define TEATIME_BREAKONERROR(FN,RC) if ((RC = teatime_check_gl_errors(__LINE__, #FN )) < 0) break
#define TEATIME_BREAKONERROR_FB(FN,RC) if ((RC = teatime_check_gl_fb_errors(__LINE__, #FN )) < 0) break
teatime_t *teatime_setup()
{
int rc = 0;
teatime_t *obj = calloc(1, sizeof(teatime_t));
if (!obj) {
fprintf(stderr, "Out of memory allocating %zu bytes\n",
sizeof(teatime_t));
return NULL;
}
do {
uint32_t version[2] = { 0, 0};
if (teatime_check_gl_version(&version[0], &version[1]) < 0) {
fprintf(stderr, "Unable to verify OpenGL version\n");
rc = -1;
break;
}
if (version[0] < 3) {
fprintf(stderr, "Minimum Required OpenGL version 3.0. You have %u.%u\n",
version[0], version[1]);
rc = -1;
break;
}
/* initialize off-screen framebuffer */
/*
* This is the EXT_framebuffer_object OpenGL extension that allows us to
* use an offscreen buffer as a target for rendering operations such as
* vector calculations, providing full precision and removing unwanted
* clamping issues.
* we are turning off the traditional framebuffer here apparently.
*/
glGenFramebuffersEXT(1, &(obj->ofb));
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, obj->ofb);
TEATIME_BREAKONERROR(glBindFramebufferEXT, rc);
fprintf(stderr, "Successfully created off-screen framebuffer with id: %d\n",
obj->ofb);
/* get the texture size */
obj->maxtexsz = -1;
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &(obj->maxtexsz));
fprintf(stderr, "Maximum Texture size for the GPU: %d\n", obj->maxtexsz);
obj->itexid = obj->otexid = 0;
obj->shader = obj->program = 0;
} while (0);
if (rc < 0) {
teatime_cleanup(obj);
obj = NULL;
}
return obj;
}
void teatime_cleanup(teatime_t *obj)
{
if (obj) {
teatime_delete_program(obj);
teatime_delete_textures(obj);
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glDeleteFramebuffersEXT(1, &(obj->ofb));
glFlush();
free(obj);
obj = NULL;
}
}
int teatime_set_viewport(teatime_t *obj, uint32_t ilen)
{
uint32_t texsz = (uint32_t)((long)(sqrt(ilen / 4.0)));
if (obj && texsz > 0 && texsz < (GLuint)obj->maxtexsz) {
/* viewport mapping 1:1 pixel = texel = data mapping */
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, texsz, 0.0, texsz);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glViewport(0, 0, texsz, texsz);
obj->tex_size = texsz;
fprintf(stderr, "Texture size: %u x %u\n", texsz, texsz);
return 0;
} else if (obj) {
fprintf(stderr, "Max. texture size is %d. Calculated: %u from input length: %u\n",
obj->maxtexsz, texsz, ilen);
}
return -EINVAL;
}
int teatime_create_textures(teatime_t *obj, const uint32_t *input, uint32_t ilen)
{
if (obj && input && ilen > 0) {
int rc = 0;
do {
uint32_t texsz = (uint32_t)((long)(sqrt(ilen / 4.0)));
if (texsz != obj->tex_size) {
fprintf(stderr, "Viewport texture size(%u) != Input texture size (%u)\n",
obj->tex_size, texsz);
rc = -EINVAL;
break;
}
glGenTextures(1, &(obj->itexid));
glGenTextures(1, &(obj->otexid));
fprintf(stderr, "Created input texture with ID: %u\n", obj->itexid);
fprintf(stderr, "Created output texture with ID: %u\n", obj->otexid);
/** BIND ONE TEXTURE AT A TIME **/
/* the texture target can vary depending on GPU */
glBindTexture(GL_TEXTURE_2D, obj->itexid);
TEATIME_BREAKONERROR(glBindTexture, rc);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
/* turn off filtering and set proper wrap mode - this is obligatory for
* floating point textures */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
TEATIME_BREAKONERROR(glTexParameteri, rc);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
TEATIME_BREAKONERROR(glTexParameteri, rc);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
TEATIME_BREAKONERROR(glTexParameteri, rc);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
TEATIME_BREAKONERROR(glTexParameteri, rc);
/* create a 2D texture of the same size as the data
* internal format: GL_RGBA32UI_EXT
* texture format: GL_RGBA_INTEGER
* texture type: GL_UNSIGNED_INT
*/
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI_EXT,
texsz, texsz, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
TEATIME_BREAKONERROR(glTexImage2D, rc);
/* transfer data to texture */
#ifdef WIN32
glTexSubImage2D
#else
glTexSubImage2DEXT
#endif
(GL_TEXTURE_2D, 0, 0, 0, obj->tex_size,
obj->tex_size, GL_RGBA_INTEGER, GL_UNSIGNED_INT, input);
#ifdef WIN32
TEATIME_BREAKONERROR(glTexSubImage2D, rc);
#else
TEATIME_BREAKONERROR(glTexSubImage2DEXT, rc);
#endif
fprintf(stderr, "Successfully transferred input data to texture ID: %u\n", obj->itexid);
/* BIND the OUTPUT texture and work on it */
/* the texture target can vary depending on GPU */
glBindTexture(GL_TEXTURE_2D, obj->otexid);
TEATIME_BREAKONERROR(glBindTexture, rc);
/* turn off filtering and set proper wrap mode - this is obligatory for
* floating point textures */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
TEATIME_BREAKONERROR(glTexParameteri, rc);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
TEATIME_BREAKONERROR(glTexParameteri, rc);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
TEATIME_BREAKONERROR(glTexParameteri, rc);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
TEATIME_BREAKONERROR(glTexParameteri, rc);
/* create a 2D texture of the same size as the data
* internal format: GL_RGBA32UI_EXT
* texture format: GL_RGBA_INTEGER
* texture type: GL_UNSIGNED_INT
*/
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32UI_EXT,
texsz, texsz, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT, NULL);
TEATIME_BREAKONERROR(glTexImage2D, rc);
/* change tex-env to replace instead of the default modulate */
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
TEATIME_BREAKONERROR(glTexEnvi, rc);
/* attach texture */
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D, obj->otexid, 0);
TEATIME_BREAKONERROR(glFramebufferTexture2DEXT, rc);
TEATIME_BREAKONERROR_FB(glFramebufferTexture2DEXT, rc);
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
TEATIME_BREAKONERROR(glDrawBuffer, rc);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT1_EXT,
GL_TEXTURE_2D, obj->otexid, 0);
TEATIME_BREAKONERROR(glFramebufferTexture2DEXT, rc);
TEATIME_BREAKONERROR_FB(glFramebufferTexture2DEXT, rc);
rc = 0;
} while (0);
return rc;
}
return -EINVAL;
}
int teatime_read_textures(teatime_t *obj, uint32_t *output, uint32_t olen)
{
if (obj && output && olen > 0 && obj->otexid > 0) {
int rc = 0;
do {
uint32_t texsz = (uint32_t)((long)(sqrt(olen / 4.0)));
if (texsz != obj->tex_size) {
fprintf(stderr, "Viewport texture size(%u) != Input texture size (%u)\n",
obj->tex_size, texsz);
rc = -EINVAL;
break;
}
/* read the texture back */
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
TEATIME_BREAKONERROR(glReadBuffer, rc);
glReadPixels(0, 0, obj->tex_size, obj->tex_size, GL_RGBA_INTEGER, GL_UNSIGNED_INT, output);
TEATIME_BREAKONERROR(glReadPixels, rc);
fprintf(stderr, "Successfully read data from the texture\n");
} while (0);
return rc;
}
return -EINVAL;
}
int teatime_create_program(teatime_t *obj, const char *source)
{
if (obj && source) {
int rc = 0;
do {
obj->program = glCreateProgram();
TEATIME_BREAKONERROR(glCreateProgram, rc);
obj->shader = glCreateShader(GL_FRAGMENT_SHADER_ARB);
TEATIME_BREAKONERROR(glCreateShader, rc);
glShaderSource(obj->shader, 1, &source, NULL);
TEATIME_BREAKONERROR(glShaderSource, rc);
glCompileShader(obj->shader);
rc = teatime_check_shader_errors(obj->shader);
if (rc < 0) break;
TEATIME_BREAKONERROR(glCompileShader, rc);
glAttachShader(obj->program, obj->shader);
TEATIME_BREAKONERROR(glAttachShader, rc);
glLinkProgram(obj->program);
rc = teatime_check_program_errors(obj->program);
if (rc < 0) break;
TEATIME_BREAKONERROR(glLinkProgram, rc);
obj->locn_input = glGetUniformLocation(obj->program, "idata");
TEATIME_BREAKONERROR(glGetUniformLocation, rc);
obj->locn_output = glGetUniformLocation(obj->program, "odata");
TEATIME_BREAKONERROR(glGetUniformLocation, rc);
obj->locn_key = glGetUniformLocation(obj->program, "ikey");
TEATIME_BREAKONERROR(glGetUniformLocation, rc);
obj->locn_rounds = glGetUniformLocation(obj->program, "rounds");
TEATIME_BREAKONERROR(glGetUniformLocation, rc);
rc = 0;
} while (0);
return rc;
}
return -EINVAL;
}
int teatime_run_program(teatime_t *obj, const uint32_t ikey[4], uint32_t rounds)
{
if (obj && obj->program > 0) {
int rc = 0;
do {
glUseProgram(obj->program);
TEATIME_BREAKONERROR(glUseProgram, rc);
glActiveTexture(GL_TEXTURE0);
TEATIME_BREAKONERROR(glActiveTexture, rc);
glBindTexture(GL_TEXTURE_2D, obj->itexid);
TEATIME_BREAKONERROR(glBindTexture, rc);
glUniform1i(obj->locn_input, 0);
TEATIME_BREAKONERROR(glUniform1i, rc);
glActiveTexture(GL_TEXTURE1);
TEATIME_BREAKONERROR(glActiveTexture, rc);
glBindTexture(GL_TEXTURE_2D, obj->otexid);
TEATIME_BREAKONERROR(glBindTexture, rc);
glUniform1i(obj->locn_output, 1);
TEATIME_BREAKONERROR(glUniform1i, rc);
glUniform4uiv(obj->locn_key, 1, ikey);
TEATIME_BREAKONERROR(glUniform1uiv, rc);
glUniform1ui(obj->locn_rounds, rounds);
TEATIME_BREAKONERROR(glUniform1ui, rc);
glFinish();
glPolygonMode(GL_FRONT, GL_FILL);
/* render */
glBegin(GL_QUADS);
glTexCoord2i(0, 0);
glVertex2i(0, 0);
//glTexCoord2i(obj->tex_size, 0);
glTexCoord2i(1, 0);
glVertex2i(obj->tex_size, 0);
//glTexCoord2i(obj->tex_size, obj->tex_size);
glTexCoord2i(1, 1);
glVertex2i(obj->tex_size, obj->tex_size);
glTexCoord2i(0, 1);
//glTexCoord2i(0, obj->tex_size);
glVertex2i(0, obj->tex_size);
glEnd();
glFinish();
TEATIME_BREAKONERROR_FB(Rendering, rc);
TEATIME_BREAKONERROR(Rendering, rc);
rc = 0;
} while (0);
return rc;
}
return -EINVAL;
}
void teatime_delete_textures(teatime_t *obj)
{
if (obj) {
if (obj->itexid != 0) {
glDeleteTextures(1, &(obj->itexid));
obj->itexid = 0;
}
if (obj->otexid != 0) {
glDeleteTextures(1, &(obj->otexid));
obj->otexid = 0;
}
}
}
void teatime_delete_program(teatime_t *obj)
{
if (obj) {
if (obj->shader > 0 && obj->program > 0) {
glDetachShader(obj->program, obj->shader);
}
if (obj->shader > 0)
glDeleteShader(obj->shader);
if (obj->program > 0)
glDeleteProgram(obj->program);
obj->shader = 0;
obj->program = 0;
}
}
void teatime_print_version(FILE *fp)
{
const GLubyte *version = NULL;
version = glGetString(GL_VERSION);
fprintf(fp, "GL Version: %s\n", (const char *)version);
version = glGetString(GL_SHADING_LANGUAGE_VERSION);
fprintf(fp, "GLSL Version: %s\n", (const char *)version);
version = glGetString(GL_VENDOR);
fprintf(fp, "GL Vendor: %s\n", (const char *)version);
}
int teatime_check_gl_version(uint32_t *major, uint32_t *minor)
{
const GLubyte *version = NULL;
version = glGetString(GL_VERSION);
if (version) {
uint32_t ver[2] = { 0, 0 };
char *endp = NULL;
char *endp2 = NULL;
errno = 0;
ver[0] = strtol((const char *)version, &endp, 10);
if (errno == ERANGE || (const void *)endp == (const void *)version) {
fprintf(stderr, "Version string %s cannot be parsed\n", (const char *)version);
return -1;
}
/* endp[0] = '.' and endp[1] points to minor */
errno = 0;
ver[1] = strtol((const char *)&endp[1], &endp2, 10);
if (errno == ERANGE || endp2 == &endp[1]) {
fprintf(stderr, "Version string %s cannot be parsed\n", (const char *)version);
return -1;
}
if (major)
*major = ver[0];
if (minor)
*minor = ver[1];
return 0;
}
return -1;
}
int teatime_check_gl_errors(int line, const char *fn_name)
{
GLenum err = glGetError();
if (err != GL_NO_ERROR) {
const GLubyte *estr = gluErrorString(err);
fprintf(stderr, "%s(): GL Error(%d) on line %d: %s\n", fn_name,
err, line, (const char *)estr);
return -1;
}
return 0;
}
int teatime_check_gl_fb_errors(int line, const char *fn_name)
{
GLenum st = (GLenum)glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
switch (st) {
case GL_FRAMEBUFFER_COMPLETE_EXT:
return 0;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
fprintf(stderr, "%s(): GL FB error on line %d: incomplete attachment\n", fn_name, line);
break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
fprintf(stderr, "%s(): GL FB error on line %d: unsupported\n", fn_name, line);
break;
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
fprintf(stderr, "%s(): GL FB error on line %d: incomplete missing attachment\n", fn_name, line);
break;
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
fprintf(stderr, "%s(): GL FB error on line %d: incomplete dimensions\n", fn_name, line);
break;
case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
fprintf(stderr, "%s(): GL FB error on line %d: incomplete formats\n", fn_name, line);
break;
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
fprintf(stderr, "%s(): GL FB error on line %d: incomplete draw buffer\n", fn_name, line);
break;
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
fprintf(stderr, "%s(): GL FB error on line %d: incomplete read buffer\n", fn_name, line);
break;
default:
fprintf(stderr, "%s(): GL FB error on line %d: Unknown. Error Value: %d\n", fn_name, line, st);
break;
}
return -1;
}
int teatime_check_program_errors(GLuint program)
{
GLint ilen = 0;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &ilen);
if (ilen > 1) {
GLsizei wb = 0;
GLchar *buf = calloc(ilen, sizeof(GLchar));
if (!buf) {
fprintf(stderr, "Out of memory allocating %d bytes\n", ilen);
return -ENOMEM;
}
glGetProgramInfoLog(program, ilen, &wb, buf);
buf[wb] = '\0';
fprintf(stderr, "Program Errors:\n%s\n",
(const char *)buf);
free(buf);
}
return 0;
}
int teatime_check_shader_errors(GLuint shader)
{
GLint ilen = 0;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &ilen);
if (ilen > 1) {
GLsizei wb = 0;
GLchar *buf = calloc(ilen, sizeof(GLchar));
if (!buf) {
fprintf(stderr, "Out of memory allocating %d bytes\n", ilen);
return -ENOMEM;
}
glGetShaderInfoLog(shader, ilen, &wb, buf);
buf[wb] = '\0';
fprintf(stderr, "Shader Errors:\n%s\n",
(const char *)buf);
free(buf);
}
return 0;
}
#define TEA_ENCRYPT_SOURCE \
"#version 130\n" \
"#extension GL_EXT_gpu_shader4 : enable\n" \
"uniform usampler2D idata;\n" \
"uniform uvec4 ikey; \n" \
"uniform uint rounds; \n" \
"out uvec4 odata; \n" \
"void main(void) {\n" \
" uvec4 x = texture(idata, gl_TexCoord[0].st);\n" \
" uint delta = uint(0x9e3779b9); \n" \
" uint sum = uint(0); \n" \
" for (uint i = uint(0); i < rounds; ++i) {\n" \
" sum += delta; \n" \
" x[0] += (((x[1] << 4) + ikey[0]) ^ (x[1] + sum)) ^ ((x[1] >> 5) + ikey[1]);\n" \
" x[1] += (((x[0] << 4) + ikey[2]) ^ (x[0] + sum)) ^ ((x[0] >> 5) + ikey[3]);\n" \
" x[2] += (((x[3] << 4) + ikey[0]) ^ (x[3] + sum)) ^ ((x[3] >> 5) + ikey[1]);\n" \
" x[3] += (((x[2] << 4) + ikey[2]) ^ (x[2] + sum)) ^ ((x[2] >> 5) + ikey[3]);\n" \
" }\n" \
" odata = x; \n" \
"}\n"
#define TEA_DECRYPT_SOURCE \
"#version 130\n" \
"#extension GL_EXT_gpu_shader4 : enable\n" \
"uniform usampler2D idata;\n" \
"uniform uvec4 ikey; \n" \
"uniform uint rounds; \n" \
"out uvec4 odata; \n" \
"void main(void) {\n" \
" uvec4 x = texture(idata, gl_TexCoord[0].st);\n" \
" uint delta = uint(0x9e3779b9); \n" \
" uint sum = delta * rounds; \n" \
" for (uint i = uint(0); i < rounds; ++i) {\n" \
" x[1] -= (((x[0] << 4) + ikey[2]) ^ (x[0] + sum)) ^ ((x[0] >> 5) + ikey[3]);\n" \
" x[0] -= (((x[1] << 4) + ikey[0]) ^ (x[1] + sum)) ^ ((x[1] >> 5) + ikey[1]);\n" \
" x[3] -= (((x[2] << 4) + ikey[2]) ^ (x[2] + sum)) ^ ((x[2] >> 5) + ikey[3]);\n" \
" x[2] -= (((x[3] << 4) + ikey[0]) ^ (x[3] + sum)) ^ ((x[3] >> 5) + ikey[1]);\n" \
" sum -= delta; \n" \
" }\n" \
" odata = x; \n" \
"}\n"
const char *teatime_encrypt_source()
{
return TEA_ENCRYPT_SOURCE;
}
const char *teatime_decrypt_source()
{
return TEA_DECRYPT_SOURCE;
}
|
b'What is the value of 5 + -20 + 2 + 29?\n'
|
-- Section: Internal Functions
-- Group: Low-level event handling
\i functions/pgq.batch_event_sql.sql
\i functions/pgq.batch_event_tables.sql
\i functions/pgq.event_retry_raw.sql
\i functions/pgq.find_tick_helper.sql
-- \i functions/pgq.insert_event_raw.sql
\i lowlevel/pgq_lowlevel.sql
-- Group: Ticker
\i functions/pgq.ticker.sql
-- Group: Periodic maintenence
\i functions/pgq.maint_retry_events.sql
\i functions/pgq.maint_rotate_tables.sql
\i functions/pgq.maint_tables_to_vacuum.sql
\i functions/pgq.maint_operations.sql
-- Group: Random utility functions
\i functions/pgq.grant_perms.sql
\i functions/pgq.force_tick.sql
\i functions/pgq.seq_funcs.sql
|
b'What is -24 + (27 - 19) - -17?\n'
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>circuits: 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~camlp4 / circuits - 8.10.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
circuits
<small>
8.10.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2021-12-23 07:49:00 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-12-23 07:49:00 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
camlp4 4.03+1 Camlp4 is a system for writing extensible parsers for programming languages
conf-findutils 1 Virtual package relying on findutils
conf-which 1 Virtual package relying on which
coq 8.5.0~camlp4 Formal proof management system
num 0 The Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.03.0 The OCaml compiler (virtual package)
ocaml-base-compiler 4.03.0 Official 4.03.0 release
ocaml-config 1 OCaml Switch Configuration
ocamlbuild 0.14.0 OCamlbuild is a build system with builtin rules to easily build most OCaml projects.
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://github.com/coq-contribs/circuits"
license: "LGPL 2.1"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/Circuits"]
depends: [
"ocaml"
"coq" {>= "8.10" & < "8.11~"}
]
tags: [
"keyword: hardware verification"
"category: Computer Science/Architecture"
]
authors: [
"Laurent Arditi"
]
bug-reports: "https://github.com/coq-contribs/circuits/issues"
dev-repo: "git+https://github.com/coq-contribs/circuits.git"
synopsis: "Some proofs of hardware (adder, multiplier, memory block instruction)"
description: """
definition and proof of a combinatorial adder, a
sequential multiplier, a memory block instruction"""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/circuits/archive/v8.10.0.tar.gz"
checksum: "md5=791bf534085120bc18d58db26e1123f4"
}
</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-circuits.8.10.0 coq.8.5.0~camlp4</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~camlp4).
The following dependencies couldn't be met:
- coq-circuits -> coq >= 8.10 -> ocaml >= 4.05.0
base of this switch (use `--unlock-base' to force)
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-circuits.8.10.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>
|
//
// RCWorkspaceCache.h
//
// Created by Mark Lilback on 12/12/11.
// Copyright (c) 2011 . All rights reserved.
//
#import "_RCWorkspaceCache.h"
@interface RCWorkspaceCache : _RCWorkspaceCache
//if multiple values are to be set, it best to get properties, set them, and then call setProperties
//each call to setProperties serializes a plist
@property (nonatomic, strong) NSMutableDictionary *properties;
-(id)propertyForKey:(NSString*)key;
//removes property if value is nil
-(void)setProperty:(id)value forKey:(NSString*)key;
-(BOOL)boolPropertyForKey:(NSString*)key;
-(void)setBoolProperty:(BOOL)val forKey:(NSString*)key;
@end
|
b'What is 7 - (-4 + (-5 - -36) + -9)?\n'
|
# BKAsciiImage
[](http://cocoapods.org/pods/BKAsciiImage)
[](http://cocoapods.org/pods/BKAsciiImage)
[](http://cocoapods.org/pods/BKAsciiImage)

### As seen on Cmd.fm iOS App
https://itunes.apple.com/app/cmd.fm-radio-for-geeks-hackers/id935765356


## Installation
BKAsciiImage is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:
```ruby
pod "BKAsciiImage"
```
## Usage
### Using BKAsciiConverter class
Import BKAsciiConverter header file
```objective-c
#import <BKAsciiImage/BKAsciiConverter.h>
```
Create a BKAsciiConverter instance
```objective-c
BKAsciiConverter *converter = [BKAsciiConverter new];
```
Convert synchronously
```objective-c
UIImage *inputImage = [UIImage imageNamed:@"anImage"];
UIImage *asciiImage = [converter convertImage:inputImage];
```
Convert in the background providing a completion block.
Completion block will be called on the main thread.
```objective-c
[converter convertImage:self.inputImage completionHandler:^(UIImage *asciiImage) {
// do whatever you want with the resulting asciiImage
}];
```
Convert to NSString
```objective-c
NSLog(@"%@",[converter convertToString:self.inputImage]);
// asynchronous
[converter convertToString:self.inputImage completionHandler:^(NSString *asciiString) {
NSLog(@"%@",asciiString);
}];
```
#### Converter options
```objective-c
converter.backgroundColor = [UIColor whiteColor]; // default: Clear color. Image background is transparent
converter.grayscale = YES; // default: NO
converter.font = [UIFont fontWithName:@"Monaco" size:13.0]; // default: System font of size 10
converter.reversedLuminance = NO; // Reverses the luminance mapping. Reversing gives better results on a dark bg. default: YES
converter.columns = 50; // By default columns is derived by the font size if not set explicitly
```
### Using UIImage category
Import header file
```objective-c
#import <BKAsciiImage/UIImage+BKAscii.h>
```
Use the provided category methods
```objective-c
UIImage *inputImage = [UIImage imageNamed:@"anImage"];
[inputImage bk_asciiImageCompletionHandler:^(UIImage *asciiImage) {
}];
[inputImage bk_asciiStringCompletionHandler:^(NSString *asciiString) {
}];
[inputImage bk_asciiImageWithFont: [UIFont fontWithName:@"Monaco" size:13.0]
bgColor: [UIColor redColor];
columns: 30
reversed: YES
grayscale: NO
completionHandler: ^(NSString *asciiString) {
// do whatever you want with the resulting asciiImage
}];
```
## Advanced usage
By default luminance values are mapped to strings using
```objective-c
NSDictionary *dictionary = @{ @1.0: @" ",
@0.95:@"`",
@0.92:@".",
@0.9 :@",",
@0.8 :@"-",
@0.75:@"~",
@0.7 :@"+",
@0.65:@"<",
@0.6 :@">",
@0.55:@"o",
@0.5 :@"=",
@0.35:@"*",
@0.3 :@"%",
@0.1 :@"X",
@0.0 :@"@"
};
```
You can instantiate a converter with your own mapping dictionary
```objective-c
NSDictionary *dictionary = @{ @1.0: @" ",
@0.7 :@"a",
@0.65:@"b",
@0.6 :@"c",
@0.55:@"d",
@0.5 :@"e",
@0.35:@"f",
@0.3 :@"g",
@0.1 :@" ",
@0.0 :@" "
};
BKAsciiConverter *converter = [[BKAsciiConverter alloc] initWithDictionary:dictionary];
UIImage *inputImage = [UIImage imageNamed:@"anImage"];
UIImage *asciiImage = [converter convertImage:inputImage];
```

## Author
Barış Koç, https://github.com/bkoc
## License
BKAsciiImage is available under the MIT license. See the LICENSE file for more info.
|
b'Evaluate (28 - 45) + 10 - (-1 - 14).\n'
|
b'0 + (-14 - 1) + 28 + -38 + 14\n'
|
@echo off
CLS
%header%
echo.
if not exist "Programme\HackMii Installer" mkdir "Programme\HackMii Installer"
echo Downloade den HackMii Installer...
start /min/wait Support\wget -c -l1 -r -nd --retr-symlinks -t10 -T30 --random-wait --reject "*.html" --reject "%2A" --reject "get.php@file=hackmii_installer_v1.0*" "http://bootmii.org/download/"
move get.php* hackmii-installer_v1.2.zip >NUL
start /min/wait Support\7za e -aoa hackmii-installer_v1.2.zip -o"Programme\HackMii Installer" *.elf -r
del hackmii*
:endedesmoduls
|
b'Evaluate 37 + -4 - 20 - (-1 + 4) - -13.\n'
|
enum asmop {
ASNOP = 0,
ASSTB,
ASSTH,
ASSTW,
ASSTL,
ASSTM,
ASSTS,
ASSTD,
ASLDSB,
ASLDUB,
ASLDSH,
ASLDUH,
ASLDSW,
ASLDUW,
ASLDL,
ASLDS,
ASLDD,
ASADDW,
ASSUBW,
ASMULW,
ASMODW,
ASUMODW,
ASDIVW,
ASUDIVW,
ASSHLW,
ASSHRW,
ASUSHRW,
ASLTW,
ASULTW,
ASGTW,
ASUGTW,
ASLEW,
ASULEW,
ASGEW,
ASUGEW,
ASEQW,
ASNEW,
ASBANDW,
ASBORW,
ASBXORW,
ASADDL,
ASSUBL,
ASMULL,
ASMODL,
ASUMODL,
ASDIVL,
ASUDIVL,
ASSHLL,
ASSHRL,
ASUSHRL,
ASLTL,
ASULTL,
ASGTL,
ASUGTL,
ASLEL,
ASULEL,
ASGEL,
ASUGEL,
ASEQL,
ASNEL,
ASBANDL,
ASBORL,
ASBXORL,
ASADDS,
ASSUBS,
ASMULS,
ASDIVS,
ASLTS,
ASGTS,
ASLES,
ASGES,
ASEQS,
ASNES,
ASADDD,
ASSUBD,
ASMULD,
ASDIVD,
ASLTD,
ASGTD,
ASLED,
ASGED,
ASEQD,
ASNED,
ASEXTBW,
ASUEXTBW,
ASEXTBL,
ASUEXTBL,
ASEXTHW,
ASUEXTHW,
ASEXTHL,
ASUEXTHL,
ASEXTWL,
ASUEXTWL,
ASSTOL,
ASSTOW,
ASDTOL,
ASDTOW,
ASSWTOD,
ASSWTOS,
ASSLTOD,
ASSLTOS,
ASEXTS,
ASTRUNCD,
ASJMP,
ASBRANCH,
ASRET,
ASCALL,
ASCALLE,
ASCALLEX,
ASPAR,
ASPARE,
ASALLOC,
ASFORM,
ASCOPYB,
ASCOPYH,
ASCOPYW,
ASCOPYL,
ASCOPYS,
ASCOPYD,
ASVSTAR,
ASVARG,
};
|
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.datafactory.v2018_06_01;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
/**
* The location of Google Cloud Storage dataset.
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", defaultImpl = GoogleCloudStorageLocation.class)
@JsonTypeName("GoogleCloudStorageLocation")
public class GoogleCloudStorageLocation extends DatasetLocation {
/**
* Specify the bucketName of Google Cloud Storage. Type: string (or
* Expression with resultType string).
*/
@JsonProperty(value = "bucketName")
private Object bucketName;
/**
* Specify the version of Google Cloud Storage. Type: string (or Expression
* with resultType string).
*/
@JsonProperty(value = "version")
private Object version;
/**
* Get specify the bucketName of Google Cloud Storage. Type: string (or Expression with resultType string).
*
* @return the bucketName value
*/
public Object bucketName() {
return this.bucketName;
}
/**
* Set specify the bucketName of Google Cloud Storage. Type: string (or Expression with resultType string).
*
* @param bucketName the bucketName value to set
* @return the GoogleCloudStorageLocation object itself.
*/
public GoogleCloudStorageLocation withBucketName(Object bucketName) {
this.bucketName = bucketName;
return this;
}
/**
* Get specify the version of Google Cloud Storage. Type: string (or Expression with resultType string).
*
* @return the version value
*/
public Object version() {
return this.version;
}
/**
* Set specify the version of Google Cloud Storage. Type: string (or Expression with resultType string).
*
* @param version the version value to set
* @return the GoogleCloudStorageLocation object itself.
*/
public GoogleCloudStorageLocation withVersion(Object version) {
this.version = version;
return this;
}
}
|
b'290 + -287 + (1 + 0 - 11) + 2\n'
|
require 'test_helper'
class VigenereTest < MiniTest::Test
def setup
super
@cipher = Cryptolalia::Cipher::Vigenere.new
end
def test_encodes
@cipher.plaintext = 'This is a super secret message.'
@cipher.keyword = 'qwerty'
@cipher.encode!
assert_equal "jdmj bq q oygxp iagixr cawjteu", @cipher.ciphertext
end
def test_decodes
@cipher.ciphertext = 'jdmj bq q oygxp iagixr cawjteu'
@cipher.keyword = 'qwerty'
@cipher.decode!
assert_equal "this is a super secret message", @cipher.plaintext
end
end
|
b'What is the value of (9 - 9) + 19 + -15?\n'
|
b'What is the value of -40 + -1 - ((-42 - -26) + 2)?\n'
|
module Mlblog
VERSION = "0.0.1"
end
|
var utils = require('./utils')
, request = require('request')
;
module.exports = {
fetchGithubInfo: function(email, cb) {
var githubProfile = {};
var api_call = "https://api.github.com/search/users?q="+email+"%20in:email";
var options = { url: api_call, headers: { 'User-Agent': 'Blogdown' } };
console.log("Calling "+api_call);
request(options, function(err, res, body) {
if(err) return cb(err);
res = JSON.parse(body);
if(res.total_count==1)
githubProfile = res.items[0];
cb(null, githubProfile);
});
},
fetchGravatarProfile: function(email, cb) {
var gravatarProfile = {};
var hash = utils.getHash(email);
var api_call = "http://en.gravatar.com/"+hash+".json";
console.log("Calling "+api_call);
var options = { url: api_call, headers: { 'User-Agent': 'Blogdown' } };
request(options, function(err, res, body) {
if(err) return cb(err);
try {
res = JSON.parse(body);
} catch(e) {
console.error("fetchGravatarProfile: Couldn't parse response JSON ", body, e);
return cb(e);
}
if(res.entry && res.entry.length > 0)
gravatarProfile = res.entry[0];
return cb(null, gravatarProfile);
});
}
};
|
b'(0 - -22) + 42 + 9 + -57\n'
|
b'Calculate (49 - (52 - 3)) + 2 + 0.\n'
|
b'What is 2 - (-3 - (-4 - -8))?\n'
|
b'(2 + -1 + -6 - (-2 + -1)) + 13\n'
|
package com.eaw1805.data.model.map;
import com.eaw1805.data.constants.RegionConstants;
import com.eaw1805.data.model.Game;
import java.io.Serializable;
/**
* Represents a region of the world.
*/
public class Region implements Serializable {
/**
* Required by Serializable interface.
*/
static final long serialVersionUID = 42L; //NOPMD
/**
* Region's identification number.
*/
private int id; // NOPMD
/**
* Region's code.
*/
private char code;
/**
* The name of the region.
*/
private String name;
/**
* The game this region belongs to.
*/
private Game game;
/**
* Default constructor.
*/
public Region() {
// Empty constructor
}
/**
* Get the Identification number of the region.
*
* @return the identification number of the region.
*/
public int getId() {
return id;
}
/**
* Set the Identification number of the region.
*
* @param identity the identification number of the region.
*/
public void setId(final int identity) {
this.id = identity;
}
/**
* Get the name of the region.
*
* @return the name of the region.
*/
public String getName() {
return name;
}
/**
* Set the thisName of the region.
*
* @param thisName the name of the region.
*/
public void setName(final String thisName) {
this.name = thisName;
}
/**
* Get the Single-char code of the region.
*
* @return the Single-char code of the region.
*/
public char getCode() {
return code;
}
/**
* Set the single-char code of the region.
*
* @param thisCode the single-char code of the region.
*/
public void setCode(final char thisCode) {
this.code = thisCode;
}
/**
* Get the game this region belongs to.
*
* @return The game of the region.
*/
public Game getGame() {
return game;
}
/**
* Set the game this region belongs to.
*
* @param value The game.
*/
public void setGame(final Game value) {
this.game = value;
}
/**
* Indicates whether some other object is "equal to" this one.
* The <code>equals</code> method implements an equivalence relation
* on non-null object references:
* <ul>
* <li>It is <i>reflexive</i>: for any non-null reference value
* <code>x</code>, <code>x.equals(x)</code> should return
* <code>true</code>.
* <li>It is <i>symmetric</i>: for any non-null reference values
* <code>x</code> and <code>y</code>, <code>x.equals(y)</code>
* should return <code>true</code> if and only if
* <code>y.equals(x)</code> returns <code>true</code>.
* <li>It is <i>transitive</i>: for any non-null reference values
* <code>x</code>, <code>y</code>, and <code>z</code>, if
* <code>x.equals(y)</code> returns <code>true</code> and
* <code>y.equals(z)</code> returns <code>true</code>, then
* <code>x.equals(z)</code> should return <code>true</code>.
* <li>It is <i>consistent</i>: for any non-null reference values
* <code>x</code> and <code>y</code>, multiple invocations of
* <tt>x.equals(y)</tt> consistently return <code>true</code>
* or consistently return <code>false</code>, provided no
* information used in <code>equals</code> comparisons on the
* objects is modified.
* <li>For any non-null reference value <code>x</code>,
* <code>x.equals(null)</code> should return <code>false</code>.
* </ul>
* The <tt>equals</tt> method for class <code>Object</code> implements
* the most discriminating possible equivalence relation on objects;
* that is, for any non-null reference values <code>x</code> and
* <code>y</code>, this method returns <code>true</code> if and only
* if <code>x</code> and <code>y</code> refer to the same object
* (<code>x == y</code> has the value <code>true</code>).
* Note that it is generally necessary to override the <tt>hashCode</tt>
* method whenever this method is overridden, so as to maintain the
* general contract for the <tt>hashCode</tt> method, which states
* that equal objects must have equal hash codes.
*
* @param obj the reference object with which to compare.
* @return <code>true</code> if this object is the same as the obj
* argument; <code>false</code> otherwise.
* @see #hashCode()
* @see java.util.Hashtable
*/
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof Region)) {
return false;
}
final Region region = (Region) obj;
if (code != region.code) {
return false;
}
if (id != region.id) {
return false;
}
if (name != null ? !name.equals(region.name) : region.name != null) {
return false;
}
return true;
}
/**
* Returns a hash code value for the object. This method is
* supported for the benefit of hashtables such as those provided by
* <code>java.util.Hashtable</code>.
* The general contract of <code>hashCode</code> is:
* <ul>
* <li>Whenever it is invoked on the same object more than once during
* an execution of a Java application, the <tt>hashCode</tt> method
* must consistently return the same integer, provided no information
* used in <tt>equals</tt> comparisons on the object is modified.
* This integer need not remain consistent from one execution of an
* application to another execution of the same application.
* <li>If two objects are equal according to the <tt>equals(Object)</tt>
* method, then calling the <code>hashCode</code> method on each of
* the two objects must produce the same integer result.
* <li>It is <em>not</em> required that if two objects are unequal
* according to the {@link java.lang.Object#equals(java.lang.Object)}
* method, then calling the <tt>hashCode</tt> method on each of the
* two objects must produce distinct integer results. However, the
* programmer should be aware that producing distinct integer results
* for unequal objects may improve the performance of hashtables.
* </ul>
* As much as is reasonably practical, the hashCode method defined by
* class <tt>Object</tt> does return distinct integers for distinct
* objects. (This is typically implemented by converting the internal
* address of the object into an integer, but this implementation
* technique is not required by the
* Java<font size="-2"><sup>TM</sup></font> programming language.)
*
* @return a hash code value for this object.
* @see java.lang.Object#equals(java.lang.Object)
* @see java.util.Hashtable
*/
@Override
public int hashCode() {
return id;
}
@Override
public String toString() {
final StringBuilder sbld = new StringBuilder();
switch (id) {
case RegionConstants.EUROPE:
sbld.append("E");
break;
case RegionConstants.CARIBBEAN:
sbld.append("C");
break;
case RegionConstants.INDIES:
sbld.append("I");
break;
case RegionConstants.AFRICA:
sbld.append("A");
break;
default:
break;
}
return sbld.toString();
}
}
|
b'What is the value of 448 - 455 - (-3 - -4 - 43)?\n'
|
package SOLID.Exercise.Logger.model.appenders;
import SOLID.Exercise.Logger.api.File;
import SOLID.Exercise.Logger.api.Layout;
import SOLID.Exercise.Logger.model.files.LogFile;
public class FileAppender extends BaseAppender {
private File file;
public FileAppender(Layout layout) {
super(layout);
this.setFile(new LogFile());
}
public void setFile(File file) {
this.file = file;
}
@Override
public void append(String message) {
this.file.write(message);
}
@Override
public String toString() {
return String.format("%s, File size: %d", super.toString(), this.file.getSize());
}
}
|
b'Calculate -7 + 11 - (3 - -3).\n'
|
<?php
namespace Master\AdvertBundle\Controller;
use Elastica\Filter\GeoDistance;
use Elastica\Query\Filtered;
use Elastica\Query\MatchAll;
use Master\AdvertBundle\Document\Advert;
use Master\AdvertBundle\Document\Localization;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class DefaultController extends Controller
{
public function indexAction(Request $request)
{
$p=1;
if($request->query->get('page')!=null)
$p=intval($request->query->get('page'));
$adverts=$this->advertShow($request,$p);
return $this->render('AdvertBundle:Default:index.html.twig',array('advert'=>$adverts));
}
public function addAction(Request $request)
{
if($request->getMethod()=="POST") {
$manager=$this->get('doctrine_mongodb');
$localisation=new Localization();
$localisation->setLatitude($request->request->get('lat'));
$localisation->setLongitude($request->request->get('long'));
$advert = new Advert();
$advert->setTitle($request->request->get('title'));
$advert->setDescription($request->request->get('description'));
$advert->setFax($request->request->get('fax'));
$advert->setTelephone($request->request->get('tel'));
$advert->setTokenuser($this->getUser()->getToken());
$advert->setLocalization($localisation);
$manager->getManager()->persist($advert);
$manager->getManager()->flush();
$adverts=$this->advertShow($request,1);
return $this->render('AdvertBundle:Default:index.html.twig',array("advert"=>$adverts));
}else{
return $this->render('AdvertBundle:Advert:add.html.twig');
}
}
public function testAction(){
$filter = new GeoDistance('location', array('lat' => -2.1741771697998047,
'lon' => 43.28249657890983), '10000km');
$query = new Filtered(new MatchAll(), $filter);
$manager=$this->get('fos_elastica.finder.structure.advert');
$test=$manager->find($query);
var_dump($test);exit;
return new Response("TEST");
}
public function advertShow($request,$p)
{
$manager=$this->get('fos_elastica.finder.structure.advert');
$pagination=$manager->find("",100);
// var_dump($pagination);exit;
$paginator = $this->get('knp_paginator');
$adverts = $paginator->paginate(
$pagination,
$request->query->get('page', $p)/*page number*/,
6/*limit per page*/
);
return $adverts;
}
}
|
b'-33 + (-5 - 0) + 118 + -105\n'
|
b'Calculate (-2 + -5 - -12) + -1.\n'
|
b'What is the value of 26 - (-1 - (-14 + -32))?\n'
|
b'What is -8 + 1 + (-18 - -3) + 20?\n'
|
b'What is 5 + -11 + 2 - -18?\n'
|
b'What is -50 - -53 - (-4 + 2 - (-14 + 0))?\n'
|
require 'spec_helper'
require 'serializables/vector3'
describe Moon::Vector3 do
context 'Serialization' do
it 'serializes' do
src = described_class.new(12, 8, 4)
result = described_class.load(src.export)
expect(result).to eq(src)
end
end
end
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>zchinese: 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.7.1+1 / zchinese - 8.9.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
zchinese
<small>
8.9.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-02-15 19:37:57 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-02-15 19:37:57 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
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.7.1+1 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.06.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.06.1 Official 4.06.1 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://github.com/coq-contribs/zchinese"
license: "Unknown"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/ZChinese"]
depends: [
"ocaml"
"coq" {>= "8.9" & < "8.10~"}
]
tags: [
"keyword: number theory"
"keyword: chinese remainder"
"keyword: primality"
"keyword: prime numbers"
"category: Mathematics/Arithmetic and Number Theory/Number theory"
"category: Miscellaneous/Extracted Programs/Arithmetic"
]
authors: [
"Valérie Ménissier-Morain"
]
bug-reports: "https://github.com/coq-contribs/zchinese/issues"
dev-repo: "git+https://github.com/coq-contribs/zchinese.git"
synopsis: "A proof of the Chinese Remainder Lemma"
description: """
This is a rewriting of the contribution chinese-lemma using Zarith"""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/zchinese/archive/v8.9.0.tar.gz"
checksum: "md5=a5fddf5409ff7b7053a84bbf9491b8fc"
}
</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-zchinese.8.9.0 coq.8.7.1+1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.7.1+1).
The following dependencies couldn't be met:
- coq-zchinese -> coq >= 8.9
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-zchinese.8.9.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>
|
/* eslint-disable import/no-extraneous-dependencies,import/no-unresolved */
import React, { useState } from 'react';
import { Form } from 'react-bootstrap';
import { Typeahead } from 'react-bootstrap-typeahead';
/* example-start */
const options = [
'Warsaw',
'Kraków',
'Łódź',
'Wrocław',
'Poznań',
'Gdańsk',
'Szczecin',
'Bydgoszcz',
'Lublin',
'Katowice',
'Białystok',
'Gdynia',
'Częstochowa',
'Radom',
'Sosnowiec',
'Toruń',
'Kielce',
'Gliwice',
'Zabrze',
'Bytom',
'Olsztyn',
'Bielsko-Biała',
'Rzeszów',
'Ruda Śląska',
'Rybnik',
];
const FilteringExample = () => {
const [caseSensitive, setCaseSensitive] = useState(false);
const [ignoreDiacritics, setIgnoreDiacritics] = useState(true);
return (
<>
<Typeahead
caseSensitive={caseSensitive}
id="filtering-example"
ignoreDiacritics={ignoreDiacritics}
options={options}
placeholder="Cities in Poland..."
/>
<Form.Group>
<Form.Check
checked={caseSensitive}
id="case-sensitive-filtering"
label="Case-sensitive filtering"
onChange={(e) => setCaseSensitive(e.target.checked)}
type="checkbox"
/>
<Form.Check
checked={!ignoreDiacritics}
id="diacritical-marks"
label="Account for diacritical marks"
onChange={(e) => setIgnoreDiacritics(!e.target.checked)}
type="checkbox"
/>
</Form.Group>
</>
);
};
/* example-end */
export default FilteringExample;
|
import React from 'react';
import './skills.scss';
export default () => {
return (
<section className="skills-section">
<svg className="bigTriangleColor separator-skills" width="100%" height="100" viewBox="0 0 100 102" preserveAspectRatio="none">
<path d="M0 0 L0 100 L70 0 L100 100 L100 0 Z" />
</svg>
<h2 className="skills-header">Skills</h2>
<p className="skills tlt">
Javascript/ES6 React Redux Node Express MongoDB GraphQL REST Next.js Mocha Jest JSS PostCSS SCSS LESS AWS nginx jQuery Webpack Rollup UI/Design
</p>
<button className="button button--wayra button--inverted skills-btn">
View My <i className="fa fa-github skills-github"></i><a className="skills-btn-a" href="https://www.github.com/musicbender" target="_blank"></a>
</button>
</section>
);
}
|
***
View in [[English](README-en.md)][[中文](README.md)]
***
# gocaptcha
go语言验证码服务器
Feature
-------
* 支持中文验证码
* 支持自定义词库、字库
* 支持自定义滤镜机制,通过滤镜来增加干扰,加大识别难度
* 当前的滤镜包括:
* 支持干扰点
* 支持干扰线
* 支持其他模式的干扰
* 更多模式,可实现imagefilter接口来扩展
* 支持自定义存储引擎,存储引擎可扩展
* 目前支持的存储引擎包括:
* 内置(buildin)
* memcache
* redis (from https://github.com/dtynn/gocaptcha)
* 如需扩展存储引擎,可实现StoreInterface接口
Useage
------
**安装**
go get github.com/hanguofeng/gocaptcha
**Quick Start**
参考 [captcha_test.go](captcha_test.go)
参考 [samples/gocaptcha-server](samples/gocaptcha-server)
[Demo](http://hanguofeng-gocaptcha.daoapp.io/)
**文档**
[[captcha.go Wiki](https://github.com/hanguofeng/gocaptcha/wiki)]
TODO
----
* 运维管理工具
LICENCE
-------
gocaptcha使用[[MIT许可协议](LICENSE)]
使用的开源软件列表,表示感谢
* https://github.com/dchest/captcha
* https://github.com/golang/freetype
* https://github.com/bradfitz/gomemcache
* https://code.google.com/p/zpix/
|
#AtaK
##The Atari 2600 Compiler Kit
AtaK, pronounced attack, is a collection of programs built to aid in the
development of Atari 2600 programs.
##Programs(Planned/Developing):
* AtaR(ah-tar), The **Ata**ri 2600 Assemble**r**
* AtaC(attack), The **Ata**ri 2600 **C** Compiler
##Universal Features:
* Programmed in C89
##Contributing:
Here are some ways to contribute:
* Come up with features
* Criticize source code and programming methods
* Put comments where you see fit
* Build/test the program on other machines
##Versioning Scheme:
[major release(roman)].[year of release(roman)], rev. [revision (arabic)]
Example:
AraR I.MMXVI, rev. 0
was the first release of AtaR(a development stub)
##Contributers:
Charles "Gip-Gip" Thompson - Author/Maintainer<br>
[ZackAttack](http://atariage.com/forums/user/40226-zackattack/) - General Critic
<br>
|
module.exports = FormButtonsDirective;
function FormButtonsDirective () {
return {
restrict: 'AE',
replace: true,
scope: {
submitClick: '&submitClick',
cancelClick: '&cancelClick'
},
templateUrl: '/src/utils/views/formButtons.tmpl.html',
link: function (scope, elem) {
angular.element(elem[0].getElementsByClassName('form-button-submit')).on('click', function () {
scope.submitClick();
});
angular.element(elem[0].getElementsByClassName('form-button-cancel')).on('click', function () {
scope.cancelClick();
});
}
};
}
|
b'What is (-11 + 40 - 4) + -23?\n'
|
/*-
* builtin.c
* This file is part of libmetha
*
* Copyright (c) 2008, Emil Romanus <[email protected]>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* http://bithack.se/projects/methabot/
*/
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/stat.h>
#include "errors.h"
#include "ftpparse.h"
#include "worker.h"
#include "urlengine.h"
#include "io.h"
#include "builtin.h"
/**
* Builtin parsers except for the html parser which is in html.c
**/
struct {
const char *name;
int len;
} protocols[] = {
{"http", 4},
{"ftp", 3},
};
/**
* Default CSS parser
**/
M_CODE
lm_parser_css(worker_t *w, iobuf_t *buf, uehandle_t *ue_h,
url_t *url, attr_list_t *al)
{
return lm_extract_css_urls(ue_h, buf->ptr, buf->sz);
}
/**
* download the data to a local file instead of
* to memory
*
* the parser chain will receive the file name in
* this.data instead of the real buffer.
**/
M_CODE
lm_handler_writefile(worker_t *w, iohandle_t *h,
url_t *url)
{
int r;
char *name;
char *ext;
char *s;
int x;
int ext_offs;
int a_sz;
int sz;
struct stat st;
/**
* create a filename to download to
**/
if (url->ext_o) {
for (x = url->ext_o; *(url->str+x) && *(url->str+x) != '?'; x++)
;
if (!(ext = malloc(x-url->ext_o+1)))
return M_OUT_OF_MEM;
memcpy(ext, url->str+url->ext_o, x-url->ext_o);
ext[x-url->ext_o] = '\0';
ext_offs = url->ext_o-(url->file_o+1);
} else {
ext = strdup("");
for (x = url->file_o+1; *(url->str+x) && *(url->str+x) != '?'; x++)
;
ext_offs = x-(url->file_o+1);
}
if (url->file_o+1 == url->sz) {
if (!(name = malloc(a_sz = sizeof("index.html")+32)))
return M_OUT_OF_MEM;
memcpy(name, "index.html", sizeof("index.html"));
ext_offs = strlen("index");
ext = strdup(".html");
} else {
if (!(name = malloc(a_sz = ext_offs+strlen(ext)+1+32)))
return M_OUT_OF_MEM;
memcpy(name, url->str+url->file_o+1, ext_offs);
strcpy(name+ext_offs, ext);
}
x=0;
if (stat(name, &st) == 0) {
do {
x++;
sz = sprintf(name+ext_offs, "-%d%s", x, ext);
} while (stat(name, &st) == 0);
}
r = lm_io_save(h, url, name);
if (r == M_OK) {
/* set the I/O buffer to the name of the file */
free(h->buf.ptr);
h->buf.ptr = name;
h->buf.sz = strlen(name);
h->buf.cap = a_sz;
} else
free(name);
free(ext);
return M_OK;
}
/**
* Parse the given string as CSS and add the found URLs to
* the uehandle.
**/
M_CODE
lm_extract_css_urls(uehandle_t *ue_h, char *p, size_t sz)
{
char *e = p+sz;
char *t, *s;
while ((p = memmem(p, e-p, "url", 3))) {
p += 3;
while (isspace(*p)) p++;
if (*p == '(') {
do p++; while (isspace(*p));
t = (*p == '"' ? "\")"
: (*p == '\'' ? "')" : ")"));
if (*t != ')')
p++;
} else
t = (*p == '"' ? "\""
: (*p == '\'' ? "'" : ";"));
if (!(s = memmem(p, e-p, t, strlen(t))))
continue;
ue_add(ue_h, p, s-p);
p = s;
}
return M_OK;
}
/**
* Default plaintext parser
**/
M_CODE
lm_parser_text(worker_t *w, iobuf_t *buf,
uehandle_t *ue_h, url_t *url,
attr_list_t *al)
{
return lm_extract_text_urls(ue_h, buf->ptr, buf->sz);
}
M_CODE
lm_extract_text_urls(uehandle_t *ue_h, char *p, size_t sz)
{
int x;
char *s, *e = p+sz;
for (p = strstr(p, "://"); p && p<e; p = strstr(p+1, "://")) {
for (x=0;x<2;x++) {
if (p-e >= protocols[x].len
&& strncmp(p-protocols[x].len, protocols[x].name, protocols[x].len) == 0) {
for (s=p+3; s < e; s++) {
if (!isalnum(*s) && *s != '%' && *s != '?'
&& *s != '=' && *s != '&' && *s != '/'
&& *s != '.') {
ue_add(ue_h, p-protocols[x].len, (s-p)+protocols[x].len);
break;
}
}
p = s;
}
}
}
return M_OK;
}
/**
* Default FTP parser. Expects data returned from the default
* FTP handler.
**/
M_CODE
lm_parser_ftp(worker_t *w, iobuf_t *buf,
uehandle_t *ue_h, url_t *url,
attr_list_t *al)
{
char *p, *prev;
struct ftpparse info;
char name[128]; /* i'm pretty sure no filename will be longer than 127 chars... */
int len;
for (prev = p = buf->ptr; p<buf->ptr+buf->sz; p++) {
if (*p == '\n') {
if (p-prev) {
if (ftpparse(&info, prev, p-prev)) {
if (info.namelen >= 126) {
LM_WARNING(w->m, "file name too long");
continue;
}
if (info.flagtrycwd) {
memcpy(name, info.name, info.namelen);
name[info.namelen] = '/';
name[info.namelen+1] = '\0';
len = info.namelen+1;
} else {
strncpy(name, info.name, info.namelen);
len = info.namelen;
}
ue_add(ue_h, name, len);
}
prev = p+1;
} else
prev = p+1;
}
}
return M_OK;
}
|
using System;
using System.Collections;
using System.Linq;
using Xunit;
namespace Popsql.Tests
{
public class SqlValuesTests
{
[Fact]
public void Add_WithNullValues_ThrowsArgumentNull()
{
var values = new SqlValues();
Assert.Throws<ArgumentNullException>(() => values.Add(null));
}
[Fact]
public void Count_ReturnsNumberOfItems()
{
var values = new SqlValues();
Assert.Equal(0, values.Count);
values.Add(Enumerable.Range(0, 5).Cast<SqlValue>());
Assert.Equal(1, values.Count);
values.Add(Enumerable.Range(5, 10).Cast<SqlValue>());
Assert.Equal(2, values.Count);
}
[Fact]
public void ExpressionType_ReturnsValues()
{
Assert.Equal(SqlExpressionType.Values, new SqlValues().ExpressionType);
}
[Fact]
public void GetEnumerator_ReturnsEnumerator()
{
var values = new SqlValues
{
Enumerable.Range(0, 5).Cast<SqlValue>(),
Enumerable.Range(5, 10).Cast<SqlValue>()
};
var enumerator = ((IEnumerable) values).GetEnumerator();
Assert.NotNull(enumerator);
int count = 0;
while (enumerator.MoveNext())
{
count++;
}
Assert.Equal(2, count);
}
}
}
|
package com.arekusu.datamover.model.jaxb;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.arekusu.com}DefinitionType"/>
* </sequence>
* <attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"definitionType"
})
@XmlRootElement(name = "ModelType", namespace = "http://www.arekusu.com")
public class ModelType {
@XmlElement(name = "DefinitionType", namespace = "http://www.arekusu.com", required = true)
protected DefinitionType definitionType;
@XmlAttribute(name = "version")
protected String version;
/**
* Gets the value of the definitionType property.
*
* @return
* possible object is
* {@link DefinitionType }
*
*/
public DefinitionType getDefinitionType() {
return definitionType;
}
/**
* Sets the value of the definitionType property.
*
* @param value
* allowed object is
* {@link DefinitionType }
*
*/
public void setDefinitionType(DefinitionType value) {
this.definitionType = value;
}
/**
* Gets the value of the version property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getVersion() {
return version;
}
/**
* Sets the value of the version property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVersion(String value) {
this.version = value;
}
}
|
b'Evaluate -46 + 41 + (3 - 0) - (-21 + -1).\n'
|
package sodium
// #cgo pkg-config: libsodium
// #include <stdlib.h>
// #include <sodium.h>
import "C"
func RuntimeHasNeon() bool {
return C.sodium_runtime_has_neon() != 0
}
func RuntimeHasSse2() bool {
return C.sodium_runtime_has_sse2() != 0
}
func RuntimeHasSse3() bool {
return C.sodium_runtime_has_sse3() != 0
}
|
b'(-6 - 0) + -13 + 68 + -63\n'
|
describe('dJSON', function () {
'use strict';
var chai = require('chai');
var expect = chai.expect;
var dJSON = require('../lib/dJSON');
var path = 'x.y["q.{r}"].z';
var obj;
beforeEach(function () {
obj = {
x: {
y: {
'q.{r}': {
z: 635
},
q: {
r: {
z: 1
}
}
}
},
'x-y': 5,
falsy: false
};
});
it('gets a value from an object with a path containing properties which contain a period', function () {
expect(dJSON.get(obj, path)).to.equal(635);
expect(dJSON.get(obj, 'x.y.q.r.z')).to.equal(1);
});
it('sets a value from an object with a path containing properties which contain a period', function () {
dJSON.set(obj, path, 17771);
expect(dJSON.get(obj, path)).to.equal(17771);
expect(dJSON.get(obj, 'x.y.q.r.z')).to.equal(1);
});
it('will return undefined when requesting a property with a dash directly', function () {
expect(dJSON.get(obj, 'x-y')).to.be.undefined;
});
it('will return the proper value when requesting a property with a dash by square bracket notation', function () {
expect(dJSON.get(obj, '["x-y"]')).to.equal(5);
});
it('returns a value that is falsy', function () {
expect(dJSON.get(obj, 'falsy')).to.equal(false);
});
it('sets a value that is falsy', function () {
dJSON.set(obj, 'new', false);
expect(dJSON.get(obj, 'new')).to.equal(false);
});
it('uses an empty object as default for the value in the set method', function () {
var newObj = {};
dJSON.set(newObj, 'foo.bar.lorem');
expect(newObj).to.deep.equal({
foo: {
bar: {
lorem: {}
}
}
});
});
it('does not create an object when a path exists as empty string', function () {
var newObj = {
nestedObject: {
anArray: [
'i have a value',
''
]
}
};
var newPath = 'nestedObject.anArray[1]';
dJSON.set(newObj, newPath, 17771);
expect(newObj).to.deep.equal({
nestedObject: {
anArray: [
'i have a value',
17771
]
}
});
});
it('creates an object from a path with a left curly brace', function () {
var newObj = {};
dJSON.set(newObj, path.replace('}', ''), 'foo');
expect(newObj).to.be.deep.equal({
x: {
y: {
'q.{r': {
z: 'foo'
}
}
}
});
});
it('creates an object from a path with a right curly brace', function () {
var newObj = {};
dJSON.set(newObj, path.replace('{', ''), 'foo');
expect(newObj).to.be.deep.equal({
x: {
y: {
'q.r}': {
z: 'foo'
}
}
}
});
});
it('creates an object from a path with curly braces', function () {
var newObj = {};
dJSON.set(newObj, path, 'foo');
expect(newObj).to.be.deep.equal({
x: {
y: {
'q.{r}': {
z: 'foo'
}
}
}
});
});
it('creates an object from a path without curly braces', function () {
var newObj = {};
dJSON.set(newObj, path.replace('{', '').replace('}', ''), 'foo');
expect(newObj).to.be.deep.equal({
x: {
y: {
'q.r': {
z: 'foo'
}
}
}
});
});
});
|
b'6 + 7 + -7 + -10 + -1 + 7\n'
|
namespace MyColors
{
partial class SimpleToolTip
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("Open Sans", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(305, 51);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// SimpleToolTip
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(305, 51);
this.ControlBox = false;
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SimpleToolTip";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "SimpleToolTip";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
}
}
|
b'Calculate (-4 - (-7 + -5 - -28)) + 3.\n'
|
b'-6 + (6 - (2 + 1 - 1)) + -4\n'
|
b'Evaluate -16 + (-6 - 1 - -22 - 24).\n'
|
from django import forms
from django.core.exceptions import ValidationError
from django.core.validators import validate_slug
from django.db import models
from django.utils import simplejson as json
from django.utils.text import capfirst
from django.utils.translation import ugettext_lazy as _
from philo.forms.fields import JSONFormField
from philo.utils.registry import RegistryIterator
from philo.validators import TemplateValidator, json_validator
#from philo.models.fields.entities import *
class TemplateField(models.TextField):
"""A :class:`TextField` which is validated with a :class:`.TemplateValidator`. ``allow``, ``disallow``, and ``secure`` will be passed into the validator's construction."""
def __init__(self, allow=None, disallow=None, secure=True, *args, **kwargs):
super(TemplateField, self).__init__(*args, **kwargs)
self.validators.append(TemplateValidator(allow, disallow, secure))
class JSONDescriptor(object):
def __init__(self, field):
self.field = field
def __get__(self, instance, owner):
if instance is None:
raise AttributeError # ?
if self.field.name not in instance.__dict__:
json_string = getattr(instance, self.field.attname)
instance.__dict__[self.field.name] = json.loads(json_string)
return instance.__dict__[self.field.name]
def __set__(self, instance, value):
instance.__dict__[self.field.name] = value
setattr(instance, self.field.attname, json.dumps(value))
def __delete__(self, instance):
del(instance.__dict__[self.field.name])
setattr(instance, self.field.attname, json.dumps(None))
class JSONField(models.TextField):
"""A :class:`TextField` which stores its value on the model instance as a python object and stores its value in the database as JSON. Validated with :func:`.json_validator`."""
default_validators = [json_validator]
def get_attname(self):
return "%s_json" % self.name
def contribute_to_class(self, cls, name):
super(JSONField, self).contribute_to_class(cls, name)
setattr(cls, name, JSONDescriptor(self))
models.signals.pre_init.connect(self.fix_init_kwarg, sender=cls)
def fix_init_kwarg(self, sender, args, kwargs, **signal_kwargs):
# Anything passed in as self.name is assumed to come from a serializer and
# will be treated as a json string.
if self.name in kwargs:
value = kwargs.pop(self.name)
# Hack to handle the xml serializer's handling of "null"
if value is None:
value = 'null'
kwargs[self.attname] = value
def formfield(self, *args, **kwargs):
kwargs["form_class"] = JSONFormField
return super(JSONField, self).formfield(*args, **kwargs)
class SlugMultipleChoiceField(models.Field):
"""Stores a selection of multiple items with unique slugs in the form of a comma-separated list. Also knows how to correctly handle :class:`RegistryIterator`\ s passed in as choices."""
__metaclass__ = models.SubfieldBase
description = _("Comma-separated slug field")
def get_internal_type(self):
return "TextField"
def to_python(self, value):
if not value:
return []
if isinstance(value, list):
return value
return value.split(',')
def get_prep_value(self, value):
return ','.join(value)
def formfield(self, **kwargs):
# This is necessary because django hard-codes TypedChoiceField for things with choices.
defaults = {
'widget': forms.CheckboxSelectMultiple,
'choices': self.get_choices(include_blank=False),
'label': capfirst(self.verbose_name),
'required': not self.blank,
'help_text': self.help_text
}
if self.has_default():
if callable(self.default):
defaults['initial'] = self.default
defaults['show_hidden_initial'] = True
else:
defaults['initial'] = self.get_default()
for k in kwargs.keys():
if k not in ('coerce', 'empty_value', 'choices', 'required',
'widget', 'label', 'initial', 'help_text',
'error_messages', 'show_hidden_initial'):
del kwargs[k]
defaults.update(kwargs)
form_class = forms.TypedMultipleChoiceField
return form_class(**defaults)
def validate(self, value, model_instance):
invalid_values = []
for val in value:
try:
validate_slug(val)
except ValidationError:
invalid_values.append(val)
if invalid_values:
# should really make a custom message.
raise ValidationError(self.error_messages['invalid_choice'] % invalid_values)
def _get_choices(self):
if isinstance(self._choices, RegistryIterator):
return self._choices.copy()
elif hasattr(self._choices, 'next'):
choices, self._choices = itertools.tee(self._choices)
return choices
else:
return self._choices
choices = property(_get_choices)
try:
from south.modelsinspector import add_introspection_rules
except ImportError:
pass
else:
add_introspection_rules([], ["^philo\.models\.fields\.SlugMultipleChoiceField"])
add_introspection_rules([], ["^philo\.models\.fields\.TemplateField"])
add_introspection_rules([], ["^philo\.models\.fields\.JSONField"])
|
b'What is 0 - -19 - (-7 + 16) - 13?\n'
|
b'What is -9 + (7 + 1 - (28 + -16))?\n'
|
#if false
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LionFire.Behaviors
{
public class Coroutine
{
}
}
#endif
|
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var core_1 = require("@angular/core");
var RemainingTimePipe = (function () {
function RemainingTimePipe() {
}
RemainingTimePipe.prototype.transform = function (date) {
var DaysInMonths = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
var Months = "JanFebMarAprMayJunJulAugSepOctNovDec";
var padding = "in ";
//Input pattern example: 2017-01-02T09:23:00.000Z
var input = date + "";
var splitted = input.split('T');
var today = new Date();
var year = +splitted[0].split('-')[0];
var month = +splitted[0].split('-')[1];
var day = +splitted[0].split('-')[2];
var splittedTime = splitted[1].split(':');
var hour = +splittedTime[0];
var minute = +splittedTime[1];
var second = +splittedTime[2].split('.')[0];
//Years
var currentYear = today.getFullYear();
var remaining = year - currentYear;
if (remaining < 0) {
return 'Started';
}
if (remaining > 0) {
if (remaining == 1) {
return padding + '1 year';
}
return padding + remaining + ' years';
}
//Months
var currentMonth = today.getMonth() + 1;
remaining = month - currentMonth;
if (remaining > 0) {
if (remaining == 1) {
//TODO Leap year
var currentDate = today.getDate();
var daysInPreviousMonth = (month != 0 ? DaysInMonths[month - 1] : DaysInMonths[11]);
var daysRemaining = (daysInPreviousMonth + day) - currentDate;
if (daysRemaining < 7) {
if (daysRemaining == 1) {
return padding + '1 day';
}
return padding + daysRemaining + ' days';
}
var weeksPassed = daysRemaining / 7;
weeksPassed = Math.round(weeksPassed);
if (weeksPassed == 1) {
return padding + '1 week';
}
return padding + weeksPassed + ' weeks';
}
return padding + remaining + ' months';
}
//Days
var currentDay = today.getDate();
var daysPassed = day - currentDay;
if (daysPassed > 0) {
if (daysPassed < 7) {
if (daysPassed == 1) {
return padding + '1 day';
}
return padding + daysPassed + ' days';
}
var weeksPassed = daysPassed / 7;
weeksPassed = Math.round(weeksPassed);
if (weeksPassed == 1) {
return padding + '1 week';
}
return padding + weeksPassed + ' weeks';
}
//Hours
var currentHour = today.getHours();
remaining = hour - currentHour;
if (remaining > 1) {
if (remaining == 2) {
return padding + '1 hour';
}
return padding + remaining + ' hours';
}
//Minutes
var currentMinute = today.getMinutes();
if (remaining == 1) {
remaining = 60 + minute - currentMinute;
}
else {
remaining = minute - currentMinute;
}
if (remaining > 0) {
if (remaining == 1) {
return padding + 'a minute';
}
return padding + remaining + ' minutes';
}
//Seconds
var currentSecond = today.getSeconds();
remaining = second - currentSecond;
if (remaining > 0) {
return padding + 'less than a minute';
}
return 'Started';
};
return RemainingTimePipe;
}());
RemainingTimePipe = __decorate([
core_1.Pipe({
name: 'remainingTimePipe'
}),
__metadata("design:paramtypes", [])
], RemainingTimePipe);
exports.RemainingTimePipe = RemainingTimePipe;
//# sourceMappingURL=remainingTimePipe.js.map
|
/* global describe, it, require */
'use strict';
// MODULES //
var // Expectation library:
chai = require( 'chai' ),
// Deep close to:
deepCloseTo = require( './utils/deepcloseto.js' ),
// Module to be tested:
log10 = require( './../lib/array.js' );
// VARIABLES //
var expect = chai.expect,
assert = chai.assert;
// TESTS //
describe( 'array log10', function tests() {
it( 'should export a function', function test() {
expect( log10 ).to.be.a( 'function' );
});
it( 'should compute the base-10 logarithm', function test() {
var data, actual, expected;
data = [
Math.pow( 10, 4 ),
Math.pow( 10, 6 ),
Math.pow( 10, 9 ),
Math.pow( 10, 15 ),
Math.pow( 10, 10 ),
Math.pow( 10, 25 )
];
actual = new Array( data.length );
actual = log10( actual, data );
expected = [ 4, 6, 9, 15, 10, 25 ];
assert.isTrue( deepCloseTo( actual, expected, 1e-7 ) );
});
it( 'should return an empty array if provided an empty array', function test() {
assert.deepEqual( log10( [], [] ), [] );
});
it( 'should handle non-numeric values by setting the element to NaN', function test() {
var data, actual, expected;
data = [ true, null, [], {} ];
actual = new Array( data.length );
actual = log10( actual, data );
expected = [ NaN, NaN, NaN, NaN ];
assert.deepEqual( actual, expected );
});
});
|
b'What is the value of (6 + -6 - 1) + (-6 - -13) + -20?\n'
|
<?php
interface Container {
/**
* Checks if a $x exists.
*
* @param unknown $x
*
* @return boolean
*/
function contains($x);
}
|
b'Calculate (62 + -45 - (2 + 3 + -3)) + 0.\n'
|
b'What is the value of 29 + -39 + -8 + 4?\n'
|
<?php
/**
* wm.class.php - window manager
*
* handles window groups and multiple gtkwindow object easily
*
* This is released under the GPL, see docs/gpl.txt for details
*
* @author Leon Pegg <[email protected]>
* @author Elizabeth M Smith <[email protected]>
* @copyright Leon Pegg (c)2006
* @link http://callicore.net/desktop
* @license http://www.opensource.org/licenses/gpl-license.php GPL
* @version $Id: wm.class.php 64 2006-12-10 18:09:56Z emsmith $
* @since Php 5.1.0
* @package callicore
* @subpackage desktop
* @category lib
* @filesource
*/
/**
* Class for handling multiple GtkWindow objects
*
* contains all static methods
*/
class CC_Wm
{
/**
* GtkWindow object array
* [string GtkWindow_Name]
* array(
* GtkWindow - Store GtkWindow object
* )
*
* @var array
*/
protected static $windows = array();
/**
* GtkWindowGroup - for making grabs work properly (see GtkWidget::grab_add)
*
* @var object instanceof GtkWindowGroup
*/
protected static $window_group;
/**
* public function __construct
*
* forces only static calls
*
* @return void
*/
public function __construct()
{
throw new CC_Exception('CC_WM contains only static methods and cannot be constructed');
}
/**
* Adds a GtkWindow object to CC_WM::$windows
*
* @param object $window instanceof GtkWindow
* @return bool
*/
public static function add_window(GtkWindow $window)
{
$name = $window->get_name();
if ($name !== '' && !array_key_exists($name, self::$windows))
{
if (!is_object(self::$window_group))
{
self::$window_group = new GtkWindowGroup();
}
self::$window_group->add_window($window);
self::$windows[$name] = $window;
return true;
}
return false;
}
/**
* Removes a GtkWindow object from CC_WM::$windows
*
* @param string $name
* @return object instanceof GtkWindow
*/
public static function remove_window($name)
{
if ($name !== '' && array_key_exists($name, self::$windows))
{
$window = self::$windows[$$name];
unset(self::$windows[$name]);
self::$window_group->remove_window($window);
return $window;
}
return false;
}
/**
* Retrives GtkWindow object from CC_WM::$windows
*
* @param string $name
* @return object instanceof GtkWindow
*/
public static function get_window($name)
{
if ($name !== '' && array_key_exists($name, self::$windows))
{
return self::$windows[$name];
}
return false;
}
/**
* Retrives CC_WM::$windows infomation array
* Structure:
* [int window_id]
* array(
* name - Name of GtkWindow
* class - Name of GtkWindow class
* )
*
* @return array
*/
public static function list_windows()
{
$list = array();
foreach (self::$windows as $name => $class)
{
$list[] = array('name' => $name, 'class' => $get_class($class));
}
return $list;
}
/**
* Shows all windows in the manager
*/
public static function show_all_windows()
{
foreach (self::$windows as $window)
{
$window->show_all();
}
}
/**
* hides all the windows in the manager
*/
public static function hide_all_windows()
{
foreach (self::$windows as $window)
{
$window->hide_all();
}
}
/**
* See if a specific window exists
*
* @param string $name name of window to check for
* @return bool
*/
public static function is_window($name)
{
return array_key_exists($name, self::$windows);
}
/**
* public function hide_all
*
* overrides hide_all for windows manager integration
*
* @return void
*/
public function hide_all()
{
if (class_exists('CC_Wm') && CC_Wm::is_window($this->get_name()) &&
$this->is_modal)
{
parent::grab_remove();
$return = parent::hide_all();
$this->is_modal = false;
return $return;
}
else
{
return parent::hide_all();
}
}
/**
* public function show_all
*
* overrides show_all for windows manager integration
*
* @return void
*/
public function show_all($modal = false)
{
if (class_exists('CC_Wm') && CC_Wm::is_window($this->get_name()))
{
$return = parent::show_all();
parent::grab_add();
$this->is_modal = true;
return $return;
}
else
{
return parent::show_all();
}
}
}
|
using CertificateManager.Entities;
using CertificateManager.Entities.Interfaces;
using System.Collections.Generic;
using System.Security.Claims;
namespace CertificateManager.Logic.Interfaces
{
public interface IAuditLogic
{
IEnumerable<AuditEvent> GetAllEvents();
void LogSecurityAuditSuccess(ClaimsPrincipal userContext, ILoggableEntity entity, EventCategory category);
void LogSecurityAuditFailure(ClaimsPrincipal userContext, ILoggableEntity entity, EventCategory category);
void LogOpsSuccess(ClaimsPrincipal userContext, string target, EventCategory category, string message);
void LogOpsError(ClaimsPrincipal userContext, string target, EventCategory category);
void LogOpsError(ClaimsPrincipal userContext, string target, EventCategory category, string message);
void InitializeMockData();
void ClearLogs(ClaimsPrincipal user);
}
}
|
b'10 + 2 + (-36 - -14)\n'
|
<!DOCTYPE HTML>
<html>
<head>
<title>Arbiter - Decisions Simplified</title>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.10/angular.min.js"></script>
<script src="app.js"></script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--[if lte IE 8]><script src="assets/js/ie/html5shiv.js"></script><![endif]-->
<link rel="stylesheet" href="assets/css/main.css" />
<!--[if lte IE 9]><link rel="stylesheet" href="assets/css/ie9.css" /><![endif]-->
<!--[if lte IE 8]><link rel="stylesheet" href="assets/css/ie8.css" /><![endif]-->
</head>
<body ng-app="decisionPage" ng-controller="decisionController" class="single">
<!-- Wrapper -->
<div id="wrapper">
<!-- Header -->
<header id="header">
<h1><a href="#">Arbiter</a></h1>
<nav class="links">
<ul>
<li><a href="#">My Posts</a></li>
</ul>
</nav>
<nav class="main">
<ul>
<li class="search">
<a class="fa-search" href="#search">Search</a>
<form id="search" method="get" action="#">
<input type="text" name="query" placeholder="Search" />
</form>
</li>
<li class="menu">
<a class="fa-bars" href="#menu">Menu</a>
</li>
</ul>
</nav>
</header>
<!-- Menu -->
<section id="menu">
<!-- Search -->
<section>
<form class="search" method="get" action="#">
<input type="text" name="query" placeholder="Search" />
</form>
</section>
<!-- Actions -->
<section>
<ul class="actions vertical">
<li><a href="#" class="button big fit">Log In</a></li>
</ul>
</section>
</section>
<!-- Main -->
<div id="main">
<!-- Post -->
<article class="post">
<header>
<div class="title">
<h2>{{test}}</h2>
</div>
<div class="meta">
<time class="published" datetime="2015-11-01">November 1, 2015</time>
<a href="#" class="author"><span class="name">Jane Doe</span><img src="images/avatar.jpg" alt="" /></a>
</div>
</header>
<footer>
<ul class="actions">
<li><a href="#" class="button big">Apple</a></li>
<li><a href="#" class="button big">Orange</a></li>
</ul>
</footer>
</article>
</div>
<!-- Footer -->
<section id="footer">
<ul class="icons">
<li><a href="#" class="fa-twitter"><span class="label">Twitter</span></a></li>
<li><a href="#" class="fa-facebook"><span class="label">Facebook</span></a></li>
<li><a href="#" class="fa-instagram"><span class="label">Instagram</span></a></li>
<li><a href="#" class="fa-rss"><span class="label">RSS</span></a></li>
<li><a href="#" class="fa-envelope"><span class="label">Email</span></a></li>
</ul>
<p class="copyright">Made by love @ UCSD</p>
</section>
</div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/skel.min.js"></script>
<script src="assets/js/util.js"></script>
<!--[if lte IE 8]><script src="assets/js/ie/respond.min.js"></script><![endif]-->
<script src="assets/js/main.js"></script>
</body>
</html>
|
#!/bin/bash
cp index.html /var/www/
cp -r js /var/www
cp -r img /var/www/img
|
html,
body {
font-family: 'Roboto', 'Helvetica', sans-serif;
}
strong,
b {
font-weight: 700;
}
h1,
h2,
h3 {
font-family: "Roboto Slab", "Helvetica", "Arial", sans-serif;
}
pre, code {
font-family: "Roboto mono", monospace;
}
.ghostdown-edit-content {
position: absolute;
top: 50px;
bottom: 50px;
left: 0;
right: 0;
width: 99%;
}
.editor-title {
font-family: "Roboto Condensed", "Helvetica", "Arial", sans-serif;
text-transform: uppercase;
font-size: 12px;
height: 42px;
margin: 0;
padding: 0 10px;
}
.ghostdown-button-save {
position: absolute;
bottom: 7px;
right: 7px;
}
.ghostdown-container {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
#ghostdown-preview {
overflow-y: scroll;
position: absolute;
top: 42px;
right: 0;
bottom: 0;
left: 0;
}
#ghostdown-rendered {
padding: 0 15px 15px;
}
#ghostdown-preview img {
max-width: 100%;
}
.ghostdown-panel {
position: relative;
margin-bottom: 50px;
}
.ghostdown-footer {
position: absolute;
left: 0;
right: 0;
bottom: 0;
padding: 15px;
}
#ghostdown-wordcount {
float: right;
display: inline-block;
margin-top: -42px;
padding: 10px 10px 0 0
}
/********************************************
* CodeMirror Markup Styling
*******************************************/
.CodeMirror {
position: absolute;
top: 42px;
right: 0;
bottom: 0;
left: 0;
height: auto;
font-family: "Roboto Mono", monospace;
}
.CodeMirror-lines{
padding: 0 7px 20px;
}
.CodeMirror .cm-header{
color: #000;
}
.CodeMirror .cm-header-1 {
font-size: 40px;
line-height: 1.35;
margin: 18px 0;
display: inline-block;
}
.CodeMirror .cm-header-2 {
font-size: 30px;
line-height: 1.35;
margin: 5px 0;
display: inline-block;
}
.CodeMirror .cm-header-3 {
font-size: 24px;
line-height: 1.35;
margin: 5px 0;
display: inline-block;
}
/********************************************
* Dropzone Styling
*******************************************/
p.dropzone {
}
|
<?php namespace EugeneTolok\Telegram\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateEugenetolokTelegramDialogsSteps2 extends Migration
{
public function up()
{
Schema::table('eugenetolok_telegram_dialogs_steps', function($table)
{
$table->increments('id');
});
}
public function down()
{
Schema::table('eugenetolok_telegram_dialogs_steps', function($table)
{
$table->dropColumn('id');
});
}
}
|
b'Calculate -325 + 317 + (-2 + 2 - 0).\n'
|
b'What is -31 - -61 - (15 - 0)?\n'
|
b'13 - 9 - (10 - 0 - -1) - -15\n'
|
import Immutable from 'immutable';
import * as ActionType from '../../actions/auth/auth';
const defaultState = Immutable.fromJS({
loggedIn: false,
});
function authReducer(state = defaultState, action) {
const {
loggedIn,
} = action;
switch (action.type) {
case ActionType.VERIFIED_LOGIN:
return state.merge(Immutable.fromJS({ loggedIn }));
default:
return state;
}
}
export default authReducer;
|
b'Evaluate -24 + 22 - (-1 - -5).\n'
|
ActionController::Routing::Routes.draw do |map|
map.resources :projects
map.resources :priorities
map.resources :tasks
# The priority is based upon order of creation: first created -> highest priority.
# Sample of regular route:
# map.connect 'products/:id', :controller => 'catalog', :action => 'view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# map.resources :products
# Sample resource route with options:
# map.resources :products, :member => { :short => :get, :toggle => :post }, :collection => { :sold => :get }
# Sample resource route with sub-resources:
# map.resources :products, :has_many => [ :comments, :sales ], :has_one => :seller
# Sample resource route with more complex sub-resources
# map.resources :products do |products|
# products.resources :comments
# products.resources :sales, :collection => { :recent => :get }
# end
# Sample resource route within a namespace:
# map.namespace :admin do |admin|
# # Directs /admin/products/* to Admin::ProductsController (app/controllers/admin/products_controller.rb)
# admin.resources :products
# end
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
# map.root :controller => "welcome"
# See how all your routes lay out with "rake routes"
# Install the default routes as the lowest priority.
# Note: These default routes make all actions in every controller accessible via GET requests. You should
# consider removing or commenting them out if you're using named routes and resources.
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
|
b'1 + (-9 + 5 + 8 - (23 - 0))\n'
|
b'Calculate (1 - (1 + -2) - 2) + (-149 - -140).\n'
|
package com.codenotfound.endpoint;
import java.math.BigInteger;
import org.example.ticketagent.ObjectFactory;
import org.example.ticketagent.TFlightsResponse;
import org.example.ticketagent.TListFlights;
import org.example.ticketagent_wsdl11.TicketAgent;
public class TicketAgentImpl implements TicketAgent {
@Override
public TFlightsResponse listFlights(TListFlights body) {
ObjectFactory factory = new ObjectFactory();
TFlightsResponse response = factory.createTFlightsResponse();
response.getFlightNumber().add(BigInteger.valueOf(101));
return response;
}
}
|
#include "NL_ImguiD3D11Renderer.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <imgui.h>
namespace NLE
{
namespace GRAPHICS
{
struct VERTEX_CONSTANT_BUFFER
{
float mvp[4][4];
};
ImguiD3D11Renderer::ImguiD3D11Renderer() :
_vertexBuffer(nullptr),
_indexBuffer(nullptr),
_vertexShaderBlob(nullptr),
_vertexShader(nullptr),
_inputLayout(nullptr),
_vertexConstantBuffer(nullptr),
_pixelShaderBlob(nullptr),
_pixelShader(nullptr),
_fontSampler(nullptr),
_fontTextureView(nullptr),
_rasterizerState(nullptr),
_blendState(nullptr),
_depthStencilState(nullptr),
_vertexBufferSize(5000),
_indexBufferSize(10000)
{
}
ImguiD3D11Renderer::~ImguiD3D11Renderer()
{
}
bool ImguiD3D11Renderer::initialize(ID3D11Device* device, ID3D11DeviceContext* devCon)
{
if (!createDeviceObjects(device, devCon))
return false;
if (!createFontAndTextures(device, devCon))
return false;
return true;
}
bool ImguiD3D11Renderer::createDeviceObjects(ID3D11Device* device, ID3D11DeviceContext* devCon)
{
// By using D3DCompile() from <d3dcompiler.h> / d3dcompiler.lib, we introduce a dependency to a given version of d3dcompiler_XX.dll (see D3DCOMPILER_DLL_A)
// If you would like to use this DX11 sample code but remove this dependency you can:
// 1) compile once, save the compiled shader blobs into a file or source code and pass them to CreateVertexShader()/CreatePixelShader() [prefered solution]
// 2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL.
// See https://github.com/ocornut/imgui/pull/638 for sources and details.
// Create the vertex shader
{
static const char* vertexShader =
"cbuffer vertexBuffer : register(b0) \
{\
float4x4 ProjectionMatrix; \
};\
struct VS_INPUT\
{\
float2 pos : POSITION;\
float4 col : COLOR0;\
float2 uv : TEXCOORD0;\
};\
\
struct PS_INPUT\
{\
float4 pos : SV_POSITION;\
float4 col : COLOR0;\
float2 uv : TEXCOORD0;\
};\
\
PS_INPUT main(VS_INPUT input)\
{\
PS_INPUT output;\
output.pos = mul( ProjectionMatrix, float4(input.pos.xy, 0.f, 1.f));\
output.col = input.col;\
output.uv = input.uv;\
return output;\
}";
D3DCompile(vertexShader, strlen(vertexShader), nullptr, nullptr, nullptr, "main", "vs_4_0", 0, 0, &_vertexShaderBlob, nullptr);
if (!_vertexShaderBlob) // NB: Pass ID3D10Blob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
return false;
if (device->CreateVertexShader((DWORD*)_vertexShaderBlob->GetBufferPointer(), _vertexShaderBlob->GetBufferSize(), nullptr, &_vertexShader) != S_OK)
return false;
// Create the input layout
D3D11_INPUT_ELEMENT_DESC local_layout[] = {
{ "POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->pos), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, (size_t)(&((ImDrawVert*)0)->uv), D3D11_INPUT_PER_VERTEX_DATA, 0 },
{ "COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (size_t)(&((ImDrawVert*)0)->col), D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
if (device->CreateInputLayout(local_layout, 3, _vertexShaderBlob->GetBufferPointer(), _vertexShaderBlob->GetBufferSize(), &_inputLayout) != S_OK)
return false;
// Create the constant buffer
{
D3D11_BUFFER_DESC desc;
desc.ByteWidth = sizeof(VERTEX_CONSTANT_BUFFER);
desc.Usage = D3D11_USAGE_DYNAMIC;
desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
desc.MiscFlags = 0;
device->CreateBuffer(&desc, nullptr, &_vertexConstantBuffer);
}
}
// Create the pixel shader
{
static const char* pixelShader =
"struct PS_INPUT\
{\
float4 pos : SV_POSITION;\
float4 col : COLOR0;\
float2 uv : TEXCOORD0;\
};\
sampler sampler0;\
Texture2D texture0;\
\
float4 main(PS_INPUT input) : SV_Target\
{\
float4 out_col = input.col * texture0.Sample(sampler0, input.uv); \
return out_col; \
}";
D3DCompile(pixelShader, strlen(pixelShader), nullptr, nullptr, nullptr, "main", "ps_4_0", 0, 0, &_pixelShaderBlob, nullptr);
if (!_pixelShaderBlob) // NB: Pass ID3D10Blob* pErrorBlob to D3DCompile() to get error showing in (const char*)pErrorBlob->GetBufferPointer(). Make sure to Release() the blob!
return false;
if (device->CreatePixelShader((DWORD*)_pixelShaderBlob->GetBufferPointer(), _pixelShaderBlob->GetBufferSize(), nullptr, &_pixelShader) != S_OK)
return false;
}
// Create the blending setup
{
D3D11_BLEND_DESC desc;
ZeroMemory(&desc, sizeof(desc));
desc.AlphaToCoverageEnable = false;
desc.RenderTarget[0].BlendEnable = true;
desc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
device->CreateBlendState(&desc, &_blendState);
}
// Create the rasterizer state
{
D3D11_RASTERIZER_DESC desc;
ZeroMemory(&desc, sizeof(desc));
desc.FillMode = D3D11_FILL_SOLID;
desc.CullMode = D3D11_CULL_NONE;
desc.ScissorEnable = true;
desc.DepthClipEnable = true;
device->CreateRasterizerState(&desc, &_rasterizerState);
}
// Create depth-stencil State
{
D3D11_DEPTH_STENCIL_DESC desc;
ZeroMemory(&desc, sizeof(desc));
desc.DepthEnable = false;
desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
desc.DepthFunc = D3D11_COMPARISON_ALWAYS;
desc.StencilEnable = false;
desc.FrontFace.StencilFailOp = desc.FrontFace.StencilDepthFailOp = desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
desc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
desc.BackFace = desc.FrontFace;
device->CreateDepthStencilState(&desc, &_depthStencilState);
}
return true;
}
bool ImguiD3D11Renderer::createFontAndTextures(ID3D11Device* device, ID3D11DeviceContext* devCon)
{
// Build texture atlas
ImGuiIO& io = ImGui::GetIO();
unsigned char* pixels;
int width, height;
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
// Upload texture to graphics system
{
D3D11_TEXTURE2D_DESC desc;
ZeroMemory(&desc, sizeof(desc));
desc.Width = width;
desc.Height = height;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.SampleDesc.Count = 1;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags = 0;
ID3D11Texture2D *pTexture = NULL;
D3D11_SUBRESOURCE_DATA subResource;
subResource.pSysMem = pixels;
subResource.SysMemPitch = desc.Width * 4;
subResource.SysMemSlicePitch = 0;
device->CreateTexture2D(&desc, &subResource, &pTexture);
// Create texture view
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
ZeroMemory(&srvDesc, sizeof(srvDesc));
srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
srvDesc.Texture2D.MipLevels = desc.MipLevels;
srvDesc.Texture2D.MostDetailedMip = 0;
device->CreateShaderResourceView(pTexture, &srvDesc, &_fontTextureView);
pTexture->Release();
}
// Store our identifier
io.Fonts->TexID = (void *)_fontTextureView;
// Create texture sampler
{
D3D11_SAMPLER_DESC desc;
ZeroMemory(&desc, sizeof(desc));
desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
desc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
desc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
desc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
desc.MipLODBias = 0.f;
desc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
desc.MinLOD = 0.f;
desc.MaxLOD = 0.f;
device->CreateSamplerState(&desc, &_fontSampler);
}
return true;
}
void ImguiD3D11Renderer::render(ID3D11Device* device, ID3D11DeviceContext* devCon, ImDrawData* drawData)
{
// Create and grow vertex/index buffers if needed
if (!_vertexBuffer || _vertexBufferSize < drawData->TotalVtxCount)
{
if (_vertexBuffer) { _vertexBuffer->Release(); _vertexBuffer = nullptr; }
_vertexBufferSize = drawData->TotalVtxCount + 5000;
D3D11_BUFFER_DESC desc;
memset(&desc, 0, sizeof(D3D11_BUFFER_DESC));
desc.Usage = D3D11_USAGE_DYNAMIC;
desc.ByteWidth = _vertexBufferSize * sizeof(ImDrawVert);
desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
desc.MiscFlags = 0;
if (device->CreateBuffer(&desc, nullptr, &_vertexBuffer) < 0)
return;
}
if (!_indexBuffer || _indexBufferSize < drawData->TotalIdxCount)
{
if (_indexBuffer) { _indexBuffer->Release(); _indexBuffer = nullptr; }
_indexBufferSize = drawData->TotalIdxCount + 10000;
D3D11_BUFFER_DESC desc;
memset(&desc, 0, sizeof(D3D11_BUFFER_DESC));
desc.Usage = D3D11_USAGE_DYNAMIC;
desc.ByteWidth = _indexBufferSize * sizeof(ImDrawIdx);
desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
if (device->CreateBuffer(&desc, nullptr, &_indexBuffer) < 0)
return;
}
// Copy and convert all vertices into a single contiguous buffer
D3D11_MAPPED_SUBRESOURCE vtx_resource, idx_resource;
if (devCon->Map(_vertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &vtx_resource) != S_OK)
return;
if (devCon->Map(_indexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &idx_resource) != S_OK)
return;
ImDrawVert* vtx_dst = (ImDrawVert*)vtx_resource.pData;
ImDrawIdx* idx_dst = (ImDrawIdx*)idx_resource.pData;
for (int n = 0; n < drawData->CmdListsCount; n++)
{
const ImDrawList* cmd_list = drawData->CmdLists[n];
memcpy(vtx_dst, &cmd_list->VtxBuffer[0], cmd_list->VtxBuffer.size() * sizeof(ImDrawVert));
memcpy(idx_dst, &cmd_list->IdxBuffer[0], cmd_list->IdxBuffer.size() * sizeof(ImDrawIdx));
vtx_dst += cmd_list->VtxBuffer.size();
idx_dst += cmd_list->IdxBuffer.size();
}
devCon->Unmap(_vertexBuffer, 0);
devCon->Unmap(_indexBuffer, 0);
// Setup orthographic projection matrix into our constant buffer
{
D3D11_MAPPED_SUBRESOURCE mapped_resource;
if (devCon->Map(_vertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_resource) != S_OK)
return;
VERTEX_CONSTANT_BUFFER* constant_buffer = (VERTEX_CONSTANT_BUFFER*)mapped_resource.pData;
float L = 0.0f;
float R = ImGui::GetIO().DisplaySize.x;
float B = ImGui::GetIO().DisplaySize.y;
float T = 0.0f;
float mvp[4][4] =
{
{ 2.0f / (R - L), 0.0f, 0.0f, 0.0f },
{ 0.0f, 2.0f / (T - B), 0.0f, 0.0f },
{ 0.0f, 0.0f, 0.5f, 0.0f },
{ (R + L) / (L - R), (T + B) / (B - T), 0.5f, 1.0f },
};
memcpy(&constant_buffer->mvp, mvp, sizeof(mvp));
devCon->Unmap(_vertexConstantBuffer, 0);
}
// Backup DX state that will be modified to restore it afterwards (unfortunately this is very ugly looking and verbose. Close your eyes!)
struct BACKUP_DX11_STATE
{
UINT ScissorRectsCount, ViewportsCount;
D3D11_RECT ScissorRects[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
D3D11_VIEWPORT Viewports[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
ID3D11RasterizerState* RS;
ID3D11BlendState* BlendState;
FLOAT BlendFactor[4];
UINT SampleMask;
UINT StencilRef;
ID3D11DepthStencilState* DepthStencilState;
ID3D11ShaderResourceView* PSShaderResource;
ID3D11SamplerState* PSSampler;
ID3D11PixelShader* PS;
ID3D11VertexShader* VS;
UINT PSInstancesCount, VSInstancesCount;
ID3D11ClassInstance* PSInstances[256], *VSInstances[256]; // 256 is max according to PSSetShader documentation
D3D11_PRIMITIVE_TOPOLOGY PrimitiveTopology;
ID3D11Buffer* IndexBuffer, *VertexBuffer, *VSConstantBuffer;
UINT IndexBufferOffset, VertexBufferStride, VertexBufferOffset;
DXGI_FORMAT IndexBufferFormat;
ID3D11InputLayout* InputLayout;
};
BACKUP_DX11_STATE old;
old.ScissorRectsCount = old.ViewportsCount = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;
devCon->RSGetScissorRects(&old.ScissorRectsCount, old.ScissorRects);
devCon->RSGetViewports(&old.ViewportsCount, old.Viewports);
devCon->RSGetState(&old.RS);
devCon->OMGetBlendState(&old.BlendState, old.BlendFactor, &old.SampleMask);
devCon->OMGetDepthStencilState(&old.DepthStencilState, &old.StencilRef);
devCon->PSGetShaderResources(0, 1, &old.PSShaderResource);
devCon->PSGetSamplers(0, 1, &old.PSSampler);
old.PSInstancesCount = old.VSInstancesCount = 256;
devCon->PSGetShader(&old.PS, old.PSInstances, &old.PSInstancesCount);
devCon->VSGetShader(&old.VS, old.VSInstances, &old.VSInstancesCount);
devCon->VSGetConstantBuffers(0, 1, &old.VSConstantBuffer);
devCon->IAGetPrimitiveTopology(&old.PrimitiveTopology);
devCon->IAGetIndexBuffer(&old.IndexBuffer, &old.IndexBufferFormat, &old.IndexBufferOffset);
devCon->IAGetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset);
devCon->IAGetInputLayout(&old.InputLayout);
// Setup viewport
D3D11_VIEWPORT vp;
memset(&vp, 0, sizeof(D3D11_VIEWPORT));
vp.Width = ImGui::GetIO().DisplaySize.x;
vp.Height = ImGui::GetIO().DisplaySize.y;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
vp.TopLeftX = vp.TopLeftY = 0.0f;
devCon->RSSetViewports(1, &vp);
// Bind shader and vertex buffers
unsigned int stride = sizeof(ImDrawVert);
unsigned int offset = 0;
devCon->IASetInputLayout(_inputLayout);
devCon->IASetVertexBuffers(0, 1, &_vertexBuffer, &stride, &offset);
devCon->IASetIndexBuffer(_indexBuffer, sizeof(ImDrawIdx) == 2 ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT, 0);
devCon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
devCon->VSSetShader(_vertexShader, NULL, 0);
devCon->VSSetConstantBuffers(0, 1, &_vertexConstantBuffer);
devCon->PSSetShader(_pixelShader, NULL, 0);
devCon->PSSetSamplers(0, 1, &_fontSampler);
// Setup render state
const float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };
devCon->OMSetBlendState(_blendState, blend_factor, 0xffffffff);
devCon->OMSetDepthStencilState(_depthStencilState, 0);
devCon->RSSetState(_rasterizerState);
// Render command lists
int vtx_offset = 0;
int idx_offset = 0;
for (int n = 0; n < drawData->CmdListsCount; n++)
{
const ImDrawList* cmd_list = drawData->CmdLists[n];
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.size(); cmd_i++)
{
const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];
if (pcmd->UserCallback)
{
pcmd->UserCallback(cmd_list, pcmd);
}
else
{
const D3D11_RECT r = { (LONG)pcmd->ClipRect.x, (LONG)pcmd->ClipRect.y, (LONG)pcmd->ClipRect.z, (LONG)pcmd->ClipRect.w };
devCon->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&pcmd->TextureId);
devCon->RSSetScissorRects(1, &r);
devCon->DrawIndexed(pcmd->ElemCount, idx_offset, vtx_offset);
}
idx_offset += pcmd->ElemCount;
}
vtx_offset += cmd_list->VtxBuffer.size();
}
// Restore modified DX state
devCon->RSSetScissorRects(old.ScissorRectsCount, old.ScissorRects);
devCon->RSSetViewports(old.ViewportsCount, old.Viewports);
devCon->RSSetState(old.RS); if (old.RS) old.RS->Release();
devCon->OMSetBlendState(old.BlendState, old.BlendFactor, old.SampleMask); if (old.BlendState) old.BlendState->Release();
devCon->OMSetDepthStencilState(old.DepthStencilState, old.StencilRef); if (old.DepthStencilState) old.DepthStencilState->Release();
devCon->PSSetShaderResources(0, 1, &old.PSShaderResource); if (old.PSShaderResource) old.PSShaderResource->Release();
devCon->PSSetSamplers(0, 1, &old.PSSampler); if (old.PSSampler) old.PSSampler->Release();
devCon->PSSetShader(old.PS, old.PSInstances, old.PSInstancesCount); if (old.PS) old.PS->Release();
for (UINT i = 0; i < old.PSInstancesCount; i++) if (old.PSInstances[i]) old.PSInstances[i]->Release();
devCon->VSSetShader(old.VS, old.VSInstances, old.VSInstancesCount); if (old.VS) old.VS->Release();
devCon->VSSetConstantBuffers(0, 1, &old.VSConstantBuffer); if (old.VSConstantBuffer) old.VSConstantBuffer->Release();
for (UINT i = 0; i < old.VSInstancesCount; i++) if (old.VSInstances[i]) old.VSInstances[i]->Release();
devCon->IASetPrimitiveTopology(old.PrimitiveTopology);
devCon->IASetIndexBuffer(old.IndexBuffer, old.IndexBufferFormat, old.IndexBufferOffset); if (old.IndexBuffer) old.IndexBuffer->Release();
devCon->IASetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset); if (old.VertexBuffer) old.VertexBuffer->Release();
devCon->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();
}
}
}
|
b'What is the value of -5 - (13 - 23) - -3?\n'
|
module Discordrb::Webhooks
# An embed is a multipart-style attachment to a webhook message that can have a variety of different purposes and
# appearances.
class Embed
def initialize(title: nil, description: nil, url: nil, timestamp: nil, colour: nil, color: nil, footer: nil,
image: nil, thumbnail: nil, video: nil, provider: nil, author: nil, fields: [])
@title = title
@description = description
@url = url
@timestamp = timestamp
@colour = colour || color
@footer = footer
@image = image
@thumbnail = thumbnail
@video = video
@provider = provider
@author = author
@fields = fields
end
# The title of this embed that will be displayed above everything else.
# @return [String]
attr_accessor :title
# The description for this embed.
# @return [String]
attr_accessor :description
# The URL the title should point to.
# @return [String]
attr_accessor :url
# The timestamp for this embed. Will be displayed just below the title.
# @return [Time]
attr_accessor :timestamp
# @return [Integer] the colour of the bar to the side, in decimal form.
attr_reader :colour
alias_method :color, :colour
# Sets the colour of the bar to the side of the embed to something new.
# @param value [Integer, String, {Integer, Integer, Integer}] The colour in decimal, hexadecimal, or R/G/B decimal
# form.
def colour=(value)
if value.is_a? Integer
raise ArgumentError, 'Embed colour must be 24-bit!' if value >= 16_777_216
@colour = value
elsif value.is_a? String
self.colour = value.delete('#').to_i(16)
elsif value.is_a? Array
raise ArgumentError, 'Colour tuple must have three values!' if value.length != 3
self.colour = value[0] << 16 | value[1] << 8 | value[2]
end
end
alias_method :color=, :colour=
# The footer for this embed.
# @example Add a footer to an embed
# embed.footer = Discordrb::Webhooks::EmbedFooter.new(text: 'Hello', icon_url: 'https://i.imgur.com/j69wMDu.jpg')
# @return [EmbedFooter]
attr_accessor :footer
# The image for this embed.
# @see EmbedImage
# @example Add a image to an embed
# embed.image = Discordrb::Webhooks::EmbedImage.new(url: 'https://i.imgur.com/PcMltU7.jpg')
# @return [EmbedImage]
attr_accessor :image
# The thumbnail for this embed.
# @see EmbedThumbnail
# @example Add a thumbnail to an embed
# embed.thumbnail = Discordrb::Webhooks::EmbedThumbnail.new(url: 'https://i.imgur.com/xTG3a1I.jpg')
# @return [EmbedThumbnail]
attr_accessor :thumbnail
# The author for this embed.
# @see EmbedAuthor
# @example Add a author to an embed
# embed.author = Discordrb::Webhooks::EmbedAuthor.new(name: 'meew0', url: 'https://github.com/meew0', icon_url: 'https://avatars2.githubusercontent.com/u/3662915?v=3&s=466')
# @return [EmbedAuthor]
attr_accessor :author
# Add a field object to this embed.
# @param field [EmbedField] The field to add.
def <<(field)
@fields << field
end
# Convenience method to add a field to the embed without having to create one manually.
# @see EmbedField
# @example Add a field to an embed, conveniently
# embed.add_field(name: 'A field', value: "The field's content")
# @param name [String] The field's name
# @param value [String] The field's value
# @param inline [true, false] Whether the field should be inlined
def add_field(name: nil, value: nil, inline: nil)
self << EmbedField.new(name: name, value: value, inline: inline)
end
# @return [Array<EmbedField>] the fields attached to this embed.
attr_reader :fields
# @return [Hash] a hash representation of this embed, to be converted to JSON.
def to_hash
{
title: @title,
description: @description,
url: @url,
timestamp: @timestamp && @timestamp.utc.iso8601,
color: @colour,
footer: @footer && @footer.to_hash,
image: @image && @image.to_hash,
thumbnail: @thumbnail && @thumbnail.to_hash,
video: @video && @video.to_hash,
provider: @provider && @provider.to_hash,
author: @author && @author.to_hash,
fields: @fields.map(&:to_hash)
}
end
end
# An embed's footer will be displayed at the very bottom of an embed, together with the timestamp. An icon URL can be
# set together with some text to be displayed.
class EmbedFooter
# Creates a new footer object.
# @param text [String, nil] The text to be displayed in the footer.
# @param icon_url [String, nil] The URL to an icon to be showed alongside the text.
def initialize(text: nil, icon_url: nil)
@text = text
@icon_url = icon_url
end
# @return [Hash] a hash representation of this embed footer, to be converted to JSON.
def to_hash
{
text: @text,
icon_url: @icon_url
}
end
end
# An embed's image will be displayed at the bottom, in large format. It will replace a footer icon URL if one is set.
class EmbedImage
# Creates a new image object.
# @param url [String, nil] The URL of the image.
def initialize(url: nil)
@url = url
end
# @return [Hash] a hash representation of this embed image, to be converted to JSON.
def to_hash
{
url: @url
}
end
end
# An embed's thumbnail will be displayed at the right of the message, next to the description and fields. When clicked
# it will point to the embed URL.
class EmbedThumbnail
# Creates a new thumbnail object.
# @param url [String, nil] The URL of the thumbnail.
def initialize(url: nil)
@url = url
end
# @return [Hash] a hash representation of this embed thumbnail, to be converted to JSON.
def to_hash
{
url: @url
}
end
end
# An embed's author will be shown at the top to indicate who "authored" the particular event the webhook was sent for.
class EmbedAuthor
# Creates a new author object.
# @param name [String, nil] The name of the author.
# @param url [String, nil] The URL the name should link to.
# @param icon_url [String, nil] The URL of the icon to be displayed next to the author.
def initialize(name: nil, url: nil, icon_url: nil)
@name = name
@url = url
@icon_url = icon_url
end
# @return [Hash] a hash representation of this embed author, to be converted to JSON.
def to_hash
{
name: @name,
url: @url,
icon_url: @icon_url
}
end
end
# A field is a small block of text with a header that can be relatively freely layouted with other fields.
class EmbedField
# Creates a new field object.
# @param name [String, nil] The name of the field, displayed in bold at the top.
# @param value [String, nil] The value of the field, displayed in normal text below the name.
# @param inline [true, false] Whether the field should be displayed in-line with other fields.
def initialize(name: nil, value: nil, inline: nil)
@name = name
@value = value
@inline = inline
end
# @return [Hash] a hash representation of this embed field, to be converted to JSON.
def to_hash
{
name: @name,
value: @value,
inline: @inline
}
end
end
end
|
# gitflow-publisher-bower
> a bower publish processor for gitflow-publisher


[](https://github.com/akonoupakis/gitflow-publisher-bower/issues)

[](http://travis-ci.org/akonoupakis/gitflow-publisher-bower)

[](https://david-dm.org/akonoupakis/gitflow-publisher-bower)
[](https://nodei.co/npm/gitflow-publisher-bower/)
## overview
This gitflow-publisher plugin module, deploys to the bower registry upon a successful gitflow release.
## usage
```js
var Publisher = require('gitflow-publisher');
var GitflowBowerPublisher = require('gitflow-publisher-bower');
var publisher = new Publisher();
publisher.use(new GitflowBowerPublisher({
name: 'module-name',
repository: 'https://github.com/username/packagename.git'
}));
publisher.publish({...})
```
## copyright and license
Code and documentation copyright 2016 akon. Code released under [the MIT license](https://cdn.rawgit.com/akonoupakis/gitflow-publisher-bower/master/LICENSE).
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.