text
stringlengths
2
1.04M
meta
dict
.registration__login-form { }
{ "content_hash": "e8de28b4b795a3d72fc516a9d78304e2", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 27, "avg_line_length": 10, "alnum_prop": 0.7, "repo_name": "yavalvas/react-blog", "id": "33d1172c6b130c1e279396a67e19f6bc3fbe1a30", "size": "30", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/public/javascripts/components/main-page/__registration/registration.css", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "526" }, { "name": "HTML", "bytes": "1309" }, { "name": "JavaScript", "bytes": "24820" } ], "symlink_target": "" }
<?php /** * Class Shop for Backward compatibility */ class ShopBackwardModuleUpdated extends Shop { const CONTEXT_ALL = 1; public $id = 1; public $id_shop_group = 1; public $physical_uri = __PS_BASE_URI__; public function getContextType() { return ShopBackwardModule::CONTEXT_ALL; } public function setContext($var) { return true; } // Simulate shop for 1.3 / 1.4 public function getID() { return 1; } /** * Get shop theme name * * @return string */ public function getTheme() { return _THEME_NAME_; } public function isFeatureActive() { return false; } }
{ "content_hash": "6224829e901ad90711a6753da308c68a", "timestamp": "", "source": "github", "line_count": 47, "max_line_length": 47, "avg_line_length": 15.404255319148936, "alnum_prop": 0.5455801104972375, "repo_name": "FabienSerny/sellermania-prestashop", "id": "2a131d0f4ec610cee58c0745d1bbe042cf967330", "size": "1618", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "backward/ContextUpdated.php", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1532" }, { "name": "HTML", "bytes": "9877" }, { "name": "JavaScript", "bytes": "48320" }, { "name": "PHP", "bytes": "599280" }, { "name": "Smarty", "bytes": "114169" } ], "symlink_target": "" }
 #include <aws/mediapackage-vod/model/PresetSpeke20Video.h> #include <aws/core/utils/HashingUtils.h> #include <aws/core/Globals.h> #include <aws/core/utils/EnumParseOverflowContainer.h> using namespace Aws::Utils; namespace Aws { namespace MediaPackageVod { namespace Model { namespace PresetSpeke20VideoMapper { static const int PRESET_VIDEO_1_HASH = HashingUtils::HashString("PRESET-VIDEO-1"); static const int PRESET_VIDEO_2_HASH = HashingUtils::HashString("PRESET-VIDEO-2"); static const int PRESET_VIDEO_3_HASH = HashingUtils::HashString("PRESET-VIDEO-3"); static const int PRESET_VIDEO_4_HASH = HashingUtils::HashString("PRESET-VIDEO-4"); static const int PRESET_VIDEO_5_HASH = HashingUtils::HashString("PRESET-VIDEO-5"); static const int PRESET_VIDEO_6_HASH = HashingUtils::HashString("PRESET-VIDEO-6"); static const int PRESET_VIDEO_7_HASH = HashingUtils::HashString("PRESET-VIDEO-7"); static const int PRESET_VIDEO_8_HASH = HashingUtils::HashString("PRESET-VIDEO-8"); static const int SHARED_HASH = HashingUtils::HashString("SHARED"); static const int UNENCRYPTED_HASH = HashingUtils::HashString("UNENCRYPTED"); PresetSpeke20Video GetPresetSpeke20VideoForName(const Aws::String& name) { int hashCode = HashingUtils::HashString(name.c_str()); if (hashCode == PRESET_VIDEO_1_HASH) { return PresetSpeke20Video::PRESET_VIDEO_1; } else if (hashCode == PRESET_VIDEO_2_HASH) { return PresetSpeke20Video::PRESET_VIDEO_2; } else if (hashCode == PRESET_VIDEO_3_HASH) { return PresetSpeke20Video::PRESET_VIDEO_3; } else if (hashCode == PRESET_VIDEO_4_HASH) { return PresetSpeke20Video::PRESET_VIDEO_4; } else if (hashCode == PRESET_VIDEO_5_HASH) { return PresetSpeke20Video::PRESET_VIDEO_5; } else if (hashCode == PRESET_VIDEO_6_HASH) { return PresetSpeke20Video::PRESET_VIDEO_6; } else if (hashCode == PRESET_VIDEO_7_HASH) { return PresetSpeke20Video::PRESET_VIDEO_7; } else if (hashCode == PRESET_VIDEO_8_HASH) { return PresetSpeke20Video::PRESET_VIDEO_8; } else if (hashCode == SHARED_HASH) { return PresetSpeke20Video::SHARED; } else if (hashCode == UNENCRYPTED_HASH) { return PresetSpeke20Video::UNENCRYPTED; } EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { overflowContainer->StoreOverflow(hashCode, name); return static_cast<PresetSpeke20Video>(hashCode); } return PresetSpeke20Video::NOT_SET; } Aws::String GetNameForPresetSpeke20Video(PresetSpeke20Video enumValue) { switch(enumValue) { case PresetSpeke20Video::PRESET_VIDEO_1: return "PRESET-VIDEO-1"; case PresetSpeke20Video::PRESET_VIDEO_2: return "PRESET-VIDEO-2"; case PresetSpeke20Video::PRESET_VIDEO_3: return "PRESET-VIDEO-3"; case PresetSpeke20Video::PRESET_VIDEO_4: return "PRESET-VIDEO-4"; case PresetSpeke20Video::PRESET_VIDEO_5: return "PRESET-VIDEO-5"; case PresetSpeke20Video::PRESET_VIDEO_6: return "PRESET-VIDEO-6"; case PresetSpeke20Video::PRESET_VIDEO_7: return "PRESET-VIDEO-7"; case PresetSpeke20Video::PRESET_VIDEO_8: return "PRESET-VIDEO-8"; case PresetSpeke20Video::SHARED: return "SHARED"; case PresetSpeke20Video::UNENCRYPTED: return "UNENCRYPTED"; default: EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); } return {}; } } } // namespace PresetSpeke20VideoMapper } // namespace Model } // namespace MediaPackageVod } // namespace Aws
{ "content_hash": "52a82b8412690cb62aa9e92aec555b44", "timestamp": "", "source": "github", "line_count": 123, "max_line_length": 92, "avg_line_length": 35.926829268292686, "alnum_prop": 0.6021724372029871, "repo_name": "aws/aws-sdk-cpp", "id": "43039708a9fcbe0875d677cdbeee4ba6e66f741c", "size": "4538", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "aws-cpp-sdk-mediapackage-vod/source/model/PresetSpeke20Video.cpp", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "309797" }, { "name": "C++", "bytes": "476866144" }, { "name": "CMake", "bytes": "1245180" }, { "name": "Dockerfile", "bytes": "11688" }, { "name": "HTML", "bytes": "8056" }, { "name": "Java", "bytes": "413602" }, { "name": "Python", "bytes": "79245" }, { "name": "Shell", "bytes": "9246" } ], "symlink_target": "" }
class Zip < ActiveRecord::Base end
{ "content_hash": "f33033002b4de376ba955df09e3031bf", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 30, "avg_line_length": 17.5, "alnum_prop": 0.7714285714285715, "repo_name": "deild/RubyOnRailsEtudeDeCas", "id": "252915ef84a1b5935a8a604733cb8a33c0d574e1", "size": "240", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pragforms/app/models/zip.rb", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "15000" }, { "name": "CSS", "bytes": "92838" }, { "name": "HTML", "bytes": "4219962" }, { "name": "JavaScript", "bytes": "40932" }, { "name": "PLSQL", "bytes": "3711" }, { "name": "Ruby", "bytes": "917345" } ], "symlink_target": "" }
Accounts.onCreateUser(function(options, user){ var userProperties = { profile: options.profile || {}, karma: 0, isInvited: false, isAdmin: false, postCount: 0, commentCount: 0, invitedCount: 0, votes: { upvotedPosts: [], downvotedPosts: [], upvotedComments: [], downvotedComments: [] } }; user = _.extend(user, userProperties); if (options.email) user.profile.email = options.email; if (getEmail(user)) user.email_hash = getEmailHash(user); if (!user.profile.name) user.profile.name = user.username; // set notifications default preferences user.profile.notifications = { users: false, posts: false, comments: true, replies: true }; // create slug from username user.slug = slugify(getUserName(user)); // if this is the first user ever, make them an admin if (!Meteor.users.find().count() ) user.isAdmin = true; // give new users a few invites (default to 3) user.inviteCount = getSetting('startInvitesCount', 3); trackEvent('new user', {username: user.username, email: user.profile.email}); // if user has already filled in their email, add them to MailChimp list // if(user.profile.email) // addToMailChimpList(user, false, function(error, result){ // if(error){ // console.log(error) // } // }); // if the new user has been invited // set her status accordingly and update invitation info if(invitesEnabled() && user.profile.email){ var invite = Invites.findOne({ invitedUserEmail : user.profile.email }); if(invite){ var invitedBy = Meteor.users.findOne({ _id : invite.invitingUserId }); user = _.extend(user, { isInvited: true, invitedBy: invitedBy._id, invitedByName: getDisplayName(invitedBy) }); Invites.update(invite._id, {$set : { accepted : true }}); } } // send notifications to admins var admins = Meteor.users.find({isAdmin: true}); admins.forEach(function(admin){ if(getUserSetting('notifications.users', false, admin)){ var emailProperties = { profileUrl: getProfileUrl(user), username: getUserName(user) } var html = getEmailTemplate('emailNewUser')(emailProperties); sendEmail(getEmail(admin), 'New user account: '+getUserName(user), buildEmailTemplate(html)); } }); return user; }); getEmailHash = function(user){ // todo: add some kind of salt in here return CryptoJS.MD5(getEmail(user).trim().toLowerCase() + user.createdAt).toString(); }; Meteor.methods({ changeEmail: function(newEmail) { Meteor.users.update(Meteor.userId(), {$set: {emails: [{address: newEmail}]}}); }, numberOfPostsToday: function(){ console.log(numberOfItemsInPast24Hours(Meteor.user(), Posts)); }, numberOfCommentsToday: function(){ console.log(numberOfItemsInPast24Hours(Meteor.user(), Comments)); }, testBuffer: function(){ // TODO }, getScoreDiff: function(id){ var object = Posts.findOne(id); var baseScore = object.baseScore; var ageInHours = (new Date().getTime() - object.submitted) / (60 * 60 * 1000); var newScore = baseScore / Math.pow(ageInHours + 2, 1.3); return Math.abs(object.score - newScore); }, setEmailHash: function(user){ var email_hash = CryptoJS.MD5(getEmail(user).trim().toLowerCase()).toString(); Meteor.users.update(user._id, {$set : {email_hash : email_hash}}); } });
{ "content_hash": "4a8b8a78618efe7d113dba62655a598f", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 99, "avg_line_length": 29.058333333333334, "alnum_prop": 0.6452537998279323, "repo_name": "MallorcaJS/discuss.mallorcajs.com", "id": "086211676c157aed9b07046bc2f68880c6350de7", "size": "3487", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "server/users.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "159073" }, { "name": "JavaScript", "bytes": "248460" } ], "symlink_target": "" }
layout: post title: Proxmox VE installation with Cfengine under Debian created: 1351847302 tags: linux automation virtualization kvm --- Following up the CFEngine series of OpenStack for [Debian](/node/94) and [Ubuntu](/node/78) here's another one, but this time for [Proxmox VE](http://www.proxmox.com) and Debian. The Proxmox VE installation and configuration is much, much simpler than the OpenStack configuration as it consists of just a few package installations. You can get the Cfengine promises at the Github repository listed below: * [https://github.com/dnaeon/proxmoxve-cfengine-debian](https://github.com/dnaeon/proxmoxve-cfengine-debian) The Cfengine policy is based on the documentation found at the Proxmox VE Wiki: * [http://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Squeeze](http://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Squeeze) Hope you find them useful and happy CFEngine'ing! :)
{ "content_hash": "6ba994bfcc798a13f6dab6b1cdf86683", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 134, "avg_line_length": 38.541666666666664, "alnum_prop": 0.787027027027027, "repo_name": "dnaeon/dnaeon.github.io", "id": "457ac8def6698f0310d9ad599e53a73c7f449111", "size": "929", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/2012-11-02-proxmox-ve-installation-with-cfengine-under-debian.md", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "6248" }, { "name": "SCSS", "bytes": "62905" } ], "symlink_target": "" }
window.gulpicon = function( css, foo ){ // expects a css array with 3 items representing CSS paths to datasvg, datapng, urlpng if( !css || css.length !== 3 ){ return; } // Thanks Modernizr & Erik Dahlstrom var w = window, svg = !!w.document.createElementNS && !!w.document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect && !!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image", "1.1") && !(window.opera && navigator.userAgent.indexOf('Chrome') === -1), loadCSS = function( data ){ var link = w.document.createElement( "link" ), ref = w.document.getElementsByTagName( "script" )[ 0 ]; link.rel = "stylesheet"; link.href = css[ data && svg ? 0 : data ? 1 : 2 ]; ref.parentNode.insertBefore( link, ref ); }, // Thanks Modernizr img = new w.Image(); img.onerror = function(){ loadCSS( false ); }; img.onload = function(){ loadCSS( img.width === 1 && img.height === 1 ); }; img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; }; // Call gulpicon() here to load CSS:
{ "content_hash": "f3002083804468902ab15ccde0c8e9b9", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 280, "avg_line_length": 35.71875, "alnum_prop": 0.6176727909011374, "repo_name": "wakayama-io/generator-sandbox", "id": "8ada856d58d230b0dce1fa286570b9e6eb967402", "size": "1143", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "app/templates/_gulpicon-loader.js", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "CSS", "bytes": "296" }, { "name": "JavaScript", "bytes": "36097" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright (c) 2016-2017 Red Hat, Inc. ~ ~ Red Hat licenses this file to you under the Apache License, version ~ 2.0 (the "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or ~ implied. See the License for the specific language governing ~ permissions and limitations under the License. --> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.workspace7.maven.plugins.vertx.it</groupId> <artifactId>vertx-demo-start</artifactId> <version>0.0.1.BUILD-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <vertx.version>3.4.1</vertx.version> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>@project.groupId@</groupId> <artifactId>@project.artifactId@</artifactId> <version>@project.version@</version> <executions> <execution> <phase>package</phase> <goals> <goal>initialize</goal> <goal>run</goal> </goals> </execution> </executions> <configuration> <launcher>demo.Main</launcher> <verticle>demo.SimpleVerticle</verticle> <runArgs> <runArg>-R</runArg> <runArg>/tmp/docs</runArg> <runArg>/home/vertx/docs</runArg> </runArgs> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>io.vertx</groupId> <artifactId>vertx-core</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>io.vertx</groupId> <artifactId>vertx-dependencies</artifactId> <version>${vertx.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> </project>
{ "content_hash": "8c339c11bfc6aafa766f4beb1b50d44b", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 108, "avg_line_length": 38.404761904761905, "alnum_prop": 0.5412275263484191, "repo_name": "kameshsampath/vertx-maven-plugin", "id": "9b06d32c3e6700480824f1fa1774509043489315", "size": "3226", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/it/run-args-extended-launcher-it/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "71" }, { "name": "FreeMarker", "bytes": "2491" }, { "name": "Groovy", "bytes": "27306" }, { "name": "Java", "bytes": "331316" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "e0c3274ef96176c95bbab3173c2bbf17", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "93073050845ff0d35754e9f300cb02aea5462a93", "size": "195", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Angraecum/Angraecum multiflorum/ Syn. Epidorchis multiflora/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
import 'babel-polyfill' import City from '../models/city' import Router from 'koa-router' import { baseApi } from '../config' const api = 'city' const router = new Router(); router.prefix(`/${baseApi}/${api}`) /* eslint-disable no-unused-vars, no-param-reassign, new-cap */ // GET /api/city router.get('/', async(ctx) => ctx.body = await City.find()) // POST /api/city router.post('/', async(ctx) => { try { const city = await new City(ctx.request.body).save() ctx.body = city } catch (err) { ctx.throw(422) } }) // GET /api/city/id router.get('/:id', async(ctx) => { try { const city = await City.findById(ctx.params.id) if (!city) { ctx.throw(404) } ctx.body = city } catch (err) { if (err.name === 'CastError' || err.name === 'NotFoundError') { ctx.throw(404) } ctx.throw(500) } }) // PUT /api/city/id router.put('/:id', async(ctx) => { try { const city = await City.findByIdAndUpdate(ctx.params.id, ctx.request.body) if (!city) { ctx.throw(404) } ctx.body = city } catch (err) { if (err.name === 'CastError' || err.name === 'NotFoundError') { ctx.throw(404) } ctx.throw(500) } }) // DELETE /api/city/id router.delete('/:id', async(ctx) => { try { const city = await City.findByIdAndRemove(ctx.params.id) if (!city) { ctx.throw(404) } ctx.body = city } catch (err) { if (err.name === 'CastError' || err.name === 'NotFoundError') { ctx.throw(404) } ctx.throw(500) } }) /* eslint-enable no-unused-vars, no-param-reassign, new-cap */ export default router
{ "content_hash": "450ea0e799c32825baac30fdb79edbad", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 78, "avg_line_length": 20.833333333333332, "alnum_prop": 0.5796923076923077, "repo_name": "NCZkevin/generator-rest-koa2", "id": "a838b55eb07cc0c90cdf87bf670d638af487df84", "size": "1625", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "generators/app/templates/server/routes/city.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "8187" } ], "symlink_target": "" }
require File.dirname(__FILE__) + "/../test_helper" class TestImport < Test::Unit::TestCase def setup @wc = stub_everything("working_copy") @cmd = Piston::Commands::Import.new end def test_temp_dir_name_hides_tmpdir_as_a_dotfile_and_suffixes_with_tmp @wc.stubs(:path).returns(Pathname.new("tmp/a/dir")) assert_equal Pathname.new("tmp/a/.dir.tmp"), @cmd.temp_dir_name(@wc) end end
{ "content_hash": "8836b738bde8900c426a4dd1bf7cbf53", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 72, "avg_line_length": 31.153846153846153, "alnum_prop": 0.6765432098765433, "repo_name": "jeremylightsmith/piston", "id": "c1711743cd91e6b21f609d5bddd6433a18c96fa0", "size": "405", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/unit/test_import.rb", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "25082" }, { "name": "Ruby", "bytes": "127180" } ], "symlink_target": "" }
package org.apache.spark.sql.execution.datasources.parquet import java.math.{BigDecimal, BigInteger} import java.nio.ByteOrder import scala.collection.JavaConverters._ import scala.collection.mutable.ArrayBuffer import org.apache.parquet.column.Dictionary import org.apache.parquet.io.api.{Binary, Converter, GroupConverter, PrimitiveConverter} import org.apache.parquet.schema.OriginalType.{INT_32, LIST, UTF8} import org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.DOUBLE import org.apache.parquet.schema.Type.Repetition import org.apache.parquet.schema.{GroupType, MessageType, PrimitiveType, Type} import org.apache.spark.Logging import org.apache.spark.sql.catalyst.InternalRow import org.apache.spark.sql.catalyst.expressions._ import org.apache.spark.sql.catalyst.util.DateTimeUtils import org.apache.spark.sql.types._ import org.apache.spark.unsafe.types.UTF8String /** * A [[ParentContainerUpdater]] is used by a Parquet converter to set converted values to some * corresponding parent container. For example, a converter for a `StructType` field may set * converted values to a [[MutableRow]]; or a converter for array elements may append converted * values to an [[ArrayBuffer]]. */ private[parquet] trait ParentContainerUpdater { /** Called before a record field is being converted */ def start(): Unit = () /** Called after a record field is being converted */ def end(): Unit = () def set(value: Any): Unit = () def setBoolean(value: Boolean): Unit = set(value) def setByte(value: Byte): Unit = set(value) def setShort(value: Short): Unit = set(value) def setInt(value: Int): Unit = set(value) def setLong(value: Long): Unit = set(value) def setFloat(value: Float): Unit = set(value) def setDouble(value: Double): Unit = set(value) } /** A no-op updater used for root converter (who doesn't have a parent). */ private[parquet] object NoopUpdater extends ParentContainerUpdater private[parquet] trait HasParentContainerUpdater { def updater: ParentContainerUpdater } /** * A convenient converter class for Parquet group types with an [[HasParentContainerUpdater]]. */ private[parquet] abstract class CatalystGroupConverter(val updater: ParentContainerUpdater) extends GroupConverter with HasParentContainerUpdater /** * Parquet converter for Parquet primitive types. Note that not all Spark SQL atomic types * are handled by this converter. Parquet primitive types are only a subset of those of Spark * SQL. For example, BYTE, SHORT, and INT in Spark SQL are all covered by INT32 in Parquet. */ private[parquet] class CatalystPrimitiveConverter(val updater: ParentContainerUpdater) extends PrimitiveConverter with HasParentContainerUpdater { override def addBoolean(value: Boolean): Unit = updater.setBoolean(value) override def addInt(value: Int): Unit = updater.setInt(value) override def addLong(value: Long): Unit = updater.setLong(value) override def addFloat(value: Float): Unit = updater.setFloat(value) override def addDouble(value: Double): Unit = updater.setDouble(value) override def addBinary(value: Binary): Unit = updater.set(value.getBytes) } /** * A [[CatalystRowConverter]] is used to convert Parquet records into Catalyst [[InternalRow]]s. * Since Catalyst `StructType` is also a Parquet record, this converter can be used as root * converter. Take the following Parquet type as an example: * {{{ * message root { * required int32 f1; * optional group f2 { * required double f21; * optional binary f22 (utf8); * } * } * }}} * 5 converters will be created: * * - a root [[CatalystRowConverter]] for [[MessageType]] `root`, which contains: * - a [[CatalystPrimitiveConverter]] for required [[INT_32]] field `f1`, and * - a nested [[CatalystRowConverter]] for optional [[GroupType]] `f2`, which contains: * - a [[CatalystPrimitiveConverter]] for required [[DOUBLE]] field `f21`, and * - a [[CatalystStringConverter]] for optional [[UTF8]] string field `f22` * * When used as a root converter, [[NoopUpdater]] should be used since root converters don't have * any "parent" container. * * @param parquetType Parquet schema of Parquet records * @param catalystType Spark SQL schema that corresponds to the Parquet record type * @param updater An updater which propagates converted field values to the parent container */ private[parquet] class CatalystRowConverter( parquetType: GroupType, catalystType: StructType, updater: ParentContainerUpdater) extends CatalystGroupConverter(updater) with Logging { assert( parquetType.getFieldCount == catalystType.length, s"""Field counts of the Parquet schema and the Catalyst schema don't match: | |Parquet schema: |$parquetType |Catalyst schema: |${catalystType.prettyJson} """.stripMargin) logDebug( s"""Building row converter for the following schema: | |Parquet form: |$parquetType |Catalyst form: |${catalystType.prettyJson} """.stripMargin) /** * Updater used together with field converters within a [[CatalystRowConverter]]. It propagates * converted filed values to the `ordinal`-th cell in `currentRow`. */ private final class RowUpdater(row: MutableRow, ordinal: Int) extends ParentContainerUpdater { override def set(value: Any): Unit = row(ordinal) = value override def setBoolean(value: Boolean): Unit = row.setBoolean(ordinal, value) override def setByte(value: Byte): Unit = row.setByte(ordinal, value) override def setShort(value: Short): Unit = row.setShort(ordinal, value) override def setInt(value: Int): Unit = row.setInt(ordinal, value) override def setLong(value: Long): Unit = row.setLong(ordinal, value) override def setDouble(value: Double): Unit = row.setDouble(ordinal, value) override def setFloat(value: Float): Unit = row.setFloat(ordinal, value) } /** * Represents the converted row object once an entire Parquet record is converted. */ val currentRow = new SpecificMutableRow(catalystType.map(_.dataType)) // Converters for each field. private val fieldConverters: Array[Converter with HasParentContainerUpdater] = { parquetType.getFields.asScala.zip(catalystType).zipWithIndex.map { case ((parquetFieldType, catalystField), ordinal) => // Converted field value should be set to the `ordinal`-th cell of `currentRow` newConverter(parquetFieldType, catalystField.dataType, new RowUpdater(currentRow, ordinal)) }.toArray } override def getConverter(fieldIndex: Int): Converter = fieldConverters(fieldIndex) override def end(): Unit = { var i = 0 while (i < currentRow.numFields) { fieldConverters(i).updater.end() i += 1 } updater.set(currentRow) } override def start(): Unit = { var i = 0 while (i < currentRow.numFields) { fieldConverters(i).updater.start() currentRow.setNullAt(i) i += 1 } } /** * Creates a converter for the given Parquet type `parquetType` and Spark SQL data type * `catalystType`. Converted values are handled by `updater`. */ private def newConverter( parquetType: Type, catalystType: DataType, updater: ParentContainerUpdater): Converter with HasParentContainerUpdater = { catalystType match { case BooleanType | IntegerType | LongType | FloatType | DoubleType | BinaryType => new CatalystPrimitiveConverter(updater) case ByteType => new CatalystPrimitiveConverter(updater) { override def addInt(value: Int): Unit = updater.setByte(value.asInstanceOf[ByteType#InternalType]) } case ShortType => new CatalystPrimitiveConverter(updater) { override def addInt(value: Int): Unit = updater.setShort(value.asInstanceOf[ShortType#InternalType]) } case t: DecimalType => new CatalystDecimalConverter(t, updater) case StringType => new CatalystStringConverter(updater) case TimestampType => // TODO Implements `TIMESTAMP_MICROS` once parquet-mr has that. new CatalystPrimitiveConverter(updater) { // Converts nanosecond timestamps stored as INT96 override def addBinary(value: Binary): Unit = { assert( value.length() == 12, "Timestamps (with nanoseconds) are expected to be stored in 12-byte long binaries, " + s"but got a ${value.length()}-byte binary.") val buf = value.toByteBuffer.order(ByteOrder.LITTLE_ENDIAN) val timeOfDayNanos = buf.getLong val julianDay = buf.getInt updater.setLong(DateTimeUtils.fromJulianDay(julianDay, timeOfDayNanos)) } } case DateType => new CatalystPrimitiveConverter(updater) { override def addInt(value: Int): Unit = { // DateType is not specialized in `SpecificMutableRow`, have to box it here. updater.set(value.asInstanceOf[DateType#InternalType]) } } // A repeated field that is neither contained by a `LIST`- or `MAP`-annotated group nor // annotated by `LIST` or `MAP` should be interpreted as a required list of required // elements where the element type is the type of the field. case t: ArrayType if parquetType.getOriginalType != LIST => if (parquetType.isPrimitive) { new RepeatedPrimitiveConverter(parquetType, t.elementType, updater) } else { new RepeatedGroupConverter(parquetType, t.elementType, updater) } case t: ArrayType => new CatalystArrayConverter(parquetType.asGroupType(), t, updater) case t: MapType => new CatalystMapConverter(parquetType.asGroupType(), t, updater) case t: StructType => new CatalystRowConverter(parquetType.asGroupType(), t, new ParentContainerUpdater { override def set(value: Any): Unit = updater.set(value.asInstanceOf[InternalRow].copy()) }) case t: UserDefinedType[_] => val catalystTypeForUDT = t.sqlType val nullable = parquetType.isRepetition(Repetition.OPTIONAL) val field = StructField("udt", catalystTypeForUDT, nullable) val parquetTypeForUDT = new CatalystSchemaConverter().convertField(field) newConverter(parquetTypeForUDT, catalystTypeForUDT, updater) case _ => throw new RuntimeException( s"Unable to create Parquet converter for data type ${catalystType.json}") } } /** * Parquet converter for strings. A dictionary is used to minimize string decoding cost. */ private final class CatalystStringConverter(updater: ParentContainerUpdater) extends CatalystPrimitiveConverter(updater) { private var expandedDictionary: Array[UTF8String] = null override def hasDictionarySupport: Boolean = true override def setDictionary(dictionary: Dictionary): Unit = { this.expandedDictionary = Array.tabulate(dictionary.getMaxId + 1) { i => UTF8String.fromBytes(dictionary.decodeToBinary(i).getBytes) } } override def addValueFromDictionary(dictionaryId: Int): Unit = { updater.set(expandedDictionary(dictionaryId)) } override def addBinary(value: Binary): Unit = { updater.set(UTF8String.fromBytes(value.getBytes)) } } /** * Parquet converter for fixed-precision decimals. */ private final class CatalystDecimalConverter( decimalType: DecimalType, updater: ParentContainerUpdater) extends CatalystPrimitiveConverter(updater) { // Converts decimals stored as INT32 override def addInt(value: Int): Unit = { addLong(value: Long) } // Converts decimals stored as INT64 override def addLong(value: Long): Unit = { updater.set(Decimal(value, decimalType.precision, decimalType.scale)) } // Converts decimals stored as either FIXED_LENGTH_BYTE_ARRAY or BINARY override def addBinary(value: Binary): Unit = { updater.set(toDecimal(value)) } private def toDecimal(value: Binary): Decimal = { val precision = decimalType.precision val scale = decimalType.scale val bytes = value.getBytes if (precision <= CatalystSchemaConverter.MAX_PRECISION_FOR_INT64) { // Constructs a `Decimal` with an unscaled `Long` value if possible. var unscaled = 0L var i = 0 while (i < bytes.length) { unscaled = (unscaled << 8) | (bytes(i) & 0xff) i += 1 } val bits = 8 * bytes.length unscaled = (unscaled << (64 - bits)) >> (64 - bits) Decimal(unscaled, precision, scale) } else { // Otherwise, resorts to an unscaled `BigInteger` instead. Decimal(new BigDecimal(new BigInteger(bytes), scale), precision, scale) } } } /** * Parquet converter for arrays. Spark SQL arrays are represented as Parquet lists. Standard * Parquet lists are represented as a 3-level group annotated by `LIST`: * {{{ * <list-repetition> group <name> (LIST) { <-- parquetSchema points here * repeated group list { * <element-repetition> <element-type> element; * } * } * }}} * The `parquetSchema` constructor argument points to the outermost group. * * However, before this representation is standardized, some Parquet libraries/tools also use some * non-standard formats to represent list-like structures. Backwards-compatibility rules for * handling these cases are described in Parquet format spec. * * @see https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#lists */ private final class CatalystArrayConverter( parquetSchema: GroupType, catalystSchema: ArrayType, updater: ParentContainerUpdater) extends CatalystGroupConverter(updater) { private var currentArray: ArrayBuffer[Any] = _ private val elementConverter: Converter = { val repeatedType = parquetSchema.getType(0) val elementType = catalystSchema.elementType val parentName = parquetSchema.getName if (isElementType(repeatedType, elementType, parentName)) { newConverter(repeatedType, elementType, new ParentContainerUpdater { override def set(value: Any): Unit = currentArray += value }) } else { new ElementConverter(repeatedType.asGroupType().getType(0), elementType) } } override def getConverter(fieldIndex: Int): Converter = elementConverter override def end(): Unit = updater.set(new GenericArrayData(currentArray.toArray)) // NOTE: We can't reuse the mutable `ArrayBuffer` here and must instantiate a new buffer for the // next value. `Row.copy()` only copies row cells, it doesn't do deep copy to objects stored // in row cells. override def start(): Unit = currentArray = ArrayBuffer.empty[Any] // scalastyle:off /** * Returns whether the given type is the element type of a list or is a syntactic group with * one field that is the element type. This is determined by checking whether the type can be * a syntactic group and by checking whether a potential syntactic group matches the expected * schema. * {{{ * <list-repetition> group <name> (LIST) { * repeated group list { <-- repeatedType points here * <element-repetition> <element-type> element; * } * } * }}} * In short, here we handle Parquet list backwards-compatibility rules on the read path. This * method is based on `AvroIndexedRecordConverter.isElementType`. * * @see https://github.com/apache/parquet-format/blob/master/LogicalTypes.md#backward-compatibility-rules */ // scalastyle:on private def isElementType( parquetRepeatedType: Type, catalystElementType: DataType, parentName: String): Boolean = { (parquetRepeatedType, catalystElementType) match { case (t: PrimitiveType, _) => true case (t: GroupType, _) if t.getFieldCount > 1 => true case (t: GroupType, _) if t.getFieldCount == 1 && t.getName == "array" => true case (t: GroupType, _) if t.getFieldCount == 1 && t.getName == parentName + "_tuple" => true case (t: GroupType, StructType(Array(f))) if f.name == t.getFieldName(0) => true case _ => false } } /** Array element converter */ private final class ElementConverter(parquetType: Type, catalystType: DataType) extends GroupConverter { private var currentElement: Any = _ private val converter = newConverter(parquetType, catalystType, new ParentContainerUpdater { override def set(value: Any): Unit = currentElement = value }) override def getConverter(fieldIndex: Int): Converter = converter override def end(): Unit = currentArray += currentElement override def start(): Unit = currentElement = null } } /** Parquet converter for maps */ private final class CatalystMapConverter( parquetType: GroupType, catalystType: MapType, updater: ParentContainerUpdater) extends CatalystGroupConverter(updater) { private var currentKeys: ArrayBuffer[Any] = _ private var currentValues: ArrayBuffer[Any] = _ private val keyValueConverter = { val repeatedType = parquetType.getType(0).asGroupType() new KeyValueConverter( repeatedType.getType(0), repeatedType.getType(1), catalystType.keyType, catalystType.valueType) } override def getConverter(fieldIndex: Int): Converter = keyValueConverter override def end(): Unit = updater.set(ArrayBasedMapData(currentKeys.toArray, currentValues.toArray)) // NOTE: We can't reuse the mutable Map here and must instantiate a new `Map` for the next // value. `Row.copy()` only copies row cells, it doesn't do deep copy to objects stored in row // cells. override def start(): Unit = { currentKeys = ArrayBuffer.empty[Any] currentValues = ArrayBuffer.empty[Any] } /** Parquet converter for key-value pairs within the map. */ private final class KeyValueConverter( parquetKeyType: Type, parquetValueType: Type, catalystKeyType: DataType, catalystValueType: DataType) extends GroupConverter { private var currentKey: Any = _ private var currentValue: Any = _ private val converters = Array( // Converter for keys newConverter(parquetKeyType, catalystKeyType, new ParentContainerUpdater { override def set(value: Any): Unit = currentKey = value }), // Converter for values newConverter(parquetValueType, catalystValueType, new ParentContainerUpdater { override def set(value: Any): Unit = currentValue = value })) override def getConverter(fieldIndex: Int): Converter = converters(fieldIndex) override def end(): Unit = { currentKeys += currentKey currentValues += currentValue } override def start(): Unit = { currentKey = null currentValue = null } } } private trait RepeatedConverter { private var currentArray: ArrayBuffer[Any] = _ protected def newArrayUpdater(updater: ParentContainerUpdater) = new ParentContainerUpdater { override def start(): Unit = currentArray = ArrayBuffer.empty[Any] override def end(): Unit = updater.set(new GenericArrayData(currentArray.toArray)) override def set(value: Any): Unit = currentArray += value } } /** * A primitive converter for converting unannotated repeated primitive values to required arrays * of required primitives values. */ private final class RepeatedPrimitiveConverter( parquetType: Type, catalystType: DataType, parentUpdater: ParentContainerUpdater) extends PrimitiveConverter with RepeatedConverter with HasParentContainerUpdater { val updater: ParentContainerUpdater = newArrayUpdater(parentUpdater) private val elementConverter: PrimitiveConverter = newConverter(parquetType, catalystType, updater).asPrimitiveConverter() override def addBoolean(value: Boolean): Unit = elementConverter.addBoolean(value) override def addInt(value: Int): Unit = elementConverter.addInt(value) override def addLong(value: Long): Unit = elementConverter.addLong(value) override def addFloat(value: Float): Unit = elementConverter.addFloat(value) override def addDouble(value: Double): Unit = elementConverter.addDouble(value) override def addBinary(value: Binary): Unit = elementConverter.addBinary(value) override def setDictionary(dict: Dictionary): Unit = elementConverter.setDictionary(dict) override def hasDictionarySupport: Boolean = elementConverter.hasDictionarySupport override def addValueFromDictionary(id: Int): Unit = elementConverter.addValueFromDictionary(id) } /** * A group converter for converting unannotated repeated group values to required arrays of * required struct values. */ private final class RepeatedGroupConverter( parquetType: Type, catalystType: DataType, parentUpdater: ParentContainerUpdater) extends GroupConverter with HasParentContainerUpdater with RepeatedConverter { val updater: ParentContainerUpdater = newArrayUpdater(parentUpdater) private val elementConverter: GroupConverter = newConverter(parquetType, catalystType, updater).asGroupConverter() override def getConverter(field: Int): Converter = elementConverter.getConverter(field) override def end(): Unit = elementConverter.end() override def start(): Unit = elementConverter.start() } }
{ "content_hash": "aceded018873b7f94b369d5307835b9f", "timestamp": "", "source": "github", "line_count": 565, "max_line_length": 109, "avg_line_length": 38.72566371681416, "alnum_prop": 0.6941499085923217, "repo_name": "ArvinDevel/onlineAggregationOnSparkV2", "id": "2ff2fda3610b8857a5de9a02ffe23e6163f5b478", "size": "22680", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/CatalystRowConverter.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "20079" }, { "name": "C", "bytes": "1493" }, { "name": "CSS", "bytes": "13902" }, { "name": "Java", "bytes": "1372541" }, { "name": "JavaScript", "bytes": "55434" }, { "name": "Makefile", "bytes": "931" }, { "name": "Python", "bytes": "177714" }, { "name": "R", "bytes": "448836" }, { "name": "Roff", "bytes": "5379" }, { "name": "SQLPL", "bytes": "3603" }, { "name": "Scala", "bytes": "10180606" }, { "name": "Shell", "bytes": "145966" }, { "name": "Thrift", "bytes": "2016" } ], "symlink_target": "" }
{% extends "common/page_base.html" %} {# common/page_base.html extends layout.html #} {% block css %} {{ super() }} <style> .item { cursor: move; text-align: center; } </style> {% endblock %} {% block content %} <div class="row"> <div class="col-12"> <h1>IWS Feature Request panel</h1> <div class="row"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#new_feature" id="new_feature_b"> Add </button> <!--button type="button" data-bind="click: savePriorities" class="btn btn-primary" data-toggle="modal" id="save_priorites_b"> Save priorites </button><br--> </div> <div class="row placeholders"> <div class="table-responsive"> <h3>Feature Request</h3> <!--div class="container" data-bind="sortable: features"> <div class="item"> <span data-bind="visible: !$root.isTaskSelected($data)"> <a href="#" data-bind="text: title, click: $root.selectedTask"></a> </span> <span data-bind="visibleAndSelect: $root.isTaskSelected($data)"> <input data-bind="value: title, event: { blur: $root.clearTask }" /> </span> </div> </div--> <table class="table table-striped table-inverse"> <thead> <tr> <th>#</th> <th>Title</th> <th>Client Name</th> <th>product Name</th> <th>Global priority</th> <th>Client Priority</th> <th>Ticket URL</th> <th>Target Date</th> <th>Action</th> </tr> </thead > <tbody data-bind="sortable: features"> {#% for fr in features %#} <tr class="item"> <th data-bind="text: id">{#{fr.id}#}</th> <td> <span data-bind="visible: !$root.isTitleSelected($data)"> <a href="#" data-bind="text: title, click: $root.selectedTitle" title="click to change texte" ></a> </span> <span data-bind="visibleAndSelect: $root.isTitleSelected($data)"> <input data-bind="value: title, event: { blur: $root.clearTitle }" /> </span> {#{fr.title}#} </td> <td data-bind="text: company_name">{#{fr.description}#}</td> <td> <span data-bind="visible: !$root.isProductSelected($data)"> <a href="#" data-bind="text: product_name, click: $root.selectedProduct" title="click to change texte" ></a> </span> <span data-bind="visibleAndSelect: $root.isProductSelected($data)"> <select data-bind="options: $root.products, event: { blur: $root.clearProduct}, value: product, optionsText: 'product_name'" /> </span> {#{fr.description}#} </td> <td data-bind="text: global_priority">{#{fr.user_id}#}</td> <td data-bind="text: client_priority">{#{fr.priority}#}</td> <td> <span data-bind="visible: !$root.isTicketUrlSelected($data)"> <a href="#" data-bind="text: ticket_url, click: $root.selectedTicketUrl" title="click to change texte" ></a> </span> <span data-bind="visibleAndSelect: $root.isTicketUrlSelected($data)"> <input data-bind="value: ticket_url, event: { blur: $root.clearTicketUrl }" /> </span> {#{fr.priority}#} </td> <td> <span data-bind="visible: !$root.isTargetDateSelected($data)"> <a href="#" data-bind="text: target_date, click: $root.selectedTargetDate" title="click to change text" ></a> </span> <span data-bind="visibleAndSelect: $root.isTargetDateSelected($data)"> <input data-bind="value: target_date, event: { blur: $root.clearTargetDate }" class="dateInput"/> </span> {#{fr.priority}#} </td> <td><a href="#" data-bind="click: $root.deleteFeature" class="btn btn-primary">Delete</a></td> </tr> {#% endfor %#} </tbody> </table> </div> </div> </div> </div> <!-- Dialog form new feature --> <form data-bind="submit: addFeature"> <div class="modal fade" id="new_feature" tabindex="-1" role="dialog" aria-labelledby="newFeatureLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> <h4 class="modal-title" id="newFeatureLabel">Create new Feature</h4> </div> <div class="modal-body"> <!----------------------------------------------> <div class="form-group"> <label for="titleText">Title</label> <input type="text" data-bind="value: newTitle" class="form-control" id="titleText" aria-describedby="titleHelp" placeholder="Enter title"> <small id="titleHelp" class="form-text text-muted">Enter the title of the feature.</small> </div> <div class="form-group"> <label for="descriptionText">Description</label> <textarea class="form-control" data-bind="value: newDesc" id="descriptionText" rows="3"></textarea> </div> {% if current_user.roles[0].name=='client' %} <input type="hidden" id="current_user_id" value="{{current_user.id}}"> <input type="hidden" id="role_user" value="3"> {% else %} <div class="form-group"> <label for="cilentSelect">Client</label> <select class="form-control" id="cilentSelect" data-bind="options: $root.clients, value: newClient, optionsText: 'company_name'"> </select> </div> <input type="hidden" id="role_user" value="1"> {% endif %} <div class="form-group"> <label for="targetDateText">Target Date</label> <input type="text" class="form-control" data-bind="value: newTargetDate" id="targetDateText" aria-describedby="targetDateHelp" placeholder="Enter target Date" data-provide="datepicker"> <small id="targetDateHelp" class="form-text text-muted">Enter the target Date.</small> </div> <div class="form-group"> <label for="ticketUrlText">Ticket URL</label> <input type="text" data-bind="value: newTicketUrl" class="form-control" id="ticketUrlText" aria-describedby="tcketUrlHelp" placeholder="Enter ticket URL" width="80%"> <small id="tcketUrlHelp" class="form-text text-muted">Enter the ticket URL.</small> </div> <div class="form-group"> <label for="productSelect">Product</label> <select class="form-control" id="productSelect" data-bind="options: $root.products, value: newProduct, optionsText: 'product_name'"> </select> </div> <!---------- End form -----------------> </div> <div class="modal-footer"> <button type="submit" class="btn btn-primary">Save</button> </div> </div> </div> </div> </form> <div id="dialog-confirm" title="Delete Feature?"> <p><span class="ui-icon ui-icon-alert" style="float:left; margin:12px 12px 20px 0;"></span> The Feature will be deleted!. Are you sure?</p> </div> {% endblock %} {% block javascript %} {{ super() }} <script src="{{ url_for('static', filename='js/knockout-sortable.min.js') }}"></script> <script src="{{ url_for('static', filename='feature.js') }}"></script> <script> $( function() { $( "#dialog-confirm" ).hide(); // $('.dateInput').prop("disabled","disabled"); // $('.dateInput').prop("disabled", true) $( ".dateInput" ).datepicker({ showOn: "button", buttonText: "Select date", dateFormat: "mm-dd-yy" }); $('#targetDateText').prop("disabled","disabled"); $('#targetDateText').prop("disabled", true) $( "#targetDateText" ).datepicker({ showOn: "button", buttonImage: "static/images/calendar.gif", buttonImageOnly: true, buttonText: "Select date", dateFormat: "mm-dd-yy" }); } ); </script> {% endblock %}
{ "content_hash": "061a99651a8887ff1a1849a9bf697274", "timestamp": "", "source": "github", "line_count": 242, "max_line_length": 156, "avg_line_length": 36.35123966942149, "alnum_prop": 0.5255200636580653, "repo_name": "walidham/iws2", "id": "b7739998e00cad44acfb9e0b8442037566850a90", "size": "8797", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/templates/core/feature_requests.html", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "CSS", "bytes": "10104" }, { "name": "HTML", "bytes": "52513" }, { "name": "JavaScript", "bytes": "19174" }, { "name": "Mako", "bytes": "412" }, { "name": "Python", "bytes": "37858" }, { "name": "Shell", "bytes": "310" } ], "symlink_target": "" }
SYNONYM #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "b7aac198e52dfc384e09d389cada3405", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.23076923076923, "alnum_prop": 0.6917293233082706, "repo_name": "mdoering/backbone", "id": "27cb7dc63d2cda2a7be4e4738cdf57af57e1ad23", "size": "181", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Petrosaviales/Petrosaviaceae/Petrosavia/Petrosavia sakuraii/ Syn. Miyoshia sakuraii/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
Completely working Web Browser for iPads This is completely working app. Itunes link: http://bit.ly/starflyinc ![alt tag](https://github.com/nealCeffrey/Starfly/blob/master/screenshot.jpg) # Author Arturs Derkintis Twitter: @DerkintisArturs # License MIT
{ "content_hash": "048b980cdb085f144b8485a757fcbff1", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 77, "avg_line_length": 14.052631578947368, "alnum_prop": 0.7640449438202247, "repo_name": "artursDerkintis/Starfly", "id": "1c22dedf84b8c5a4d141746e5d027f1225465c07", "size": "277", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "73" }, { "name": "JavaScript", "bytes": "626837" }, { "name": "Objective-C", "bytes": "161179" }, { "name": "Ruby", "bytes": "148" }, { "name": "Swift", "bytes": "449923" } ], "symlink_target": "" }
package Web::Summarizer::ReferenceTargetPairwiseSummarizer; use strict; use warnings; use Moose; use namespace::autoclean; with('Web::Summarizer::ReferenceTargetSummarizer'); __PACKAGE__->meta->make_immutable; 1;
{ "content_hash": "d7d583d8df5b629695573c7b617a4c31", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 59, "avg_line_length": 15.642857142857142, "alnum_prop": 0.771689497716895, "repo_name": "ypetinot/web-summarization", "id": "a15d283e5080b0e6e140f21f928fc630b09c713d", "size": "219", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "summarizers/graph-summarizer-4/src/Web/Summarizer/ReferenceTargetPairwiseSummarizer.pm", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "1902" }, { "name": "C++", "bytes": "290281" }, { "name": "Java", "bytes": "25815" }, { "name": "Makefile", "bytes": "22679" }, { "name": "Perl", "bytes": "2716151" }, { "name": "Perl 6", "bytes": "28318" }, { "name": "R", "bytes": "13126" }, { "name": "Roff", "bytes": "9652" }, { "name": "Scala", "bytes": "10574" }, { "name": "Shell", "bytes": "162274" }, { "name": "Smarty", "bytes": "1192" }, { "name": "TeX", "bytes": "943" }, { "name": "Thrift", "bytes": "13198" } ], "symlink_target": "" }
package ru.pashkin.jmt.model.figures; import ru.pashkin.jmt.model.AbstractFigure; import java.awt.Point; public class Snag extends AbstractFigure { private static final Point[] leftOrientation = new Point[4]; private static final Point[] rightOrientation = new Point[4]; private static final Point[] upOrientation = new Point[4]; private static final Point[] downOrientation = new Point[4]; static { leftOrientation[0] = new Point(1, 0); leftOrientation[1] = new Point(0, 1); leftOrientation[2] = new Point(1, 1); leftOrientation[3] = new Point(1, 2); rightOrientation[0] = new Point(1, 0); rightOrientation[1] = new Point(1, 1); rightOrientation[2] = new Point(2, 1); rightOrientation[3] = new Point(1, 2); upOrientation[0] = new Point(1, 0); upOrientation[1] = new Point(0, 1); upOrientation[2] = new Point(1, 1); upOrientation[3] = new Point(2, 1); downOrientation[0] = new Point(0, 1); downOrientation[1] = new Point(1, 1); downOrientation[2] = new Point(2, 1); downOrientation[3] = new Point(1, 2); } @Override public Point[] getPoints(int orientation) { switch (orientation) { case ORIENTATION_DOWN: return downOrientation; case ORIENTATION_LEFT: return leftOrientation; case ORIENTATION_RIGHT: return rightOrientation; case ORIENTATION_UP: return upOrientation; } return downOrientation; } }
{ "content_hash": "a4c5536d8aaf95d292c8102e29be6e07", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 65, "avg_line_length": 31.150943396226417, "alnum_prop": 0.5844942459115687, "repo_name": "pashkinmv/java-multiplayer-tetris", "id": "d34898e75787aac6a3aed494bee1783d3f086a3a", "size": "2789", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/src/main/java/ru/pashkin/jmt/model/figures/Snag.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "186676" } ], "symlink_target": "" }
package quasar.contrib.fs2 import slamdata.Predef.{Boolean, None, Option, Some, Throwable, Unit} import java.util.Iterator import java.util.stream.{Stream => JStream} import scala.util.{Either, Left} import cats.effect.{Concurrent, Resource, Sync} import cats.syntax.monadError._ import fs2.concurrent.{NoneTerminatedQueue, Queue, SignallingRef} import fs2.{Chunk, Stream} import scalaz.{Functor, StreamT, Scalaz}, Scalaz._ import shims.monadToScalaz object convert { // java.util.stream.Stream def fromJavaStream[F[_], A](js: F[JStream[A]])(implicit F: Sync[F]): Stream[F, A] = { def getNext(i: Iterator[A]): F[Option[(A, Iterator[A])]] = F.delay(i.hasNext).ifM( F.delay(Some((i.next(), i))), F.pure(None)) Stream.bracket(js)(s => F.delay(s.close())) .flatMap(s => Stream.unfoldEval(s.iterator)(getNext)) } // scalaz.StreamT def fromChunkedStreamT[F[_]: Functor, A](chunks: StreamT[F, Chunk[A]]): Stream[F, A] = Stream.unfoldChunkEval(chunks)(_.step.map(_( yieldd = (c, st) => Some((c, st)) , skip = st => Some((Chunk.empty, st)) , done = None))) def fromStreamT[F[_]: Functor, A](st: StreamT[F, A]): Stream[F, A] = fromChunkedStreamT(st.map(Chunk.singleton(_))) def toStreamT[F[_]: Concurrent, A](s: Stream[F, A]) : Resource[F, StreamT[F, A]] = Resource(chunkQ(s)) map { startQ => StreamT.wrapEffect(startQ.map(q => for { c <- StreamT.unfoldM(q)(_.dequeue1.map(_.sequence).rethrow.map(_.strengthR(q))) a <- StreamT.unfoldM(0)(i => (i < c.size).option((c(i), i + 1)).point[F]) } yield a)) } //// private def chunkQ[F[_], A](s: Stream[F, A])(implicit F: Concurrent[F]) : F[(F[NoneTerminatedQueue[F, Either[Throwable, Chunk[A]]]], F[Unit])] = SignallingRef[F, Boolean](false) map { i => val startQ = for { q <- Queue.synchronousNoneTerminated[F, Either[Throwable, Chunk[A]]] enqueue = s.chunks .attempt .interruptWhen(i) .noneTerminate .through(q.enqueue) .handleErrorWith(t => Stream.eval(q.enqueue1(Some(Left(t))))) _ <- F.start(enqueue.compile.drain) } yield q (startQ, i.set(true)) } }
{ "content_hash": "8a2876e39e319db427bd99fb64f0c56f", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 89, "avg_line_length": 30.213333333333335, "alnum_prop": 0.6037069726390115, "repo_name": "slamdata/quasar", "id": "06fddd56e6efe916a34e57e9d098f85de78c954b", "size": "2869", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "foundation/src/main/scala/quasar/contrib/fs2/convert.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "857" }, { "name": "Scala", "bytes": "2474240" }, { "name": "Shell", "bytes": "24105" } ], "symlink_target": "" }
extern ConfigVariableInt gl_version; extern EXPCL_PANDAGL ConfigVariableBool gl_support_fbo; extern ConfigVariableBool gl_cheap_textures; extern ConfigVariableBool gl_ignore_clamp; extern ConfigVariableBool gl_support_clamp_to_border; extern ConfigVariableBool gl_support_texture_lod; extern ConfigVariableBool gl_ignore_filters; extern ConfigVariableBool gl_ignore_mipmaps; extern ConfigVariableBool gl_force_mipmaps; extern ConfigVariableBool gl_show_texture_usage; extern ConfigVariableInt gl_show_texture_usage_max_size; extern ConfigVariableBool gl_color_mask; extern ConfigVariableBool gl_support_occlusion_query; extern ConfigVariableBool gl_compile_and_execute; extern ConfigVariableBool gl_interleaved_arrays; extern ConfigVariableBool gl_parallel_arrays; extern ConfigVariableInt gl_max_errors; extern ConfigVariableEnum<GeomEnums::UsageHint> gl_min_buffer_usage_hint; extern ConfigVariableBool gl_debug; extern ConfigVariableBool gl_debug_synchronous; extern ConfigVariableEnum<NotifySeverity> gl_debug_abort_level; extern ConfigVariableBool gl_debug_object_labels; extern ConfigVariableBool gl_debug_buffers; extern ConfigVariableBool gl_finish; extern ConfigVariableBool gl_force_depth_stencil; extern ConfigVariableBool gl_force_fbo_color; extern ConfigVariableBool gl_check_errors; extern ConfigVariableBool gl_force_flush; extern ConfigVariableBool gl_separate_specular_color; extern ConfigVariableBool gl_cube_map_seamless; extern ConfigVariableBool gl_dump_compiled_shaders; extern ConfigVariableBool gl_validate_shaders; extern ConfigVariableBool gl_immutable_texture_storage; extern ConfigVariableBool gl_use_bindless_texture; extern ConfigVariableBool gl_enable_memory_barriers; extern ConfigVariableBool gl_vertex_array_objects; extern ConfigVariableBool gl_fixed_vertex_attrib_locations; extern ConfigVariableBool gl_support_primitive_restart_index; extern ConfigVariableBool gl_support_sampler_objects; extern ConfigVariableBool gl_support_shadow_filter; extern ConfigVariableEnum<CoordinateSystem> gl_coordinate_system; extern EXPCL_GL void CLP(init_classes)(); #if !defined(WIN32) && defined(GSG_VERBOSE) ostream &output_gl_enum(ostream &out, GLenum v); INLINE ostream &operator << (ostream &out, GLenum v) { return output_gl_enum(out, v); } #endif #ifdef DO_PSTATS #define DO_PSTATS_STUFF(XX) XX; #else #define DO_PSTATS_STUFF(XX) #endif #define ISPOW2(X) (((X) & ((X)-1))==0) #define report_my_gl_errors() \ report_my_errors(__LINE__, __FILE__) #define clear_my_gl_errors() \ clear_my_errors(__LINE__, __FILE__)
{ "content_hash": "9c9ad483de9454108c7eed7952e3dbef", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 73, "avg_line_length": 38.696969696969695, "alnum_prop": 0.8206734534064213, "repo_name": "mgracer48/panda3d", "id": "ec1db27cf1da74afd62409960a4874b7ab8f1d38", "size": "3729", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "panda/src/glstuff/glmisc_src.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "4004" }, { "name": "C", "bytes": "6395157" }, { "name": "C++", "bytes": "31241851" }, { "name": "Emacs Lisp", "bytes": "166274" }, { "name": "Groff", "bytes": "3106" }, { "name": "HTML", "bytes": "8081" }, { "name": "Java", "bytes": "3777" }, { "name": "JavaScript", "bytes": "7003" }, { "name": "Logos", "bytes": "5504" }, { "name": "MAXScript", "bytes": "1745" }, { "name": "NSIS", "bytes": "91955" }, { "name": "Nemerle", "bytes": "4403" }, { "name": "Objective-C", "bytes": "30065" }, { "name": "Objective-C++", "bytes": "300394" }, { "name": "Perl", "bytes": "206982" }, { "name": "Perl6", "bytes": "30636" }, { "name": "Puppet", "bytes": "2627" }, { "name": "Python", "bytes": "5530563" }, { "name": "Rebol", "bytes": "421" }, { "name": "Shell", "bytes": "55940" }, { "name": "Visual Basic", "bytes": "136" } ], "symlink_target": "" }
using System.Collections.Generic; using Umbraco.Cms.Core.Models; namespace Umbraco.Cms.Core.Persistence.Repositories { /// <summary> /// Represents a repository for <see cref="IAuditEntry"/> entities. /// </summary> public interface IAuditEntryRepository : IReadWriteQueryRepository<int, IAuditEntry> { /// <summary> /// Gets a page of entries. /// </summary> IEnumerable<IAuditEntry> GetPage(long pageIndex, int pageCount, out long records); /// <summary> /// Determines whether the repository is available. /// </summary> /// <remarks>During an upgrade, the repository may not be available, until the table has been created.</remarks> bool IsAvailable(); } }
{ "content_hash": "48f87acb8030a8aea3f1225c5b1c2ac0", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 120, "avg_line_length": 34.54545454545455, "alnum_prop": 0.6513157894736842, "repo_name": "JimBobSquarePants/Umbraco-CMS", "id": "159267c16e5d6cdd0f8e5b14439a1c1275ecd001", "size": "762", "binary": false, "copies": "4", "ref": "refs/heads/v9/contrib", "path": "src/Umbraco.Core/Persistence/Repositories/IAuditEntryRepository.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "15925308" }, { "name": "CSS", "bytes": "13049" }, { "name": "Dockerfile", "bytes": "2352" }, { "name": "HTML", "bytes": "1236051" }, { "name": "JavaScript", "bytes": "4518767" }, { "name": "Less", "bytes": "543715" }, { "name": "PowerShell", "bytes": "23312" }, { "name": "Shell", "bytes": "3572" }, { "name": "TSQL", "bytes": "371" }, { "name": "TypeScript", "bytes": "117460" } ], "symlink_target": "" }
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package pe.ijooswk.pic2count; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Example customization of dimensions originally defined in res/values/dimens.xml (such as screen margins) for screens with more than 820dp of available width. This would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). */ public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int action_settings=0x7f080006; public static final int image=0x7f080002; public static final int pager=0x7f080000; public static final int pic_gallery_btn=0x7f080004; public static final int pic_gallery_image=0x7f080005; public static final int section_label=0x7f080001; public static final int text=0x7f080003; } public static final class layout { public static final int activity_main=0x7f030000; public static final int fragment_main=0x7f030001; public static final int notification_layout=0x7f030002; public static final int pic_detail_view=0x7f030003; } public static final class menu { public static final int main=0x7f070000; } public static final class string { public static final int action_settings=0x7f050004; public static final int app_name=0x7f050000; public static final int title_section1=0x7f050001; public static final int title_section2=0x7f050002; public static final int title_section3=0x7f050003; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f060000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f060001; } }
{ "content_hash": "3a8bb7a37b949786ea920077a8708264", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 91, "avg_line_length": 39.55, "alnum_prop": 0.6880530973451328, "repo_name": "ijooswk/pic2count", "id": "ad3c282138f1d44e5871a0271d1e0cdf62c52847", "size": "3164", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gen/pe/ijooswk/pic2count/R.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "19630" } ], "symlink_target": "" }
<?php namespace BW\ShopBundle\Controller; use BW\MainBundle\Utility\FormUtility; use Symfony\Component\HttpFoundation\Request; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use BW\ShopBundle\Entity\Product; use BW\ShopBundle\Form\ProductType; /** * Class ProductController * @package BW\ShopBundle\Controller */ class ProductController extends Controller { /** * Lists all Category entities. */ public function listAction() { $em = $this->getDoctrine()->getManager(); $entities = $em->getRepository('BWShopBundle:Product')->findBy(array( 'published' => true, ), array( // 'created' => 'ASC', )); return $this->render('BWShopBundle:Product:list.html.twig', array( 'entities' => $entities, )); } /** * Finds and displays a Product entity by slug. */ public function showBySlugAction($slug) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('BWShopBundle:Product')->findOneBySlug($slug); if ( ! $entity) { throw $this->createNotFoundException('Unable to find Product entity.'); } return $this->render('BWShopBundle:Product:show.html.twig', array( 'entity' => $entity, )); } /** * Lists all Product entities. */ public function indexAction() { $em = $this->getDoctrine()->getManager(); $entities = $em->getRepository('BWShopBundle:Product')->findAll(); return $this->render('BWShopBundle:Product:index.html.twig', array( 'entities' => $entities, )); } /** * Creates a new Product entity. */ public function createAction(Request $request) { $entity = new Product(); $form = $this->createCreateForm($entity); $form->handleRequest($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($entity); $em->flush(); if ($form->get('createAndClose')->isClicked()) { return $this->redirect($this->generateUrl('product')); } return $this->redirect($this->generateUrl('product_edit', array('id' => $entity->getId()))); } return $this->render('BWShopBundle:Product:new.html.twig', array( 'entity' => $entity, 'form' => $form->createView(), )); } /** * Creates a form to create a Product entity. * * @param Product $entity The entity * @return \Symfony\Component\Form\Form The form */ private function createCreateForm(Product $entity) { $form = $this->createForm(new ProductType(), $entity, array( 'action' => $this->generateUrl('product_create'), 'method' => 'POST', )); FormUtility::addCreateButton($form); FormUtility::addCreateAndCloseButton($form); return $form; } /** * Displays a form to create a new Product entity. */ public function newAction() { $entity = new Product(); $form = $this->createCreateForm($entity); return $this->render('BWShopBundle:Product:new.html.twig', array( 'entity' => $entity, 'form' => $form->createView(), )); } /** * Finds and displays a Product entity. */ public function showAction($id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('BWShopBundle:Product')->find($id); if ( ! $entity) { throw $this->createNotFoundException('Unable to find Product entity.'); } $deleteForm = $this->createDeleteForm($id); return $this->render('BWShopBundle:Product:show.html.twig', array( 'entity' => $entity, 'delete_form' => $deleteForm->createView(), )); } /** * Displays a form to edit an existing Product entity. */ public function editAction($id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('BWShopBundle:Product')->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find Product entity.'); } $editForm = $this->createEditForm($entity); $deleteForm = $this->createDeleteForm($id); return $this->render('BWShopBundle:Product:edit.html.twig', array( 'entity' => $entity, 'form' => $editForm->createView(), 'delete_form' => $deleteForm->createView(), )); } /** * Creates a form to edit a Product entity. * * @param Product $entity The entity * @return \Symfony\Component\Form\Form The form */ private function createEditForm(Product $entity) { $form = $this->createForm(new ProductType(), $entity, array( 'action' => $this->generateUrl('product_update', array('id' => $entity->getId())), 'method' => 'PUT', )); FormUtility::addUpdateButton($form); FormUtility::addUpdateAndCloseButton($form); FormUtility::addDeleteButton($form); return $form; } /** * Edits an existing Product entity. */ public function updateAction(Request $request, $id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('BWShopBundle:Product')->find($id); if ( ! $entity) { throw $this->createNotFoundException('Unable to find Product entity.'); } $deleteForm = $this->createDeleteForm($id); $editForm = $this->createEditForm($entity); $editForm->handleRequest($request); if ($editForm->isValid()) { if ($editForm->get('delete')->isClicked()) { $this->delete($id); return $this->redirect($this->generateUrl('product')); } $em->flush(); if ($editForm->get('updateAndClose')->isClicked()) { return $this->redirect($this->generateUrl('product')); } return $this->redirect($this->generateUrl('product_edit', array('id' => $id))); } return $this->render('BWShopBundle:Product:edit.html.twig', array( 'entity' => $entity, 'form' => $editForm->createView(), 'delete_form' => $deleteForm->createView(), )); } private function delete($id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('BWShopBundle:Product')->find($id); if ( ! $entity) { throw $this->createNotFoundException('Unable to find Product entity.'); } $em->remove($entity); $em->flush(); } /** * Deletes a Product entity. */ public function deleteAction(Request $request, $id) { $form = $this->createDeleteForm($id); $form->handleRequest($request); if ($form->isValid()) { $this->delete($id); } return $this->redirect($this->generateUrl('product')); } /** * Creates a form to delete a Product entity by id. * * @param mixed $id The entity id * @return \Symfony\Component\Form\Form The form */ private function createDeleteForm($id) { return $this->createFormBuilder() ->setAction($this->generateUrl('product_delete', array('id' => $id))) ->setMethod('DELETE') ->add('submit', 'submit', array('label' => 'Delete')) ->getForm() ; } }
{ "content_hash": "6c6d94eaf753efaaa6883e7e7bbb791c", "timestamp": "", "source": "github", "line_count": 274, "max_line_length": 104, "avg_line_length": 28.072992700729927, "alnum_prop": 0.5504420176807072, "repo_name": "bocharsky-bw/bow", "id": "6b393bc010f93b9e10a2d413aad4a531cf9f7494", "size": "7692", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/BW/ShopBundle/Controller/ProductController.php", "mode": "33188", "license": "mit", "language": [ { "name": "ABAP", "bytes": "962" }, { "name": "ActionScript", "bytes": "1133" }, { "name": "Assembly", "bytes": "506" }, { "name": "AutoHotkey", "bytes": "720" }, { "name": "C", "bytes": "512" }, { "name": "C#", "bytes": "83" }, { "name": "C++", "bytes": "1522" }, { "name": "CSS", "bytes": "310216" }, { "name": "Clojure", "bytes": "794" }, { "name": "CoffeeScript", "bytes": "806" }, { "name": "ColdFusion", "bytes": "86" }, { "name": "Common Lisp", "bytes": "632" }, { "name": "D", "bytes": "324" }, { "name": "Dart", "bytes": "489" }, { "name": "Erlang", "bytes": "487" }, { "name": "Go", "bytes": "641" }, { "name": "Groovy", "bytes": "1080" }, { "name": "Haskell", "bytes": "512" }, { "name": "Haxe", "bytes": "447" }, { "name": "JSONiq", "bytes": "4" }, { "name": "Java", "bytes": "396" }, { "name": "JavaScript", "bytes": "21458880" }, { "name": "Julia", "bytes": "202" }, { "name": "LiveScript", "bytes": "5747" }, { "name": "Lua", "bytes": "981" }, { "name": "Matlab", "bytes": "4" }, { "name": "Nix", "bytes": "2212" }, { "name": "OCaml", "bytes": "539" }, { "name": "Objective-C", "bytes": "2672" }, { "name": "PHP", "bytes": "962790" }, { "name": "Pascal", "bytes": "1412" }, { "name": "Perl", "bytes": "678" }, { "name": "PowerShell", "bytes": "418" }, { "name": "Python", "bytes": "478" }, { "name": "R", "bytes": "2445" }, { "name": "Ruby", "bytes": "531" }, { "name": "Rust", "bytes": "495" }, { "name": "Scala", "bytes": "1541" }, { "name": "Scheme", "bytes": "559" }, { "name": "Shell", "bytes": "1417" }, { "name": "Tcl", "bytes": "899" }, { "name": "TeX", "bytes": "1345" }, { "name": "TypeScript", "bytes": "1607" }, { "name": "VHDL", "bytes": "830" }, { "name": "Verilog", "bytes": "274" }, { "name": "Visual Basic", "bytes": "916" }, { "name": "XQuery", "bytes": "114" } ], "symlink_target": "" }
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- All the css and script files included in this head is mandatory for my-tree directive--> <link href="my_tree_directive/my_tree_directive.css" rel="stylesheet" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <title>My Tree Angular Directive</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.6/angular.min.js"></script> <script src="my_tree_directive/my_tree_directive.js"></script> <script src="Scripts/app.js"></script> </head> <body ng-app="myApp"> <h1>My Tree Angular Directive</h1> <div class="row" ng-controller="myController"> <div class="col-md-12"> <!-- BEGIN PORTLET--> <div class="portlet light bordered"> <div class="portlet-title"> <div class="caption font-purple-plum"> </div> </div> <div class="portlet-body"> <!--Tree search box--> <input id="searchableBox" results="5" type="search" class="form-control" ng-model="searchTreeTxt" placeholder="Search tree" style="width:50%" /> <!-- Expand or collapse all button for my-tree--> <a class="btn btn-info" ng-click="expandAll = !expandAll" style="margin-top:10px">{{expandAll?"Collapse All" : "Expand All"}}</a> <div> <label>Root Levels per page</label> <select ng-model="pageSize"> <option value="10">10</option> <option value="20">20</option> <option value="50">50</option> <option value="100">100</option> </select> </div> <!-- Here we use our data tree--> <mytree source-data="tableData" search-text="searchTreeTxt" page-size="pageSize" expand-all="expandAll"></mytree> </div> </div> <!-- END PORTLET--> </div> </div> </body> </html>
{ "content_hash": "0b1eb4db0ec3d624d01afe5c453e3a30", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 164, "avg_line_length": 44.407407407407405, "alnum_prop": 0.5379482902418682, "repo_name": "abhilashpullelil/my_tree_directive", "id": "7e244840e823b4e70df1ed4e326eb7038eb8d0d1", "size": "2400", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Examples/Sample_1/My_Tree_Angular_Directive/My_Tree_Angular_Directive/Index.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "821" }, { "name": "HTML", "bytes": "4861" }, { "name": "JavaScript", "bytes": "5256" } ], "symlink_target": "" }
int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } }
{ "content_hash": "1830cd67acaebed0ebafee9af0930fd3", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 88, "avg_line_length": 30.4, "alnum_prop": 0.6842105263157895, "repo_name": "joeleee/ChatBarDemo", "id": "adfe1b7242c31ff9d51f4f8adf9495a32665971a", "size": "331", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ChatBarDemo/ChatBarDemo/main.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "1055919" }, { "name": "Ruby", "bytes": "219" }, { "name": "Shell", "bytes": "4587" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="en"> <head><title></title></head> <body> <h2>Nucleoitide BLAST</h2> <h3>Description</h3> <p> This tool runs nucleotide BLAST search using the NCBI BLAST server. The query sequence file can contain up to 10 sequences. </p> <h3>Parameters</h3> <li><b>Database</b> This option selects the target protein database in the NCBI BLAST server. The available databases are: NCBI non-redundant proteins, PDB, UniProt/Swiss, RefSeq reference proteins, Patented protein sequences, Metagenomic proteins, Transkriptome Shotgun Assembly proteins. By default, SwissProt is used as the target database.</li> <li><b>BLAST program to use</b>b> BLAST algorithm to use. BLAST algorithm to use.<i>Megablast</i>is intended for comparing a query to closely related sequences and works best if the target percent identity is 95% or more but is very fast. <i>Discontiguous megablast</i> uses an initial seed that ignores some bases (allowing mismatches\) and is intended for cross-species comparisons. <i>BlastN</i> is slow, but allows a word-size down to seven bases. <li><b>Expectation threshold for saving hits</b> E-value specifies the statistical significance threshold for reporting matches against database sequences. The default value 10 means that 10 such matches are expected to be found merely by chance. Lower thresholds are more stringent, leading to fewer chance matches being reported.</li> <li><b>Word size</b> The length of the seed that initiates an alignment. BLAST works by finding word-matches between the query and database sequences. One may think of this process as finding hot-spots that BLAST can then use to initiate extensions that might eventually lead to full-blown alignments. For BLASTP searches non-exact word matches are taken into account based upon the similarity between words. </li> <li><b>Maximun number of hits to collect per sequence</b> This parameter limits the number of hit sequences reported for one query sequence. By default up to 100 hits are reported, but if you wish to collect all the hits, and not just the best ones you should in many cases increase this value significantly.</li> <li><b>Output format type</b> The BLAST results can be presented in many different formats. The classical BLAST report is not optimal for big data query sets or in the cases where the results will be analyzed with other tools. In addition to the text based BLAST reports, the results can be presented as table or XML file. You can also produce a fasta formatted sequence file containing the matching hit sequence regions or a list of hit sequence names. <li><b>Filter low complexity regions</b> Use DUST program for filtering low complexity regions in the query sequence.</li> <li><b>Entrez query to limit search</b> You can use Entrez query syntax to search a subset of the selected BLAST database. This can be helpful to limit searches to molecule types, sequence lengths or to exclude organisms.</li> <li><b>Location on the query sequence</b> Location of the search region in the query sequence, for example: 23-66.</li> <li><b>Reward for match</b>Reward for a nucleotide match. The scoring system consists of a reward for a match and a penalty for a mismatch. The absolute reward/penalty ratio should be increased as one looks at more divergent sequences. A ratio of 0.33 (/-3) is appropriate for sequences that are about 99% conserved; a ratio of 0.5 (1-2) is best for sequences that are 95% conserved; a ratio of about one (1/-1) is best for sequences that are 75% conserved.</li> <li><b>Penalty for a mismatch.</b> Penalty for a nucleotide mismatch. The scoring system consists of a reward for a match and a penalty for a mismatch. The absolute reward/penalty ratio should be increased as one looks at more divergent sequences. A ratio of 0.33 1/-3 is appropriate for sequences that are about 99% conserved; a ratio of 0.5 (1/-2) is best for sequences that are 95% conserved; a ratio of about one (1/-1) is best for sequences that are 75% conserved.) <li><b>Gap opening penalty</b> Cost to open a gap. Integer value from 6 to 25. The default value of this parameter depends on the selected scoring matrix. Note that if you assign this value, you must define also the gap extension penalty</li> <li><b>Gap extension penalty</b> Gap extension penalty. Integer value from 1 to 3.The default value of this parameter depends on the selected scoring matrix. Note that if you assign this value, you must define also the gap opening penalty </li> <li><b>Output a log file</b> Collect a log file for the BLAST run.</li> </body>
{ "content_hash": "45802a5fff6bd1e072497026618db1fc", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 140, "avg_line_length": 70.56060606060606, "alnum_prop": 0.7710972729224823, "repo_name": "chipster/chipster-tools", "id": "81bd19c7f96b817035e27efcb2be61b40f512ee0", "size": "4657", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "manual/ncbi_blastn.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "2152897" }, { "name": "Python", "bytes": "115517" }, { "name": "R", "bytes": "2444973" }, { "name": "Shell", "bytes": "153816" } ], "symlink_target": "" }
package com.smartlogic.classificationserver.client; import java.util.LinkedList; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Result extends ClassifiableObject { protected static final Log logger = LogFactory.getLog(Result.class); public Result(Document document) throws ClassificationException { // If there is no data provided, then just return an empty category list if (document == null) return; Element element = document.getDocumentElement(); NodeList nodeList = element.getElementsByTagName("STRUCTUREDDOCUMENT"); if ((nodeList == null) || (nodeList.getLength() == 0)) { throw new ClassificationException("No STRUCTUREDDOCUMENT element returned by classification server: " + toString(document)); } Element structuredDocumentElement = (Element)nodeList.item(0); addMetadata(structuredDocumentElement); // The hash value can be present as a HASH element on the Structured Document element, as a SYSTEM node, or as a META node NodeList hashNodeList = element.getElementsByTagName("HASH"); if ((hashNodeList != null) && (hashNodeList.getLength() > 0)) { Element hashNode = (Element)hashNodeList.item(0); setHash(hashNode.getAttribute("value")); } if (hash == null) getHashFromElements(element, "SYSTEM"); if (hash == null) getHashFromElements(element, "META"); NodeList articleNodeList = structuredDocumentElement.getElementsByTagName("ARTICLE"); if (articleNodeList != null) { for (int a = 0; a < articleNodeList.getLength(); a++) { Element articleElement = (Element)articleNodeList.item(a); addArticle(new Article(articleElement)); } } } private void getHashFromElements(Element parentElement, String candidateName) { NodeList candidateNodeList = parentElement.getElementsByTagName(candidateName); if ((candidateNodeList != null) && (candidateNodeList.getLength() > 0)) { for (int n = 0; n < candidateNodeList.getLength(); n++) { Element candidateElement = (Element)candidateNodeList.item(0); if ("HASH".equals(candidateElement.getAttribute("name"))) { setHash(candidateElement.getAttribute("value")); } } } } private List<Article> articles = new LinkedList<Article>(); /** * Return the set of articles within the one results * @return the articles */ public List<Article> getArticles() { return articles; } private void addArticle(Article article) { articles.add(article); } private String hash = null; public String getHash() { return hash; } public void setHash(String hash) { this.hash = hash; } }
{ "content_hash": "f2b1d1e98f604b017d6936afb8c4f35f", "timestamp": "", "source": "github", "line_count": 81, "max_line_length": 127, "avg_line_length": 34.46913580246913, "alnum_prop": 0.710243553008596, "repo_name": "Smartlogic-Semaphore-Limited/Java-APIs", "id": "a3d2ee1c1ed662fd9839e45056b420780092a8b8", "size": "2792", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Semaphore-CS-Client/src/main/java/com/smartlogic/classificationserver/client/Result.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "843294" } ], "symlink_target": "" }
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/action_settings" android:orderInCategory="100" android:showAsAction="never" android:title="@string/action_settings"/> </menu>
{ "content_hash": "aafefccca8229dd4f762d4ee361474d3", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 66, "avg_line_length": 24, "alnum_prop": 0.6212121212121212, "repo_name": "heitornascimento/doe-recife", "id": "54861f056a8bd1746180bc429690f5c960d293b4", "size": "264", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doe-recife/app/src/main/res/menu/institution_list.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "191535" } ], "symlink_target": "" }
package org.secureauth.sarestapi.data.DFP; import com.fasterxml.jackson.annotation.*; import java.util.HashMap; import java.util.Map; @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "uaBrowser", "uaString", "uaDevice", "uaEngine", "uaOS", "uaCPU", "uaPlatform", "language", "colorDepth", "pixelRatio", "screenResolution", "availableScreenResolution", "timezone", "timezoneOffset", "localStorage", "sessionStorage", "indexedDb", "addBehavior", "openDatabase", "cpuClass", "platform", "doNotTrack", "plugins", "canvas", "webGl", "adBlock", "userTamperLanguage", "userTamperScreenResolution", "userTamperOS", "userTamperBrowser", "touchSupport", "cookieSupport", "fonts" }) public class Fingerprint_ { @JsonProperty("uaBrowser") private UaBrowser uaBrowser; @JsonProperty("uaString") private String uaString; @JsonProperty("uaDevice") private UaDevice uaDevice; @JsonProperty("uaEngine") private UaEngine uaEngine; @JsonProperty("uaOS") private UaOS uaOS; @JsonProperty("uaCPU") private UaCPU uaCPU; @JsonProperty("uaPlatform") private String uaPlatform; @JsonProperty("language") private String language; @JsonProperty("colorDepth") private Integer colorDepth; @JsonProperty("pixelRatio") private Integer pixelRatio; @JsonProperty("screenResolution") private String screenResolution; @JsonProperty("availableScreenResolution") private String availableScreenResolution; @JsonProperty("timezone") private String timezone; @JsonProperty("timezoneOffset") private Integer timezoneOffset; @JsonProperty("localStorage") private Boolean localStorage; @JsonProperty("sessionStorage") private Boolean sessionStorage; @JsonProperty("indexedDb") private Boolean indexedDb; @JsonProperty("addBehavior") private Boolean addBehavior; @JsonProperty("openDatabase") private Boolean openDatabase; @JsonProperty("cpuClass") private Object cpuClass; @JsonProperty("platform") private String platform; @JsonProperty("doNotTrack") private Object doNotTrack; @JsonProperty("plugins") private String plugins; @JsonProperty("canvas") private String canvas; @JsonProperty("webGl") private Object webGl; @JsonProperty("adBlock") private Boolean adBlock; @JsonProperty("userTamperLanguage") private Boolean userTamperLanguage; @JsonProperty("userTamperScreenResolution") private Boolean userTamperScreenResolution; @JsonProperty("userTamperOS") private Boolean userTamperOS; @JsonProperty("userTamperBrowser") private Boolean userTamperBrowser; @JsonProperty("touchSupport") private TouchSupport touchSupport; @JsonProperty("cookieSupport") private Boolean cookieSupport; @JsonProperty("fonts") private String fonts; @JsonIgnore private final Map<String, Object> additionalProperties = new HashMap<String, Object>(); @JsonProperty("uaBrowser") public UaBrowser getUaBrowser() { return uaBrowser; } @JsonProperty("uaBrowser") public void setUaBrowser(UaBrowser uaBrowser) { this.uaBrowser = uaBrowser; } @JsonProperty("uaString") public String getUaString() { return uaString; } @JsonProperty("uaString") public void setUaString(String uaString) { this.uaString = uaString; } @JsonProperty("uaDevice") public UaDevice getUaDevice() { return uaDevice; } @JsonProperty("uaDevice") public void setUaDevice(UaDevice uaDevice) { this.uaDevice = uaDevice; } @JsonProperty("uaEngine") public UaEngine getUaEngine() { return uaEngine; } @JsonProperty("uaEngine") public void setUaEngine(UaEngine uaEngine) { this.uaEngine = uaEngine; } @JsonProperty("uaOS") public UaOS getUaOS() { return uaOS; } @JsonProperty("uaOS") public void setUaOS(UaOS uaOS) { this.uaOS = uaOS; } @JsonProperty("uaCPU") public UaCPU getUaCPU() { return uaCPU; } @JsonProperty("uaCPU") public void setUaCPU(UaCPU uaCPU) { this.uaCPU = uaCPU; } @JsonProperty("uaPlatform") public String getUaPlatform() { return uaPlatform; } @JsonProperty("uaPlatform") public void setUaPlatform(String uaPlatform) { this.uaPlatform = uaPlatform; } @JsonProperty("language") public String getLanguage() { return language; } @JsonProperty("language") public void setLanguage(String language) { this.language = language; } @JsonProperty("colorDepth") public Integer getColorDepth() { return colorDepth; } @JsonProperty("colorDepth") public void setColorDepth(Integer colorDepth) { this.colorDepth = colorDepth; } @JsonProperty("pixelRatio") public Integer getPixelRatio() { return pixelRatio; } @JsonProperty("pixelRatio") public void setPixelRatio(Integer pixelRatio) { this.pixelRatio = pixelRatio; } @JsonProperty("screenResolution") public String getScreenResolution() { return screenResolution; } @JsonProperty("screenResolution") public void setScreenResolution(String screenResolution) { this.screenResolution = screenResolution; } @JsonProperty("availableScreenResolution") public String getAvailableScreenResolution() { return availableScreenResolution; } @JsonProperty("availableScreenResolution") public void setAvailableScreenResolution(String availableScreenResolution) { this.availableScreenResolution = availableScreenResolution; } @JsonProperty("timezone") public String getTimezone() { return timezone; } @JsonProperty("timezone") public void setTimezone(String timezone) { this.timezone = timezone; } @JsonProperty("timezoneOffset") public Integer getTimezoneOffset() { return timezoneOffset; } @JsonProperty("timezoneOffset") public void setTimezoneOffset(Integer timezoneOffset) { this.timezoneOffset = timezoneOffset; } @JsonProperty("localStorage") public Boolean getLocalStorage() { return localStorage; } @JsonProperty("localStorage") public void setLocalStorage(Boolean localStorage) { this.localStorage = localStorage; } @JsonProperty("sessionStorage") public Boolean getSessionStorage() { return sessionStorage; } @JsonProperty("sessionStorage") public void setSessionStorage(Boolean sessionStorage) { this.sessionStorage = sessionStorage; } @JsonProperty("indexedDb") public Boolean getIndexedDb() { return indexedDb; } @JsonProperty("indexedDb") public void setIndexedDb(Boolean indexedDb) { this.indexedDb = indexedDb; } @JsonProperty("addBehavior") public Boolean getAddBehavior() { return addBehavior; } @JsonProperty("addBehavior") public void setAddBehavior(Boolean addBehavior) { this.addBehavior = addBehavior; } @JsonProperty("openDatabase") public Boolean getOpenDatabase() { return openDatabase; } @JsonProperty("openDatabase") public void setOpenDatabase(Boolean openDatabase) { this.openDatabase = openDatabase; } @JsonProperty("cpuClass") public Object getCpuClass() { return cpuClass; } @JsonProperty("cpuClass") public void setCpuClass(Object cpuClass) { this.cpuClass = cpuClass; } @JsonProperty("platform") public String getPlatform() { return platform; } @JsonProperty("platform") public void setPlatform(String platform) { this.platform = platform; } @JsonProperty("doNotTrack") public Object getDoNotTrack() { return doNotTrack; } @JsonProperty("doNotTrack") public void setDoNotTrack(Object doNotTrack) { this.doNotTrack = doNotTrack; } @JsonProperty("plugins") public String getPlugins() { return plugins; } @JsonProperty("plugins") public void setPlugins(String plugins) { this.plugins = plugins; } @JsonProperty("canvas") public String getCanvas() { return canvas; } @JsonProperty("canvas") public void setCanvas(String canvas) { this.canvas = canvas; } @JsonProperty("webGl") public Object getWebGl() { return webGl; } @JsonProperty("webGl") public void setWebGl(Object webGl) { this.webGl = webGl; } @JsonProperty("adBlock") public Boolean getAdBlock() { return adBlock; } @JsonProperty("adBlock") public void setAdBlock(Boolean adBlock) { this.adBlock = adBlock; } @JsonProperty("userTamperLanguage") public Boolean getUserTamperLanguage() { return userTamperLanguage; } @JsonProperty("userTamperLanguage") public void setUserTamperLanguage(Boolean userTamperLanguage) { this.userTamperLanguage = userTamperLanguage; } @JsonProperty("userTamperScreenResolution") public Boolean getUserTamperScreenResolution() { return userTamperScreenResolution; } @JsonProperty("userTamperScreenResolution") public void setUserTamperScreenResolution(Boolean userTamperScreenResolution) { this.userTamperScreenResolution = userTamperScreenResolution; } @JsonProperty("userTamperOS") public Boolean getUserTamperOS() { return userTamperOS; } @JsonProperty("userTamperOS") public void setUserTamperOS(Boolean userTamperOS) { this.userTamperOS = userTamperOS; } @JsonProperty("userTamperBrowser") public Boolean getUserTamperBrowser() { return userTamperBrowser; } @JsonProperty("userTamperBrowser") public void setUserTamperBrowser(Boolean userTamperBrowser) { this.userTamperBrowser = userTamperBrowser; } @JsonProperty("touchSupport") public TouchSupport getTouchSupport() { return touchSupport; } @JsonProperty("touchSupport") public void setTouchSupport(TouchSupport touchSupport) { this.touchSupport = touchSupport; } @JsonProperty("cookieSupport") public Boolean getCookieSupport() { return cookieSupport; } @JsonProperty("cookieSupport") public void setCookieSupport(Boolean cookieSupport) { this.cookieSupport = cookieSupport; } @JsonProperty("fonts") public String getFonts() { return fonts; } @JsonProperty("fonts") public void setFonts(String fonts) { this.fonts = fonts; } @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
{ "content_hash": "0ea7a73fc6dd4157af8d0b7b99e60d8b", "timestamp": "", "source": "github", "line_count": 455, "max_line_length": 91, "avg_line_length": 24.67032967032967, "alnum_prop": 0.6678841870824054, "repo_name": "SecureAuthCorp/saidp-sdk-java", "id": "db0942731bd7eec37090c40d8530bf69ca50d459", "size": "11226", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/main/java/org/secureauth/sarestapi/data/DFP/Fingerprint_.java", "mode": "33261", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "173" }, { "name": "CSS", "bytes": "12842" }, { "name": "HTML", "bytes": "1430057" }, { "name": "Java", "bytes": "436617" }, { "name": "JavaScript", "bytes": "14178" } ], "symlink_target": "" }
var Backbone = require('backbone'); var StationView = require('views/station'); var StationsList = Backbone.View.extend({ tagName: 'section', initialize: function(options) { this.router = options.router; }, render: function() { var self = this; var stationsView = this.collection.map(function(station) { return (new StationView({model: station, router: self.router})).render().el; }); this.$el.html(stationsView); return this; } }); module.exports = StationsList;
{ "content_hash": "8d1bb4170c338a230017122b62600a15", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 79, "avg_line_length": 24.3, "alnum_prop": 0.6975308641975309, "repo_name": "rguico/divvy-neighborhoods", "id": "99de7d61ee607f7fde6f68f764d1532eb6e17851", "size": "486", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/views/stationList.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "343" }, { "name": "JavaScript", "bytes": "555346" } ], "symlink_target": "" }
import * as p from "core/properties" import {input, textarea, select, option, Keys} from "core/dom" import {extend} from "core/util/object" import {DOMView} from "core/dom_view" import {Model} from "../../../model" import {DTINDEX_NAME, Item} from "./data_table" export abstract class CellEditorView extends DOMView { model: CellEditor defaultValue: any get emptyValue(): any { return null } inputEl: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement protected args: any protected abstract _createInput(): HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement constructor(options: any) { super(extend({model: options.column.model}, options)) } initialize(options: any): void { super.initialize(options) this.inputEl = this._createInput() this.defaultValue = null this.args = options this.render() } css_classes(): string[] { return super.css_classes().concat("bk-cell-editor") } render(): void { super.render() this.args.container.appendChild(this.el) this.el.appendChild(this.inputEl) this.renderEditor() this.disableNavigation() } renderEditor(): void {} disableNavigation(): void { this.inputEl.addEventListener("keydown", (event: KeyboardEvent) => { switch (event.keyCode) { case Keys.Left: case Keys.Right: case Keys.Up: case Keys.Down: case Keys.PageUp: case Keys.PageDown: event.stopImmediatePropagation() } }) } destroy(): void { this.remove() } focus(): void { this.inputEl.focus() } show(): void {} hide(): void {} position(): any {} getValue(): any { return this.inputEl.value } setValue(val: any): void { this.inputEl.value = val } serializeValue(): any { return this.getValue() } isValueChanged(): boolean { return !(this.getValue() == "" && this.defaultValue == null) && this.getValue() !== this.defaultValue } applyValue(item: Item, state: any): void { this.args.grid.getData().setField(item[DTINDEX_NAME], this.args.column.field, state) } loadValue(item: Item): void { const value = item[this.args.column.field] this.defaultValue = value != null ? value : this.emptyValue this.setValue(this.defaultValue) } validateValue(value: any): any { if (this.args.column.validator) { const result = this.args.column.validator(value) if (!result.valid) { return result } } return { valid: true, msg: null } } validate(): any { return this.validateValue(this.getValue()) } } export abstract class CellEditor extends Model { static initClass(): void { this.prototype.type = "CellEditor" } } CellEditor.initClass() export class StringEditorView extends CellEditorView { model: StringEditor inputEl: HTMLInputElement get emptyValue(): string { return "" } protected _createInput(): HTMLInputElement { return input({type: "text"}) } renderEditor(): void { //completions = @model.completions //if completions.length != 0 // @inputEl.classList.add("bk-cell-editor-completion") // $(@inputEl).autocomplete({source: completions}) // $(@inputEl).autocomplete("widget") this.inputEl.focus() this.inputEl.select() } loadValue(item: Item): void { super.loadValue(item) this.inputEl.defaultValue = this.defaultValue this.inputEl.select() } } export class StringEditor extends CellEditor { static initClass(): void { this.prototype.type = 'StringEditor' this.prototype.default_view = StringEditorView this.define({ completions: [ p.Array, [] ], }) } } StringEditor.initClass() export class TextEditorView extends CellEditorView { model: TextEditor inputEl: HTMLTextAreaElement protected _createInput(): HTMLTextAreaElement { return textarea() } } export class TextEditor extends CellEditor { static initClass(): void { this.prototype.type = 'TextEditor' this.prototype.default_view = TextEditorView } } TextEditor.initClass() export class SelectEditorView extends CellEditorView { model: SelectEditor inputEl: HTMLSelectElement protected _createInput(): HTMLSelectElement { return select() } renderEditor(): void { for (const opt of this.model.options) { this.inputEl.appendChild(option({value: opt}, opt)) } this.focus() } } export class SelectEditor extends CellEditor { options: string[] static initClass(): void { this.prototype.type = 'SelectEditor' this.prototype.default_view = SelectEditorView this.define({ options: [ p.Array, [] ], }) } } SelectEditor.initClass() export class PercentEditorView extends CellEditorView { model: PercentEditor inputEl: HTMLInputElement protected _createInput(): HTMLInputElement { return input({type: "text"}) } } export class PercentEditor extends CellEditor { static initClass(): void { this.prototype.type = 'PercentEditor' this.prototype.default_view = PercentEditorView } } PercentEditor.initClass() export class CheckboxEditorView extends CellEditorView { model: CheckboxEditor inputEl: HTMLInputElement protected _createInput(): HTMLInputElement { return input({type: "checkbox", value: "true"}) } renderEditor(): void { this.focus() } loadValue(item: Item): void { this.defaultValue = !!item[this.args.column.field] this.inputEl.checked = this.defaultValue } serializeValue(): any { return this.inputEl.checked } } export class CheckboxEditor extends CellEditor { static initClass(): void { this.prototype.type = 'CheckboxEditor' this.prototype.default_view = CheckboxEditorView } } CheckboxEditor.initClass() export class IntEditorView extends CellEditorView { model: IntEditor inputEl: HTMLInputElement protected _createInput(): HTMLInputElement { return input({type: "text"}) } renderEditor(): void { //$(@inputEl).spinner({step: @model.step}) this.inputEl.focus() this.inputEl.select() } remove(): void { //$(@inputEl).spinner("destroy") super.remove() } serializeValue(): any { return parseInt(this.getValue(), 10) || 0 } loadValue(item: Item): void { super.loadValue(item) this.inputEl.defaultValue = this.defaultValue this.inputEl.select() } validateValue(value: any): any { if (isNaN(value)) return { valid: false, msg: "Please enter a valid integer" } else return super.validateValue(value) } } export class IntEditor extends CellEditor { static initClass(): void { this.prototype.type = 'IntEditor' this.prototype.default_view = IntEditorView this.define({ step: [ p.Number, 1 ], }) } } IntEditor.initClass() export class NumberEditorView extends CellEditorView { model: NumberEditor inputEl: HTMLInputElement protected _createInput(): HTMLInputElement { return input({type: "text"}) } renderEditor(): void { //$(@inputEl).spinner({step: @model.step}) this.inputEl.focus() this.inputEl.select() } remove(): void { //$(@inputEl).spinner("destroy") super.remove() } serializeValue(): any { return parseFloat(this.getValue()) || 0.0 } loadValue(item: Item): void { super.loadValue(item) this.inputEl.defaultValue = this.defaultValue this.inputEl.select() } validateValue(value: any): any { if (isNaN(value)) return { valid: false, msg: "Please enter a valid number" } else return super.validateValue(value) } } export class NumberEditor extends CellEditor { static initClass(): void { this.prototype.type = 'NumberEditor' this.prototype.default_view = NumberEditorView this.define({ step: [ p.Number, 0.01 ], }) } } NumberEditor.initClass() export class TimeEditorView extends CellEditorView { model: TimeEditor inputEl: HTMLInputElement protected _createInput(): HTMLInputElement { return input({type: "text"}) } } export class TimeEditor extends CellEditor { static initClass(): void { this.prototype.type = 'TimeEditor' this.prototype.default_view = TimeEditorView } } TimeEditor.initClass() export class DateEditorView extends CellEditorView { model: DateEditor inputEl: HTMLInputElement protected _createInput(): HTMLInputElement { return input({type: "text"}) } get emptyValue(): Date { return new Date() } renderEditor(): void { //this.calendarOpen = false //@$datepicker = $(@inputEl).datepicker({ // showOn: "button" // buttonImageOnly: true // beforeShow: () => @calendarOpen = true // onClose: () => @calendarOpen = false //}) //@$datepicker.siblings(".ui-datepicker-trigger").css("vertical-align": "middle") //@$datepicker.width(@$datepicker.width() - (14 + 2*4 + 4)) # img width + margins + edge distance this.inputEl.focus() this.inputEl.select() } destroy(): void { //$.datepicker.dpDiv.stop(true, true) //@$datepicker.datepicker("hide") //@$datepicker.datepicker("destroy") super.destroy() } show(): void { //if @calendarOpen // $.datepicker.dpDiv.stop(true, true).show() super.show() } hide(): void { //if @calendarOpen // $.datepicker.dpDiv.stop(true, true).hide() super.hide() } position(/*_position*/): any { //if @calendarOpen // $.datepicker.dpDiv.css(top: position.top + 30, left: position.left) return super.position() } getValue(): any {} //return @$datepicker.datepicker("getDate").getTime() setValue(_val: any): void {} } //@$datepicker.datepicker("setDate", new Date(val)) export class DateEditor extends CellEditor { static initClass(): void { this.prototype.type = 'DateEditor' this.prototype.default_view = DateEditorView } } DateEditor.initClass()
{ "content_hash": "f3faab6460b339ddf7e04adcd705b2da", "timestamp": "", "source": "github", "line_count": 447, "max_line_length": 105, "avg_line_length": 22.172259507829978, "alnum_prop": 0.662798910301685, "repo_name": "Karel-van-de-Plassche/bokeh", "id": "532fe3f2ff240bd4094747a43414483d03d9fff5", "size": "9911", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "bokehjs/src/lib/models/widgets/tables/cell_editors.ts", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "1442" }, { "name": "CSS", "bytes": "102094" }, { "name": "CoffeeScript", "bytes": "462899" }, { "name": "HTML", "bytes": "46193" }, { "name": "JavaScript", "bytes": "24563" }, { "name": "Makefile", "bytes": "1150" }, { "name": "Python", "bytes": "2705342" }, { "name": "Shell", "bytes": "8995" }, { "name": "TypeScript", "bytes": "1468291" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "5a2cfbb06fd466f8533ab0f1ebb9778a", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "14f3e44a53950ea4d62a63e863ab7b7ed11b9b89", "size": "180", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Malvales/Malvaceae/Nototriche/Nototriche villosissima/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
ACCEPTED #### According to NUB Generator [autonym] #### Published in null #### Original name null ### Remarks null
{ "content_hash": "a5aa41d0d6af05941b2cf22afef73362", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 23, "avg_line_length": 9.076923076923077, "alnum_prop": 0.6779661016949152, "repo_name": "mdoering/backbone", "id": "09c1881618f7b90e28e6fac22a7c84be98475c44", "size": "188", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Proteales/Proteaceae/Leucadendron/Leucadendron glaberrimum/Leucadendron glaberrimum glaberrimum/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
from bson import ObjectId import copy import time from eve.tests import TestBase from eve.tests.utils import DummyEvent from eve import STATUS, STATUS_OK, ETAG from eve.tests.test_settings import MONGO_DBNAME class TestVersioningBase(TestBase): def setUp(self): self.versioned_field = 'ref' self.unversioned_field = 'prog' self.fields = [self.versioned_field, self.unversioned_field] super(TestVersioningBase, self).setUp() self.id_field = self.domain[self.known_resource]['id_field'] self.version_field = self.app.config['VERSION'] self.latest_version_field = self.app.config['LATEST_VERSION'] self.document_id_field = (self.id_field + self.app.config['VERSION_ID_SUFFIX']) self.known_resource_shadow = self.known_resource + \ self.app.config['VERSIONS'] self._db = self.connection[MONGO_DBNAME] def tearDown(self): super(TestVersioningBase, self).tearDown() self.connection.close() def enableVersioning(self, partial=False): del(self.domain['contacts']['schema']['title']['default']) del(self.domain['contacts']['schema']['dependency_field1']['default']) del(self.domain['contacts']['schema']['read_only_field']['default']) del(self.domain['contacts']['schema']['dict_with_read_only'] ['schema']['read_only_in_dict']['default']) if partial is True: contact_schema = self.domain['contacts']['schema'] contact_schema[self.unversioned_field]['versioned'] = False domain = copy.copy(self.domain) for resource, settings in domain.items(): settings['versioning'] = True settings['datasource'].pop('projection', None) self.app.register_resource(resource, settings) def enableDataVersionRelation(self, embeddable=True, custom_field=None, custom_field_type='string'): field = { 'type': 'dict', 'schema': { self.app.config['VERSION']: {'type': 'integer'} }, 'data_relation': { 'version': True, 'resource': 'contacts' } } if custom_field is None: field['schema'][self.id_field] = {'type': 'objectid'} else: field['schema'][custom_field] = {'type': custom_field_type} field['data_relation']['field'] = custom_field if embeddable is True: field['data_relation']['embeddable'] = True self.domain['invoices']['schema']['person'] = field def enableSoftDelete(self): self.app.config['SOFT_DELETE'] = True domain = copy.copy(self.domain) for resource, settings in domain.items(): # rebuild resource settings for soft delete del settings['soft_delete'] self.app.register_resource(resource, settings) self.deleted_field = self.app.config['DELETED'] def assertEqualFields(self, obj1, obj2, fields): for field in fields: self.assertEqual(obj1[field], obj2[field]) def assertVersion(self, response, version): self.assertTrue(self.version_field in response) self.assertEqual(response[self.version_field], version) def assertLatestVersion(self, response, latest_version): self.assertTrue(self.latest_version_field in response) self.assertEqual(response[self.latest_version_field], latest_version) def assertDocumentVersionFields( self, response, version, latest_version=None): self.assertVersion(response, version) if latest_version is None: latest_version = version self.assertLatestVersion(response, latest_version) def directGetDocument(self, _id): return self._db[self.known_resource].find_one(ObjectId(_id)) def directGetShadowDocument(self, _id, version): return self._db[self.known_resource_shadow].find_one( {self.document_id_field: ObjectId(_id), self.app.config['VERSION']: version} ) def countDocuments(self, _id=None): query = {} if _id is not None: query[self.id_field] = ObjectId(_id) documents = self._db[self.known_resource].find(query) return documents.count() def countShadowDocuments(self, _id=None): query = {} if _id is not None: query[self.document_id_field] = ObjectId(_id) documents = self._db[self.known_resource_shadow].find(query) return documents.count() def assertGoodPutPatch(self, response, status): self.assert200(status) self.assertTrue(STATUS in response) self.assertTrue(STATUS_OK in response[STATUS]) class TestNormalVersioning(TestVersioningBase): def setUp(self): super(TestNormalVersioning, self).setUp() # create some dummy contacts to use for versioning tests self.item = { self.versioned_field: 'ref value 1..............', self.unversioned_field: 123 } self.item_change = { self.versioned_field: 'ref value 2..............', self.unversioned_field: 456 } def insertTestData(self): contact, status = self.post(self.known_resource_url, data=self.item) self.assert201(status) self.item_id = contact[self.id_field] self.item_etag = contact[ETAG] self.item_id_url = ('/%s/%s' % (self.domain[self.known_resource]['url'], self.item_id)) def assertPrimaryAndShadowDocuments(self, _id, version, partial=False): # verify primary document fields document = self.directGetDocument(_id) self.assertTrue(document is not None) self.assertTrue(document[self.version_field] == version) self.assertTrue(self.versioned_field in document) self.assertTrue(self.unversioned_field in document) # verify shadow documents fields shadow_document = self.directGetShadowDocument(_id, version) self.assertTrue(shadow_document is not None) self.assertTrue(self.versioned_field in shadow_document) self.assertEqual( document[self.versioned_field], shadow_document[self.versioned_field]) if partial is True: self.assertFalse(self.unversioned_field in shadow_document) else: self.assertTrue(self.unversioned_field in shadow_document) self.assertEqual( document[self.unversioned_field], shadow_document[self.unversioned_field]) # verify meta fields self.assertTrue(shadow_document[self.version_field] == version) self.assertTrue(self.document_id_field in shadow_document) self.assertEqual( document[self.id_field], shadow_document[self.document_id_field]) self.assertTrue(self.id_field in shadow_document) self.assertTrue(self.app.config['LAST_UPDATED'] in shadow_document) self.assertTrue(self.app.config['ETAG'] in shadow_document) # verify that no unexpected fields exist num_meta_fields = 5 # see previous block if partial is True: self.assertEqual(len(shadow_document.keys()), num_meta_fields + 1) else: self.assertEqual(len(shadow_document.keys()), num_meta_fields + 2) def assertHateoasLinks(self, links, version_param): """ Makes sure links for `self`, `collection`, and `parent` point to the right place. """ self_url = links['self']['href'] coll_url = links['collection']['href'] prnt_url = links['parent']['href'] self.assertTrue('?version=%s' % (str(version_param)) in self_url) if version_param in ('all', 'diffs'): self.assertEqual(self_url.split('?')[0], coll_url) self.assertEqual(coll_url.rsplit('/', 1)[0], prnt_url) else: self.assertEqual('%s?version=all' % self_url.split('?')[0], coll_url) self.assertEqual(coll_url.split('?')[0], prnt_url) def do_test_get(self): query = '?where={"%s":"%s"}' % \ (self.id_field, self.item_id) response, status = self.get(self.known_resource, query=query) response = response[self.app.config['ITEMS']][0] # get always returns the latest version of a document self.assert200(status) self.assertDocumentVersionFields(response, 1) self.assertEqualFields(self.item, response, self.fields) def do_test_getitem(self, partial): # put a second version response, status = self.put(self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) if partial is True: # build expected response since the state of version 1 will change version_1 = copy.copy(self.item) version_1[self.unversioned_field] = \ self.item_change[self.unversioned_field] else: version_1 = self.item # check the get of the first version response, status = self.get(self.known_resource, item=self.item_id, query='?version=1') self.assert200(status) self.assertDocumentVersionFields(response, 1, 2) self.assertEqualFields(version_1, response, self.fields) links = response['_links'] self.assertHateoasLinks(links, 1) # check the get of the second version response, status = self.get(self.known_resource, item=self.item_id, query='?version=2') self.assert200(status) self.assertDocumentVersionFields(response, 2) self.assertEqualFields(self.item_change, response, self.fields) links = response['_links'] self.assertHateoasLinks(links, 2) # check the get without version specified and make sure it is version 2 response, status = self.get(self.known_resource, item=self.item_id) self.assert200(status) self.assertDocumentVersionFields(response, 2) self.assertEqualFields(self.item_change, response, self.fields) def do_test_post(self, partial): response, status = self.post( self.known_resource_url, data=self.item_change) self.assert201(status) _id = response[self.id_field] self.assertPrimaryAndShadowDocuments(_id, 1, partial=partial) document = self.directGetDocument(_id) self.assertEqualFields(self.item_change, document, self.fields) self.assertTrue(self.countShadowDocuments(self.item_id) == 1) def do_test_multi_post(self): self.assertTrue(True) def do_test_put(self, partial): response, status = self.put(self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) self.assertPrimaryAndShadowDocuments(self.item_id, 2, partial=partial) document = self.directGetDocument(self.item_id) self.assertEqualFields(self.item_change, document, self.fields) self.assertTrue(self.countShadowDocuments(self.item_id) == 2) def do_test_patch(self, partial): response, status = self.patch( self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) self.assertPrimaryAndShadowDocuments(self.item_id, 2, partial=partial) document = self.directGetDocument(self.item_id) self.assertEqualFields(self.item_change, document, self.fields) self.assertTrue(self.countShadowDocuments(self.item_id) == 2) def do_test_version_control_the_unkown(self): self.assertTrue(True) class TestCompleteVersioning(TestNormalVersioning): def setUp(self): super(TestCompleteVersioning, self).setUp() self.enableVersioning() self.insertTestData() def test_get(self): """ """ self.do_test_get() def test_getitem(self): """ """ self.do_test_getitem(partial=False) def test_post(self): """ Verify that a shadow document is created on post with all of the appropriate fields. """ self.do_test_post(partial=False) def test_multi_post(self): """ Eve literally throws single documents into an array before processing them in a POST, so I don't feel the need to specially test the versioning features here. Making a stub nontheless. """ self.do_test_multi_post() def test_put(self): """ Verify that an additional shadow document is created on post with all of the appropriate fields. """ self.do_test_put(partial=False) def test_patch(self): """ """ self.do_test_patch(partial=False) def test_version_control_the_unkown(self): """ """ self.do_test_version_control_the_unkown() def test_getitem_version_unknown(self): """ Make sure that Eve return a nice error when requesting an unknown version. """ response, status = self.get( self.known_resource, item=self.item_id, query='?version=2') self.assert404(status) def test_getitem_version_bad_format(self): """ Make sure that Eve return a nice error when requesting an unknown version. """ response, status = self.get( self.known_resource, item=self.item_id, query='?version=bad') self.assert400(status) def test_getitem_version_all(self): """ Verify that all documents are returned which each appearing exactly as it would if it were accessed explicitly. """ meta_fields = self.fields + [ self.id_field, self.app.config['LAST_UPDATED'], self.app.config['ETAG'], self.app.config['DATE_CREATED'], self.app.config['LINKS'], self.version_field, self.latest_version_field] # put a second version response, status = self.put( self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) etag2 = response[self.app.config['ETAG']] # get query response, status = self.get( self.known_resource, item=self.item_id, query='?version=all') self.assert200(status) items = response[self.app.config['ITEMS']] self.assertEqual(len(items), 2) # check the get of the first version self.assertDocumentVersionFields(items[0], 1, 2) self.assertEqualFields(self.item, items[0], self.fields) self.assertTrue(field in items[0] for field in meta_fields) self.assertEqual(len(items[0].keys()), len(meta_fields)) self.assertEqual(items[0][self.app.config['ETAG']], self.item_etag) # # check the get of the second version self.assertDocumentVersionFields(items[1], 2) self.assertEqualFields(self.item_change, items[1], self.fields) self.assertTrue(field in items[1] for field in meta_fields) self.assertEqual(len(items[1].keys()), len(meta_fields)) self.assertEqual(items[1][self.app.config['ETAG']], etag2) # check the `self` links for both versions self_href = items[0]['_links']['self']['href'] self.assertEqual(int(self_href.split('?version=')[1]), items[0][self.version_field]) self_href = items[1]['_links']['self']['href'] self.assertEqual(int(self_href.split('?version=')[1]), items[1][self.version_field]) def test_getitem_version_pagination(self): """ Verify that `?version=all` and `?version=diffs` display pagination links when results exceed `PAGINATION_DEFAULT`. """ # create many versions response, status = self.put( self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) for n in range(100): response, status = self.put( self.item_id_url, data=self.item_change, headers=[('If-Match', response[self.app.config['ETAG']])]) # get 2nd page of results page = 2 response, status = self.get(self.known_resource, item=self.item_id, query='?version=all&page=%d' % page) links = response['_links'] self.assertNextLink(links, 3) self.assertPrevLink(links, 1) self.assertLastLink(links, 5) self.assertPagination(response, 2, 102, 25) self.assertHateoasLinks(links, 'all') def test_on_fetched_item(self): """ Verify that on_fetched_item events are fired for versioned requests. """ devent = DummyEvent(lambda: True) self.app.on_fetched_item += devent response, status = self.get(self.known_resource, item=self.item_id, query='?version=1') self.assertEqual(self.known_resource, devent.called[0]) self.assertEqual( self.item_id, str(devent.called[1][self.id_field])) self.assertEqual(2, len(devent.called)) # check for ?version=all requests devent = DummyEvent(lambda: True) self.app.on_fetched_item += devent response, status = self.get(self.known_resource, item=self.item_id, query='?version=all') self.assertEqual(self.known_resource, devent.called[0]) self.assertEqual( self.item_id, str(devent.called[1][self.id_field])) self.assertEqual(2, len(devent.called)) # check for ?version=diffs requests devent = DummyEvent(lambda: True) self.app.on_fetched_item += devent response, status = self.get(self.known_resource, item=self.item_id, query='?version=diffs') self.assertEqual(None, devent.called) def test_on_fetched_item_contacts(self): """ Verify that on_fetched_item_contacts events are fired for versioned requests. """ devent = DummyEvent(lambda: True) self.app.on_fetched_item_contacts += devent response, status = self.get(self.known_resource, item=self.item_id, query='?version=1') self.assertEqual( self.item_id, str(devent.called[0][self.id_field])) self.assertEqual(1, len(devent.called)) # check for ?version=all requests devent = DummyEvent(lambda: True) self.app.on_fetched_item_contacts += devent response, status = self.get(self.known_resource, item=self.item_id, query='?version=all') self.assertEqual( self.item_id, str(devent.called[0][self.id_field])) self.assertEqual(1, len(devent.called)) # check for ?version=diffs requests devent = DummyEvent(lambda: True) self.app.on_fetched_item_contacts += devent response, status = self.get(self.known_resource, item=self.item_id, query='?version=diffs') self.assertEqual(None, devent.called) # TODO: also test with HATEOS off def test_getitem_version_diffs(self): """ Verify that the first document is returned in its entirety and that subsequent documents are simply diff to the previous version. """ meta_fields = self.fields + [ self.id_field, self.app.config['LAST_UPDATED'], self.app.config['ETAG'], self.app.config['DATE_CREATED'], self.app.config['LINKS'], self.version_field, self.latest_version_field] # put a second version response, status = self.put( self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) etag2 = response[self.app.config['ETAG']] # get query response, status = self.get( self.known_resource, item=self.item_id, query='?version=diffs') self.assert200(status) items = response[self.app.config['ITEMS']] self.assertEqual(len(items), 2) # check the get of the first version self.assertDocumentVersionFields(items[0], 1, 2) self.assertEqualFields(self.item, items[0], self.fields) self.assertTrue(field in items[0] for field in meta_fields) self.assertEqual(len(items[0].keys()), len(meta_fields)) self.assertEqual(items[0][self.app.config['ETAG']], self.item_etag) # # check the get of the second version self.assertVersion(items[1], 2) self.assertEqualFields(self.item_change, items[1], self.fields) changed_fields = self.fields + [ self.version_field, self.app.config['ETAG']] for field in changed_fields: self.assertTrue(field in items[1], "%s not in diffs" % field) # since the test routine happens so fast, `LAST_UPDATED` may or may not # be in the diff (the date output only has a one second resolution) self.assertTrue( len(items[1].keys()) == len(changed_fields) or len(items[1].keys()) == len(changed_fields) + 1) self.assertEqual(items[1][self.app.config['ETAG']], etag2) # TODO: could also verify that a 3rd iteration is a diff of the 2nd # iteration and not a diff of the 1st iteration by mistake... # TODO: also test with HATEOS off def test_getitem_projection(self): """ Verify that projections happen smoothly when versioning is on. """ # test inclusive projection response, status = self.get( self.known_resource, item=self.item_id, query='?projection={"%s": 1}' % self.unversioned_field) self.assert200(status) self.assertTrue(self.unversioned_field in response) self.assertFalse(self.versioned_field in response) self.assertTrue(self.version_field in response) self.assertTrue(self.latest_version_field in response) # test exclusive projection response, status = self.get( self.known_resource, item=self.item_id, query='?projection={"%s": 0}' % self.unversioned_field) self.assert200(status) self.assertFalse(self.unversioned_field in response) self.assertTrue(self.versioned_field in response) self.assertTrue(self.version_field in response) self.assertTrue(self.latest_version_field in response) def test_getitem_version_all_projection(self): """ Verify that projections happen smoothly when versioning is on. """ # put a second version response, status = self.put( self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) # test inclusive projection projection = '{"%s": 1}' % self.unversioned_field response, status = self.get( self.known_resource, item=self.item_id, query='?version=all&projection=%s' % projection) self.assert200(status) items = response[self.app.config['ITEMS']] self.assertEqual(len(items), 2) for item in items: self.assertTrue(self.unversioned_field in item) self.assertFalse(self.versioned_field in item) self.assertTrue(self.version_field in item) self.assertTrue(self.latest_version_field in item) if item[self.version_field] == 1: self.assertEqual( item[self.unversioned_field], self.item[self.unversioned_field]) else: self.assertEqual( item[self.unversioned_field], self.item_change[self.unversioned_field]) # test exclusive projection projection = '{"%s": 0}' % self.unversioned_field response, status = self.get( self.known_resource, item=self.item_id, query='?version=all&projection=%s' % projection) self.assert200(status) items = response[self.app.config['ITEMS']] self.assertEqual(len(items), 2) for item in items: self.assertFalse(self.unversioned_field in item) self.assertTrue(self.versioned_field in item) self.assertTrue(self.version_field in item) self.assertTrue(self.latest_version_field in item) def test_getitem_version_new_latest_version_invalidates_cache(self): """Verify that a cached document version is invalidate when the _latest_version field has changed due to creation of a new version """ # get first version and record Last-Modified r = self.test_client.get(self.item_id_url + "?version=1") document, status = self.parse_response(r) self.assert200(status) self.assertEqual(document[self.latest_version_field], 1) last_modified = r.headers.get('Last-Modified') # put a second version (after enough time has passed to expect a new # Last-Modified header) time.sleep(2) response, status = self.put( self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) # get first version again and confirm Last-Modified and latest version # have been updated r = self.test_client.get(self.item_id_url + "?version=1", headers=[ ('If-None-Match', self.item_etag), ('If-Modified-Since', last_modified)]) document, status = self.parse_response(r) self.assert200(status) self.assertEqual(document[self.latest_version_field], 2) def test_getitem_version_ignores_if_none_match(self): """Verify that cached old version documents cannot be validated by etag alone. It is impossible to catch _latest_version changes to old versioned docs with only etags. """ response, status = self.put( self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) r = self.test_client.get(self.item_id_url + "?version=1", headers=[ ('If-None-Match', self.item_etag)]) self.assert200(r.status_code) def test_automatic_fields(self): """ Make sure that Eve throws an error if we try to set a versioning field manually. """ # set _version self.item_change[self.version_field] = '1' r, status = self.post( self.known_resource_url, data=self.item_change) self.assertValidationErrorStatus(status) self.assertValidationError(r, {self.version_field: 'unknown field'}) # set _latest_version self.item_change[self.latest_version_field] = '1' r, status = self.post( self.known_resource_url, data=self.item_change) self.assertValidationErrorStatus(status) self.assertValidationError( r, {self.latest_version_field: 'unknown field'}) # set _id_document self.item_change[self.document_id_field] = '1' r, status = self.post( self.known_resource_url, data=self.item_change) self.assertValidationErrorStatus(status) self.assertValidationError( r, {self.document_id_field: 'unknown field'}) def test_referential_integrity(self): """ Make sure that Eve still correctly handles vanilla data_relations when versioning is turned on. (Copied from tests/methods/post.py.) """ data = {"person": self.unknown_item_id} r, status = self.post('/invoices/', data=data) self.assertValidationErrorStatus(status) expected = ("value '%s' must exist in resource '%s', field '%s'" % (self.unknown_item_id, 'contacts', self.id_field)) self.assertValidationError(r, {'person': expected}) data = {"person": self.item_id} r, status = self.post('/invoices/', data=data) self.assert201(status) def test_delete(self): """ Verify that we don't throw an error if we delete a resource that is supposed to be versioned but whose shadow collection does not exist. """ # turn off filter setting self.domain['contacts']['datasource']['filter'] = None # verify the primary collection exists but the shadow does not self.assertTrue(self.countDocuments() > 0) self.assertTrue(self.countShadowDocuments() > 0) # delete resource and verify no errors response, status = self.delete(self.known_resource_url) self.assert204(status) # verify that there are 0 documents in both collections self.assertTrue(self.countDocuments() == 0) self.assertTrue(self.countShadowDocuments() == 0) def test_deleteitem(self): """ Verify that we don't throw an error if we delete an item that is supposed to be versioned but that doesn't have any shadow copies. """ # verify the primary document exists but no shadow documents do self.assertTrue(self.countDocuments(self.item_id) > 0) self.assertTrue(self.countShadowDocuments(self.item_id) > 0) # delete resource and verify no errors response, status = self.delete( self.item_id_url, headers=[('If-Match', self.item_etag)]) self.assert204(status) # verify that neither primary or shadow documents exist self.assertTrue(self.countDocuments(self.item_id) == 0) self.assertTrue(self.countShadowDocuments(self.item_id) == 0) def test_softdelete(self): """ Deleting a versioned item with soft delete enabled should create a new version marked as deleted, which is returned with 404 Not Found in response to GET requests. GETs of previous versions should continue to respond with `200 OK` responses. Requests for `?version=all/diff` should include the soft deleted version as if it were a normal version of the document. """ self.enableSoftDelete() response, status = self.delete( self.item_id_url, headers=[('If-Match', self.item_etag)]) self.assert204(status) # verify that the primary document and two (v1 and deleted v2) shadow # documents exist self.assertTrue(self.countDocuments(self.item_id) == 1) self.assertTrue(self.countShadowDocuments(self.item_id) == 2) # GET primary should return `404 Not Found` w/ doc + _deleted == True r = self.test_client.get(self.item_id_url) document, status = self.parse_response(r) self.assert404(status) self.assertEqual(document[self.latest_version_field], 2) self.assertEqual(document.get(self.deleted_field), True) # GET v2 should return `404 Not Found` w/ doc + _deleted == True r = self.test_client.get(self.item_id_url + "?version=2") document, status = self.parse_response(r) self.assert404(status) self.assertEqual(document[self.latest_version_field], 2) self.assertEqual(document.get(self.deleted_field), True) # GET v1 should return `200 OK` w/ doc + _deleted == False r = self.test_client.get(self.item_id_url + "?version=1") document, status = self.parse_response(r) self.assert200(status) self.assertEqual(document[self.latest_version_field], 2) self.assertEqual(document.get(self.deleted_field), False) # GET ?version=all and ?version=diff should include the deleted version # as if it were any other version, but with the _deleted flag == True r = self.test_client.get(self.item_id_url + "?version=all") document, status = self.parse_response(r) self.assert200(status) items = document[self.app.config['ITEMS']] self.assertEqual(len(items), 2) self.assertEqual(items[1].get(self.deleted_field), True) r = self.test_client.get(self.item_id_url + "?version=diffs") document, status = self.parse_response(r) self.assert200(status) items = document[self.app.config['ITEMS']] self.assertEqual(len(items), 2) # Deleted item shoud diff by the version, etag, deleted, links, and # last_updated field only (the speed of test executon means # last_updated will only change in test intermittently) self.assertVersion(items[1], 2) changed_fields = [ self.version_field, self.deleted_field, self.app.config['ETAG'], self.app.config['LINKS']] self.assertTrue( len(items[1].keys()) == len(changed_fields) or len(items[1].keys()) == len(changed_fields) + 1) for field in changed_fields: self.assertTrue(field in items[1], "%s not in diffs" % field) def test_softdelete_version_db_fields(self): """ Document versions created with soft delete enabled should include the DELETED field. """ self.enableSoftDelete() # v1 created before soft delete was enabled, it will not have DELETED v1_doc = self._db[self.known_resource_shadow].find_one({ self.document_id_field: ObjectId(self.item_id), self.version_field: 1 }) self.assertEqual(v1_doc.get(self.deleted_field), None) # Create second version r = self.test_client.patch( self.item_id_url, data={'ref': '1234567890123456789012345'}, headers=[('If-Match', self.item_etag)] ) # Create deleted third version response, status = self.delete( self.item_id_url, headers=[('If-Match', r.headers['ETag'])]) self.assert204(status) # v2 doc should have DELETED = False added v2_doc = self._db[self.known_resource_shadow].find_one({ self.document_id_field: ObjectId(self.item_id), self.version_field: 2 }) self.assertEqual(v2_doc.get(self.deleted_field), False) # v3 should have DELETED = True v3_doc = self._db[self.known_resource_shadow].find_one({ self.document_id_field: ObjectId(self.item_id), self.version_field: 3 }) self.assertEqual(v3_doc.get(self.deleted_field), True) class TestVersionedDataRelation(TestNormalVersioning): def setUp(self): super(TestVersionedDataRelation, self).setUp() # enable versioning in the invoice data_relation definition self.enableDataVersionRelation() self.enableVersioning() self.insertTestData() def test_referential_integrity(self): """ Make sure that Eve correctly validates a data_relation with a version and returns the version with the data_relation in the response. """ data_relation = \ self.domain['invoices']['schema']['person']['data_relation'] value_field = data_relation['field'] version_field = self.app.config['VERSION'] validation_error_format = ( "versioned data_relation must be a dict" " with fields '%s' and '%s'" % (value_field, version_field)) # must be a dict data = {"person": self.item_id} r, status = self.post('/invoices/', data=data) self.assertValidationErrorStatus(status) self.assertValidationError(r, {'person': 'must be of dict type'}) # must have _id data = {"person": {value_field: self.item_id}} r, status = self.post('/invoices/', data=data) self.assertValidationErrorStatus(status) self.assertValidationError(r, {'person': validation_error_format}) # must have _version data = {"person": {version_field: 1}} r, status = self.post('/invoices/', data=data) self.assertValidationErrorStatus(status) self.assertValidationError(r, {'person': validation_error_format}) # bad id format data = {"person": {value_field: 'bad', version_field: 1}} r, status = self.post('/invoices/', data=data) self.assertValidationErrorStatus(status) self.assertValidationError( r, {'person': { value_field: "value 'bad' cannot be converted to a ObjectId"}}) # unknown id data = {"person": { value_field: self.unknown_item_id, version_field: 1}} r, status = self.post('/invoices/', data=data) self.assertValidationErrorStatus(status) self.assertValidationError( r, {'person': "value '%s' must exist in " "resource '%s', field '%s' at version '%s'." % (self.unknown_item_id, 'contacts', value_field, 1)}) # version doesn't exist data = {"person": {value_field: self.item_id, version_field: 2}} r, status = self.post('/invoices/', data=data) self.assertValidationErrorStatus(status) self.assertValidationError( r, {'person': "value '%s' must exist in " "resource '%s', field '%s' at version '%s'." % (self.item_id, 'contacts', value_field, 2)}) # put a second version response, status = self.put(self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) # reference first version... this should work data = {"person": {value_field: self.item_id, version_field: 1}} r, status = self.post('/invoices/', data=data) self.assert201(status) # and response should include embedded v1 response, status = self.get( self.domain['invoices']['url'], item=r[self.id_field], query='?embedded={"person": 1}') self.assert200(status) self.assertEqual(response['person'].get(version_field), 1) # reference second version... this should work data = {"person": {value_field: self.item_id, version_field: 2}} r, status = self.post('/invoices/', data=data) self.assert201(status) # and response should include embedded v2 response, status = self.get( self.domain['invoices']['url'], item=r[self.id_field], query='?embedded={"person": 1}') self.assert200(status) self.assertEqual(response['person'].get(version_field), 2) def test_embedded(self): """ Perform a quick check to make sure that Eve can embedded with a version in the data relation. """ data_relation = \ self.domain['invoices']['schema']['person']['data_relation'] value_field = data_relation['field'] # add embeddable data relation data = {"person": {value_field: self.item_id, self.version_field: 1}} response, status = self.post('/invoices/', data=data) self.assert201(status) invoice_id = response[value_field] # test that it works response, status = self.get( self.domain['invoices']['url'], item=invoice_id, query='?embedded={"person": 1}') self.assert200(status) self.assertTrue('ref' in response['person']) def test_softdelete_embedded(self): """ If a versioned embedded document is soft deleted, a previous version should still resolve correctly. """ self.enableSoftDelete() data_relation = \ self.domain['invoices']['schema']['person']['data_relation'] value_field = data_relation['field'] version_field = self.app.config['VERSION'] # add embeddable data relation data = {"person": {value_field: self.item_id, version_field: 1}} response, status = self.post('/invoices/', data=data) self.assert201(status) invoice_id = response[value_field] # soft delete embedded doc response, status = self.delete( self.item_id_url, headers=[('If-Match', self.item_etag)]) self.assert204(status) # v1 should still return response, status = self.get( self.domain['invoices']['url'], item=invoice_id, query='?embedded={"person": 1}') self.assert200(status) self.assertEqual(response['person'].get(self.id_field), self.item_id) self.assertEqual(response['person'].get( self.app.config['ETAG']), self.item_etag) self.assertEqual(response['person'].get(self.version_field), 1) self.assertEqual(response['person'].get(self.deleted_field), False) def test_softdelete_data_relation_validation(self): """Eve validation should not allow a data relation to a soft deleted document version. A data relation to an un-deleted version should be allowed. """ self.enableSoftDelete() # soft delete embeddable document self.enableSoftDelete() response, status = self.delete( self.item_id_url, headers=[('If-Match', self.item_etag)]) self.assert204(status) # creating data relation to still valid v1 should work data_relation = \ self.domain['invoices']['schema']['person']['data_relation'] value_field = data_relation['field'] version_field = self.app.config['VERSION'] data = {"person": {value_field: self.item_id, version_field: 1}} response, status = self.post('/invoices/', data=data) self.assert201(status) # saving relation to deleted version 2 should fail data = {"person": {value_field: self.item_id, version_field: 2}} r, status = self.post('/invoices/', data=data) self.assertValidationErrorStatus(status) self.assertValidationError( r, {'person': "value '%s' must exist in " "resource '%s', field '%s' at version '%s'." % (self.item_id, 'contacts', value_field, 2)}) class TestVersionedDataRelationCustomField(TestNormalVersioning): def setUp(self): super(TestVersionedDataRelationCustomField, self).setUp() # enable versioning in the invoice data_relation definition with custom # relation field self.enableDataVersionRelation(custom_field=self.versioned_field) self.enableVersioning() self.insertTestData() def test_referential_integrity(self): """ Make sure that Eve correctly distinguishes between versions when referencing fields that aren't '_id'. """ # put a second version response, status = self.put(self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) # try saving a field from the first version against version 2 data = {"person": {'ref': self.item['ref'], self.version_field: 2}} r, status = self.post('/invoices/', data=data) self.assertValidationErrorStatus(status) self.assertValidationError( r, {'person': "value '%s' must exist in " "resource '%s', field '%s' at version '%s'." % (self.item['ref'], 'contacts', 'ref', 2)}) # try saving against the first version...this should work data = {"person": {'ref': self.item['ref'], self.version_field: 1}} r, status = self.post('/invoices/', data=data) self.assert201(status) # and response should include embedded v1 response, status = self.get( self.domain['invoices']['url'], item=r[self.id_field], query='?embedded={"person": 1}') self.assert200(status) self.assertEqual(response['person'].get(self.version_field), 1) class TestVersionedDataRelationUnversionedField(TestNormalVersioning): def setUp(self): super(TestVersionedDataRelationUnversionedField, self).setUp() # enable versioning in the invoice data_relation definition with custom # unversioned relation field self.enableDataVersionRelation( custom_field=self.unversioned_field, custom_field_type='integer') self.enableVersioning(partial=True) self.insertTestData() def test_referential_integrity(self): """ Make sure that Eve correctly distinguishes between versions when referencing unversioned fields """ # put a second version response, status = self.put(self.item_id_url, data=self.item_change, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) # reference first version relation_field = self.unversioned_field data = {"person": { relation_field: self.item_change[relation_field], self.version_field: 1 }} r, status = self.post('/invoices/', data=data) self.assert201(status) # and response should include embedded v1 response, status = self.get( self.domain['invoices']['url'], item=r[self.id_field], query='?embedded={"person": 1}') self.assert200(status) self.assertEqual(response['person'].get(self.version_field), 1) class TestPartialVersioning(TestNormalVersioning): def setUp(self): super(TestPartialVersioning, self).setUp() self.enableVersioning(partial=True) self.insertTestData() def test_get(self): """ Test that get response successfully synthesize the full document even with unversioned fields. """ self.do_test_get() def test_getitem(self): """ Test that get response can successfully synthesize both old and new document versions when partial versioning is in place. """ self.do_test_getitem(partial=True) def test_post(self): """ Verify that partial version control can happen on POST. """ self.do_test_post(partial=True) def test_multi_post(self): """ Eve literally throws single documents into an array before processing them in a POST, so I don't feel the need to specially test the versioning features here. Making a stub nontheless. """ self.do_test_multi_post() def test_put(self): """ Verify that partial version control can happen on PUT. """ self.do_test_put(partial=True) def test_patch(self): """ Verify that partial version control can happen on PATCH. """ self.do_test_patch(partial=True) def test_version_control_the_unkown(self): """ Currently, the versioning scheme assumes true unless a field is explicitly marked to not be version controlled. That means, if 'allow_unknown' is enabled, those fields are always version controlled. This is the same behavior as under TestCompleteVersioning. """ self.do_test_version_control_the_unkown() class TestLateVersioning(TestVersioningBase): def setUp(self): super(TestLateVersioning, self).setUp() # enable versioning in the invoice data_relation definition self.enableDataVersionRelation(embeddable=True) # turn on version after data has been inserted into the db self.enableVersioning() def test_get(self): """ Make sure that Eve returns version = 1 even for documents that haven't been modified since version control has been turned on. """ response, status = self.get(self.known_resource) self.assert200(status) items = response[self.app.config['ITEMS']] self.assertEqual(len(items), self.app.config['PAGINATION_DEFAULT']) for item in items: self.assertDocumentVersionFields(item, 1) def test_getitem(self): """ Make sure that Eve returns version = 1 even for documents that haven't been modified since version control has been turned on. """ response, status = self.get(self.known_resource, item=self.item_id) self.assert200(status) self.assertDocumentVersionFields(response, 1) def test_put(self): """ Make sure that Eve jumps to version = 2 and saves two shadow copies (version 1 and version 2) for documents that where already in the database before version control was turned on. """ # make sure there are no shadow documents self.assertTrue(self.countShadowDocuments() == 0) # put a change changes = {"ref": "this is a different value"} response, status = self.put(self.item_id_url, data=changes, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) self.assertDocumentVersionFields(response, 2) # make sure that this saved to the db (if it didn't, version == 1) self.assertTrue(self.countShadowDocuments() == 2) response2, status = self.get(self.known_resource, item=self.item_id) self.assert200(status) self.assertDocumentVersionFields(response2, 2) self.assertEqual(response[ETAG], response2[ETAG]) def test_patch(self): """ Make sure that Eve jumps to version = 2 and saves two shadow copies (version 1 and version 2) for documents that where already in the database before version control was turned on. """ # make sure there are no shadow documents self.assertTrue(self.countShadowDocuments() == 0) # patch a change changes = {"ref": "this is a different value"} response, status = self.patch( self.item_id_url, data=changes, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) self.assertDocumentVersionFields(response, 2) # make sure that this saved to the db (if it didn't, version == 1) self.assertTrue(self.countShadowDocuments() == 2) response2, status = self.get(self.known_resource, item=self.item_id) self.assert200(status) self.assertDocumentVersionFields(response2, 2) self.assertEqual(response[ETAG], response2[ETAG]) def test_datasource(self): """ Make sure that Eve uses the same mongo collection for storing versions when datasource is used.""" # make sure there are no shadow documents self.assertTrue(self.countShadowDocuments() == 0) # patch a change changes = {"ref": "this is a different value"} response, status = self.patch( self.item_id_url, data=changes, headers=[('If-Match', self.item_etag)]) self.assertGoodPutPatch(response, status) self.assertDocumentVersionFields(response, 2) # make sure that this saved to the db (if it didn't, version == 1) self.assertTrue(self.countShadowDocuments() == 2) data = { self.versioned_field: 'ref value 3..............', self.unversioned_field: 444 } contact, status = self.post(self.known_resource_url, data=data) self.assert201(status) # make sure that this is saved to the db in the same collection self.assertEqual(self.countShadowDocuments(), 3) def test_delete(self): """ Verify that we don't throw an error if we delete a resource that is supposed to be versioned but whose shadow collection does not exist. """ # turn off filter setting self.domain['contacts']['datasource']['filter'] = None # verify the primary collection exists but the shadow does not self.assertTrue(self.countDocuments() > 0) self.assertTrue(self.countShadowDocuments() == 0) # delete resource and verify no errors response, status = self.delete(self.known_resource_url) self.assert204(status) # verify that there are 0 documents in both collections self.assertTrue(self.countDocuments() == 0) self.assertTrue(self.countShadowDocuments() == 0) def test_deleteitem(self): """ Verify that we don't throw an error if we delete an item that is supposed to be versioned but that doesn't have any shadow copies. """ # verify the primary document exists but no shadow documents do self.assertTrue(self.countDocuments(self.item_id) > 0) self.assertTrue(self.countShadowDocuments(self.item_id) == 0) # delete resource and verify no errors response, status = self.delete( self.item_id_url, headers=[('If-Match', self.item_etag)]) self.assert204(status) # verify that neither primary or shadow documents exist self.assertTrue(self.countDocuments(self.item_id) == 0) self.assertTrue(self.countShadowDocuments(self.item_id) == 0) def test_softdelete(self): """ Make sure that Eve jumps to version = 2 and saves two shadow copies (version 1 and version 2) for documents that where already in the database before version control was turned on. """ self.enableSoftDelete() # verify the primary document exists but no shadow documents do self.assertTrue(self.countDocuments(self.item_id) > 0) self.assertTrue(self.countShadowDocuments(self.item_id) == 0) # soft delete resource and verify no errors response, status = self.delete( self.item_id_url, headers=[('If-Match', self.item_etag)]) self.assert204(status) # verify that the primary document and two (late caught v1 and deleted # v2) shadow documents exist self.assertTrue(self.countDocuments(self.item_id) == 1) self.assertTrue(self.countShadowDocuments(self.item_id) == 2) def test_referential_integrity(self): """ Make sure that Eve doesn't mind doing a data relation even when the shadow copy doesn't exist. """ data_relation = \ self.domain['invoices']['schema']['person']['data_relation'] value_field = data_relation['field'] version_field = self.app.config['VERSION'] # verify that Eve will take version = 1 if no shadow docs exist data = {"person": {value_field: self.item_id, version_field: 1}} response, status = self.post('/invoices/', data=data) self.assert201(status) def test_embedded(self): """ Perform a quick check to make sure that Eve can embedded with a version in the data relation. """ data_relation = \ self.domain['invoices']['schema']['person']['data_relation'] value_field = data_relation['field'] version_field = self.app.config['VERSION'] # verify that Eve will take version = 1 if no shadow docs exist data = {"person": {value_field: self.item_id, version_field: 1}} response, status = self.post('/invoices/', data=data) self.assert201(status) invoice_id = response[value_field] # verify that we can embed across the data_relation w/o shadow copy response, status = self.get( self.domain['invoices']['url'], item=invoice_id, query='?embedded={"person": 1}') self.assert200(status) self.assertTrue('ref' in response['person']) class TestVersioningWithCustomIdField(TestNormalVersioning): def setUp(self): super(TestVersioningWithCustomIdField, self).setUp() self.domain[self.known_resource]['schema'][self.id_field] = { 'type': 'string', } self.enableVersioning() self.insertTestData() def test_getitem(self): """ Make sure we can insert at least two versioning documents. """ self.do_test_getitem(partial=False)
{ "content_hash": "03f3a160452699e46c2522cf0d802510", "timestamp": "", "source": "github", "line_count": 1363, "max_line_length": 82, "avg_line_length": 41.60014673514306, "alnum_prop": 0.6154388811484807, "repo_name": "Graghav/surabi", "id": "bd436cfeb8e5110eb679c4a5e86593e498706470", "size": "56726", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ADMIN/venv/lib/python2.7/site-packages/eve/tests/versioning.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "39177" }, { "name": "CSS", "bytes": "1313697" }, { "name": "HTML", "bytes": "59143" }, { "name": "JavaScript", "bytes": "3508430" }, { "name": "Python", "bytes": "5679903" }, { "name": "Shell", "bytes": "3262" } ], "symlink_target": "" }
char* find(char *haystack, char needle); int main(){ char sentence[400]; char word; int position; fgets(sentence, 400, stdin); scanf("%c", &word); position = find(sentence, word) - sentence; if(find(sentence, word)){ printf("%d", position); }else{ printf("%d", -1); } return 0; } char* find(char *haystack, char needle){ int count; for(count = 0; count < strlen(haystack); count++){ if(haystack[count] == needle){ return &haystack[count]; } } return NULL; }
{ "content_hash": "d3c57911225b2f6614c1bbe44cf065e8", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 54, "avg_line_length": 13.418604651162791, "alnum_prop": 0.5320623916811091, "repo_name": "elsys/po-homework", "id": "c474e51177de7ac202c6e7395b0edc34ae58fd65", "size": "617", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "G/02/12/task2.c", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "756587" } ], "symlink_target": "" }
<!-- ~ Copyright (c) 2016 Network New Technologies Inc. ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.networknt</groupId> <artifactId>light-4j</artifactId> <version>2.0.21-SNAPSHOT</version> <relativePath>..</relativePath> </parent> <artifactId>config</artifactId> <packaging>jar</packaging> <description>A module that handles externalized configuration files.</description> <dependencies> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-jsr310</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> <dependency> <groupId>org.owasp.encoder</groupId> <artifactId>encoder</artifactId> </dependency> <dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> </dependency> <dependency> <groupId>com.networknt</groupId> <artifactId>decryptor</artifactId> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> </dependencies> </project>
{ "content_hash": "5905dd294a15e0410206728a4d4ed98a", "timestamp": "", "source": "github", "line_count": 70, "max_line_length": 108, "avg_line_length": 35.32857142857143, "alnum_prop": 0.6275778406793369, "repo_name": "networknt/undertow-server", "id": "9795b2816c29b89432eb877b06b51470af627ac6", "size": "2473", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "config/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "761952" } ], "symlink_target": "" }
''' Created on 2015/09/08 @author: yangjun ''' import unittest import sys import json import logging class ParametrizedTestCase(unittest.TestCase): """ TestCase classes that want to be parametrized should inherit from this class. """ def __init__(self, methodName='runTest', param=None): super(ParametrizedTestCase, self).__init__(methodName) self.param = param @staticmethod def parametrize(testcase_class, param=None): """ Create a suite containing all tests taken from the given subclass, passing them the parameter 'param'. """ testloader = unittest.TestLoader() testnames = testloader.getTestCaseNames(testcase_class) suite = unittest.TestSuite() for name in testnames: suite.addTest(testcase_class(name, param=param)) return suite class TestDemo(ParametrizedTestCase): def test_something(self): print 'param : ', self.param assert(1 == 1) def test_something_else(self): assert(2 == 2) if __name__ == "__main__": try: param = sys.argv[1] print 'param : ', param param = json.loads(param) suite = unittest.TestSuite() suite.addTest(ParametrizedTestCase.parametrize(TestDemo, param=param)) unittest.TextTestRunner(verbosity=2).run(suite) except Exception as e: logging.error(e, exc_info=1) raise Exception(e)
{ "content_hash": "53089604cd7cc62d8c23d4d4f4ffca4b", "timestamp": "", "source": "github", "line_count": 49, "max_line_length": 79, "avg_line_length": 30.142857142857142, "alnum_prop": 0.6242383209207854, "repo_name": "junneyang/datadrivedunittest", "id": "84215b929da939c85540b06e3b86f8aa0ebd4f52", "size": "1519", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "TestDemo.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "7694" } ], "symlink_target": "" }
#import <SkimNotes/SKNExtendedAttributeManager.h> #import <SkimNotes/NSFileManager_SKNExtensions.h> #import <SkimNotes/PDFDocument_SKNExtensions.h> #import <SkimNotes/PDFAnnotation_SKNExtensions.h> #import <SkimNotes/SKNPDFAnnotationNote.h>
{ "content_hash": "cc6dd5b240578a144b8d5dff69d2a7a2", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 49, "avg_line_length": 24.6, "alnum_prop": 0.8252032520325203, "repo_name": "camillobruni/skim", "id": "eae7e4d3152be92584a1c7882c63e0528bdb7d5a", "size": "1878", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "SkimNotes/SkimNotes.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "66446" }, { "name": "Objective-C", "bytes": "3066280" }, { "name": "Perl", "bytes": "616858" }, { "name": "Python", "bytes": "2318" }, { "name": "Shell", "bytes": "1735" } ], "symlink_target": "" }
DEFAULT_EVENT_IMAGE = 'img/default_event.png'
{ "content_hash": "b626fe48cbb1a8611258de53ce6fe651", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 45, "avg_line_length": 46, "alnum_prop": 0.7608695652173914, "repo_name": "freeslugs/eventum", "id": "6ec193362247bb1d3b0ed3c94ba1b5cef638fb30", "size": "106", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "config/client_config.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "64540" }, { "name": "HTML", "bytes": "54201" }, { "name": "JavaScript", "bytes": "29243" }, { "name": "Python", "bytes": "214815" }, { "name": "Shell", "bytes": "1845" } ], "symlink_target": "" }
<?php namespace Nette\Application; use Nette; /** * Presenter request. Immutable object. * * @author David Grudl * * @property string $presenterName * @property array $parameters * @property array $post * @property array $files * @property string $method */ final class Request extends Nette\FreezableObject { /** method */ const FORWARD = 'FORWARD'; /** flag */ const SECURED = 'secured'; /** flag */ const RESTORED = 'restored'; /** @var string */ private $method; /** @var array */ private $flags = array(); /** @var string */ private $name; /** @var array */ private $params; /** @var array */ private $post; /** @var array */ private $files; /** * @param string fully qualified presenter name (module:module:presenter) * @param string method * @param array variables provided to the presenter usually via URL * @param array variables provided to the presenter via POST * @param array all uploaded files * @param array flags */ public function __construct( $name, $method, array $params, array $post = array(), array $files = array(), array $flags = array() ) { $this->name = $name; $this->method = $method; $this->params = $params; $this->post = $post; $this->files = $files; $this->flags = $flags; } /** * Sets the presenter name. * * @param string * * @return Request provides a fluent interface */ public function setPresenterName($name) { $this->updating(); $this->name = $name; return $this; } /** * Retrieve the presenter name. * * @return string */ public function getPresenterName() { return $this->name; } /** @deprecated */ function getParams() { trigger_error(__METHOD__.'() is deprecated; use getParameters() instead.', E_USER_WARNING); return $this->getParameters(); } /** @deprecated */ function setParams(array $params) { trigger_error(__METHOD__.'() is deprecated; use setParameters() instead.', E_USER_WARNING); return $this->setParameters($params); } /** * Returns all variables provided to the presenter (usually via URL). * * @return array */ public function getParameters() { return $this->params; } /** * Sets variables provided to the presenter. * * @param array * * @return Request provides a fluent interface */ public function setParameters(array $params) { $this->updating(); $this->params = $params; return $this; } /** * Returns all variables provided to the presenter via POST. * * @return array */ public function getPost() { return $this->post; } /** * Sets variables provided to the presenter via POST. * * @param array * * @return Request provides a fluent interface */ public function setPost(array $params) { $this->updating(); $this->post = $params; return $this; } /** * Returns all uploaded files. * * @return array */ public function getFiles() { return $this->files; } /** * Sets all uploaded files. * * @param array * * @return Request provides a fluent interface */ public function setFiles(array $files) { $this->updating(); $this->files = $files; return $this; } /** * Returns the method. * * @return string */ public function getMethod() { return $this->method; } /** * Sets the method. * * @param string * * @return Request provides a fluent interface */ public function setMethod($method) { $this->method = $method; return $this; } /** * Checks if the method is the given one. * * @param string * * @return bool */ public function isMethod($method) { return strcasecmp($this->method, $method) === 0; } /** * Checks if the method is POST. * * @return bool */ public function isPost() { return strcasecmp($this->method, 'post') === 0; } /** * Sets the flag. * * @param string * @param bool * * @return Request provides a fluent interface */ public function setFlag($flag, $value = true) { $this->updating(); $this->flags[$flag] = (bool)$value; return $this; } /** * Checks the flag. * * @param string * * @return bool */ public function hasFlag($flag) { return !empty( $this->flags[$flag] ); } }
{ "content_hash": "f753764a7cb62fb301cb240b7d79f850", "timestamp": "", "source": "github", "line_count": 279, "max_line_length": 99, "avg_line_length": 18.03584229390681, "alnum_prop": 0.5200715421303657, "repo_name": "DerDu/MOC-Framework-Mark-V", "id": "4572db7bcdc31ab19d74f1911fbadd0cce024c13", "size": "5297", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "Component/Documentation/Vendor/ApiGen/libs/Nette/Nette/Application/Request.php", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ApacheConf", "bytes": "110" }, { "name": "HTML", "bytes": "252" }, { "name": "PHP", "bytes": "299247" }, { "name": "Smarty", "bytes": "252" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>persistent-union-find: 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.13.0 / persistent-union-find - 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> persistent-union-find <small> 8.10.0 <span class="label label-info">Not compatible</span> </small> </h1> <p><em><script>document.write(moment("2021-10-30 10:24:50 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-10-30 10:24:50 UTC)</em><p> <h2>Context</h2> <pre># Packages matching: installed # Name # Installed # Synopsis base-bigarray base base-threads base base-unix base conf-findutils 1 Virtual package relying on findutils conf-gmp 3 Virtual package relying on a GMP lib system installation coq 8.13.0 Formal proof management system num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic ocaml 4.12.0 The OCaml compiler (virtual package) ocaml-base-compiler 4.12.0 Official release 4.12.0 ocaml-config 2 OCaml Switch Configuration ocaml-options-vanilla 1 Ensure that OCaml is compiled with no special options enabled ocamlfind 1.9.1 A library manager for OCaml zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers # opam file: opam-version: &quot;2.0&quot; maintainer: &quot;[email protected]&quot; homepage: &quot;http://www.lri.fr/~filliatr/puf/&quot; license: &quot;Unknown&quot; build: [make &quot;-j%{jobs}%&quot;] install: [make &quot;install&quot;] remove: [&quot;rm&quot; &quot;-R&quot; &quot;%{lib}%/coq/user-contrib/PersistentUnionFind&quot;] depends: [ &quot;ocaml&quot; &quot;coq&quot; {&gt;= &quot;8.10&quot; &amp; &lt; &quot;8.11~&quot;} ] tags: [ &quot;keyword: program verification&quot; &quot;keyword: union-find&quot; &quot;keyword: data structures&quot; &quot;keyword: Tarjan&quot; &quot;category: Computer Science/Decision Procedures and Certified Algorithms/Correctness proofs of algorithms&quot; ] authors: [ &quot;Jean-Christophe Filliâtre&quot; ] bug-reports: &quot;https://github.com/coq-contribs/persistent-union-find/issues&quot; dev-repo: &quot;git+https://github.com/coq-contribs/persistent-union-find.git&quot; synopsis: &quot;Persistent Union Find&quot; description: &quot;&quot;&quot; Correctness proof of the Ocaml implementation of a persistent union-find data structure. See http://www.lri.fr/~filliatr/puf/ for more details.&quot;&quot;&quot; flags: light-uninstall url { src: &quot;https://github.com/coq-contribs/persistent-union-find/archive/v8.10.0.tar.gz&quot; checksum: &quot;md5=9d860c3649cb724e3f5e513d1b1ff60b&quot; } </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-persistent-union-find.8.10.0 coq.8.13.0</code></dd> <dt>Return code</dt> <dd>5120</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.13.0). The following dependencies couldn&#39;t be met: - coq-persistent-union-find -&gt; coq &lt; 8.11~ -&gt; ocaml &lt; 4.10 base of this switch (use `--unlock-base&#39; 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-persistent-union-find.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"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "bb5790243084fac4abf8a3e0981b3d19", "timestamp": "", "source": "github", "line_count": 173, "max_line_length": 157, "avg_line_length": 42.17341040462428, "alnum_prop": 0.5538651315789473, "repo_name": "coq-bench/coq-bench.github.io", "id": "99214e9114ad8ee635b10e96cb81592d79ae16db", "size": "7299", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.12.0-2.0.8/released/8.13.0/persistent-union-find/8.10.0.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
#region Apache License Version 2.0 #endregion Apache License Version 2.0 using System; using System.Text; using System.Collections.Generic; using System.IO; using System.Xml.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using Senparc.Weixin.Cache; using Senparc.Weixin.Cache.Redis; using Senparc.Weixin.Exceptions; using Senparc.Weixin.Work.CommonAPIs; using Senparc.Weixin.Work.Containers; using Senparc.CO2NET.Cache.Redis; using Senparc.CO2NET.Cache; using Moq; using Senparc.CO2NET.RegisterServices; using Senparc.CO2NET; using Senparc.Weixin.Entities; using Senparc.WeixinTests; #if NETSTANDARD2_0_OR_GREATER || NETCOREAPP2_1_OR_GREATER || NET6_0_OR_GREATER using Microsoft.AspNetCore.Hosting; #endif namespace Senparc.Weixin.Work.Test.CommonApis { /// <summary> /// CommonApiTest 的摘要说明 /// </summary> [TestClass] public partial class CommonApiTest : BaseTest { private dynamic _appConfig; protected dynamic AppConfig { get { if (_appConfig == null) { #if NETSTANDARD2_0_OR_GREATER || NETCOREAPP2_1_OR_GREATER || NET6_0_OR_GREATER var filePath = "../../../Config/test.config"; #else var filePath = "../../Config/test.config"; #endif if (File.Exists(filePath)) { #if NETSTANDARD2_0_OR_GREATER || NETCOREAPP2_1_OR_GREATER || NET6_0_OR_GREATER var stream = new FileStream(filePath, FileMode.Open); var doc = XDocument.Load(stream); stream.Dispose(); #else var doc = XDocument.Load(filePath); #endif _appConfig = new { CorpId = doc.Root.Element("CorpId").Value, CorpSecret = doc.Root.Element("CorpSecret").Value, }; } else { _appConfig = new { CorpId = "YourAppId", //换成你的信息 CorpSecret = "YourSecret",//换成你的信息 }; } } return _appConfig; } } protected string _corpId { get { return AppConfig.CorpId; } } protected string _corpSecret { get { return AppConfig.CorpSecret; } } protected readonly bool _userRedis = true;//是否使用Reids public CommonApiTest() { if (_userRedis) { var redisConfiguration = "localhost:6379,defaultDatabase=2"; RedisManager.ConfigurationOption = redisConfiguration; CacheStrategyFactory.RegisterObjectCacheStrategy(() => RedisObjectCacheStrategy.Instance);//Redis Senparc.CO2NET.Cache.Redis.Register.UseKeyValueRedisNow();//键值对缓存策略(推荐) Senparc.Weixin.Cache.Redis.Register.ActivityDomainCache();//进行领域缓存注册 } //全局只需注册一次 AccessTokenContainer.RegisterAsync(_corpId, _corpSecret, "单元测试").GetAwaiter().GetResult(); } [TestMethod] public void GetTokenTest() { var tokenResult = CommonApi.GetToken(_corpId, _corpSecret); Assert.IsNotNull(tokenResult); Assert.IsTrue(tokenResult.access_token.Length > 0); } [TestMethod] public void GetTokenFailTest() { try { var result = CommonApi.GetToken("appid", "secret"); Assert.Fail();//上一步就应该已经抛出异常 } catch (ErrorJsonResultException ex) { //实际返回的信息(错误信息) Assert.AreEqual(ex.JsonResult.errcode, ReturnCode_Work.不合法的corpid); } } [TestMethod] public void GetCallBackIpTest() { var accessToken = AccessTokenContainer.GetToken(_corpId, _corpSecret); var result = CommonApi.GetCallBackIp(accessToken); Assert.IsNotNull(result); Assert.IsTrue(result.errcode == ReturnCode_Work.请求成功); } } }
{ "content_hash": "d31d5e2ee0b08f9d1f6100ed02437545", "timestamp": "", "source": "github", "line_count": 143, "max_line_length": 113, "avg_line_length": 30.062937062937063, "alnum_prop": 0.5459409164922074, "repo_name": "JeffreySu/WeiXinMPSDK", "id": "4fd5f8178cb4a603f3c676ec584dddcf2c19b853", "size": "5271", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Senparc.Weixin.Work/Senparc.Weixin.Work.Test/CommonApis/CommonApiTest.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "7980825" }, { "name": "HTML", "bytes": "560" }, { "name": "JavaScript", "bytes": "214247" } ], "symlink_target": "" }
#ifndef RANDOMSEQUENCEGENERATOR_H_ #define RANDOMSEQUENCEGENERATOR_H_ #include "generator/InvalidRecordException.h" #include "generator/AbstractSequenceGenerator.h" #include "runtime/setter/SetterChain.h" #include <Poco/AutoPtr.h> #include <Poco/BasicEvent.h> #include <Poco/PriorityEvent.h> #include <Poco/PriorityDelegate.h> #include <string> #include <vector> using namespace Poco; namespace Myriad { /** * @addtogroup generator * @{*/ // forward declarations template<class RecordType> class RandomSequenceInspector; /** * A common template class for all record generators that produce pseudo-random * record sequences. * * @author: Alexander Alexandrov <[email protected]> */ template<class RecordType> class RandomSequenceGenerator: public AbstractSequenceGenerator { public: /** * The RecordMeta type associated with the given \p RecordType. */ typedef typename RecordTraits<RecordType>::MetaType RecordMetaType; /** * The RecordFactory type associated with the given \p RecordType. */ typedef typename RecordTraits<RecordType>::FactoryType RecordFactoryType; /** * The SetterChain type associated with the given \p RecordType. */ typedef typename RecordTraits<RecordType>::SetterChainType RecordSetterChainType; /** * Constructor. */ RandomSequenceGenerator(const string& name, GeneratorConfig& config, NotificationCenter& notificationCenter) : AbstractSequenceGenerator(name, config, notificationCenter), _random(name) { } /** * Basic initialization logic for all random set generators. * * This method initializes a generator specific RandomStream substream as a * copy of the current GeneratorConfig::masterPRNG() and then advances the * position of the master PRNG. * * @see AbstractSequenceGenerator::initialize() */ virtual void initialize() { if (_logger.debug()) { _logger.debug(format("Initializing random set generator `%s`", name())); } _random = _config.masterPRNG(); // advance the position of the master PRNG to the next substream // this ensures that no two generators will share the same substream in // the initialization of the generator subsystem _config.masterPRNG().nextSubstream(); string s1 = format("substream cardinality is %Lu", _config.cardinality(name())); string s2 = format("generating segment [%Lu, %Lu) of %Lu", _config.genIDBegin(name()), _config.genIDEnd(name()), _config.cardinality(name())); _logger.information(format("Configured sizing for generator `%s` # %05hu of %05hu: %s, %s", name(), _config.nodeID(), _config.numberOfChunks(), s1, s2)); _logger.information(format("Substream seed for the generator `%s` set to [%s]", name(), _random.seed().toString())); } /** * Releases resources allocated by the static set generator. */ virtual void release() { if (_logger.debug()) { _logger.debug(format("Releasing random set generator `%s`", name())); } delete this; } /** * Execute common preparation logic common to all generator stages. * * @param stage The current GgeneratorStage. * @param pool A reference to the applicaiton GeneratorPool. */ virtual void prepare(Stage stage, const GeneratorPool& pool) { if (_logger.debug()) { _logger.debug(format("Preparing random set generator `%s` for stage `%s`", name(), stage.name())); } } /** * Execute stage cleanup logic common to all generator stages. * * @param stage The current GeneratorStage. */ virtual void cleanup(Stage stage) { if (_logger.debug()) { _logger.debug(format("Cleaning up random set generator `%s` after stage `%s`", name(), stage.name())); } // clear all registered tasks clearTasks(); // reset the random generator _random.resetSubstream(); } /** * Returns a reference to the underlying RandomStream. If the configure() * method of the RandomSequenceGenerator has been called, this method is * guaranteed to return a RandomStream instance that points to the first * position of the associated PRNG substream. * * @return A reference to the local RandomStream instance. */ const RandomStream& random() const { return _random; } /** * Returns the cardinality of the record sequence produced by this generator. * * @return The sequence cardinality for this generator. */ const I64u cardinality() const { return _config.cardinality(name()); } /** * Constructs and returns a new record factory for the given \p RecordType. */ virtual const RecordFactoryType recordFactory() { return RecordFactoryType(RecordMetaType(_config.enumSets())); } /** * Creates and returns an random access inspector for this record sequence. */ RandomSequenceInspector<RecordType> inspector() { return RandomSequenceInspector<RecordType> (*this); } /** * Creates a new setter chain which consumes records from the provided * RandomStream reference. * * @param opMode OperationMode for the SetterChain (sequential or random). * @param random A reference to the RandomStream consumed by the chain. */ virtual RecordSetterChainType setterChain(BaseSetterChain::OperationMode opMode, RandomStream& random) = 0; protected: /** * Private destructor (no static allocation). */ virtual ~RandomSequenceGenerator() { } /** * RandomStream generator for this generator. */ RandomStream _random; }; /** * A random-access wraper for a random record sequence. * * @author: Alexander Alexandrov <[email protected]> */ template<class RecordType> class RandomSequenceInspector { public: /** * The RandomSequenceGenerator type associated with the given \p RecordType. */ typedef typename RecordTraits<RecordType>::GeneratorType SequenceGeneratorType; /** * The SetterChain type associated with the given \p RecordType. */ typedef typename RecordTraits<RecordType>::SetterChainType RecordSetterChainType; /** * The RecordFactory type associated with the given \p RecordType. */ typedef typename RecordTraits<RecordType>::FactoryType RecordFactoryType; /** * Constructor. * * @param generator A reference to the enclosing RecordSetterChainType. */ RandomSequenceInspector(RandomSequenceGenerator<RecordType>& generator) : _generator(generator), _recordFactory(_generator.recordFactory()), _random(_generator.random()), _setterChain(_generator.setterChain(BaseSetterChain::RANDOM, _random)), _logger(Logger::get("inspector."+generator.name())) { } /** * Copy constructor. */ RandomSequenceInspector(const RandomSequenceInspector& other) : _generator(other._generator), _recordFactory(_generator.recordFactory()), _random(_generator.random()), _setterChain(_generator.setterChain(BaseSetterChain::RANDOM, _random)), _logger(other._logger) { } /** * Instantiates and returns the \p RecordType at the given \p genID * position in the random sequence. * * @throws InvalidRecordException If the record at sequence position * \p genID is not valid, i.e. if it is not defined. */ const AutoPtr<RecordType> at(const I64u genID) const { AutoPtr<RecordType> recordPtr = _recordFactory(); recordPtr->genID(genID); _setterChain(recordPtr); return recordPtr; } /** * Filter the range of valid \p genID values from an equality predicate. */ Interval<I64u> filter(const EqualityPredicate<RecordType>& predicate) { return _setterChain.filter(predicate); } /** * Get the cardinality of the accessed record sequence. */ const I64u cardinality() const { return _generator.cardinality(); } private: /** * A reference to the parent generator (needed by the copy constructor). */ RandomSequenceGenerator<RecordType>& _generator; /** * A record factory instance. */ RecordFactoryType _recordFactory; /** * A copy of the generator's random stream. */ RandomStream _random; /** * The SetterChain for this record type. */ RecordSetterChainType _setterChain; /** * Logger instance. */ Logger& _logger; }; /** * Partitioned iterator task. * * Iterates over a subsequence of records allocated to a particular partition. * * @author: Alexander Alexandrov <[email protected]> */ template<class RecordType> class PartitionedSequenceIteratorTask: public StageTask<RecordType> { public: /** * The RandomSequenceGenerator type associated with the given \p RecordType. */ typedef typename RecordTraits<RecordType>::GeneratorType SequenceGeneratorType; /** * The SetterChain type associated with the given \p RecordType. */ typedef typename RecordTraits<RecordType>::SetterChainType RecordSetterChainType; /** * The RecordFactory type associated with the given \p RecordType. */ typedef typename RecordTraits<RecordType>::FactoryType RecordFactoryType; /** * Constructor. */ PartitionedSequenceIteratorTask(RandomSequenceGenerator<RecordType>& generator, const GeneratorConfig& config, bool dryRun = false) : StageTask<RecordType> (generator.name() + "::generate_records", generator.name(), config, dryRun), _generator(generator), _recordFactory(_generator.recordFactory()), _random(generator.random()), _logger(Logger::get("task.random.default."+generator.name())) { } /** * Indicates that this StageTask is runnable. * * @return Always \p true. */ bool runnable() { return true; } /** * The run() of this runnable task. * * This method simply iterates over the allocated genID subsequence and * instantiates and writes out the \p RecordType instance at each position. */ void run() { if (_logger.debug()) { _logger.debug(format("Running stage task `%s`", this->name())); } I32u progressCounter = 0; ID first = _generator.config().genIDBegin(_generator.name()); ID current = _generator.config().genIDBegin(_generator.name()); ID last = _generator.config().genIDEnd(_generator.name()); _random.atChunk(current); RecordSetterChainType setterChain = _generator.setterChain(BaseSetterChain::SEQUENTIAL, _random); while (current < last) { AutoPtr<RecordType> recordPtr = _recordFactory(); recordPtr->genID(current); try { setterChain(recordPtr); } catch(const InvalidRecordException& e) { current = e.nextValidGenID(); _random.atChunk(current); if(progressCounter + e.invalidRangeSize() >= 1000) { progressCounter = 0; this->_progress = (current - first) / static_cast<Decimal>(last - first); } continue; } if (!this->_dryRun) { this->_out->collect(*recordPtr); } ++current; _random.nextChunk(); if(++progressCounter >= 1000) { progressCounter = 0; this->_progress = (current - first) / static_cast<Decimal>(last - first); } } // flush the output collector contents this->_out->flush(); this->_progress = 1.0; if (_logger.debug()) { _logger.debug(format("Finishing stage task `%s`", this->name())); } } protected: /** * A reference to the generator creating the stage. */ RandomSequenceGenerator<RecordType>& _generator; /** * A record factory instance. */ RecordFactoryType _recordFactory; /** * A copy of the generator's random stream. */ RandomStream _random; /** * Logger instance. */ Logger& _logger; }; /** @}*/// add to generator group } // namespace Myriad #endif /* RANDOMSEQUENCEGENERATOR_H_ */
{ "content_hash": "6afd0f0f96ed4f46b6b44cff36c9ea65", "timestamp": "", "source": "github", "line_count": 454, "max_line_length": 161, "avg_line_length": 27.920704845814978, "alnum_prop": 0.6351372672767435, "repo_name": "codeaudit/myriad-toolkit", "id": "eb84b34395371622e3228c2d83ba5c80dbd4e39b", "size": "13301", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/cpp/generator/RandomSequenceGenerator.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "5208" }, { "name": "C++", "bytes": "379576" }, { "name": "Python", "bytes": "55306" }, { "name": "Shell", "bytes": "1051" } ], "symlink_target": "" }
import React from 'react'; import PropTypes from 'prop-types'; const Navigation = ({components}) => { return ( <ul className="navigation"> { components.map( name => { return ( <li key={name}> <a href={`#${name}`}>{name}</a> </li> ); }) } </ul> ); }; Navigation.propTypes = { components: PropTypes.array.isRequired }; export default Navigation;
{ "content_hash": "376a16c6f7093326da08b36bca63f99a", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 45, "avg_line_length": 18.625, "alnum_prop": 0.5055928411633109, "repo_name": "eliaslopezgt/ps-react-eli", "id": "f3b78f26c6a7134e0fd54361004a0ac97b79d88a", "size": "447", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/docs/Navigation.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "753" }, { "name": "HTML", "bytes": "1590" }, { "name": "JavaScript", "bytes": "81569" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>MaterialAdminLTE 3 | Forgot Password (v2)</title> <!-- Google Font: Source Sans Pro --> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback"> <!-- Font Awesome --> <link rel="stylesheet" href="../../plugins/fontawesome-free/css/all.min.css"> <!-- icheck bootstrap --> <link rel="stylesheet" href="../../plugins/icheck-bootstrap/icheck-bootstrap.min.css"> <!-- Theme style --> <link rel="stylesheet" href="../../dist/css/adminlte.min.css"> <!-- Bootstrap Material Design style --> <link rel="stylesheet" href="../../dist/css/bootstrap-material-design.min.css"> </head> <body class="hold-transition login-page"> <div class="login-box"> <div class="card card-outline card-primary"> <div class="card-header text-center"> <a href="../../index2.html" class="h1"><b>Admin</b>LTE</a> </div> <div class="card-body"> <p class="login-box-msg">You forgot your password? Here you can easily retrieve a new password.</p> <form action="recover-password.html" method="post"> <div class="input-group mb-3"> <input type="email" class="form-control" placeholder="Email"> <div class="input-group-append"> <div class="input-group-text"> <span class="fas fa-envelope"></span> </div> </div> </div> <div class="row"> <div class="col-12"> <button type="submit" class="btn btn-primary btn-block">Request new password</button> </div> <!-- /.col --> </div> </form> <p class="mt-3 mb-1"> <a href="login.html">Login</a> </p> </div> <!-- /.login-card-body --> </div> </div> <!-- /.login-box --> <!-- jQuery --> <script src="../../plugins/jquery/jquery.min.js"></script> <!-- Bootstrap 4 --> <script src="../../plugins/bootstrap/js/bootstrap.bundle.min.js"></script> <!-- AdminLTE App --> <script src="../../dist/js/adminlte.js"></script> <!-- Bootstrap Material Design --> <script src="../../dist/js/popper.min.js"></script> <script src="../../dist/js/bootstrap-material-design.min.js"></script> <script>$(document).ready(function() { $('body').bootstrapMaterialDesign(); });</script> </body> </html>
{ "content_hash": "896389cfbb4f16da5034335d2955aaf8", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 122, "avg_line_length": 38.317460317460316, "alnum_prop": 0.6006628003314002, "repo_name": "DucThanhNguyen/MaterialAdminLTE", "id": "fc542cdf9e4699a0e330106da19d6c52771b12e2", "size": "2414", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "pages/examples/forgot-password-v2.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "724880" }, { "name": "HTML", "bytes": "2627922" }, { "name": "JavaScript", "bytes": "12094485" }, { "name": "SCSS", "bytes": "211672" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>动态粒子特效__符海飞个人网站</title> <!--title图标--> <link rel="shortcut icon" type="image/x-icon" href="../../../images/favicon/favicon.ico"> <!--CSS.--> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <!--画布--> <canvas class="canvas"></canvas> <!--帮助按钮--> <div class="help">?</div> <!--输入框--> <div class="ui"> <input class="ui-input" type="text"> </div> <!--帮助菜单--> <div class="overlay"> <!--帮助整体表格--> <div class="tabs"> <!--帮助选项卡--> <div class="tabs-labels"> <span class="tabs-label">Commands</span> <span class="tabs-label">Info</span> </div> <!--快捷命令框--> <div class="tabs-panels"> <ul class="tabs-panel commands"> <li class="commands-item"><span class="commands-item-title">文本输入</span><span class="commands-item-info" data-demo="Hello :)">Type anything</span><span class="commands-item-action">Demo</span></li> <li class="commands-item"><span class="commands-item-title">倒 计 时</span><span class="commands-item-info" data-demo="#countdown 10">#countdown<span class="commands-item-mode">number</span></span><span class="commands-item-action">Demo</span></li> <li class="commands-item"><span class="commands-item-title">当前时间</span><span class="commands-item-info" data-demo="#time">#time</span><span class="commands-item-action">Demo</span></li> <li class="commands-item"><span class="commands-item-title">绘制矩形</span><span class="commands-item-info" data-demo="#rectangle 30x15">#rectangle<span class="commands-item-mode">width x height</span></span><span class="commands-item-action">Demo</span></li> <li class="commands-item"><span class="commands-item-title">绘制圆形</span><span class="commands-item-info" data-demo="#circle 25">#circle<span class="commands-item-mode">diameter</span></span><span class="commands-item-action">Demo</span></li> <li class="commands-item commands-item--gap"><span class="commands-item-title">Animate</span><span class="commands-item-info" data-demo="The time is|#time|#countdown 3|#icon thumbs-up"><span class="commands-item-mode">command1</span>&nbsp;|<span class="commands-item-mode">command2</span></span> <span class="commands-item-action">Demo</span> </li> </ul> <!--信息--> <div class="tabs-panel ui-details"> <div class="ui-details-content"> <h1>Canvas粒子文字动画</h1> <h1>Shape Shifter</h1> <p> <br> 作 者 : <a href="javascript:void(0);" target="_blank"> 符 海 飞 <a/><br> 邮 箱 : <a href="mailto:[email protected]"> [email protected] </a> <br> 个人网站: <a href="http://www.fuhaifei.xyz"> www.fuhaifei.xyz </a> </p> </div> </div> </div> </div> <div style="position: absolute; bottom: 5%; left: 50%; margin: 0 0 -9px -153px; font-size: 18px; font-family: '微软雅黑';"> 更多网页效果请访问<a href="http://www.fuhaifei.xyz" target="_blank">符海飞个人网站</a>。 </div> </div> <!--JS.--> <script src="js/index.js"></script> </body> </html>
{ "content_hash": "327cd12e60368dba5cd171051900e861", "timestamp": "", "source": "github", "line_count": 66, "max_line_length": 301, "avg_line_length": 46.63636363636363, "alnum_prop": 0.6289798570500325, "repo_name": "turkey321/turkey321.github.com", "id": "0525d472947b5cf93adf1813e957f7e15158996e", "size": "3284", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "OtherPage/SpecialEffects/ShapeShifter_SE/index.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "447032" }, { "name": "HTML", "bytes": "973568" }, { "name": "JavaScript", "bytes": "3369210" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <containers xmlns="http://www.appserver.io/appserver"> <container name="combined-appserver"> <servers> <server name="http"> <virtualHosts> <virtualHost name="angular-messages.dev www.angular-messages.dev"> <params> <param name="documentRoot" type="string">webapps/angular-messages</param> </params> <rewrites> <rewrite condition="-f{OR}.*\.do.*" target="" flag="L" /> <rewrite condition="^/app/(.+)${AND}\..{1,5}{AND}!\?{OR}\..{1,5}\?" target="/.tmp/$1" flag="L" /> <rewrite condition="^/app" target="/.tmp/index.html" flag="L" /> </rewrites> </virtualHost> </virtualHosts> </server> <server name="https"> <virtualHosts> <virtualHost name="angular-messages www.angular-messages.dev"> <params> <param name="documentRoot" type="string">webapps/angular-messages</param> </params> <rewrites> <rewrite condition="-f{OR}.*\.do.*" target="" flag="L" /> <rewrite condition="^/app/(.+)${AND}\..{1,5}{AND}!\?{OR}\..{1,5}\?" target="/.tmp/$1" flag="L" /> <rewrite condition="^/app" target="/.tmp/index.html" flag="L" /> </rewrites> </virtualHost> </virtualHosts> </server> </servers> </container> </containers>
{ "content_hash": "95f59d47ec6e2c034d0ffae10a0c0694", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 125, "avg_line_length": 48.46341463414634, "alnum_prop": 0.3809763462506291, "repo_name": "FlorianHartl/angular-messages", "id": "3441de28f1fa3d8f2cf824f886b0cae5b38fee97", "size": "1987", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "META-INF/containers.xml", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "18708" }, { "name": "HTML", "bytes": "8142" }, { "name": "JavaScript", "bytes": "11168" }, { "name": "PHP", "bytes": "5932" } ], "symlink_target": "" }
package com.example.android.movies.models; import android.os.Parcel; import android.os.Parcelable; import com.example.android.movies.utilities.DateUtils; /** * Class describing a movie object */ public class Movie implements Parcelable { // id of the movie private int id; //title of the movie private String title; //original title of the movie private String originalTitle; //synopsis of the movie private String synopsis; //user rating private String userRating; //release date private String releaseDate; //poster path of the movie private String posterPathUrl; //getter method for movie poster file path public String getPosterPathUrl() { return posterPathUrl; } //getter method for id public int getId() { return id; } //getter method for title public String getTitle() { return title; } public String getOriginalTitle() { return originalTitle; } public String getSynopsis() { return synopsis; } public String getUserRating() { return userRating; } public String getReleaseDate() { return releaseDate; } //default movie constructor public Movie(int id, String title, String posterPathUrl, String originalTitle, String synopsis, String userRating, String releaseDate) { DateUtils dateUtils = new DateUtils(); this.id = id; this.title = title; this.posterPathUrl = posterPathUrl; this.originalTitle = originalTitle; this.synopsis = synopsis; this.userRating = userRating; this.releaseDate = dateUtils.getYearFromStringDate(releaseDate); } protected Movie(Parcel in) { id = in.readInt(); title = in.readString(); posterPathUrl = in.readString(); originalTitle = in.readString(); synopsis = in.readString(); userRating = in.readString(); releaseDate = in.readString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int i) { parcel.writeInt(this.id); parcel.writeString(this.title); parcel.writeString(this.posterPathUrl); parcel.writeString(this.originalTitle); parcel.writeString(this.synopsis); parcel.writeString(this.userRating); parcel.writeString(this.releaseDate); } public static final Creator<Movie> CREATOR = new Creator<Movie>() { @Override public Movie createFromParcel(Parcel in) { return new Movie(in); } @Override public Movie[] newArray(int size) { return new Movie[size]; } }; }
{ "content_hash": "163695ff1e5ed064367f70df3e04a1fa", "timestamp": "", "source": "github", "line_count": 108, "max_line_length": 140, "avg_line_length": 25.61111111111111, "alnum_prop": 0.6352133044107013, "repo_name": "PavlosIsaris/Udacity-Popular-movies-Android-App", "id": "d09ab603a9957e9c606d56317b3a6371ab14de09", "size": "2766", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/example/android/movies/models/Movie.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "80226" } ], "symlink_target": "" }
**springboot-jetty-undertow-demo**: This module is a basic SpringBoot web application demonstrating how to use Jetty or Undertow Servlet containers instead of default Tomcat container. #### How to run? Cuurently spring-boot-starter-undertow is configured to use Undertow container. springboot-jetty-undertow-demo> mvn spring-boot:run If you want to use **Jetty**, uncomment **spring-boot-starter-jetty** and comment out **spring-boot-starter-undertow** starter in pom.xml. Go to http://localhost:8080/
{ "content_hash": "2837396e66170db2b84c62d357938895", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 184, "avg_line_length": 46, "alnum_prop": 0.782608695652174, "repo_name": "sivaprasadreddy/springboot-learn-by-example", "id": "ea4efa9ab41c8ca21cb95a8152fd2e86cab2b3dc", "size": "591", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "chapter-11/springboot-jetty-undertow-demo/README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "420325" }, { "name": "HTML", "bytes": "30297" }, { "name": "Java", "bytes": "182481" }, { "name": "JavaScript", "bytes": "12024" } ], "symlink_target": "" }
using System.Reflection; using System.Resources; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PluralSight Downloader")] [assembly: AssemblyDescription("Download PluralSight Videos")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("CodeBlueDev")] [assembly: AssemblyProduct("PluralSight Downloader")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("71a13431-bade-448f-87bf-42c9257c4490")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguage("en")]
{ "content_hash": "f0d09064d662ac21c5e2ab5f232ee438", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 84, "avg_line_length": 40.054054054054056, "alnum_prop": 0.752361673414305, "repo_name": "CodeBlueDev/PluralSightDownloader", "id": "eb6dd089ec9f9bb2dfbc5f5f6bedf621fee284cb", "size": "1485", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/CodeBlueDev.PluralSightDownloader.WinForms/Properties/AssemblyInfo.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C#", "bytes": "57579" } ], "symlink_target": "" }
layout: post title: Self Host a Wiki or Knowledge Base for Your Team author: Sasank Chilamkurthy --- How is your startup sharing knowledge with the rest of your team? We've been using slack's `#general` or `#random` channels to make announcements. We regularly post documents and PPTs in slack channels so that they can be used by other people. We have a channel called `#setup` to post all IT related information like how to login to VPN etc. But after a few weeks, these docs/notes become super hard to find. As good as slack's search is, you have to precisely know what you're looking for. What we needed was a centralized knowledge base website - something like [Confluence](https://www.atlassian.com/software/confluence) But Confluence is clunky and slow, and not cheap ($5/user). We experimented with [TiddlyWiki](https://tiddlywiki.com/). It calls itself 'a non-linear personal web notebook'. It's an opensource software which you can host on your servers or AWS. But its non linear organization makes it super unintuitive and confusing. ## Why Outline? Then, I found [outline](https://www.getoutline.com/)! Outline is similar to TiddlyWiki in that it's opensource and free to self-host. Its UI is a great balance between simplicity of plain text notes and feature creep of Confluence. Login to outline is through your slack - so one less password to remember (or save). You can create private notebooks for a team or just for yourself. You can create a public link of a note so that you can share it with people outside your team - say via email. <span class="marginnote"> Outline has great UI </span> <img src='https://www.getoutline.com/images/screenshot.png'> Best part of all of this is that *data doesn't leave your servers* if you self-host it! We already have a server lying around on AWS to host our own [python package server, pypi](https://en.wikipedia.org/wiki/Python_Package_Index). Since neither hosting pypi nor hosting outline are particularly intensive, we've hosted outline on this machine as `wiki.qure.ai`. ## Install Outline Unfortunately, documentation for self-hosting outline is limited. There's no robust docker-compose avaialable that you can use to directly create your server. In the rest of this post, I'll show you how to host in your laptop or server. Before starting, make sure to install [docker](https://docs.docker.com/get-docker/) and [docker-compose](https://docs.docker.com/compose/install/). ``` git clone https://github.com/chsasank/outline-wiki-docker-compose.git cd outline-wiki-docker-compose make install ``` <span class="marginnote"> make install </span> <img src='/assets/images/outline/make_install.png'> Follow the instructions. You'll have to create a slack app. <span class="marginnote"> Slack app </span> <img style="max-width: 75%;" src='/assets/images/outline/slack_app.png'> If you want to install HTTPS: ```bash make https ``` Run the server: ```bash make start ```
{ "content_hash": "13d2b4613128c696ab6756bfbe86a5ac", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 493, "avg_line_length": 50.11864406779661, "alnum_prop": 0.7632735880960433, "repo_name": "chsasank/chsasank.github.io", "id": "1bf7031a294e085e82d99b218a02ab22d2527440", "size": "2961", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_posts/tech/2020-06-12-outline-self-hosted-wiki.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "16210" }, { "name": "HTML", "bytes": "10469" }, { "name": "JavaScript", "bytes": "1128" }, { "name": "Ruby", "bytes": "143" }, { "name": "TeX", "bytes": "50411" } ], "symlink_target": "" }
module.exports = function (options) { var seneca = this; var plugin = "gcm"; /* |-------------------------------------------------------------------------- | Dependencies |-------------------------------------------------------------------------- */ var gcm = require("node-gcm"); var Validator = new (require("./validator"))(); /* |-------------------------------------------------------------------------- | Kue |-------------------------------------------------------------------------- */ if (options.USE_KUE) { var queue = require("kue").createQueue(); queue.process("chrome:multicast", options.MAX_CONCURRENT_JOBS, function (job, done) { var args = job.data.args; pushChromeMulticast(args, function (err, result) { done(err, result); }); }); queue.process("android", options.MAX_CONCURRENT_JOBS, function (job, done) { var args = job.data.args; pushAndroid(args, function (err, result) { done(err, result); }); }); } /* |-------------------------------------------------------------------------- | Chrome multicast |-------------------------------------------------------------------------- */ function pushChromeMulticast(args, callback) { Validator.validateChromeMulticast(args, function (err, data) { if (err) return callback(err, null); var message = new gcm.Message(); var sender = new gcm.Sender(args.config.gcm.apiKey); sender.sendNoRetry(message, { registrationTokens: args.tokens }, function (err, response) { if (err) callback(err, null); else callback(null, { result: response }); }); }); } seneca.add({ role: plugin, cmd: "chrome:multicast" }, function (args, callback) { if (options.USE_KUE) { queue.create("chrome:multicast", { title: "Chrome multicast", args: args }).attempts(10).removeOnComplete(false).save(); callback(null, { result: "Processing..." }) } else { pushChromeMulticast(args, callback); } }); /* |-------------------------------------------------------------------------- | Android |-------------------------------------------------------------------------- */ function pushAndroid(args, callback) { Validator.validateAndroid(args, function (err, data) { if (err) return callback(err, null); var message = new gcm.Message(args.params); var sender = new gcm.Sender(args.config.gcm.apiKey); sender.sendNoRetry(message, { registrationTokens: args.tokens }, function (err, response) { if (err) callback(err, null); else callback(null, { result: response }); }); }); } seneca.add({ role: plugin, cmd: "android" }, function (args, callback) { if (options.USE_KUE) { queue.create("android", { title: "Android", args: args }).attempts(10).removeOnComplete(false).save(); callback(null, { result: "Processing..." }) } else { pushAndroid(args, callback); } }); return { name: plugin } }
{ "content_hash": "501e470ca9fb55c8bd56306cb91af005", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 103, "avg_line_length": 32.38317757009346, "alnum_prop": 0.42395382395382397, "repo_name": "Xzya/PushMicroservice", "id": "73c48801113f36ee6afb951b1c0b97cb0686e983", "size": "3465", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "services/gcm.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "23889" } ], "symlink_target": "" }
package com.babylove.www.spring.ioc.demo1.dao; public interface InjectionDao { public void save(String args); }
{ "content_hash": "26f14daeeedf6b726a65f8b84e5e564a", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 46, "avg_line_length": 19.333333333333332, "alnum_prop": 0.7672413793103449, "repo_name": "l81893521/spring-example", "id": "a90009b591f2afaddfebcd1bf5300ddf5dc6457b", "size": "116", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/babylove/www/spring/ioc/demo1/dao/InjectionDao.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "39700" }, { "name": "Java", "bytes": "71719" } ], "symlink_target": "" }
require 'chef/provisioning/aws_driver/aws_provider' require 'retryable' class Chef::Provider::AwsInternetGateway < Chef::Provisioning::AWSDriver::AWSProvider include Chef::Provisioning::AWSDriver::TaggingStrategy::EC2ConvergeTags provides :aws_internet_gateway def action_detach internet_gateway = Chef::Resource::AwsInternetGateway.get_aws_object(new_resource.name, resource: new_resource) detach_vpc(internet_gateway) end protected def create_aws_object desired_vpc = Chef::Resource::AwsVpc.get_aws_object(new_resource.vpc, resource: new_resource) if new_resource.vpc converge_by "create internet gateway #{new_resource.name} in region #{region}" do internet_gateway = new_resource.driver.ec2.internet_gateways.create retry_with_backoff(AWS::EC2::Errors::InvalidInternetGatewayID::NotFound) do internet_gateway.tags['Name'] = new_resource.name end if desired_vpc attach_vpc(desired_vpc, internet_gateway) end internet_gateway end end def update_aws_object(internet_gateway) current_vpc = internet_gateway.vpc if new_resource.vpc desired_vpc = Chef::Resource::AwsVpc.get_aws_object(new_resource.vpc, resource: new_resource) if current_vpc != desired_vpc attach_vpc(desired_vpc, internet_gateway) end end end def destroy_aws_object(internet_gateway) converge_by "delete internet gateway #{new_resource.name} in region #{region}" do detach_vpc(internet_gateway) internet_gateway.delete end end private def attach_vpc(vpc, desired_gateway) if vpc.internet_gateway && vpc.internet_gateway != desired_gateway Cheffish.inline_resource(self, action) do aws_vpc vpc.id do cidr_block vpc.cidr_block internet_gateway false end end end converge_by "attach vpc #{vpc.id} to #{desired_gateway.id}" do desired_gateway.vpc = vpc end end def detach_vpc(internet_gateway) if internet_gateway.vpc converge_by "detach vpc #{internet_gateway.vpc.id} from internet gateway #{internet_gateway.id}" do internet_gateway.detach(internet_gateway.vpc) end end end end
{ "content_hash": "f75dc2faa15a98740b89b2abbd902b01", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 117, "avg_line_length": 29.56, "alnum_prop": 0.699594046008119, "repo_name": "Fodoj/chef-provisioning-aws", "id": "56fb9abe4d10b722a2d025fa6346bfdc022617d8", "size": "2217", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "lib/chef/provider/aws_internet_gateway.rb", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Ruby", "bytes": "401894" } ], "symlink_target": "" }
/** * 1. Start the server * 2. Launch Browser-Sync */ var gulp = require('gulp'); var browserSync = require('browser-sync').create(), config = require('../config')(), plg = require('gulp-load-plugins')({ pattern: ['gulp-*', 'gulp.*'], replaceString: /^gulp(-|\.)/, camelize: true, lazy: true}); var reload = browserSync.reload; gulp.task('runapp', function() { return plg.nodemon({ script: 'src/server/app.js', ext: 'js', execMap: { 'js': 'babel-node --optional strict' }, ignore: [ '*.paw', '.tmp/**', '.vagrant/**', 'src/client/**', 'src/server/logs/**', '.git/**', 'node_modules/**', 'bower_components/**', '.DS_Store', '.sass-cache'], verbose: true }) .on('restart', function () { plg.notify('restarted'); setTimeout(browserSync.reload, 500); }); }); // browserSync.use(bsyncSPA({ // selector: '[ng-app]'// Only needed for angular apps // })); gulp.task('serve', ['sass', /*'scripts:watch', */'inject', 'runapp'], function() { browserSync.init({ proxy: { target: '127.0.0.1:9000', // express' port middleware: function (req, res, next) { console.log(req.url); next(); } }, port: 3000, // browser-sync's port browser: ['google chrome'], files: [ config.client + '**/*', config.temp + '**/*.css', config.sass ], open: false, ui: false, injectChanges: true, logFileChanges: true, logLevel: 'debug', logPrefix: 'topshelf', notify: true, ghost: false, xip: false }); console.log('Starting BrowserSync on port 3000'); gulp.watch(config.sass, ['sass'], reload); gulp.watch(config.ngApp, ['lint'], reload); gulp.watch(config.index, ['inject'], reload); gulp.watch(config.html, ['partials'], reload); });
{ "content_hash": "0550420d83c4d920001d46043c8b199c", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 82, "avg_line_length": 25.602564102564102, "alnum_prop": 0.513770655983976, "repo_name": "strues/TopShelf", "id": "16d860a64604974e1232a44f97692f8e74f2f048", "size": "1997", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gulp/tasks/serve.js", "mode": "33261", "license": "mit", "language": [ { "name": "CSS", "bytes": "176022" }, { "name": "HTML", "bytes": "75382" }, { "name": "JavaScript", "bytes": "216837" } ], "symlink_target": "" }
import { module, test } from 'qunit'; import { setupRenderingTest } from 'ember-qunit'; import { render, fillIn, waitUntil, find } from '@ember/test-helpers'; import hbs from 'htmlbars-inline-precompile'; import { clickTrigger, selectChoose } from 'ember-power-select/test-support/helpers'; module('Integration | Component | paper-select', function(hooks) { setupRenderingTest(hooks); hooks.beforeEach(function() { this.set('sizes', ['small (12-inch)', 'medium (14-inch)', 'large (16-inch)', 'insane (42-inch)']); }); test('opens on click', async function(assert) { await render(hbs`{{#paper-select disabled=disableSelect placeholder="Size" options=sizes selected=selectedSize onChange=(action (mut selectedSize)) as |size| }} {{size}} {{/paper-select}}`); await clickTrigger('md-input-container'); assert.dom('md-select-menu').exists(); }); test('backdrop removed if select closed', async function(assert) { await render(hbs`{{#paper-select disabled=disableSelect placeholder="Size" options=sizes selected=selectedSize onChange=(action (mut selectedSize)) as |size| }} {{size}} {{/paper-select}}`); assert.dom('md-backdrop').doesNotExist(); await clickTrigger('md-input-container'); assert.dom('md-backdrop').exists(); await clickTrigger('md-input-container'); await waitUntil(() => !find('md-backdrop'), { timeout: 2000 }); assert.dom('md-backdrop').doesNotExist(); }); test('it can select an option', async function(assert) { await render(hbs`{{#paper-select disabled=disableSelect placeholder="Size" options=sizes selected=selectedSize onChange=(action (mut selectedSize)) as |size| }} {{size}} {{/paper-select}}`); await clickTrigger('md-input-container'); await selectChoose('md-input-container', 'large (16-inch)'); assert.equal(this.selectedSize, 'large (16-inch)'); }); test('header is rendered above content', async function(assert) { await render(hbs`{{#paper-select disabled=disableSelect placeholder="Size" options=sizes searchEnabled=true selected=selectedSize onChange=(action (mut selectedSize)) as |size| }} {{size}} {{/paper-select}}`); await clickTrigger('md-input-container'); assert.dom('md-select-menu > md-select-header').exists(); assert.dom('md-select-menu > md-content').exists(); }); test('it can search a value', async function(assert) { await render(hbs`{{#paper-select disabled=disableSelect placeholder="Size" options=sizes searchEnabled=true selected=selectedSize onChange=(action (mut selectedSize)) as |size| }} {{size}} {{/paper-select}}`); await clickTrigger('md-input-container'); assert.dom('md-select-menu md-option').exists({ count: 4 }); await fillIn('md-select-header input', 'small'); assert.dom('md-select-menu md-option').exists({ count: 1 }); assert.dom('md-select-menu md-option').hasText('small (12-inch)'); }); test('it shows search message before entering search string', async function(assert) { this.search = (value) => this.sizes.filter((size) => size.includes(value)); await render(hbs`{{#paper-select search=search searchEnabled=true selected=selectedSize onChange=(action (mut selectedSize)) as |size| }} {{size}} {{/paper-select}}`); await clickTrigger('md-input-container'); assert.dom('md-select-menu > md-content').exists(); assert.dom('md-select-menu > md-content').hasText('Type to search'); }); });
{ "content_hash": "8f6d5bdf54fcbe2a9ba225487341fd1d", "timestamp": "", "source": "github", "line_count": 135, "max_line_length": 102, "avg_line_length": 27.748148148148147, "alnum_prop": 0.6348104644954619, "repo_name": "xomaczar/ember-paper", "id": "82b7e871e39e9752fd60767185056d4fdb8fa8e6", "size": "3746", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tests/integration/components/paper-select-test.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "41644" }, { "name": "HTML", "bytes": "215410" }, { "name": "JavaScript", "bytes": "458959" }, { "name": "Shell", "bytes": "28" } ], "symlink_target": "" }
using Autofac; namespace Crane.Core.Tests.TestUtilities { public static class ModuleExtension { public static IContainer BuildContainerWithModule(this Module module) { var builder = new ContainerBuilder(); builder.RegisterModule(module); var container = builder.Build(); return container; } } }
{ "content_hash": "90193b7d02524280a5c21cc984b771cb", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 77, "avg_line_length": 25.333333333333332, "alnum_prop": 0.6236842105263158, "repo_name": "ewilde/crane", "id": "bf1d65aae240a342df75e08918afdb1e62874622", "size": "382", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "src/Crane.Core.Tests/TestUtilities/ModuleExtension.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "1123" }, { "name": "C#", "bytes": "306432" }, { "name": "PowerShell", "bytes": "117996" }, { "name": "Shell", "bytes": "376" } ], "symlink_target": "" }
<div className="button-Primary"> <i className="icon icon-Arrow-Right" /> </div>;
{ "content_hash": "5d647a7958def4c66fa2d99c10f13d75", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 43, "avg_line_length": 28.333333333333332, "alnum_prop": 0.6588235294117647, "repo_name": "trevonerd/babel-plugin-react-jsx-boilerplate", "id": "2320faf3562b4f7b7a04c42128a3069acd809401", "size": "85", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/fixtures/react-jsx-boilerplate/no class attributes, force uppercase/actual.js", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "JavaScript", "bytes": "730" } ], "symlink_target": "" }
function FileData_Pairs(x) { x.t("properties","managing"); x.t("properties","[characterization]"); x.t("properties","continue"); x.t("properties","defining"); x.t("properties","unique"); x.t("properties","section"); x.t("managing","sample"); x.t("[characterization]","properties"); x.t("once","click"); x.t("summary","section"); x.t("line","defining"); x.t("line","enzyme"); x.t("sample","characterizations"); x.t("cytotoxicity","enter"); x.t("listed","point"); x.t("induction","enter"); x.t("new","entry"); x.t("choice","transfection"); x.t("entry","enclosed"); x.t("entry","brackets"); x.t("entry","temporary"); x.t("entry","persisted"); x.t("characterization","defining"); x.t("characterization","enter"); x.t("enclosed","new"); x.t("name","choice"); x.t("brackets","indicating"); x.t("brackets","disappear"); x.t("continue","process"); x.t("fields","click"); x.t("defining","[characterization]"); x.t("defining","vitro"); x.t("cell","line"); x.t("point","entry"); x.t("select","following"); x.t("enzyme","induction"); x.t("transfection","enter"); x.t("indicating","entry"); x.t("define","properties"); x.t("unique","characterization"); x.t("section","define"); x.t("section","opens"); x.t("opens","select"); x.t("enter","name"); x.t("enter","information"); x.t("enter","appropriate"); x.t("enter","alternative"); x.t("click","submit"); x.t("click","[other]"); x.t("disappear","cytotoxicity"); x.t("temporary","once"); x.t("process","described"); x.t("characterizations","summary"); x.t("characterizations","adding"); x.t("information","following"); x.t("persisted","brackets"); x.t("appropriate","cell"); x.t("submit","update"); x.t("selections","listed"); x.t("described","adding"); x.t("vitro","[characterization]"); x.t("vitro","characterization"); x.t("following","fields"); x.t("following","characterizations"); x.t("adding","vitro"); x.t("alternative","selections"); x.t("[other]","enter"); x.t("update","entry"); }
{ "content_hash": "6f16e57233aad740b30b05b749ba01fe", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 39, "avg_line_length": 28.12676056338028, "alnum_prop": 0.613420130195293, "repo_name": "NCIP/cananolab", "id": "7964b5a753a97bf594ccc71342a972b3a91677b6", "size": "1997", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/webappOnlineHelp/wwhdata/js/search/pairs/pair72.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Batchfile", "bytes": "115" }, { "name": "CSS", "bytes": "105762" }, { "name": "HTML", "bytes": "535251" }, { "name": "Java", "bytes": "2955188" }, { "name": "JavaScript", "bytes": "924057" }, { "name": "PLSQL", "bytes": "9322" } ], "symlink_target": "" }
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <groupId>org.apache.bigtop.itest</groupId> <artifactId>smoke-tests</artifactId> <version>0.8.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.bigtop.itest</groupId> <artifactId>hcatalog-smoke-execution</artifactId> <version>0.8.0-SNAPSHOT</version> <name>HCatalog smoke test execution</name> <properties> <org.apache.maven-dependency-plugin.groupId>org.apache.bigtop.itest</org.apache.maven-dependency-plugin.groupId> <org.apache.maven-dependency-plugin.artifactId>hcatalog-smoke</org.apache.maven-dependency-plugin.artifactId> <org.apache.maven-dependency-plugin.version>${hcatalog-smoke.version}</org.apache.maven-dependency-plugin.version> <org.apache.maven-dependency-plugin.type>jar</org.apache.maven-dependency-plugin.type> </properties> <dependencies> <dependency> <groupId>org.apache.bigtop.itest</groupId> <artifactId>hcatalog-smoke</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>1.0</version> <executions> <execution> <id>enforce-property</id> <goals> <goal>enforce</goal> </goals> <configuration> <fail>true</fail> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.11</version> <configuration> <forkMode>always</forkMode> </configuration> </plugin> </plugins> </build> </project>
{ "content_hash": "c3588b53fd47f5cd1bbfb2030206c5fb", "timestamp": "", "source": "github", "line_count": 83, "max_line_length": 118, "avg_line_length": 36.3855421686747, "alnum_prop": 0.678476821192053, "repo_name": "mattfenwick/bigtop", "id": "d413cfb84cf3738a62197441c4e4219da194b959", "size": "3020", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "bigtop-tests/test-execution/smokes/hcatalog/pom.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "4822" }, { "name": "Erlang", "bytes": "84" }, { "name": "Groovy", "bytes": "460989" }, { "name": "Java", "bytes": "279498" }, { "name": "Perl", "bytes": "3303" }, { "name": "Puppet", "bytes": "108717" }, { "name": "Ruby", "bytes": "11529" }, { "name": "SQL", "bytes": "12038" }, { "name": "Scala", "bytes": "489" }, { "name": "Shell", "bytes": "190090" }, { "name": "XSLT", "bytes": "2495" } ], "symlink_target": "" }
<?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * Functions for the replication GUI * * @package PhpMyAdmin */ namespace PhpMyAdmin; use PhpMyAdmin\Core; use PhpMyAdmin\Message; use PhpMyAdmin\Replication; use PhpMyAdmin\Response; use PhpMyAdmin\Url; use PhpMyAdmin\Util; /** * PhpMyAdmin\ReplicationGui class * * @package PhpMyAdmin */ class ReplicationGui { /** * returns HTML for error message * * @return String HTML code */ public static function getHtmlForErrorMessage() { $html = ''; if (isset($_SESSION['replication']['sr_action_status']) && isset($_SESSION['replication']['sr_action_info']) ) { if ($_SESSION['replication']['sr_action_status'] == 'error') { $error_message = $_SESSION['replication']['sr_action_info']; $html .= Message::error($error_message)->getDisplay(); $_SESSION['replication']['sr_action_status'] = 'unknown'; } elseif ($_SESSION['replication']['sr_action_status'] == 'success') { $success_message = $_SESSION['replication']['sr_action_info']; $html .= Message::success($success_message)->getDisplay(); $_SESSION['replication']['sr_action_status'] = 'unknown'; } } return $html; } /** * returns HTML for master replication * * @return String HTML code */ public static function getHtmlForMasterReplication() { $html = ''; if (! isset($_POST['repl_clear_scr'])) { $html .= '<fieldset>'; $html .= '<legend>' . __('Master replication') . '</legend>'; $html .= __('This server is configured as master in a replication process.'); $html .= '<ul>'; $html .= ' <li><a href="#master_status_href" id="master_status_href">'; $html .= __('Show master status') . '</a>'; $html .= self::getHtmlForReplicationStatusTable('master', true, false); $html .= ' </li>'; $html .= ' <li><a href="#master_slaves_href" id="master_slaves_href">'; $html .= __('Show connected slaves') . '</a>'; $html .= self::getHtmlForReplicationSlavesTable(true); $html .= ' </li>'; $_url_params = $GLOBALS['url_params']; $_url_params['mr_adduser'] = true; $_url_params['repl_clear_scr'] = true; $html .= ' <li><a href="server_replication.php" data-post="'; $html .= Url::getCommon($_url_params, '') . '" id="master_addslaveuser_href">'; $html .= __('Add slave replication user') . '</a></li>'; } // Display 'Add replication slave user' form if (isset($_POST['mr_adduser'])) { $html .= self::getHtmlForReplicationMasterAddSlaveUser(); } elseif (! isset($_POST['repl_clear_scr'])) { $html .= "</ul>"; $html .= "</fieldset>"; } return $html; } /** * returns HTML for master replication configuration * * @return String HTML code */ public static function getHtmlForMasterConfiguration() { $html = '<fieldset>'; $html .= '<legend>' . __('Master configuration') . '</legend>'; $html .= __( 'This server is not configured as a master server in a ' . 'replication process. You can choose from either replicating ' . 'all databases and ignoring some of them (useful if you want to ' . 'replicate a majority of the databases) or you can choose to ignore ' . 'all databases by default and allow only certain databases to be ' . 'replicated. Please select the mode:' ) . '<br /><br />'; $html .= '<select name="db_type" id="db_type">'; $html .= '<option value="all">' . __('Replicate all databases; Ignore:'); $html .= '</option>'; $html .= '<option value="ign">' . __('Ignore all databases; Replicate:'); $html .= '</option>'; $html .= '</select>'; $html .= '<br /><br />'; $html .= __('Please select databases:') . '<br />'; $html .= self::getHtmlForReplicationDbMultibox(); $html .= '<br /><br />'; $html .= __( 'Now, add the following lines at the end of [mysqld] section' . ' in your my.cnf and please restart the MySQL server afterwards.' ) . '<br />'; $html .= '<pre id="rep"></pre>'; $html .= __( 'Once you restarted MySQL server, please click on Go button. ' . 'Afterwards, you should see a message informing you, that this server' . ' <b>is</b> configured as master.' ); $html .= '</fieldset>'; $html .= '<fieldset class="tblFooters">'; $html .= ' <form method="post" action="server_replication.php" >'; $html .= Url::getHiddenInputs('', ''); $html .= ' <input type="submit" value="' . __('Go') . '" id="goButton" />'; $html .= ' </form>'; $html .= '</fieldset>'; return $html; } /** * returns HTML for slave replication configuration * * @param bool $server_slave_status Whether it is Master or Slave * @param array $server_slave_replication Slave replication * * @return String HTML code */ public static function getHtmlForSlaveConfiguration( $server_slave_status, array $server_slave_replication ) { $html = '<fieldset>'; $html .= '<legend>' . __('Slave replication') . '</legend>'; /** * check for multi-master replication functionality */ $server_slave_multi_replication = $GLOBALS['dbi']->fetchResult( 'SHOW ALL SLAVES STATUS' ); if ($server_slave_multi_replication) { $html .= __('Master connection:'); $html .= '<form method="get" action="server_replication.php">'; $html .= Url::getHiddenInputs($GLOBALS['url_params']); $html .= ' <select name="master_connection">'; $html .= '<option value="">' . __('Default') . '</option>'; foreach ($server_slave_multi_replication as $server) { $html .= '<option' . (isset($_POST['master_connection']) && $_POST['master_connection'] == $server['Connection_name'] ? ' selected="selected"' : '') . '>' . $server['Connection_name'] . '</option>'; } $html .= '</select>'; $html .= ' <input type="submit" value="' . __('Go') . '" id="goButton" />'; $html .= '</form>'; $html .= '<br /><br />'; } if ($server_slave_status) { $html .= '<div id="slave_configuration_gui">'; $_url_params = $GLOBALS['url_params']; $_url_params['sr_take_action'] = true; $_url_params['sr_slave_server_control'] = true; if ($server_slave_replication[0]['Slave_IO_Running'] == 'No') { $_url_params['sr_slave_action'] = 'start'; } else { $_url_params['sr_slave_action'] = 'stop'; } $_url_params['sr_slave_control_parm'] = 'IO_THREAD'; $slave_control_io_link = Url::getCommon($_url_params, ''); if ($server_slave_replication[0]['Slave_SQL_Running'] == 'No') { $_url_params['sr_slave_action'] = 'start'; } else { $_url_params['sr_slave_action'] = 'stop'; } $_url_params['sr_slave_control_parm'] = 'SQL_THREAD'; $slave_control_sql_link = Url::getCommon($_url_params, ''); if ($server_slave_replication[0]['Slave_IO_Running'] == 'No' || $server_slave_replication[0]['Slave_SQL_Running'] == 'No' ) { $_url_params['sr_slave_action'] = 'start'; } else { $_url_params['sr_slave_action'] = 'stop'; } $_url_params['sr_slave_control_parm'] = null; $slave_control_full_link = Url::getCommon($_url_params, ''); $_url_params['sr_slave_action'] = 'reset'; $slave_control_reset_link = Url::getCommon($_url_params, ''); $_url_params = $GLOBALS['url_params']; $_url_params['sr_take_action'] = true; $_url_params['sr_slave_skip_error'] = true; $slave_skip_error_link = Url::getCommon($_url_params, ''); if ($server_slave_replication[0]['Slave_SQL_Running'] == 'No') { $html .= Message::error( __('Slave SQL Thread not running!') )->getDisplay(); } if ($server_slave_replication[0]['Slave_IO_Running'] == 'No') { $html .= Message::error( __('Slave IO Thread not running!') )->getDisplay(); } $_url_params = $GLOBALS['url_params']; $_url_params['sl_configure'] = true; $_url_params['repl_clear_scr'] = true; $reconfiguremaster_link = Url::getCommon($_url_params, ''); $html .= __( 'Server is configured as slave in a replication process. Would you ' . 'like to:' ); $html .= '<br />'; $html .= '<ul>'; $html .= ' <li><a href="#slave_status_href" id="slave_status_href">'; $html .= __('See slave status table') . '</a>'; $html .= self::getHtmlForReplicationStatusTable('slave', true, false); $html .= ' </li>'; $html .= ' <li><a href="#slave_control_href" id="slave_control_href">'; $html .= __('Control slave:') . '</a>'; $html .= ' <div id="slave_control_gui" class="hide">'; $html .= ' <ul>'; $html .= ' <li><a href="server_replication.php" data-post="' . $slave_control_full_link . '">'; $html .= (($server_slave_replication[0]['Slave_IO_Running'] == 'No' || $server_slave_replication[0]['Slave_SQL_Running'] == 'No') ? __('Full start') : __('Full stop')) . ' </a></li>'; $html .= ' <li><a class="ajax" id="reset_slave"' . ' href="server_replication.php" data-post="' . $slave_control_reset_link . '">'; $html .= __('Reset slave') . '</a></li>'; if ($server_slave_replication[0]['Slave_SQL_Running'] == 'No') { $html .= ' <li><a href="server_replication.php" data-post="' . $slave_control_sql_link . '">'; $html .= __('Start SQL Thread only') . '</a></li>'; } else { $html .= ' <li><a href="server_replication.php" data-post="' . $slave_control_sql_link . '">'; $html .= __('Stop SQL Thread only') . '</a></li>'; } if ($server_slave_replication[0]['Slave_IO_Running'] == 'No') { $html .= ' <li><a href="server_replication.php" data-post="' . $slave_control_io_link . '">'; $html .= __('Start IO Thread only') . '</a></li>'; } else { $html .= ' <li><a href="server_replication.php" data-post="' . $slave_control_io_link . '">'; $html .= __('Stop IO Thread only') . '</a></li>'; } $html .= ' </ul>'; $html .= ' </div>'; $html .= ' </li>'; $html .= ' <li>'; $html .= self::getHtmlForSlaveErrorManagement($slave_skip_error_link); $html .= ' </li>'; $html .= ' <li><a href="server_replication.php" data-post="' . $reconfiguremaster_link . '">'; $html .= __('Change or reconfigure master server') . '</a></li>'; $html .= '</ul>'; $html .= '</div>'; } elseif (! isset($_POST['sl_configure'])) { $_url_params = $GLOBALS['url_params']; $_url_params['sl_configure'] = true; $_url_params['repl_clear_scr'] = true; $html .= sprintf( __( 'This server is not configured as slave in a replication process. ' . 'Would you like to %sconfigure%s it?' ), '<a href="server_replication.php" data-post="' . Url::getCommon($_url_params, '') . '">', '</a>' ); } $html .= '</fieldset>'; return $html; } /** * returns HTML for Slave Error Management * * @param String $slave_skip_error_link error link * * @return String HTML code */ public static function getHtmlForSlaveErrorManagement($slave_skip_error_link) { $html = '<a href="#slave_errormanagement_href" ' . 'id="slave_errormanagement_href">'; $html .= __('Error management:') . '</a>'; $html .= ' <div id="slave_errormanagement_gui" class="hide">'; $html .= Message::error( __('Skipping errors might lead into unsynchronized master and slave!') )->getDisplay(); $html .= ' <ul>'; $html .= ' <li><a href="server_replication.php" data-post="' . $slave_skip_error_link . '">'; $html .= __('Skip current error') . '</a></li>'; $html .= ' <li>'; $html .= ' <form method="post" action="server_replication.php">'; $html .= Url::getHiddenInputs('', ''); $html .= sprintf( __('Skip next %s errors.'), '<input type="text" name="sr_skip_errors_count" value="1" ' . 'class = "repl_gui_skip_err_cnt" />' ); $html .= ' <input type="submit" name="sr_slave_skip_error" '; $html .= 'value="' . __('Go') . '" />'; $html .= ' <input type="hidden" name="sr_take_action" value="1" />'; $html .= ' </form></li>'; $html .= ' </ul>'; $html .= ' </div>'; return $html; } /** * returns HTML for not configure for a server replication * * @return String HTML code */ public static function getHtmlForNotServerReplication() { $_url_params = $GLOBALS['url_params']; $_url_params['mr_configure'] = true; $html = '<fieldset>'; $html .= '<legend>' . __('Master replication') . '</legend>'; $html .= sprintf( __( 'This server is not configured as master in a replication process. ' . 'Would you like to %sconfigure%s it?' ), '<a href="server_replication.php" data-post="' . Url::getCommon($_url_params, '') . '">', '</a>' ); $html .= '</fieldset>'; return $html; } /** * returns HTML code for selecting databases * * @return String HTML code */ public static function getHtmlForReplicationDbMultibox() { $multi_values = ''; $multi_values .= '<select name="db_select[]" ' . 'size="6" multiple="multiple" id="db_select" class="width96">'; foreach ($GLOBALS['dblist']->databases as $current_db) { if ($GLOBALS['dbi']->isSystemSchema($current_db)) { continue; } $current_db = htmlspecialchars($current_db); $multi_values .= ' <option value="' . $current_db . '" '; $multi_values .= '>'; $multi_values .= $current_db . '</option>'; } // end while $multi_values .= '</select><br />'; $multi_values .= '<a href="#" id="db_select_href">' . __('Select all') . '</a>'; $multi_values .= '&nbsp;/&nbsp;'; $multi_values .= '<a href="#" id="db_reset_href">' . __('Unselect all') . '</a>'; return $multi_values; } /** * returns HTML for changing master * * @param String $submitname - submit button name * * @return String HTML code */ public static function getHtmlForReplicationChangeMaster($submitname) { $html = ''; list($username_length, $hostname_length) = self::getUsernameHostnameLength(); $html .= '<form method="post" action="server_replication.php">'; $html .= Url::getHiddenInputs('', ''); $html .= ' <fieldset id="fieldset_add_user_login">'; $html .= ' <legend>' . __('Slave configuration'); $html .= ' - ' . __('Change or reconfigure master server') . '</legend>'; $html .= __( 'Make sure you have a unique server-id in your configuration file (my.cnf). ' . 'If not, please add the following line into [mysqld] section:' ); $html .= '<br />'; $html .= '<pre>server-id=' . time() . '</pre>'; $html .= self::getHtmlForAddUserInputDiv( array('text'=>__('User name:'), 'for'=>"text_username"), array( 'type'=>'text', 'name'=>'username', 'id'=>'text_username', 'maxlength'=>$username_length, 'title'=>__('User name'), 'required'=>'required' ) ); $html .= self::getHtmlForAddUserInputDiv( array('text'=>__('Password:'), 'for'=>"text_pma_pw"), array( 'type'=>'password', 'name'=>'pma_pw', 'id'=>'text_pma_pw', 'title'=>__('Password'), 'required'=>'required' ) ); $html .= self::getHtmlForAddUserInputDiv( array('text'=>__('Host:'), 'for'=>"text_hostname"), array( 'type'=>'text', 'name'=>'hostname', 'id'=>'text_hostname', 'maxlength'=>$hostname_length, 'value'=>'', 'required'=>'required' ) ); $html .= self::getHtmlForAddUserInputDiv( array('text'=>__('Port:'), 'for'=>"text_port"), array( 'type'=>'number', 'name'=>'text_port', 'id'=>'text_port', 'maxlength'=>6, 'value'=>'3306', 'required'=>'required' ) ); $html .= ' </fieldset>'; $html .= ' <fieldset id="fieldset_user_privtable_footer" class="tblFooters">'; $html .= ' <input type="hidden" name="sr_take_action" value="true" />'; $html .= ' <input type="hidden" name="' . $submitname . '" value="1" />'; $html .= ' <input type="submit" id="confslave_submit" value="'; $html .= __('Go') . '" />'; $html .= ' </fieldset>'; $html .= '</form>'; return $html; } /** * returns HTML code for Add user input div * * @param array $label_array label tag elements * @param array $input_array input tag elements * * @return String HTML code */ public static function getHtmlForAddUserInputDiv(array $label_array, array $input_array) { $html = ' <div class="item">'; $html .= ' <label for="' . $label_array['for'] . '">'; $html .= $label_array['text'] . '</label>'; $html .= ' <input '; foreach ($input_array as $key=>$value) { $html .= ' ' . $key . '="' . $value . '" '; } $html .= ' />'; $html .= ' </div>'; return $html; } /** * This function returns html code for table with replication status. * * @param string $type either master or slave * @param boolean $hidden if true, then default style is set to hidden, * default value false * @param boolean $title if true, then title is displayed, default true * * @return String HTML code */ public static function getHtmlForReplicationStatusTable($type, $hidden = false, $title = true) { global ${"{$type}_variables"}; global ${"{$type}_variables_alerts"}; global ${"{$type}_variables_oks"}; global ${"server_{$type}_replication"}; global ${"strReplicationStatus_{$type}"}; $html = ''; // TODO check the Masters server id? // seems to default to '1' when queried via SHOW VARIABLES , // but resulted in error on the master when slave connects // [ERROR] Error reading packet from server: Misconfigured master // - server id was not set ( server_errno=1236) // [ERROR] Got fatal error 1236: 'Misconfigured master // - server id was not set' from master when reading data from binary log // //$server_id = $GLOBALS['dbi']->fetchValue( // "SHOW VARIABLES LIKE 'server_id'", 0, 1 //); $html .= '<div id="replication_' . $type . '_section" style="'; $html .= ($hidden ? 'display: none;' : '') . '"> '; if ($title) { if ($type == 'master') { $html .= '<h4><a name="replication_' . $type . '"></a>'; $html .= __('Master status') . '</h4>'; } else { $html .= '<h4><a name="replication_' . $type . '"></a>'; $html .= __('Slave status') . '</h4>'; } } else { $html .= '<br />'; } $html .= ' <table id="server' . $type . 'replicationsummary" class="data"> '; $html .= ' <thead>'; $html .= ' <tr>'; $html .= ' <th>' . __('Variable') . '</th>'; $html .= ' <th>' . __('Value') . '</th>'; $html .= ' </tr>'; $html .= ' </thead>'; $html .= ' <tbody>'; foreach (${"{$type}_variables"} as $variable) { $serverReplicationVariable = is_array(${"server_{$type}_replication"}) && isset(${"server_{$type}_replication"}[0]) ? ${"server_{$type}_replication"}[0][$variable] : ''; $html .= ' <tr>'; $html .= ' <td class="name">'; $html .= htmlspecialchars($variable); $html .= ' </td>'; $html .= ' <td class="value">'; // TODO change to regexp or something, to allow for negative match if (isset(${"{$type}_variables_alerts"}[$variable]) && ${"{$type}_variables_alerts"}[$variable] == $serverReplicationVariable ) { $html .= '<span class="attention">'; } elseif (isset(${"{$type}_variables_oks"}[$variable]) && ${"{$type}_variables_oks"}[$variable] == $serverReplicationVariable ) { $html .= '<span class="allfine">'; } else { $html .= '<span>'; } // allow wrapping long table lists into multiple lines static $variables_wrap = array( 'Replicate_Do_DB', 'Replicate_Ignore_DB', 'Replicate_Do_Table', 'Replicate_Ignore_Table', 'Replicate_Wild_Do_Table', 'Replicate_Wild_Ignore_Table'); if (in_array($variable, $variables_wrap)) { $html .= htmlspecialchars(str_replace( ',', ', ', $serverReplicationVariable )); } else { $html .= htmlspecialchars($serverReplicationVariable); } $html .= '</span>'; $html .= ' </td>'; $html .= ' </tr>'; } $html .= ' </tbody>'; $html .= ' </table>'; $html .= ' <br />'; $html .= '</div>'; return $html; } /** * returns html code for table with slave users connected to this master * * @param boolean $hidden - if true, then default style is set to hidden, * - default value false * * @return string */ public static function getHtmlForReplicationSlavesTable($hidden = false) { $html = ''; // Fetch data $data = $GLOBALS['dbi']->fetchResult('SHOW SLAVE HOSTS', null, null); $html .= ' <br />'; $html .= ' <div id="replication_slaves_section" style="'; $html .= ($hidden ? 'display: none;' : '') . '"> '; $html .= ' <table class="data">'; $html .= ' <thead>'; $html .= ' <tr>'; $html .= ' <th>' . __('Server ID') . '</th>'; $html .= ' <th>' . __('Host') . '</th>'; $html .= ' </tr>'; $html .= ' </thead>'; $html .= ' <tbody>'; foreach ($data as $slave) { $html .= ' <tr>'; $html .= ' <td class="value">' . $slave['Server_id'] . '</td>'; $html .= ' <td class="value">' . $slave['Host'] . '</td>'; $html .= ' </tr>'; } $html .= ' </tbody>'; $html .= ' </table>'; $html .= ' <br />'; $html .= Message::notice( __( 'Only slaves started with the ' . '--report-host=host_name option are visible in this list.' ) )->getDisplay(); $html .= ' <br />'; $html .= ' </div>'; return $html; } /** * get the correct username and hostname lengths for this MySQL server * * @return array username length, hostname length */ public static function getUsernameHostnameLength() { $fields_info = $GLOBALS['dbi']->getColumns('mysql', 'user'); $username_length = 16; $hostname_length = 41; foreach ($fields_info as $val) { if ($val['Field'] == 'User') { strtok($val['Type'], '()'); $v = strtok('()'); if (is_int($v)) { $username_length = $v; } } elseif ($val['Field'] == 'Host') { strtok($val['Type'], '()'); $v = strtok('()'); if (is_int($v)) { $hostname_length = $v; } } } return array($username_length, $hostname_length); } /** * returns html code to add a replication slave user to the master * * @return String HTML code */ public static function getHtmlForReplicationMasterAddSlaveUser() { $html = ''; list($username_length, $hostname_length) = self::getUsernameHostnameLength(); if (isset($_POST['username']) && strlen($_POST['username']) === 0) { $GLOBALS['pred_username'] = 'any'; } $html .= '<div id="master_addslaveuser_gui">'; $html .= '<form autocomplete="off" method="post" '; $html .= 'action="server_privileges.php"'; $html .= ' onsubmit="return checkAddUser(this);">'; $html .= Url::getHiddenInputs('', ''); $html .= '<fieldset id="fieldset_add_user_login">' . '<legend>' . __('Add slave replication user') . '</legend>' . self::getHtmlForAddUserLoginForm($username_length) . '<div class="item">' . '<label for="select_pred_hostname">' . ' ' . __('Host:') . '</label>' . '<span class="options">' . ' <select name="pred_hostname" id="select_pred_hostname" title="' . __('Host') . '"'; $_current_user = $GLOBALS['dbi']->fetchValue('SELECT USER();'); if (! empty($_current_user)) { $thishost = str_replace( "'", '', mb_substr( $_current_user, (mb_strrpos($_current_user, '@') + 1) ) ); if ($thishost != 'localhost' && $thishost != '127.0.0.1') { $html .= ' data-thishost="' . htmlspecialchars($thishost) . '" '; } else { unset($thishost); } } $html .= '>' . "\n"; unset($_current_user); // when we start editing a user, $GLOBALS['pred_hostname'] is not defined if (! isset($GLOBALS['pred_hostname']) && isset($_POST['hostname'])) { switch (mb_strtolower($_POST['hostname'])) { case 'localhost': case '127.0.0.1': $GLOBALS['pred_hostname'] = 'localhost'; break; case '%': $GLOBALS['pred_hostname'] = 'any'; break; default: $GLOBALS['pred_hostname'] = 'userdefined'; break; } } $html .= ' <option value="any"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'any') ? ' selected="selected"' : '') . '>' . __('Any host') . '</option>' . ' <option value="localhost"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'localhost') ? ' selected="selected"' : '') . '>' . __('Local') . '</option>'; if (!empty($thishost)) { $html .= ' <option value="thishost"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'thishost') ? ' selected="selected"' : '') . '>' . __('This Host') . '</option>'; } unset($thishost); $html .= self::getHtmlForTableInfoForm($hostname_length); $html .= '</form>'; $html .= '</div>'; return $html; } /** * returns html code to add a replication slave user to the master * * @param int $username_length Username length * * @return String HTML code */ public static function getHtmlForAddUserLoginForm($username_length) { $html = '<input type="hidden" name="grant_count" value="25" />' . '<input type="hidden" name="createdb" id="createdb_0" value="0" />' . '<input id="checkbox_Repl_slave_priv" type="hidden"' . ' title="Needed for the replication slaves." ' . 'value="Y" name="Repl_slave_priv"/>' . '<input id="checkbox_Repl_client_priv" type="hidden" ' . 'title="Needed for the replication slaves."' . ' value="Y" name="Repl_client_priv"/> ' . '<input type="hidden" name="sr_take_action" value="true" />' . '<div class="item">' . '<label for="select_pred_username">' . ' ' . __('User name:') . '</label>' . '<span class="options">' . ' <select name="pred_username" id="select_pred_username" ' . 'title="' . __('User name') . '">' . ' <option value="any"' . ((isset($GLOBALS['pred_username']) && $GLOBALS['pred_username'] == 'any') ? ' selected="selected"' : '') . '>' . __('Any user') . '</option>' . ' <option value="userdefined"' . ((! isset($GLOBALS['pred_username']) || $GLOBALS['pred_username'] == 'userdefined') ? ' selected="selected"' : '') . '>' . __('Use text field:') . '</option>' . ' </select>' . '</span>' . '<input type="text" name="username" id="pma_username" maxlength="' . $username_length . '" title="' . __('User name') . '"' . (empty($_POST['username']) ? '' : ' value="' . (isset($GLOBALS['new_username']) ? $GLOBALS['new_username'] : htmlspecialchars($_POST['username'])) . '"') . ' />' . '</div>'; return $html; } /** * returns HTML for TableInfoForm * * @param int $hostname_length Selected hostname length * * @return String HTML code */ public static function getHtmlForTableInfoForm($hostname_length) { $html = ' <option value="hosttable"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'hosttable') ? ' selected="selected"' : '') . '>' . __('Use Host Table') . '</option>' . ' <option value="userdefined"' . ((isset($GLOBALS['pred_hostname']) && $GLOBALS['pred_hostname'] == 'userdefined') ? ' selected="selected"' : '') . '>' . __('Use text field:') . '</option>' . ' </select>' . '</span>' . '<input type="text" name="hostname" id="pma_hostname" maxlength="' . $hostname_length . '" value="' . (isset($_POST['hostname']) ? htmlspecialchars($_POST['hostname']) : '') . '" title="' . __('Host') . '" />' . Util::showHint( __( 'When Host table is used, this field is ignored ' . 'and values stored in Host table are used instead.' ) ) . '</div>' . '<div class="item">' . '<label for="select_pred_password">' . ' ' . __('Password:') . '</label>' . '<span class="options">' . ' <select name="pred_password" id="select_pred_password" title="' . __('Password') . '">' . ' <option value="none"'; if (isset($_POST['username'])) { $html .= ' selected="selected"'; } $html .= '>' . __('No Password') . '</option>' . ' <option value="userdefined"' . (isset($_POST['username']) ? '' : ' selected="selected"') . '>' . __('Use text field:') . '</option>' . ' </select>' . '</span>' . '<input type="password" id="text_pma_pw" name="pma_pw" title="' . __('Password') . '" />' . '</div>' . '<div class="item">' . '<label for="text_pma_pw2">' . ' ' . __('Re-type:') . '</label>' . '<span class="options">&nbsp;</span>' . '<input type="password" name="pma_pw2" id="text_pma_pw2" title="' . __('Re-type') . '" />' . '</div>' . '<div class="item">' . '<label for="button_generate_password">' . ' ' . __('Generate password:') . '</label>' . '<span class="options">' . ' <input type="button" class="button" ' . 'id="button_generate_password" value="' . __('Generate') . '" onclick="suggestPassword(this.form)" />' . '</span>' . '<input type="text" name="generated_pw" id="generated_pw" />' . '</div>' . '</fieldset>'; $html .= '<fieldset id="fieldset_user_privtable_footer" class="tblFooters">' . ' <input type="hidden" name="adduser_submit" value="1" />' . ' <input type="submit" id="adduser_submit" value="' . __('Go') . '" />' . '</fieldset>'; return $html; } /** * handle control requests * * @return NULL */ public static function handleControlRequest() { if (isset($_POST['sr_take_action'])) { $refresh = false; $result = false; $messageSuccess = null; $messageError = null; if (isset($_POST['slave_changemaster']) && ! $GLOBALS['cfg']['AllowArbitraryServer']) { $_SESSION['replication']['sr_action_status'] = 'error'; $_SESSION['replication']['sr_action_info'] = __('Connection to server is disabled, please enable $cfg[\'AllowArbitraryServer\'] in phpMyAdmin configuration.'); } elseif (isset($_POST['slave_changemaster'])) { $result = self::handleRequestForSlaveChangeMaster(); } elseif (isset($_POST['sr_slave_server_control'])) { $result = self::handleRequestForSlaveServerControl(); $refresh = true; switch ($_POST['sr_slave_action']) { case 'start': $messageSuccess = __('Replication started successfully.'); $messageError = __('Error starting replication.'); break; case 'stop': $messageSuccess = __('Replication stopped successfully.'); $messageError = __('Error stopping replication.'); break; case 'reset': $messageSuccess = __('Replication resetting successfully.'); $messageError = __('Error resetting replication.'); break; default: $messageSuccess = __('Success.'); $messageError = __('Error.'); break; } } elseif (isset($_POST['sr_slave_skip_error'])) { $result = self::handleRequestForSlaveSkipError(); } if ($refresh) { $response = Response::getInstance(); if ($response->isAjax()) { $response->setRequestStatus($result); $response->addJSON( 'message', $result ? Message::success($messageSuccess) : Message::error($messageError) ); } else { Core::sendHeaderLocation( './server_replication.php' . Url::getCommonRaw($GLOBALS['url_params']) ); } } unset($refresh); } } /** * handle control requests for Slave Change Master * * @return boolean */ public static function handleRequestForSlaveChangeMaster() { $sr = array(); $_SESSION['replication']['m_username'] = $sr['username'] = $GLOBALS['dbi']->escapeString($_POST['username']); $_SESSION['replication']['m_password'] = $sr['pma_pw'] = $GLOBALS['dbi']->escapeString($_POST['pma_pw']); $_SESSION['replication']['m_hostname'] = $sr['hostname'] = $GLOBALS['dbi']->escapeString($_POST['hostname']); $_SESSION['replication']['m_port'] = $sr['port'] = $GLOBALS['dbi']->escapeString($_POST['text_port']); $_SESSION['replication']['m_correct'] = ''; $_SESSION['replication']['sr_action_status'] = 'error'; $_SESSION['replication']['sr_action_info'] = __('Unknown error'); // Attempt to connect to the new master server $link_to_master = Replication::connectToMaster( $sr['username'], $sr['pma_pw'], $sr['hostname'], $sr['port'] ); if (! $link_to_master) { $_SESSION['replication']['sr_action_status'] = 'error'; $_SESSION['replication']['sr_action_info'] = sprintf( __('Unable to connect to master %s.'), htmlspecialchars($sr['hostname']) ); } else { // Read the current master position $position = Replication::slaveBinLogMaster($link_to_master); if (empty($position)) { $_SESSION['replication']['sr_action_status'] = 'error'; $_SESSION['replication']['sr_action_info'] = __( 'Unable to read master log position. ' . 'Possible privilege problem on master.' ); } else { $_SESSION['replication']['m_correct'] = true; if (! Replication::slaveChangeMaster( $sr['username'], $sr['pma_pw'], $sr['hostname'], $sr['port'], $position, true, false ) ) { $_SESSION['replication']['sr_action_status'] = 'error'; $_SESSION['replication']['sr_action_info'] = __('Unable to change master!'); } else { $_SESSION['replication']['sr_action_status'] = 'success'; $_SESSION['replication']['sr_action_info'] = sprintf( __('Master server changed successfully to %s.'), htmlspecialchars($sr['hostname']) ); } } } return $_SESSION['replication']['sr_action_status'] === 'success'; } /** * handle control requests for Slave Server Control * * @return boolean */ public static function handleRequestForSlaveServerControl() { if (empty($_POST['sr_slave_control_parm'])) { $_POST['sr_slave_control_parm'] = null; } if ($_POST['sr_slave_action'] == 'reset') { $qStop = Replication::slaveControl("STOP", null, DatabaseInterface::CONNECT_USER); $qReset = $GLOBALS['dbi']->tryQuery("RESET SLAVE;"); $qStart = Replication::slaveControl("START", null, DatabaseInterface::CONNECT_USER); $result = ($qStop !== false && $qStop !== -1 && $qReset !== false && $qReset !== -1 && $qStart !== false && $qStart !== -1); } else { $qControl = Replication::slaveControl( $_POST['sr_slave_action'], $_POST['sr_slave_control_parm'], DatabaseInterface::CONNECT_USER ); $result = ($qControl !== false && $qControl !== -1); } return $result; } /** * handle control requests for Slave Skip Error * * @return boolean */ public static function handleRequestForSlaveSkipError() { $count = 1; if (isset($_POST['sr_skip_errors_count'])) { $count = $_POST['sr_skip_errors_count'] * 1; } $qStop = Replication::slaveControl("STOP", null, DatabaseInterface::CONNECT_USER); $qSkip = $GLOBALS['dbi']->tryQuery( "SET GLOBAL SQL_SLAVE_SKIP_COUNTER = " . $count . ";" ); $qStart = Replication::slaveControl("START", null, DatabaseInterface::CONNECT_USER); $result = ($qStop !== false && $qStop !== -1 && $qSkip !== false && $qSkip !== -1 && $qStart !== false && $qStart !== -1); return $result; } }
{ "content_hash": "2fbe5abcbfade816e6b424e24b0c550f", "timestamp": "", "source": "github", "line_count": 1094, "max_line_length": 175, "avg_line_length": 39.11791590493601, "alnum_prop": 0.463068115434046, "repo_name": "cytopia/devilbox", "id": "f9e3534df8123d002939e64cd3585083800bb7a9", "size": "42795", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": ".devilbox/www/htdocs/vendor/phpmyadmin-4.9.7/libraries/classes/ReplicationGui.php", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "86" }, { "name": "CSS", "bytes": "3980" }, { "name": "JavaScript", "bytes": "923" }, { "name": "Makefile", "bytes": "4209" }, { "name": "PHP", "bytes": "221096" }, { "name": "Shell", "bytes": "204888" } ], "symlink_target": "" }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Testing; using osuTK; using osuTK.Graphics; namespace osu.Framework.Tests.Visual.TestCaseContainerExtensions { public class TestCaseCachedBufferedContainer : GridTestCase { public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(BufferedContainer), typeof(BufferedContainerDrawNode), }; public TestCaseCachedBufferedContainer() : base(5, 2) { string[] labels = { "uncached", "cached", "uncached with rotation", "cached with rotation", "uncached with movement", "cached with movement", "uncached with parent scale", "cached with parent scale", "uncached with parent scale&fade", "cached with parent scale&fade", }; var boxes = new List<ContainingBox>(); for (int i = 0; i < Rows * Cols; ++i) { ContainingBox box; Cell(i).AddRange(new Drawable[] { new SpriteText { Text = labels[i], Font = new FontUsage(size: 20), }, box = new ContainingBox(i >= 6, i >= 8) { Child = new CountingBox(i == 2 || i == 3, i == 4 || i == 5) { CacheDrawnFrameBuffer = i % 2 == 1, }, } }); boxes.Add(box); } AddWaitStep(5); // ensure uncached is always updating children. AddAssert("box 0 count > 0", () => boxes[0].Count > 0); AddAssert("even box counts equal", () => boxes[0].Count == boxes[2].Count && boxes[2].Count == boxes[4].Count && boxes[4].Count == boxes[6].Count); // ensure cached is never updating children. AddAssert("box 1 count is 1", () => boxes[1].Count == 1); // ensure rotation changes are invalidating cache (for now). AddAssert("box 2 count > 0", () => boxes[2].Count > 0); AddAssert("box 2 count equals box 3 count", () => boxes[2].Count == boxes[3].Count); // ensure cached with only translation is never updating children. AddAssert("box 5 count is 1", () => boxes[1].Count == 1); // ensure a parent scaling is invalidating cache. AddAssert("box 5 count equals box 6 count", () => boxes[5].Count == boxes[6].Count); // ensure we don't break on colour invalidations (due to blanket invalidation logic in Drawable.Invalidate). AddAssert("box 7 count equals box 8 count", () => boxes[7].Count == boxes[8].Count); } private class ContainingBox : Container { private readonly bool scaling; private readonly bool fading; public ContainingBox(bool scaling, bool fading) { this.scaling = scaling; this.fading = fading; RelativeSizeAxes = Axes.Both; } protected override void LoadComplete() { base.LoadComplete(); if (scaling) this.ScaleTo(1.2f, 1000).Then().ScaleTo(1, 1000).Loop(); if (fading) this.FadeTo(0.5f, 1000).Then().FadeTo(1, 1000).Loop(); } } private class CountingBox : BufferedContainer { private readonly bool rotating; private readonly bool moving; private readonly SpriteText count; public new int Count; public CountingBox(bool rotating = false, bool moving = false) { this.rotating = rotating; this.moving = moving; RelativeSizeAxes = Axes.Both; Origin = Anchor.Centre; Anchor = Anchor.Centre; Scale = new Vector2(0.5f); InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Origin = Anchor.Centre, Anchor = Anchor.Centre, Colour = Color4.NavajoWhite, }, count = new SpriteText { Colour = Color4.Black, Origin = Anchor.Centre, Anchor = Anchor.Centre, Font = new FontUsage(size: 80), } }; } protected override void Update() { base.Update(); if (RequiresChildrenUpdate) { Count++; count.Text = Count.ToString(); } } protected override void LoadComplete() { base.LoadComplete(); if (rotating) this.RotateTo(360, 1000).Loop(); if (moving) this.MoveTo(new Vector2(100, 0), 2000, Easing.InOutSine).Then().MoveTo(new Vector2(0, 0), 2000, Easing.InOutSine).Loop(); } } } }
{ "content_hash": "939cd1d5ffc728d3a4cf87ec8c2fa0ac", "timestamp": "", "source": "github", "line_count": 168, "max_line_length": 149, "avg_line_length": 34.63095238095238, "alnum_prop": 0.480577518047439, "repo_name": "Tom94/osu-framework", "id": "7c75a74532b35f96622f407a763ad223910490b4", "size": "5820", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "osu.Framework.Tests/Visual/TestCaseContainerExtensions/TestCaseCachedBufferedContainer.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "2997445" }, { "name": "C++", "bytes": "948" }, { "name": "GLSL", "bytes": "8174" } ], "symlink_target": "" }
typedef uint_least16_t char16_t; typedef uint_least32_t char32_t; # endif typedef float swift_float2 __attribute__((__ext_vector_type__(2))); typedef float swift_float3 __attribute__((__ext_vector_type__(3))); typedef float swift_float4 __attribute__((__ext_vector_type__(4))); typedef double swift_double2 __attribute__((__ext_vector_type__(2))); typedef double swift_double3 __attribute__((__ext_vector_type__(3))); typedef double swift_double4 __attribute__((__ext_vector_type__(4))); typedef int swift_int2 __attribute__((__ext_vector_type__(2))); typedef int swift_int3 __attribute__((__ext_vector_type__(3))); typedef int swift_int4 __attribute__((__ext_vector_type__(4))); #endif #if !defined(SWIFT_PASTE) # define SWIFT_PASTE_HELPER(x, y) x##y # define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y) #endif #if !defined(SWIFT_METATYPE) # define SWIFT_METATYPE(X) Class #endif #if defined(__has_attribute) && __has_attribute(objc_runtime_name) # define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X))) #else # define SWIFT_RUNTIME_NAME(X) #endif #if defined(__has_attribute) && __has_attribute(swift_name) # define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) #else # define SWIFT_COMPILE_NAME(X) #endif #if !defined(SWIFT_CLASS_EXTRA) # define SWIFT_CLASS_EXTRA #endif #if !defined(SWIFT_PROTOCOL_EXTRA) # define SWIFT_PROTOCOL_EXTRA #endif #if !defined(SWIFT_ENUM_EXTRA) # define SWIFT_ENUM_EXTRA #endif #if !defined(SWIFT_CLASS) # if defined(__has_attribute) && __has_attribute(objc_subclassing_restricted) # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA # define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # else # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA # endif #endif #if !defined(SWIFT_PROTOCOL) # define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA # define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA #endif #if !defined(SWIFT_EXTENSION) # define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__) #endif #if !defined(OBJC_DESIGNATED_INITIALIZER) # if defined(__has_attribute) && __has_attribute(objc_designated_initializer) # define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) # else # define OBJC_DESIGNATED_INITIALIZER # endif #endif #if !defined(SWIFT_ENUM) # define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_EXTRA _name : _type # if defined(__has_feature) && __has_feature(generalized_swift_name) # define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_EXTRA _name : _type # else # define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) SWIFT_ENUM(_type, _name) # endif #endif #if defined(__has_feature) && __has_feature(modules) @import UIKit; @import CoreGraphics; @import Foundation; #endif #pragma clang diagnostic ignored "-Wproperty-attribute-mismatch" #pragma clang diagnostic ignored "-Wduplicate-method-arg" @class UIWindow; SWIFT_CLASS("_TtC12MovingHelper11AppDelegate") @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (nonatomic, strong) UIWindow * _Nullable window; - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER; @end @class NSCoder; /// A button subclass to make it simpler to display and update whether a Task is done or not. SWIFT_CLASS("_TtC12MovingHelper8Checkbox") @interface Checkbox : UIButton @property (nonatomic) BOOL isChecked; - (void)awakeFromNib; - (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER; @end @class NSDate; @class UITextField; @class UILabel; @class UIPickerView; @class UITextView; @class NSBundle; SWIFT_CLASS("_TtC12MovingHelper20DetailViewController") @interface DetailViewController : UIViewController @property (nonatomic, weak) IBOutlet UITextField * _Null_unspecified titleTextField; @property (nonatomic, weak) IBOutlet Checkbox * _Null_unspecified doneCheckbox; @property (nonatomic, weak) IBOutlet UILabel * _Null_unspecified daysRemainingLabel; @property (nonatomic, weak) IBOutlet UIPickerView * _Null_unspecified dueDatePicker; @property (nonatomic, weak) IBOutlet UITextView * _Null_unspecified notesTextView; @property (nonatomic, strong) NSDate * _Null_unspecified moveDate; @property (nonatomic) BOOL inEditMode; - (void)viewDidLoad; - (void)viewWillAppear:(BOOL)animated; - (IBAction)checkboxToggled; - (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil OBJC_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER; @end @interface DetailViewController (SWIFT_EXTENSION(MovingHelper)) <UIPickerViewDataSource> - (NSInteger)numberOfComponentsInPickerView:(UIPickerView * _Nonnull)pickerView; - (NSInteger)pickerView:(UIPickerView * _Nonnull)pickerView numberOfRowsInComponent:(NSInteger)component; @end @interface DetailViewController (SWIFT_EXTENSION(MovingHelper)) <UIPickerViewDelegate> - (NSString * _Null_unspecified)pickerView:(UIPickerView * _Nonnull)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component; - (void)pickerView:(UIPickerView * _Nonnull)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component; @end @class UIStoryboardSegue; SWIFT_CLASS("_TtC12MovingHelper20MasterViewController") @interface MasterViewController : UITableViewController - (void)viewDidLoad; - (void)viewDidAppear:(BOOL)animated; - (void)prepareForSegue:(UIStoryboardSegue * _Nonnull)segue sender:(id _Nullable)sender; - (IBAction)calendarIconTapped; - (nonnull instancetype)initWithStyle:(UITableViewStyle)style OBJC_DESIGNATED_INITIALIZER; - (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil OBJC_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER; @end @interface MasterViewController (SWIFT_EXTENSION(MovingHelper)) @end @interface MasterViewController (SWIFT_EXTENSION(MovingHelper)) - (void)updatedMovingDate; @end @class UITableView; @class UIView; @class NSIndexPath; @class UITableViewCell; @interface MasterViewController (SWIFT_EXTENSION(MovingHelper)) - (NSInteger)numberOfSectionsInTableView:(UITableView * _Nonnull)tableView; - (CGFloat)tableView:(UITableView * _Nonnull)tableView heightForHeaderInSection:(NSInteger)section; - (UIView * _Nullable)tableView:(UITableView * _Nonnull)tableView viewForHeaderInSection:(NSInteger)section; - (NSInteger)tableView:(UITableView * _Nonnull)tableView numberOfRowsInSection:(NSInteger)section; - (UITableViewCell * _Nonnull)tableView:(UITableView * _Nonnull)tableView cellForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath; @end @class UIDatePicker; /// VC to use to select a moving date. SWIFT_CLASS("_TtC12MovingHelper24MovingDateViewController") @interface MovingDateViewController : UIViewController @property (nonatomic, weak) IBOutlet UIDatePicker * _Null_unspecified whenMovingDatePicker; @property (nonatomic, weak) IBOutlet UILabel * _Null_unspecified whenMovingLabel; @property (nonatomic, weak) IBOutlet UILabel * _Null_unspecified daysLeftLabel; @property (nonatomic, weak) IBOutlet UIButton * _Null_unspecified createTasksButton; @property (nonatomic) BOOL updatingDate; - (void)viewDidLoad; - (NSDate * _Nonnull)twoMonthsFromToday; - (IBAction)datePickerChanged; - (IBAction)createTasks; - (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil OBJC_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER; @end @interface NSDate (SWIFT_EXTENSION(MovingHelper)) /// The start of the day per NSCalendar rules for the receiver. - (NSDate * _Nonnull)startOfDay; /// The start of the current day per NSCalendar rules for the receiver. + (NSDate * _Nonnull)startOfToday; @end @interface NSDictionary (SWIFT_EXTENSION(MovingHelper)) /// Checks a dictionary for a value for a given key, and returns either its String value or an empty string. /// /// \param key : The key to use to check the dictionary /// /// \returns The found string, or an empty string if it was not found. - (NSString * _Nonnull)safeString:(NSString * _Nonnull)key; /// Checks a dictionary for a value for a given key, and returns either its integer value or zero. /// /// \param key : The key to use to check the dictionary /// /// \returns The found number, or zero if it was not found. - (NSInteger)safeInt:(NSString * _Nonnull)key; /// Checks a dictionary for a value for a given key, and returns either its boolean value or false. /// /// \param key : The key to use to check the dictionary /// /// \returns The found boolean value, or false if it was not found. - (BOOL)safeBoolean:(NSString * _Nonnull)key; @end @class NSDateFormatter; /// A section header view which shows when tasks are due and changes color based on whether the due date has passed for the given move date. SWIFT_CLASS("_TtC12MovingHelper21TaskSectionHeaderView") @interface TaskSectionHeaderView : UITableViewCell + (NSDateFormatter * _Nonnull)dateFormatter; @property (nonatomic, strong) IBOutlet UILabel * _Null_unspecified sectionNameLabel; @property (nonatomic, strong) IBOutlet UILabel * _Null_unspecified deadlineDateLabel; @property (nonatomic, strong) IBOutlet UILabel * _Null_unspecified fromNowOrAgoLabel; - (nonnull instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString * _Nullable)reuseIdentifier OBJC_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER; @end SWIFT_CLASS("_TtC12MovingHelper17TaskTableViewCell") @interface TaskTableViewCell : UITableViewCell @property (nonatomic, strong) IBOutlet UILabel * _Null_unspecified titleLabel; @property (nonatomic, strong) IBOutlet UILabel * _Null_unspecified notesLabel; @property (nonatomic, strong) IBOutlet Checkbox * _Null_unspecified checkbox; - (void)configureForDoneState:(BOOL)done; - (IBAction)tappedCheckbox; - (nonnull instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString * _Nullable)reuseIdentifier OBJC_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER; @end @interface UITableViewCell (SWIFT_EXTENSION(MovingHelper)) /// \returns The cell identifier based on the class's name, but not tied /// to the project bundle. A class of FooTableViewCell would return "FooTableViewCell" as the identifier. + (NSString * _Nonnull)cellIdentifierFromClassName; @end #pragma clang diagnostic pop
{ "content_hash": "e8ad9cf78eded3dff4b85fe5da90f8bc", "timestamp": "", "source": "github", "line_count": 262, "max_line_length": 176, "avg_line_length": 42.38549618320611, "alnum_prop": 0.7777577667717245, "repo_name": "1640/MovingHelper", "id": "fa2f609f3c264a3dd623f6527298b7cc58140409", "size": "11649", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Build/Intermediates/MovingHelper.build/Debug-iphonesimulator/MovingHelper.build/DerivedSources/MovingHelper-Swift.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "5246" }, { "name": "Makefile", "bytes": "160287" }, { "name": "Objective-C", "bytes": "163461" }, { "name": "Swift", "bytes": "39237" } ], "symlink_target": "" }
<?php namespace My\BetBundle\Entity; use Doctrine\ORM\EntityRepository; /** * BetRepository * * This class was generated by the Doctrine ORM. Add your own custom * repository methods below. */ class BetRepository extends EntityRepository { public function findAllUserBets($start, $end) { $query = $this->getEntityManager() ->createQuery(' SELECT b.id FROM My\BetBundle\Entity\Bet b WHERE b.kupon BETWEEN :start AND :end ') ->setParameters(array('start' => $start, 'end' => $end)); return $query->getArrayResult(); } public function findAllUserBetsFromMatchday($matchday, $user) { $query = $this->getEntityManager() ->createQuery(' SELECT DISTINCT o.id FROM My\BetBundle\Entity\Bet b JOIN b.kupon k JOIN b.offer o JOIN o.meet m JOIN m.matchday mt WHERE (mt.id = :matchday) AND (k.user = :user) ') ->setParameters(array('matchday' => $matchday, 'user' => $user)); return $query->getArrayResult(); } public function findAllUserBetsFromMatchday2($matchday) { $query = $this->getEntityManager() ->createQuery(' SELECT DISTINCT o.id as oid,u.id as uid FROM My\BetBundle\Entity\Bet b JOIN b.kupon k JOIN b.offer o JOIN o.meet m JOIN m.matchday mt JOIN k.user u WHERE mt.id = :matchday ') ->setParameters(array('matchday' => $matchday)); return $query->getArrayResult(); } public function findAllUserBetsToThisMatchday($matchday, $user) { $query = $this->getEntityManager() ->createQuery(' SELECT DISTINCT o.id FROM My\BetBundle\Entity\Bet b JOIN b.kupon k JOIN b.offer o JOIN o.meet m JOIN m.matchday mt WHERE (mt.id <= :matchday) AND (k.user = :user) ') ->setParameters(array('matchday' => $matchday, 'user' => $user)); return $query->getArrayResult(); } }
{ "content_hash": "20481e4c5377d7a154945c67a9c5189e", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 73, "avg_line_length": 26.962025316455698, "alnum_prop": 0.5666666666666667, "repo_name": "damianoo84/pracamagisterska", "id": "4e152422b325842c5bfc15deca793e24f8d15219", "size": "2130", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/My/BetBundle/Entity/BetRepository.php", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "210" }, { "name": "PHP", "bytes": "298338" }, { "name": "Perl", "bytes": "26" } ], "symlink_target": "" }
#include <math.h> #include <stdio.h> #include "HalideRuntime.h" #include "HalideBuffer.h" #include <assert.h> #if COMPILING_FOR_CUDA #include "HalideRuntimeCuda.h" #elif COMPILING_FOR_OPENCL #include "HalideRuntimeOpenCL.h" #endif #include "gpu_object_lifetime.h" #include "../common/gpu_object_lifetime.h" using namespace Halide; void my_halide_print(void *user_context, const char *str) { printf("%s", str); record_gpu_debug(str); } int main(int argc, char **argv) { halide_set_custom_print(&my_halide_print); // Run the whole program several times. for (int i = 0; i < 2; i++) { Image<int> output(80); gpu_object_lifetime(output); output.copy_to_host(); output.device_free(); for (int x = 0; x < output.width(); x++) { if (output(x) != x) { printf("Error! %d != %d\n", output(x), x); return -1; } } #if COMPILING_FOR_CUDA halide_device_release(nullptr, halide_cuda_device_interface()); #elif COMPILING_FOR_OPENCL halide_device_release(nullptr, halide_opencl_device_interface()); #endif } int ret = validate_gpu_object_lifetime(false /* allow_globals */, true /* allow_none */, 1 /* max_globals */); if (ret != 0) { return ret; } printf("Success!\n"); return 0; }
{ "content_hash": "ea72088c6146d0003f64b97070b12d5a", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 114, "avg_line_length": 23.310344827586206, "alnum_prop": 0.5976331360946746, "repo_name": "jiawen/Halide", "id": "920bfdce7322c17333124ddbb5cbeaae8ad9bb86", "size": "1352", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/generator/gpu_object_lifetime_aottest.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "7244" }, { "name": "C", "bytes": "454474" }, { "name": "C++", "bytes": "5723874" }, { "name": "CMake", "bytes": "84384" }, { "name": "HTML", "bytes": "9668" }, { "name": "Java", "bytes": "109499" }, { "name": "LLVM", "bytes": "122202" }, { "name": "Makefile", "bytes": "120168" }, { "name": "Matlab", "bytes": "543" }, { "name": "Objective-C", "bytes": "26335" }, { "name": "Objective-C++", "bytes": "23224" }, { "name": "Python", "bytes": "210608" }, { "name": "Shell", "bytes": "32208" } ], "symlink_target": "" }
Set-StrictMode -Version Latest Set-Location (Split-Path $PSScriptRoot) tool/version.ps1 node_modules/.bin/tsc --project src/tsconfig.json
{ "content_hash": "aa4f7cd04f40500bfe4dc9273810e373", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 49, "avg_line_length": 27.8, "alnum_prop": 0.7985611510791367, "repo_name": "cedx/reverse-proxy.js", "id": "124c5d6f59d0ae13fe4871cab07de45020b1ad06", "size": "159", "binary": false, "copies": "3", "ref": "refs/heads/main", "path": "tool/build.ps1", "mode": "33261", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "7599" }, { "name": "PowerShell", "bytes": "3160" }, { "name": "TypeScript", "bytes": "18852" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="robots" content="noindex"> <title>File common/libraries/Logger.php</title> <link rel="stylesheet" href="resources/bootstrap.min.css?08b23951ef4599ca9cbf1f902d0e8290c9653ddd"> <link rel="stylesheet" href="resources/style.css?062e9e59e0b8c44fbaaded5b7ffc21f907b78669"> </head> <body> <div id="navigation" class="navbar navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> <a href="index.html" class="brand">Overview</a> <div class="nav-collapse"> <ul class="nav"> <li> <span>Namespace</span> </li> <li> <a href="function-valid_email.html" title="Summary of valid_email"><span>Function</span></a> </li> </ul> </div> </div> </div> </div> <div id="left"> <div id="menu"> <form id="search" class="form-search"> <input type="hidden" name="cx" value=""> <input type="hidden" name="ie" value="UTF-8"> <input type="text" name="q" class="search-query" placeholder="Search"> </form> <div id="groups"> <h3>Namespaces</h3> <ul> <li> <a href="namespace-Nails.html"> Nails<span></span> </a> <ul> <li> <a href="namespace-Nails.Admin.html"> Admin<span></span> </a> <ul> <li> <a href="namespace-Nails.Admin.Admin.html"> Admin </a> </li> <li> <a href="namespace-Nails.Admin.Auth.html"> Auth </a> </li> <li> <a href="namespace-Nails.Admin.Blog.html"> Blog </a> </li> <li> <a href="namespace-Nails.Admin.Cdn.html"> Cdn </a> </li> <li> <a href="namespace-Nails.Admin.Cms.html"> Cms </a> </li> <li> <a href="namespace-Nails.Admin.Email.html"> Email </a> </li> <li> <a href="namespace-Nails.Admin.Shop.html"> Shop </a> </li> <li> <a href="namespace-Nails.Admin.Testimonial.html"> Testimonial </a> </li> </ul></li></ul></li> <li> <a href="namespace-None.html"> None </a> </li> </ul> </div> <div id="elements"> <h3>Classes</h3> <ul> <li><a href="class-Admin.html">Admin</a></li> <li><a href="class-Admin_changelog_model.html">Admin_changelog_model</a></li> <li><a href="class-Admin_help_model.html">Admin_help_model</a></li> <li><a href="class-Admin_model.html">Admin_model</a></li> <li><a href="class-Admin_sitelog_model.html">Admin_sitelog_model</a></li> <li><a href="class-AdminController.html">AdminController</a></li> <li><a href="class-AdminRouter.html">AdminRouter</a></li> <li><a href="class-Api.html">Api</a></li> <li><a href="class-App_notification_model.html">App_notification_model</a></li> <li><a href="class-App_setting_model.html">App_setting_model</a></li> <li><a href="class-Asset.html">Asset</a></li> <li><a href="class-Auth.html">Auth</a></li> <li><a href="class-Auth_model.html">Auth_model</a></li> <li><a href="class-Aws_local_CDN.html">Aws_local_CDN</a></li> <li><a href="class-Barcode.html">Barcode</a></li> <li><a href="class-Barcode_generator.html">Barcode_generator</a></li> <li><a href="class-Basket.html">Basket</a></li> <li><a href="class-Blank_avatar.html">Blank_avatar</a></li> <li><a href="class-Blog.html">Blog</a></li> <li><a href="class-Blog_category_model.html">Blog_category_model</a></li> <li><a href="class-Blog_model.html">Blog_model</a></li> <li><a href="class-Blog_post_model.html">Blog_post_model</a></li> <li><a href="class-Blog_skin_model.html">Blog_skin_model</a></li> <li><a href="class-Blog_tag_model.html">Blog_tag_model</a></li> <li><a href="class-Blog_widget_model.html">Blog_widget_model</a></li> <li><a href="class-Cdn.html">Cdn</a></li> <li><a href="class-Cdnapi.html">Cdnapi</a></li> <li><a href="class-Checkout.html">Checkout</a></li> <li><a href="class-CI.html" class="invalid">CI</a></li> <li><a href="class-CI_Model.html">CI_Model</a></li> <li><a href="class-Cms.html">Cms</a></li> <li><a href="class-Cms_block_model.html">Cms_block_model</a></li> <li><a href="class-Cms_menu_model.html">Cms_menu_model</a></li> <li><a href="class-Cms_page_model.html">Cms_page_model</a></li> <li><a href="class-Cms_slider_model.html">Cms_slider_model</a></li> <li><a href="class-Comment.html">Comment</a></li> <li><a href="class-CORE_NAILS_App.html">CORE_NAILS_App</a></li> <li><a href="class-CORE_NAILS_Calendar.html">CORE_NAILS_Calendar</a></li> <li><a href="class-CORE_NAILS_Controller.html">CORE_NAILS_Controller</a></li> <li><a href="class-CORE_NAILS_Deploy.html">CORE_NAILS_Deploy</a></li> <li><a href="class-CORE_NAILS_ErrorHandler.html">CORE_NAILS_ErrorHandler</a></li> <li><a href="class-CORE_NAILS_ErrorHandler_Rollbar.html">CORE_NAILS_ErrorHandler_Rollbar</a></li> <li><a href="class-CORE_NAILS_Exceptions.html">CORE_NAILS_Exceptions</a></li> <li><a href="class-CORE_NAILS_Form_validation.html">CORE_NAILS_Form_validation</a></li> <li><a href="class-CORE_NAILS_Hooks.html">CORE_NAILS_Hooks</a></li> <li><a href="class-CORE_NAILS_Install.html">CORE_NAILS_Install</a></li> <li><a href="class-CORE_NAILS_Lang.html">CORE_NAILS_Lang</a></li> <li><a href="class-CORE_NAILS_Loader.html">CORE_NAILS_Loader</a></li> <li><a href="class-CORE_NAILS_Log.html">CORE_NAILS_Log</a></li> <li><a href="class-CORE_NAILS_Migrate.html">CORE_NAILS_Migrate</a></li> <li><a href="class-CORE_NAILS_Model.html">CORE_NAILS_Model</a></li> <li><a href="class-CORE_NAILS_Pagination.html">CORE_NAILS_Pagination</a></li> <li><a href="class-CORE_NAILS_Profiler.html">CORE_NAILS_Profiler</a></li> <li><a href="class-CORE_NAILS_Router.html">CORE_NAILS_Router</a></li> <li><a href="class-CORE_NAILS_Session.html">CORE_NAILS_Session</a></li> <li><a href="class-CORE_NAILS_URI.html">CORE_NAILS_URI</a></li> <li><a href="class-CORE_NAILS_User_agent.html">CORE_NAILS_User_agent</a></li> <li><a href="class-Country_model.html">Country_model</a></li> <li><a href="class-Curl.html">Curl</a></li> <li><a href="class-Datetime_model.html">Datetime_model</a></li> <li><a href="class-Deploy.html">Deploy</a></li> <li><a href="class-Emailer.html">Emailer</a></li> <li><a href="class-Enquire.html">Enquire</a></li> <li><a href="class-Event.html">Event</a></li> <li><a href="class-Faux_session.html">Faux_session</a></li> <li><a href="class-Feed.html">Feed</a></li> <li><a href="class-Forgotten_Password.html">Forgotten_Password</a></li> <li><a href="class-Geo_ip.html">Geo_ip</a></li> <li><a href="class-Geo_ip_driver_Nails_ip_services.html">Geo_ip_driver_Nails_ip_services</a></li> <li><a href="class-Home.html">Home</a></li> <li><a href="class-Language_model.html">Language_model</a></li> <li><a href="class-Local_CDN.html">Local_CDN</a></li> <li><a href="class-Logger.html">Logger</a></li> <li><a href="class-Login.html">Login</a></li> <li><a href="class-Logout.html">Logout</a></li> <li><a href="class-Maintenance.html">Maintenance</a></li> <li><a href="class-Manager.html">Manager</a></li> <li><a href="class-Mfa_device.html">Mfa_device</a></li> <li><a href="class-Mfa_question.html">Mfa_question</a></li> <li><a href="class-Modules.html">Modules</a></li> <li><a href="class-Mustache.html">Mustache</a></li> <li><a href="class-MX_Config.html">MX_Config</a></li> <li><a href="class-MX_Controller.html">MX_Controller</a></li> <li><a href="class-MX_Lang.html">MX_Lang</a></li> <li><a href="class-MX_Loader.html">MX_Loader</a></li> <li><a href="class-MX_Router.html">MX_Router</a></li> <li><a href="class-NAILS_Admin.html">NAILS_Admin</a></li> <li><a href="class-NAILS_Admin_changelog_model.html">NAILS_Admin_changelog_model</a></li> <li><a href="class-NAILS_Admin_Controller.html">NAILS_Admin_Controller</a></li> <li><a href="class-NAILS_Admin_help_model.html">NAILS_Admin_help_model</a></li> <li><a href="class-NAILS_Admin_Model.html">NAILS_Admin_Model</a></li> <li><a href="class-NAILS_Admin_sitelog_model.html">NAILS_Admin_sitelog_model</a></li> <li><a href="class-NAILS_Api.html">NAILS_Api</a></li> <li><a href="class-NAILS_API_Controller.html">NAILS_API_Controller</a></li> <li><a href="class-NAILS_App_notification_model.html">NAILS_App_notification_model</a></li> <li><a href="class-NAILS_App_setting_model.html">NAILS_App_setting_model</a></li> <li><a href="class-NAILS_Auth.html">NAILS_Auth</a></li> <li><a href="class-NAILS_Auth_Controller.html">NAILS_Auth_Controller</a></li> <li><a href="class-NAILS_Auth_Mfa_Controller.html">NAILS_Auth_Mfa_Controller</a></li> <li><a href="class-NAILS_Auth_model.html">NAILS_Auth_model</a></li> <li><a href="class-NAILS_Barcode.html">NAILS_Barcode</a></li> <li><a href="class-NAILS_Basket.html">NAILS_Basket</a></li> <li><a href="class-NAILS_Blank_avatar.html">NAILS_Blank_avatar</a></li> <li><a href="class-NAILS_Blog.html" class="invalid">NAILS_Blog</a></li> <li><a href="class-NAILS_Blog_category_model.html">NAILS_Blog_category_model</a></li> <li><a href="class-NAILS_Blog_Controller.html">NAILS_Blog_Controller</a></li> <li><a href="class-NAILS_Blog_model.html">NAILS_Blog_model</a></li> <li><a href="class-NAILS_Blog_post_model.html">NAILS_Blog_post_model</a></li> <li><a href="class-NAILS_Blog_skin_model.html">NAILS_Blog_skin_model</a></li> <li><a href="class-NAILS_Blog_tag_model.html">NAILS_Blog_tag_model</a></li> <li><a href="class-NAILS_Blog_widget_model.html">NAILS_Blog_widget_model</a></li> <li><a href="class-NAILS_CDN_Controller.html">NAILS_CDN_Controller</a></li> <li><a href="class-NAILS_Cdnapi.html">NAILS_Cdnapi</a></li> <li><a href="class-NAILS_Checkout.html">NAILS_Checkout</a></li> <li><a href="class-NAILS_Cms.html" class="invalid">NAILS_Cms</a></li> <li><a href="class-NAILS_Cms_block_model.html">NAILS_Cms_block_model</a></li> <li><a href="class-NAILS_CMS_Controller.html">NAILS_CMS_Controller</a></li> <li><a href="class-NAILS_Cms_menu_model.html">NAILS_Cms_menu_model</a></li> <li><a href="class-NAILS_Cms_page_model.html">NAILS_Cms_page_model</a></li> <li><a href="class-NAILS_Cms_slider_model.html">NAILS_Cms_slider_model</a></li> <li><a href="class-Nails_CMS_Template.html">Nails_CMS_Template</a></li> <li><a href="class-Nails_CMS_Template_fullwidth.html">Nails_CMS_Template_fullwidth</a></li> <li><a href="class-NAILS_CMS_Template_redirect.html">NAILS_CMS_Template_redirect</a></li> <li><a href="class-Nails_CMS_Template_sidebar_left.html">Nails_CMS_Template_sidebar_left</a></li> <li><a href="class-Nails_CMS_Template_sidebar_right.html">Nails_CMS_Template_sidebar_right</a></li> <li><a href="class-NAILS_CMS_Widget.html">NAILS_CMS_Widget</a></li> <li><a href="class-NAILS_CMS_Widget_html.html">NAILS_CMS_Widget_html</a></li> <li><a href="class-NAILS_CMS_Widget_image.html">NAILS_CMS_Widget_image</a></li> <li><a href="class-NAILS_CMS_Widget_richtext.html">NAILS_CMS_Widget_richtext</a></li> <li><a href="class-NAILS_CMS_Widget_slider.html">NAILS_CMS_Widget_slider</a></li> <li><a href="class-NAILS_CMS_Widget_table.html">NAILS_CMS_Widget_table</a></li> <li><a href="class-NAILS_Controller.html">NAILS_Controller</a></li> <li><a href="class-NAILS_Country_model.html">NAILS_Country_model</a></li> <li><a href="class-NAILS_Cron_Controller.html">NAILS_Cron_Controller</a></li> <li><a href="class-NAILS_Datetime_model.html">NAILS_Datetime_model</a></li> <li><a href="class-NAILS_Deploy.html">NAILS_Deploy</a></li> <li><a href="class-NAILS_Email.html">NAILS_Email</a></li> <li><a href="class-NAILS_Email_Controller.html">NAILS_Email_Controller</a></li> <li><a href="class-NAILS_Enquire.html">NAILS_Enquire</a></li> <li><a href="class-NAILS_Exceptions.html">NAILS_Exceptions</a></li> <li><a href="class-NAILS_Feed.html">NAILS_Feed</a></li> <li><a href="class-NAILS_Forgotten_Password.html">NAILS_Forgotten_Password</a></li> <li><a href="class-NAILS_Geo_ip_driver.html">NAILS_Geo_ip_driver</a></li> <li><a href="class-NAILS_Hooks.html">NAILS_Hooks</a></li> <li><a href="class-NAILS_Lang.html">NAILS_Lang</a></li> <li><a href="class-NAILS_Language_model.html">NAILS_Language_model</a></li> <li><a href="class-NAILS_Loader.html">NAILS_Loader</a></li> <li><a href="class-NAILS_Log.html">NAILS_Log</a></li> <li><a href="class-NAILS_Login.html">NAILS_Login</a></li> <li><a href="class-NAILS_Logout.html">NAILS_Logout</a></li> <li><a href="class-NAILS_Logs.html">NAILS_Logs</a></li> <li><a href="class-NAILS_Maintenance.html">NAILS_Maintenance</a></li> <li><a href="class-NAILS_Manager.html">NAILS_Manager</a></li> <li><a href="class-NAILS_Mfa_device.html">NAILS_Mfa_device</a></li> <li><a href="class-NAILS_Mfa_question.html">NAILS_Mfa_question</a></li> <li><a href="class-NAILS_Model.html">NAILS_Model</a></li> <li><a href="class-NAILS_Notify.html">NAILS_Notify</a></li> <li><a href="class-NAILS_Orders.html">NAILS_Orders</a></li> <li><a href="class-NAILS_Override.html">NAILS_Override</a></li> <li><a href="class-NAILS_Pagination.html">NAILS_Pagination</a></li> <li><a href="class-NAILS_Placeholder.html">NAILS_Placeholder</a></li> <li><a href="class-NAILS_Register.html">NAILS_Register</a></li> <li><a href="class-NAILS_Render.html">NAILS_Render</a></li> <li><a href="class-NAILS_Reset_Password.html">NAILS_Reset_Password</a></li> <li><a href="class-NAILS_Router.html">NAILS_Router</a></li> <li><a href="class-NAILS_Routes_model.html">NAILS_Routes_model</a></li> <li><a href="class-NAILS_Scale.html">NAILS_Scale</a></li> <li><a href="class-NAILS_Serve.html">NAILS_Serve</a></li> <li><a href="class-NAILS_Shop.html" class="invalid">NAILS_Shop</a></li> <li><a href="class-NAILS_Shop_attribute_model.html">NAILS_Shop_attribute_model</a></li> <li><a href="class-NAILS_Shop_basket_model.html">NAILS_Shop_basket_model</a></li> <li><a href="class-NAILS_Shop_brand_model.html">NAILS_Shop_brand_model</a></li> <li><a href="class-NAILS_Shop_category_model.html">NAILS_Shop_category_model</a></li> <li><a href="class-NAILS_Shop_collection_model.html">NAILS_Shop_collection_model</a></li> <li><a href="class-NAILS_Shop_Controller.html">NAILS_Shop_Controller</a></li> <li><a href="class-NAILS_Shop_currency_model.html">NAILS_Shop_currency_model</a></li> <li><a href="class-NAILS_Shop_feed_model.html">NAILS_Shop_feed_model</a></li> <li><a href="class-NAILS_Shop_inform_product_available_model.html">NAILS_Shop_inform_product_available_model</a></li> <li><a href="class-NAILS_Shop_model.html">NAILS_Shop_model</a></li> <li><a href="class-NAILS_Shop_order_model.html">NAILS_Shop_order_model</a></li> <li><a href="class-NAILS_Shop_order_payment_model.html">NAILS_Shop_order_payment_model</a></li> <li><a href="class-NAILS_Shop_payment_gateway_model.html">NAILS_Shop_payment_gateway_model</a></li> <li><a href="class-NAILS_Shop_product_model.html">NAILS_Shop_product_model</a></li> <li><a href="class-NAILS_Shop_product_type_meta_model.html">NAILS_Shop_product_type_meta_model</a></li> <li><a href="class-NAILS_Shop_product_type_model.html">NAILS_Shop_product_type_model</a></li> <li><a href="class-NAILS_Shop_range_model.html">NAILS_Shop_range_model</a></li> <li><a href="class-NAILS_Shop_sale_model.html">NAILS_Shop_sale_model</a></li> <li><a href="class-NAILS_Shop_shipping_driver_model.html">NAILS_Shop_shipping_driver_model</a></li> <li><a href="class-NAILS_Shop_skin_checkout_model.html">NAILS_Shop_skin_checkout_model</a></li> <li><a href="class-NAILS_Shop_skin_front_model.html">NAILS_Shop_skin_front_model</a></li> <li><a href="class-NAILS_Shop_tag_model.html">NAILS_Shop_tag_model</a></li> <li><a href="class-NAILS_Shop_tax_rate_model.html">NAILS_Shop_tax_rate_model</a></li> <li><a href="class-NAILS_Shop_voucher_model.html">NAILS_Shop_voucher_model</a></li> <li><a href="class-NAILS_Sitemap.html">NAILS_Sitemap</a></li> <li><a href="class-NAILS_Sitemap_model.html">NAILS_Sitemap_model</a></li> <li><a href="class-NAILS_System.html">NAILS_System</a></li> <li><a href="class-NAILS_System_startup.html">NAILS_System_startup</a></li> <li><a href="class-NAILS_Testimonial_model.html">NAILS_Testimonial_model</a></li> <li><a href="class-NAILS_Thumb.html">NAILS_Thumb</a></li> <li><a href="class-NAILS_Tracker.html">NAILS_Tracker</a></li> <li><a href="class-NAILS_Unsubscribe.html">NAILS_Unsubscribe</a></li> <li><a href="class-NAILS_URI.html">NAILS_URI</a></li> <li><a href="class-NAILS_User_group_model.html">NAILS_User_group_model</a></li> <li><a href="class-NAILS_User_model.html">NAILS_User_model</a></li> <li><a href="class-NAILS_User_password_model.html">NAILS_User_password_model</a></li> <li><a href="class-NAILS_Verify.html">NAILS_Verify</a></li> <li><a href="class-NAILS_View_Online.html">NAILS_View_Online</a></li> <li><a href="class-NAILS_Zip.html">NAILS_Zip</a></li> <li><a href="class-Notify.html">Notify</a></li> <li><a href="class-Orders.html">Orders</a></li> <li><a href="class-Override.html">Override</a></li> <li><a href="class-Pdf.html">Pdf</a></li> <li><a href="class-Placeholder.html">Placeholder</a></li> <li><a href="class-Register.html">Register</a></li> <li><a href="class-Render.html">Render</a></li> <li><a href="class-Reset_Password.html">Reset_Password</a></li> <li><a href="class-Routes_model.html">Routes_model</a></li> <li><a href="class-Scale.html">Scale</a></li> <li><a href="class-Serve.html">Serve</a></li> <li><a href="class-Shop.html" class="invalid">Shop</a></li> <li><a href="class-Shop_attribute_model.html">Shop_attribute_model</a></li> <li><a href="class-Shop_basket_model.html">Shop_basket_model</a></li> <li><a href="class-Shop_brand_model.html">Shop_brand_model</a></li> <li><a href="class-Shop_category_model.html">Shop_category_model</a></li> <li><a href="class-Shop_collection_model.html">Shop_collection_model</a></li> <li><a href="class-Shop_currency_model.html">Shop_currency_model</a></li> <li><a href="class-Shop_feed_model.html">Shop_feed_model</a></li> <li><a href="class-Shop_inform_product_available_model.html">Shop_inform_product_available_model</a></li> <li><a href="class-Shop_model.html">Shop_model</a></li> <li><a href="class-Shop_order_model.html">Shop_order_model</a></li> <li><a href="class-Shop_order_payment_model.html">Shop_order_payment_model</a></li> <li><a href="class-Shop_payment_gateway_model.html">Shop_payment_gateway_model</a></li> <li><a href="class-Shop_product_model.html">Shop_product_model</a></li> <li><a href="class-Shop_product_type_meta_model.html">Shop_product_type_meta_model</a></li> <li><a href="class-Shop_product_type_model.html">Shop_product_type_model</a></li> <li><a href="class-Shop_range_model.html">Shop_range_model</a></li> <li><a href="class-Shop_sale_model.html">Shop_sale_model</a></li> <li><a href="class-Shop_shipping_driver_flatrate.html">Shop_shipping_driver_flatrate</a></li> <li><a href="class-Shop_shipping_driver_model.html">Shop_shipping_driver_model</a></li> <li><a href="class-Shop_skin_checkout_model.html">Shop_skin_checkout_model</a></li> <li><a href="class-Shop_skin_front_model.html">Shop_skin_front_model</a></li> <li><a href="class-Shop_tag_model.html">Shop_tag_model</a></li> <li><a href="class-Shop_tax_rate_model.html">Shop_tax_rate_model</a></li> <li><a href="class-Shop_voucher_model.html">Shop_voucher_model</a></li> <li><a href="class-Sitemap.html">Sitemap</a></li> <li><a href="class-Sitemap_model.html">Sitemap_model</a></li> <li><a href="class-Social_signon.html">Social_signon</a></li> <li><a href="class-System.html">System</a></li> <li><a href="class-System_startup.html">System_startup</a></li> <li><a href="class-Testimonial_model.html">Testimonial_model</a></li> <li><a href="class-Thumb.html">Thumb</a></li> <li><a href="class-Tracker.html">Tracker</a></li> <li><a href="class-Unsubscribe.html">Unsubscribe</a></li> <li><a href="class-User_group_model.html">User_group_model</a></li> <li><a href="class-User_model.html">User_model</a></li> <li><a href="class-User_password_model.html">User_password_model</a></li> <li><a href="class-Verify.html">Verify</a></li> <li><a href="class-View_online.html">View_online</a></li> <li><a href="class-Zip.html">Zip</a></li> </ul> <h3>Interfaces</h3> <ul> <li><a href="class-Cdn_driver.html">Cdn_driver</a></li> <li><a href="class-CORE_NAILS_ErrorHandler_Interface.html">CORE_NAILS_ErrorHandler_Interface</a></li> <li class="active"><a href="class-Shop_shipping_driver.html">Shop_shipping_driver</a></li> </ul> <h3>Traits</h3> <ul> <li><a href="class-NAILS_COMMON_TRAIT_CACHING.html">NAILS_COMMON_TRAIT_CACHING</a></li> <li><a href="class-NAILS_COMMON_TRAIT_ERROR_HANDLING.html">NAILS_COMMON_TRAIT_ERROR_HANDLING</a></li> <li><a href="class-NAILS_COMMON_TRAIT_GETCOUNT_COMMON.html">NAILS_COMMON_TRAIT_GETCOUNT_COMMON</a></li> </ul> <h3>Functions</h3> <ul> <li><a href="function-_db_flush_caches.html">_db_flush_caches</a></li> <li><a href="function-_db_reset_active_record.html">_db_reset_active_record</a></li> <li><a href="function-_genderise.html">_genderise</a></li> <li><a href="function-_LOG.html">_LOG</a></li> <li><a href="function-_LOG_DUMMY_MODE.html">_LOG_DUMMY_MODE</a></li> <li><a href="function-_LOG_FILE.html">_LOG_FILE</a></li> <li><a href="function-_LOG_MUTE_OUTPUT.html">_LOG_MUTE_OUTPUT</a></li> <li><a href="function-_NAILS_ERROR.html">_NAILS_ERROR</a></li> <li><a href="function-_NAILS_GET_COMPONENTS.html">_NAILS_GET_COMPONENTS</a></li> <li><a href="function-_NAILS_GET_DRIVERS.html">_NAILS_GET_DRIVERS</a></li> <li><a href="function-_NAILS_GET_MODULES.html">_NAILS_GET_MODULES</a></li> <li><a href="function-_NAILS_GET_SKINS.html">_NAILS_GET_SKINS</a></li> <li><a href="function-_NAILS_MIN_PHP_VERSION.html">_NAILS_MIN_PHP_VERSION</a></li> <li><a href="function-active_user.html">active_user</a></li> <li><a href="function-addTrailingSlash.html">addTrailingSlash</a></li> <li><a href="function-app_notification.html">app_notification</a></li> <li><a href="function-app_notification_notify.html">app_notification_notify</a></li> <li><a href="function-app_setting.html">app_setting</a></li> <li><a href="function-array_search_multi.html">array_search_multi</a></li> <li><a href="function-array_sort_multi.html">array_sort_multi</a></li> <li><a href="function-array_unique_multi.html">array_unique_multi</a></li> <li><a href="function-blog_latest_posts.html">blog_latest_posts</a></li> <li><a href="function-blog_posts_with_association.html">blog_posts_with_association</a></li> <li><a href="function-blog_posts_with_category.html">blog_posts_with_category</a></li> <li><a href="function-blog_posts_with_tag.html">blog_posts_with_tag</a></li> <li><a href="function-calculate_age.html">calculate_age</a></li> <li><a href="function-camelcase_to_underscore.html">camelcase_to_underscore</a></li> <li><a href="function-cdn_avatar.html">cdn_avatar</a></li> <li><a href="function-cdn_blank_avatar.html">cdn_blank_avatar</a></li> <li><a href="function-cdn_expiring_url.html">cdn_expiring_url</a></li> <li><a href="function-cdn_placeholder.html">cdn_placeholder</a></li> <li><a href="function-cdn_scale.html">cdn_scale</a></li> <li><a href="function-cdn_serve.html">cdn_serve</a></li> <li><a href="function-cdn_serve_zipped.html">cdn_serve_zipped</a></li> <li><a href="function-cdn_thumb.html">cdn_thumb</a></li> <li><a href="function-cdnManageUrl.html">cdnManageUrl</a></li> <li><a href="function-clean.html">clean</a></li> <li><a href="function-cmsBlock.html">cmsBlock</a></li> <li><a href="function-cmsMenu.html">cmsMenu</a></li> <li><a href="function-cmsSlider.html">cmsSlider</a></li> <li><a href="function-create_event.html">create_event</a></li> <li><a href="function-datepicker.html">datepicker</a></li> <li><a href="function-dropdown_days.html">dropdown_days</a></li> <li><a href="function-dropdown_hours.html">dropdown_hours</a></li> <li><a href="function-dropdown_minutes.html">dropdown_minutes</a></li> <li><a href="function-dropdown_months.html">dropdown_months</a></li> <li><a href="function-dropdown_years.html">dropdown_years</a></li> <li><a href="function-dump.html">dump</a></li> <li><a href="function-dumpanddie.html">dumpanddie</a></li> <li><a href="function-form_email.html">form_email</a></li> <li><a href="function-form_field.html">form_field</a></li> <li><a href="function-form_field_boolean.html">form_field_boolean</a></li> <li><a href="function-form_field_checkbox.html">form_field_checkbox</a></li> <li><a href="function-form_field_date.html">form_field_date</a></li> <li><a href="function-form_field_datetime.html">form_field_datetime</a></li> <li><a href="function-form_field_dropdown.html">form_field_dropdown</a></li> <li><a href="function-form_field_dropdown_multiple.html">form_field_dropdown_multiple</a></li> <li><a href="function-form_field_email.html">form_field_email</a></li> <li><a href="function-form_field_mm.html">form_field_mm</a></li> <li><a href="function-form_field_mm_image.html">form_field_mm_image</a></li> <li><a href="function-form_field_multiimage.html">form_field_multiimage</a></li> <li><a href="function-form_field_password.html">form_field_password</a></li> <li><a href="function-form_field_radio.html">form_field_radio</a></li> <li><a href="function-form_field_submit.html">form_field_submit</a></li> <li><a href="function-form_field_text.html">form_field_text</a></li> <li><a href="function-form_field_textarea.html">form_field_textarea</a></li> <li><a href="function-form_field_wysiwyg.html">form_field_wysiwyg</a></li> <li><a href="function-form_open.html">form_open</a></li> <li><a href="function-format_bytes.html">format_bytes</a></li> <li><a href="function-genderise.html">genderise</a></li> <li><a href="function-get_basket.html">get_basket</a></li> <li><a href="function-get_basket_count.html">get_basket_count</a></li> <li><a href="function-get_basket_total.html">get_basket_total</a></li> <li><a href="function-get_ext_from_mime.html">get_ext_from_mime</a></li> <li><a href="function-get_mime_from_ext.html">get_mime_from_ext</a></li> <li><a href="function-get_mime_from_file.html">get_mime_from_file</a></li> <li><a href="function-get_userobject.html">get_userobject</a></li> <li><a href="function-getControllerData.html">getControllerData</a></li> <li><a href="function-getDomainFromUrl.html">getDomainFromUrl</a></li> <li><a href="function-getRelativePath.html">getRelativePath</a></li> <li><a href="function-gravatar.html">gravatar</a></li> <li><a href="function-here.html">here</a></li> <li><a href="function-img.html">img</a></li> <li><a href="function-in_array_multi.html">in_array_multi</a></li> <li><a href="function-is_clean.html">is_clean</a></li> <li><a href="function-isIpInRange.html">isIpInRange</a></li> <li><a href="function-isModuleEnabled.html">isModuleEnabled</a></li> <li><a href="function-isPageSecure.html">isPageSecure</a></li> <li><a href="function-keyValueSection.html">keyValueSection</a></li> <li><a href="function-lang.html">lang</a></li> <li><a href="function-last_query.html">last_query</a></li> <li><a href="function-lastquery.html">lastquery</a></li> <li><a href="function-link_tag.html">link_tag</a></li> <li><a href="function-list_first_last.html">list_first_last</a></li> <li><a href="function-map.html">map</a></li> <li><a href="function-niceTime.html">niceTime</a></li> <li><a href="function-possessionise.html">possessionise</a></li> <li><a href="function-readFileChunked.html">readFileChunked</a></li> <li><a href="function-redirect.html">redirect</a></li> <li><a href="function-return_bytes.html">return_bytes</a></li> <li><a href="function-secure_site_url.html">secure_site_url</a></li> <li><a href="function-sendDeveloperMail.html">sendDeveloperMail</a></li> <li><a href="function-set_app_setting.html">set_app_setting</a></li> <li><a href="function-setControllerData.html">setControllerData</a></li> <li><a href="function-show_401.html">show_401</a></li> <li><a href="function-showFatalError.html">showFatalError</a></li> <li><a href="function-site_url.html">site_url</a></li> <li><a href="function-special_chars.html">special_chars</a></li> <li><a href="function-str_lreplace.html">str_lreplace</a></li> <li><a href="function-stringToBoolean.html">stringToBoolean</a></li> <li><a href="function-tel.html">tel</a></li> <li><a href="function-title_case.html">title_case</a></li> <li><a href="function-toNailsDate.html">toNailsDate</a></li> <li><a href="function-toNailsDatetime.html">toNailsDatetime</a></li> <li><a href="function-toUserDate.html">toUserDate</a></li> <li><a href="function-toUserDatetime.html">toUserDatetime</a></li> <li><a href="function-unauthorised.html">unauthorised</a></li> <li><a href="function-underscore_to_camelcase.html">underscore_to_camelcase</a></li> <li><a href="function-userHasPermission.html">userHasPermission</a></li> <li class="active"><a href="function-valid_email.html">valid_email</a></li> </ul> </div> </div> </div> <div id="splitter"></div> <div id="right"> <div id="rightInner"> <pre id="source"><code><span id="1" class="l"><a href="#1"> 1 </a><span class="xlang">&lt;?php</span> </span><span id="2" class="l"><a href="#2"> 2 </a> </span><span id="3" class="l"><a href="#3"> 3 </a><span class="php-comment">/** </span></span><span id="4" class="l"><a href="#4"> 4 </a><span class="php-comment"> * Provides enhanced logging facilities </span></span><span id="5" class="l"><a href="#5"> 5 </a><span class="php-comment"> * @todo : Deprecate this in favour of something like monolog </span></span><span id="6" class="l"><a href="#6"> 6 </a><span class="php-comment"> * </span></span><span id="7" class="l"><a href="#7"> 7 </a><span class="php-comment"> * @package Nails </span></span><span id="8" class="l"><a href="#8"> 8 </a><span class="php-comment"> * @subpackage common </span></span><span id="9" class="l"><a href="#9"> 9 </a><span class="php-comment"> * @category Library </span></span><span id="10" class="l"><a href="#10"> 10 </a><span class="php-comment"> * @author Nails Dev Team </span></span><span id="11" class="l"><a href="#11"> 11 </a><span class="php-comment"> * @link </span></span><span id="12" class="l"><a href="#12"> 12 </a><span class="php-comment"> */</span> </span><span id="13" class="l"><a href="#13"> 13 </a> </span><span id="14" class="l"><a href="#14"> 14 </a><span class="php-keyword1">class</span> Logger </span><span id="15" class="l"><a href="#15"> 15 </a>{ </span><span id="16" class="l"><a href="#16"> 16 </a> <span class="php-keyword1">private</span> <span class="php-var">$log</span>; </span><span id="17" class="l"><a href="#17"> 17 </a> <span class="php-keyword1">private</span> <span class="php-var">$isCli</span>; </span><span id="18" class="l"><a href="#18"> 18 </a> <span class="php-keyword1">public</span> <span class="php-var">$mute_output</span>; </span><span id="19" class="l"><a href="#19"> 19 </a> <span class="php-keyword1">public</span> <span class="php-var">$dummy_mode</span>; </span><span id="20" class="l"><a href="#20"> 20 </a> </span><span id="21" class="l"><a href="#21"> 21 </a> <span class="php-comment">// --------------------------------------------------------------------------</span> </span><span id="22" class="l"><a href="#22"> 22 </a> </span><span id="23" class="l"><a href="#23"> 23 </a> <span class="php-comment">/** </span></span><span id="24" class="l"><a href="#24"> 24 </a><span class="php-comment"> * Constructor </span></span><span id="25" class="l"><a href="#25"> 25 </a><span class="php-comment"> **/</span> </span><span id="26" class="l"><a href="#26"> 26 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> __construct() </span><span id="27" class="l"><a href="#27"> 27 </a> { </span><span id="28" class="l"><a href="#28"> 28 </a> <span class="php-comment">// Load helper</span> </span><span id="29" class="l"><a href="#29"> 29 </a> get_instance()-&gt;load-&gt;helper(<span class="php-quote">'file'</span>); </span><span id="30" class="l"><a href="#30"> 30 </a> </span><span id="31" class="l"><a href="#31"> 31 </a> <span class="php-comment">// --------------------------------------------------------------------------</span> </span><span id="32" class="l"><a href="#32"> 32 </a> </span><span id="33" class="l"><a href="#33"> 33 </a> <span class="php-comment">// On the CLI?</span> </span><span id="34" class="l"><a href="#34"> 34 </a> <span class="php-var">$this</span>-&gt;isCli = get_instance()-&gt;input-&gt;is_cli_request(); </span><span id="35" class="l"><a href="#35"> 35 </a> </span><span id="36" class="l"><a href="#36"> 36 </a> <span class="php-comment">// --------------------------------------------------------------------------</span> </span><span id="37" class="l"><a href="#37"> 37 </a> </span><span id="38" class="l"><a href="#38"> 38 </a> <span class="php-comment">// Define defaults</span> </span><span id="39" class="l"><a href="#39"> 39 </a> <span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span> = <span class="php-keyword1">new</span> stdClass(); </span><span id="40" class="l"><a href="#40"> 40 </a> <span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;exists = <span class="php-keyword1">false</span>; </span><span id="41" class="l"><a href="#41"> 41 </a> <span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;<span class="php-keyword2">file</span> = DEPLOY_LOG_DIR . <span class="php-quote">'log-'</span> . <span class="php-keyword2">date</span>(<span class="php-quote">'Y-m-d'</span>) . <span class="php-quote">'.php'</span>; </span><span id="42" class="l"><a href="#42"> 42 </a> <span class="php-var">$this</span>-&gt;mute_output = <span class="php-keyword1">false</span>; </span><span id="43" class="l"><a href="#43"> 43 </a> <span class="php-var">$this</span>-&gt;dummy_mode = <span class="php-keyword1">false</span>; </span><span id="44" class="l"><a href="#44"> 44 </a> } </span><span id="45" class="l"><a href="#45"> 45 </a> </span><span id="46" class="l"><a href="#46"> 46 </a> <span class="php-comment">// --------------------------------------------------------------------------</span> </span><span id="47" class="l"><a href="#47"> 47 </a> </span><span id="48" class="l"><a href="#48"> 48 </a> <span class="php-comment">/** </span></span><span id="49" class="l"><a href="#49"> 49 </a><span class="php-comment"> * Writes a line to the log </span></span><span id="50" class="l"><a href="#50"> 50 </a><span class="php-comment"> * @param string </span></span><span id="51" class="l"><a href="#51"> 51 </a><span class="php-comment"> * @return void </span></span><span id="52" class="l"><a href="#52"> 52 </a><span class="php-comment"> **/</span> </span><span id="53" class="l"><a href="#53"> 53 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> line(<span class="php-var">$line</span> = <span class="php-quote">''</span>) </span><span id="54" class="l"><a href="#54"> 54 </a> { </span><span id="55" class="l"><a href="#55"> 55 </a> <span class="php-comment">// Is dummy mode enabled? If it is then don't do anything.</span> </span><span id="56" class="l"><a href="#56"> 56 </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;dummy_mode) { </span><span id="57" class="l"><a href="#57"> 57 </a> </span><span id="58" class="l"><a href="#58"> 58 </a> <span class="php-keyword1">return</span> <span class="php-keyword1">true</span>; </span><span id="59" class="l"><a href="#59"> 59 </a> } </span><span id="60" class="l"><a href="#60"> 60 </a> </span><span id="61" class="l"><a href="#61"> 61 </a> <span class="php-comment">// --------------------------------------------------------------------------</span> </span><span id="62" class="l"><a href="#62"> 62 </a> </span><span id="63" class="l"><a href="#63"> 63 </a> <span class="php-comment">// If the log file doesn't exist (or we haven't checked already), attempt to create it</span> </span><span id="64" class="l"><a href="#64"> 64 </a> <span class="php-keyword1">if</span> (!<span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;exists) { </span><span id="65" class="l"><a href="#65"> 65 </a> </span><span id="66" class="l"><a href="#66"> 66 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">file_exists</span>(<span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;<span class="php-keyword2">file</span>)) { </span><span id="67" class="l"><a href="#67"> 67 </a> </span><span id="68" class="l"><a href="#68"> 68 </a> <span class="php-comment">// Check directory is there</span> </span><span id="69" class="l"><a href="#69"> 69 </a> <span class="php-var">$dir</span> = <span class="php-keyword2">dirname</span>(<span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;<span class="php-keyword2">file</span>); </span><span id="70" class="l"><a href="#70"> 70 </a> </span><span id="71" class="l"><a href="#71"> 71 </a> <span class="php-keyword1">if</span> (!<span class="php-keyword2">is_dir</span>(<span class="php-var">$dir</span>)) { </span><span id="72" class="l"><a href="#72"> 72 </a> </span><span id="73" class="l"><a href="#73"> 73 </a> <span class="php-comment">// Create structure</span> </span><span id="74" class="l"><a href="#74"> 74 </a> <span class="php-keyword2">mkdir</span>(<span class="php-var">$dir</span>, <span class="php-num">0750</span>, <span class="php-keyword1">true</span>); </span><span id="75" class="l"><a href="#75"> 75 </a> } </span><span id="76" class="l"><a href="#76"> 76 </a> </span><span id="77" class="l"><a href="#77"> 77 </a> <span class="php-comment">// --------------------------------------------------------------------------</span> </span><span id="78" class="l"><a href="#78"> 78 </a> </span><span id="79" class="l"><a href="#79"> 79 </a> <span class="php-var">$firstLine</span> = <span class="php-quote">'&lt;?php if !defined(\'BASEPATH\') exit(\'No direct script access allowed\'); ?&gt;'</span> . <span class="php-quote">&quot;\n\n&quot;</span>; </span><span id="80" class="l"><a href="#80"> 80 </a> <span class="php-keyword1">if</span> (write_file(<span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;<span class="php-keyword2">file</span>, <span class="php-var">$firstLine</span>)) { </span><span id="81" class="l"><a href="#81"> 81 </a> </span><span id="82" class="l"><a href="#82"> 82 </a> <span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;exists = <span class="php-keyword1">true</span>; </span><span id="83" class="l"><a href="#83"> 83 </a> </span><span id="84" class="l"><a href="#84"> 84 </a> } <span class="php-keyword1">else</span> { </span><span id="85" class="l"><a href="#85"> 85 </a> </span><span id="86" class="l"><a href="#86"> 86 </a> <span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;exists = <span class="php-keyword1">false</span>; </span><span id="87" class="l"><a href="#87"> 87 </a> } </span><span id="88" class="l"><a href="#88"> 88 </a> </span><span id="89" class="l"><a href="#89"> 89 </a> } <span class="php-keyword1">else</span> { </span><span id="90" class="l"><a href="#90"> 90 </a> </span><span id="91" class="l"><a href="#91"> 91 </a> <span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;exists = <span class="php-keyword1">true</span>; </span><span id="92" class="l"><a href="#92"> 92 </a> } </span><span id="93" class="l"><a href="#93"> 93 </a> } </span><span id="94" class="l"><a href="#94"> 94 </a> </span><span id="95" class="l"><a href="#95"> 95 </a> <span class="php-comment">// --------------------------------------------------------------------------</span> </span><span id="96" class="l"><a href="#96"> 96 </a> </span><span id="97" class="l"><a href="#97"> 97 </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;exists) { </span><span id="98" class="l"><a href="#98"> 98 </a> </span><span id="99" class="l"><a href="#99"> 99 </a> <span class="php-keyword1">if</span> (<span class="php-keyword1">empty</span>(<span class="php-var">$line</span>)) { </span><span id="100" class="l"><a href="#100">100 </a> </span><span id="101" class="l"><a href="#101">101 </a> write_file(<span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;<span class="php-keyword2">file</span>, <span class="php-quote">&quot;\n&quot;</span>, <span class="php-quote">'a'</span>); </span><span id="102" class="l"><a href="#102">102 </a> </span><span id="103" class="l"><a href="#103">103 </a> } <span class="php-keyword1">else</span> { </span><span id="104" class="l"><a href="#104">104 </a> </span><span id="105" class="l"><a href="#105">105 </a> write_file(<span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;<span class="php-keyword2">file</span>, <span class="php-quote">'INFO - '</span> . <span class="php-keyword2">date</span>(<span class="php-quote">'Y-m-d H:i:s'</span>) . <span class="php-quote">' --&gt; '</span> . <span class="php-keyword2">trim</span>(<span class="php-var">$line</span>) . <span class="php-quote">&quot;\n&quot;</span>, <span class="php-quote">'a'</span>); </span><span id="106" class="l"><a href="#106">106 </a> } </span><span id="107" class="l"><a href="#107">107 </a> } </span><span id="108" class="l"><a href="#108">108 </a> </span><span id="109" class="l"><a href="#109">109 </a> <span class="php-comment">// --------------------------------------------------------------------------</span> </span><span id="110" class="l"><a href="#110">110 </a> </span><span id="111" class="l"><a href="#111">111 </a> <span class="php-comment">// If we're working on the command line then pump it out there too</span> </span><span id="112" class="l"><a href="#112">112 </a> </span><span id="113" class="l"><a href="#113">113 </a> <span class="php-keyword1">if</span> (<span class="php-var">$this</span>-&gt;isCli) { </span><span id="114" class="l"><a href="#114">114 </a> </span><span id="115" class="l"><a href="#115">115 </a> <span class="php-keyword2">fwrite</span>(STDOUT, <span class="php-var">$line</span> . <span class="php-quote">&quot;\n&quot;</span>); </span><span id="116" class="l"><a href="#116">116 </a> } </span><span id="117" class="l"><a href="#117">117 </a> </span><span id="118" class="l"><a href="#118">118 </a> <span class="php-comment">// --------------------------------------------------------------------------</span> </span><span id="119" class="l"><a href="#119">119 </a> </span><span id="120" class="l"><a href="#120">120 </a> <span class="php-comment">// If we're not on production and the request is not CLI then echo to the browser</span> </span><span id="121" class="l"><a href="#121">121 </a> <span class="php-keyword1">if</span> (<span class="php-keyword2">strtoupper</span>(ENVIRONMENT) != <span class="php-quote">'PRODUCTION'</span> &amp;&amp; !<span class="php-var">$this</span>-&gt;isCli &amp;&amp; !<span class="php-var">$this</span>-&gt;mute_output) { </span><span id="122" class="l"><a href="#122">122 </a> </span><span id="123" class="l"><a href="#123">123 </a> @<span class="php-keyword2">ob_start</span>(); </span><span id="124" class="l"><a href="#124">124 </a> <span class="php-keyword1">echo</span> <span class="php-var">$line</span> . <span class="php-quote">&quot;&lt;br /&gt;\n&quot;</span>; </span><span id="125" class="l"><a href="#125">125 </a> @<span class="php-keyword2">ob_flush</span>(); </span><span id="126" class="l"><a href="#126">126 </a> } </span><span id="127" class="l"><a href="#127">127 </a> } </span><span id="128" class="l"><a href="#128">128 </a> </span><span id="129" class="l"><a href="#129">129 </a> <span class="php-comment">// --------------------------------------------------------------------------</span> </span><span id="130" class="l"><a href="#130">130 </a> </span><span id="131" class="l"><a href="#131">131 </a> <span class="php-comment">/** </span></span><span id="132" class="l"><a href="#132">132 </a><span class="php-comment"> * Change the file which is being logged to </span></span><span id="133" class="l"><a href="#133">133 </a><span class="php-comment"> * @param string </span></span><span id="134" class="l"><a href="#134">134 </a><span class="php-comment"> * @return void </span></span><span id="135" class="l"><a href="#135">135 </a><span class="php-comment"> **/</span> </span><span id="136" class="l"><a href="#136">136 </a> <span class="php-keyword1">public</span> <span class="php-keyword1">function</span> set_file(<span class="php-var">$file</span> = <span class="php-keyword1">null</span>) </span><span id="137" class="l"><a href="#137">137 </a> { </span><span id="138" class="l"><a href="#138">138 </a> <span class="php-comment">// Reset the log exists var so that line() checks again</span> </span><span id="139" class="l"><a href="#139">139 </a> <span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;exists = <span class="php-keyword1">false</span>; </span><span id="140" class="l"><a href="#140">140 </a> </span><span id="141" class="l"><a href="#141">141 </a> <span class="php-comment">// --------------------------------------------------------------------------</span> </span><span id="142" class="l"><a href="#142">142 </a> </span><span id="143" class="l"><a href="#143">143 </a> <span class="php-var">$this</span>-&gt;<span class="php-keyword2">log</span>-&gt;<span class="php-keyword2">file</span> = <span class="php-var">$file</span> ? FCPATH . APPPATH . <span class="php-quote">'logs/'</span> . <span class="php-var">$file</span> : FCPATH . APPPATH . <span class="php-quote">'logs/'</span> . <span class="php-keyword2">date</span>(<span class="php-quote">'Y-m-d'</span>) . <span class="php-quote">'.php'</span>; </span><span id="144" class="l"><a href="#144">144 </a> } </span><span id="145" class="l"><a href="#145">145 </a>} </span><span id="146" class="l"><a href="#146">146 </a></span></code></pre> </div> <div id="footer"> API documentation generated by <a href="http://apigen.org">ApiGen</a> </div> </div> <script src="resources/combined.js?2d1b11028defa2366a18dd5e1addc1c7d8076a23"></script> <script src="elementlist.js?c9595e87523a6c177e40603f9cab8b4c281ae5dc"></script> </body> </html>
{ "content_hash": "8667cbf395dd2399f17002e7b00270a4", "timestamp": "", "source": "github", "line_count": 665, "max_line_length": 537, "avg_line_length": 72.6, "alnum_prop": 0.6145321982642556, "repo_name": "nailsapp/site-docs", "id": "4d11703315414e3fb4eb8c65ebf8fe1c780e367e", "size": "48279", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "api/source-class-Logger.html", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "772" }, { "name": "CSS", "bytes": "17824" }, { "name": "HTML", "bytes": "49592840" }, { "name": "JavaScript", "bytes": "135518" }, { "name": "PHP", "bytes": "98915" } ], "symlink_target": "" }
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.facebook.presto.tests.hive; import io.prestodb.tempto.BeforeTestWithContext; import io.prestodb.tempto.ProductTest; import io.prestodb.tempto.query.QueryExecutor; import org.testng.annotations.Test; import static com.facebook.presto.tests.TestGroups.AUTHORIZATION; import static com.facebook.presto.tests.TestGroups.HIVE_CONNECTOR; import static com.facebook.presto.tests.TestGroups.PROFILE_SPECIFIC_TESTS; import static com.facebook.presto.tests.utils.QueryExecutors.connectToPresto; import static io.prestodb.tempto.assertions.QueryAssert.assertThat; import static io.prestodb.tempto.context.ContextDsl.executeWith; import static io.prestodb.tempto.sql.SqlContexts.createViewAs; import static java.lang.String.format; public class TestSqlStandardAccessControlChecks extends ProductTest { private String tableName; private QueryExecutor aliceExecutor; private QueryExecutor bobExecutor; @BeforeTestWithContext public void setup() { tableName = "alice_owned_table"; aliceExecutor = connectToPresto("alice@presto"); bobExecutor = connectToPresto("bob@presto"); aliceExecutor.executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); aliceExecutor.executeQuery(format("CREATE TABLE %s(month bigint, day bigint) WITH (partitioned_by = ARRAY['day'])", tableName)); } @Test(groups = {AUTHORIZATION, HIVE_CONNECTOR, PROFILE_SPECIFIC_TESTS}) public void testAccessControlSelect() { assertThat(() -> bobExecutor.executeQuery(format("SELECT * FROM %s", tableName))) .failsWithMessage(format("Access Denied: Cannot select from table default.%s", tableName)); aliceExecutor.executeQuery(format("GRANT SELECT ON %s TO bob", tableName)); assertThat(bobExecutor.executeQuery(format("SELECT * FROM %s", tableName))).hasNoRows(); } @Test(groups = {AUTHORIZATION, HIVE_CONNECTOR, PROFILE_SPECIFIC_TESTS}) public void testAccessControlSelectFromPartitions() { assertThat(() -> bobExecutor.executeQuery(format("SELECT * FROM \"%s$partitions\"", tableName))) .failsWithMessage(format("Access Denied: Cannot select from table default.%s$partitions", tableName)); aliceExecutor.executeQuery(format("GRANT SELECT ON %s TO bob", tableName)); assertThat(bobExecutor.executeQuery(format("SELECT * FROM \"%s$partitions\"", tableName))).hasNoRows(); } @Test(groups = {AUTHORIZATION, HIVE_CONNECTOR, PROFILE_SPECIFIC_TESTS}) public void testAccessControlShowPartitions() { assertThat(() -> bobExecutor.executeQuery(format("SHOW PARTITIONS FROM %s", tableName))) .failsWithMessage(format("Access Denied: Cannot select from table default.%s$partitions", tableName)); aliceExecutor.executeQuery(format("GRANT SELECT ON %s TO bob", tableName)); assertThat(bobExecutor.executeQuery(format("SHOW PARTITIONS FROM %s", tableName))).hasNoRows(); } @Test(groups = {AUTHORIZATION, HIVE_CONNECTOR, PROFILE_SPECIFIC_TESTS}) public void testAccessControlInsert() { assertThat(() -> bobExecutor.executeQuery(format("INSERT INTO %s VALUES (3, 22)", tableName))) .failsWithMessage(format("Access Denied: Cannot insert into table default.%s", tableName)); aliceExecutor.executeQuery(format("GRANT INSERT ON %s TO bob", tableName)); assertThat(bobExecutor.executeQuery(format("INSERT INTO %s VALUES (3, 22)", tableName))).hasRowsCount(1); assertThat(aliceExecutor.executeQuery(format("SELECT * FROM %s", tableName))).hasRowsCount(1); } @Test(groups = {AUTHORIZATION, HIVE_CONNECTOR, PROFILE_SPECIFIC_TESTS}) public void testAccessControlDelete() { aliceExecutor.executeQuery(format("INSERT INTO %s VALUES (4, 13)", tableName)); assertThat(aliceExecutor.executeQuery(format("SELECT * FROM %s", tableName))).hasRowsCount(1); assertThat(() -> bobExecutor.executeQuery(format("DELETE FROM %s WHERE day=4", tableName))) .failsWithMessage(format("Access Denied: Cannot delete from table default.%s", tableName)); aliceExecutor.executeQuery(format("GRANT DELETE ON %s TO bob", tableName)); bobExecutor.executeQuery(format("DELETE FROM %s", tableName)); assertThat(aliceExecutor.executeQuery(format("SELECT * FROM %s", tableName))).hasNoRows(); } @Test(groups = {AUTHORIZATION, HIVE_CONNECTOR, PROFILE_SPECIFIC_TESTS}) public void testAccessControlCreateTableAsSelect() { String createTableAsSelect = "bob_create_table_as_select"; assertThat(() -> bobExecutor.executeQuery(format("CREATE TABLE %s AS SELECT * FROM %s", createTableAsSelect, tableName))) .failsWithMessage(format("Access Denied: Cannot select from table default.%s", tableName)); aliceExecutor.executeQuery(format("GRANT SELECT ON %s TO bob", tableName)); bobExecutor.executeQuery(format("CREATE TABLE %s AS SELECT * FROM %s", createTableAsSelect, tableName)); assertThat(bobExecutor.executeQuery(format("SELECT * FROM %s", createTableAsSelect))).hasNoRows(); } @Test(groups = {AUTHORIZATION, HIVE_CONNECTOR, PROFILE_SPECIFIC_TESTS}) public void testAccessControlDropTable() { assertThat(() -> bobExecutor.executeQuery(format("DROP TABLE %s", tableName))) .failsWithMessage(format("Access Denied: Cannot drop table default.%s", tableName)); aliceExecutor.executeQuery(format("DROP TABLE %s", tableName)); assertThat(() -> aliceExecutor.executeQuery(format("SELECT * FROM %s", tableName))) .failsWithMessage("does not exist"); } @Test(groups = {AUTHORIZATION, HIVE_CONNECTOR, PROFILE_SPECIFIC_TESTS}) public void testAccessControlAlterTable() { assertThat(aliceExecutor.executeQuery(format("SHOW COLUMNS FROM %s", tableName))).hasRowsCount(2); assertThat(() -> bobExecutor.executeQuery(format("ALTER TABLE %s ADD COLUMN year bigint", tableName))) .failsWithMessage(format("Access Denied: Cannot add a column to table default.%s", tableName)); aliceExecutor.executeQuery(format("ALTER TABLE %s ADD COLUMN year bigint", tableName)); assertThat(aliceExecutor.executeQuery(format("SHOW COLUMNS FROM %s", tableName))).hasRowsCount(3); } @Test(groups = {AUTHORIZATION, HIVE_CONNECTOR, PROFILE_SPECIFIC_TESTS}) public void testAccessControlCreateView() { String viewName = "bob_view"; String selectTableSql = format("SELECT * FROM %s", tableName); String createViewSql = format("CREATE VIEW %s AS %s", viewName, selectTableSql); bobExecutor.executeQuery(format("DROP VIEW IF EXISTS %s", viewName)); assertThat(() -> bobExecutor.executeQuery(createViewSql)) .failsWithMessage(format("Access Denied: Cannot select from table default.%s", tableName)); aliceExecutor.executeQuery(format("GRANT SELECT ON %s TO bob", tableName)); assertThat(() -> bobExecutor.executeQuery(createViewSql)) .failsWithMessage(format("Access Denied: Cannot create view that selects from default.%s", tableName)); aliceExecutor.executeQuery(format("REVOKE SELECT ON %s FROM bob", tableName)); aliceExecutor.executeQuery(format("GRANT SELECT ON %s TO bob WITH GRANT OPTION", tableName)); executeWith(createViewAs(viewName, selectTableSql, bobExecutor), view -> { assertThat(bobExecutor.executeQuery(format("SELECT * FROM %s", view.getName()))) .hasNoRows(); }); } @Test(groups = {AUTHORIZATION, HIVE_CONNECTOR, PROFILE_SPECIFIC_TESTS}) public void testAccessControlDropView() { String viewName = "alice_view_for_drop"; aliceExecutor.executeQuery(format("CREATE VIEW %s AS SELECT * FROM %s", viewName, tableName)); assertThat(() -> bobExecutor.executeQuery(format("DROP VIEW %s", viewName))) .failsWithMessage(format("Access Denied: Cannot drop view default.%s", viewName)); aliceExecutor.executeQuery(format("DROP VIEW %s", viewName)); assertThat(() -> aliceExecutor.executeQuery(format("SELECT * FROM %s", viewName))) .failsWithMessage("does not exist"); } }
{ "content_hash": "f98205b975b9a06eea9341855dbe4c83", "timestamp": "", "source": "github", "line_count": 172, "max_line_length": 136, "avg_line_length": 51.68023255813954, "alnum_prop": 0.7017662279221509, "repo_name": "yuananf/presto", "id": "8ea3a494bd5e271bb9e5c1ecb47958719c1859bd", "size": "8889", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "presto-product-tests/src/main/java/com/facebook/presto/tests/hive/TestSqlStandardAccessControlChecks.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "26770" }, { "name": "CSS", "bytes": "12676" }, { "name": "HTML", "bytes": "55873" }, { "name": "Java", "bytes": "26815676" }, { "name": "JavaScript", "bytes": "201960" }, { "name": "Makefile", "bytes": "6822" }, { "name": "PLSQL", "bytes": "7831" }, { "name": "Python", "bytes": "6568" }, { "name": "SQLPL", "bytes": "8493" }, { "name": "Shell", "bytes": "25939" }, { "name": "Thrift", "bytes": "12038" } ], "symlink_target": "" }
package com.yummynoodlebar.config; import static junit.framework.TestCase.assertEquals; import static org.mockito.Matchers.any; import static org.mockito.Mockito.when; import java.util.Date; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.TransactionConfiguration; import org.springframework.transaction.annotation.Transactional; import com.yummynoodlebar.config.persistence.PersistenceConfig; import com.yummynoodlebar.core.domain.Order; import com.yummynoodlebar.core.services.MenuService; import com.yummynoodlebar.core.services.OrderService; import com.yummynoodlebar.events.menu.AllMenuItemsEvent; import com.yummynoodlebar.events.menu.RequestAllMenuItemsEvent; import com.yummynoodlebar.events.orders.AllOrdersEvent; import com.yummynoodlebar.events.orders.CreateOrderEvent; import com.yummynoodlebar.events.orders.RequestAllOrdersEvent; import com.yummynoodlebar.persistence.services.MenuPersistenceService; import com.yummynoodlebar.web.controller.fixture.WebDataFixture; @RunWith(SpringJUnit4ClassRunner.class) @ActiveProfiles("dev") @ContextConfiguration(classes = { CoreConfig.class, PersistenceConfig.class }) @Transactional @TransactionConfiguration(defaultRollback = true) public class CoreDomainIntegrationTest { @Autowired OrderService orderService; @Autowired @InjectMocks MenuService menuService; @Mock MenuPersistenceService menuPersistenceService; @Before public void setup() { MockitoAnnotations.initMocks(this); when(menuPersistenceService.requestAllMenuItems(any(RequestAllMenuItemsEvent.class))).thenReturn(WebDataFixture.allMenuItems()); } @Test public void thatAllMenuItemsReturned() { AllMenuItemsEvent allMenuItems = menuService.requestAllMenuItems(new RequestAllMenuItemsEvent()); assertEquals(3, allMenuItems.getMenuItemDetails().size()); } @Test public void addANewOrderToTheSystem() { Order order = new Order(new Date()); CreateOrderEvent ev = new CreateOrderEvent(order.toOrderDetails()); orderService.createOrder(ev); AllOrdersEvent allOrders = orderService.requestAllOrders(new RequestAllOrdersEvent()); assertEquals(1, allOrders.getOrdersDetails().size()); } }
{ "content_hash": "e8d6eef20c660d53f43d5e578ea8f15e", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 130, "avg_line_length": 34.532467532467535, "alnum_prop": 0.8108311395261376, "repo_name": "cnbcg/yummynoodlebar-project", "id": "e9660736cb416aaf55d73f62724d11f1a05dc01d", "size": "2659", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test/java/com/yummynoodlebar/config/CoreDomainIntegrationTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Groovy", "bytes": "3689" }, { "name": "Java", "bytes": "173754" }, { "name": "JavaScript", "bytes": "520" } ], "symlink_target": "" }
package com.herak.bouldershare.classes; import android.Manifest; import android.content.ContentValues; import android.content.Context; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Typeface; import android.net.Uri; import android.provider.MediaStore; import android.support.v4.content.ContextCompat; import android.util.TypedValue; import android.view.GestureDetector; import android.view.Gravity; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; import com.herak.bouldershare.MainActivity; import com.herak.bouldershare.R; import com.herak.bouldershare.data.BoulderContract; import com.herak.bouldershare.data.BoulderProvider; import com.herak.bouldershare.enums.HoldType; import java.io.IOException; import java.io.InputStream; import java.security.KeyStore; import java.text.BreakIterator; import java.util.ArrayList; import java.util.List; import static com.herak.bouldershare.enums.HoldType.REGULAR_HOLD; import static com.herak.bouldershare.enums.HoldType.START_HOLD; import static com.herak.bouldershare.enums.HoldType.TOP_HOLD; /** * Created by darko on 23.4.2017.. */ public class BoulderProblemView extends View { private List<Hold> holds = new ArrayList<Hold>(); private Paint paint; private int circleRadius; private int minCircleRadius; HoldType currentHoldType = START_HOLD; Bitmap mBoulderBitmap; ScaleGestureDetector scaleGestureDetector; GestureDetector mGestureDetector; boolean scaleOngoing; long lastScale; private BoulderProblemInfo mBoulderProblemInfo; MainActivity mainActivity; private Bitmap mScaledBitmap; private double mScaleFactor; public BoulderProblemInfo getBoulderProblemInfo() { return mBoulderProblemInfo; } public void setBoulderProblemInfo(BoulderProblemInfo mBoulderProblemInfo) { this.mBoulderProblemInfo = mBoulderProblemInfo; } private void updateBoulderProblemInfo(){ } public BoulderProblemView(Context context) { super(context); paint = new Paint(); this.mainActivity = (MainActivity) context; this.mScaleFactor = 0; this.mBoulderProblemInfo = mainActivity.getmBoulderProblemInfo(); if(mBoulderProblemInfo == null){ //mainActivity didn't contain the boulder problem info mBoulderProblemInfo = new BoulderProblemInfo(); } if (mBoulderProblemInfo.getInputBitmapUri() != null){ //load bitmap from input bitmap Uri int permissionCheck = ContextCompat.checkSelfPermission(mainActivity, Manifest.permission.WRITE_EXTERNAL_STORAGE); if (permissionCheck != PackageManager.PERMISSION_GRANTED){ mainActivity.changeFragment(MainActivity.FRAGMENT_TYPE.MAIN_FRAGMENT); Toast.makeText(getContext(), R.string.no_read_permission, Toast.LENGTH_LONG).show(); } try { this.mBoulderBitmap = MediaStore.Images.Media.getBitmap(context.getContentResolver(),mBoulderProblemInfo.getInputBitmapUri()); } catch (IOException e) { e.printStackTrace(); } }else{ this.mBoulderBitmap = mainActivity.getmBoulderBitmap(); this.mBoulderProblemInfo.setInputBitmapUri(mainActivity.getmBoulderBitmapUri()); } try { InputStream imageStream = context.getContentResolver().openInputStream(mBoulderProblemInfo.getInputBitmapUri()); this.mBoulderBitmap = MainActivity.modifyOrientation(this.mBoulderBitmap, imageStream); mainActivity.setmBoulderBitmap(this.mBoulderBitmap); } catch (IOException e) { e.printStackTrace(); } if( mBoulderProblemInfo.getHolds() != null && !mBoulderProblemInfo.getHolds().isEmpty() ){ this.holds = mBoulderProblemInfo.getHolds(); } // this.mBoulderProblemInfo.setInputBitmapUri(mainActivity.getmBoulderBitmapUri()); scaleGestureDetector = new ScaleGestureDetector(context, new MyOnScaleGestureListener(this)); mGestureDetector = new GestureDetector(context, new GestureListener()); } public Canvas drawOnCustomCanvas(Canvas canvas){ drawOnCanvas(canvas, mScaleFactor); return canvas; } private void drawOnCanvas(Canvas canvas, double scaleFactor) { if(mainActivity != null) { mBoulderProblemInfo = mainActivity.getmBoulderProblemInfo(); } circleRadius = Math.round(canvas.getHeight() / 25f); minCircleRadius = Math.round(circleRadius / 2f); paint.setStrokeWidth(Math.round(canvas.getHeight() / 160f)); paint.setStyle(Paint.Style.STROKE); for(Hold hold : holds){ switch(hold.type){ case REGULAR_HOLD: paint.setColor(Color.RED); break; case START_HOLD: paint.setColor(Color.GREEN); break; case TOP_HOLD: paint.setColor(Color.MAGENTA); break; } canvas.drawCircle((int) (hold.x * scaleFactor), (int) (hold.y * scaleFactor), (int) (hold.circleRadius * scaleFactor), paint); } if(mBoulderProblemInfo != null){ if(mBoulderProblemInfo.getAuthor() != null || mBoulderProblemInfo.getName() != null || mBoulderProblemInfo.getGrade() != null || mBoulderProblemInfo.getComment() != null ){ LinearLayout layout = new LinearLayout(mainActivity); Typeface roboto = Typeface.createFromAsset(mainActivity.getResources().getAssets(), "font/Roboto-Medium.ttf"); TextView textView = new TextView(mainActivity); textView.setText(getInfo(mBoulderProblemInfo)); textView.setVisibility(View.VISIBLE); textView.setBackgroundColor(Color.argb(180, 30, 30, 30)); textView.setTextColor(Color.parseColor("#45BBDC")); textView.setTypeface(roboto); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, (int) (16 * scaleFactor)); textView.setPadding(10, 10, 10, 10); if(scaleFactor == 1){ textView.setWidth(mScaledBitmap.getWidth()); }else{ textView.setWidth(canvas.getWidth()); } textView.setGravity(Gravity.CENTER); layout.addView(textView); layout.measure(canvas.getWidth(), canvas.getHeight()); layout.layout(0, 0, canvas.getWidth(), canvas.getHeight()); // canvas.translate(0, 0); layout.draw(canvas); } } } @Override protected void onDraw(Canvas canvas) { if(mBoulderBitmap != null){ if(mScaledBitmap == null){ if(mBoulderBitmap.getWidth()/canvas.getWidth() > mBoulderBitmap.getHeight()/canvas.getHeight()){ mScaleFactor = (double) mBoulderBitmap.getWidth()/canvas.getWidth(); }else{ mScaleFactor = (double) mBoulderBitmap.getHeight()/canvas.getHeight(); } mScaledBitmap = Bitmap.createScaledBitmap(mBoulderBitmap.copy(Bitmap.Config.ARGB_8888, true), (int) (mBoulderBitmap.getWidth()/mScaleFactor), (int) (mBoulderBitmap.getHeight()/mScaleFactor), true); } }else{ //mBoulderBitmap is null, abort drawing and go to main activity with a message mainActivity.changeFragment(MainActivity.FRAGMENT_TYPE.MAIN_FRAGMENT); Toast.makeText(getContext(), R.string.no_mboulderbitmap, Toast.LENGTH_LONG).show(); return; } mBoulderProblemInfo.setHolds(holds); //TODO decide if this should be moved somewhere done not as often (i.e. on database save) canvas.drawBitmap(mScaledBitmap, 0, 0, paint); drawOnCanvas(canvas, 1); } private String getInfo(BoulderProblemInfo boulderProblemInfo){ String infoText = ""; if(mBoulderProblemInfo.getName() != null && !mBoulderProblemInfo.getName().equals("")){ infoText = mBoulderProblemInfo.getName(); } if(mBoulderProblemInfo.getGrade() != null && !mBoulderProblemInfo.getGrade().equals("")){ if(infoText.length() > 0){ infoText += " (" + mBoulderProblemInfo.getGrade() + ")"; }else { infoText += mBoulderProblemInfo.getGrade(); } } if(mBoulderProblemInfo.getAuthor() != null && !mBoulderProblemInfo.getAuthor().equals("")){ if(infoText.length() > 0){ infoText += " by " + mBoulderProblemInfo.getAuthor(); }else{ infoText += mBoulderProblemInfo.getAuthor(); } } if(mBoulderProblemInfo.getComment() != null && !mBoulderProblemInfo.getComment().equals("")){ if(infoText.length() > 0){ infoText += "\n" + mBoulderProblemInfo.getComment(); }else{ infoText += mBoulderProblemInfo.getComment(); } } return infoText; } long actionDownTimestamp; private final long LONG_PRESS_DURATION = 500; private boolean moveInitiated = false; private Hold holdBeingMoved; @Override public boolean onTouchEvent(MotionEvent event) { scaleGestureDetector.onTouchEvent(event); mGestureDetector.onTouchEvent(event); if(event.getPointerCount() == 1) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: actionDownTimestamp = System.currentTimeMillis(); unsavedChangesDetected(); break; case MotionEvent.ACTION_MOVE: Hold currentPosition = new Hold(event.getX(), event.getY()); if(holdBeingMoved == null) holdBeingMoved = getExistingHold(currentPosition); if(moveInitiated || System.currentTimeMillis()-actionDownTimestamp > 200 && holdBeingMoved != null && holdBeingMoved.distanceFrom(currentPosition) > 10){ holdBeingMoved.x = currentPosition.x; holdBeingMoved.y = currentPosition.y; moveInitiated = true; invalidate(); } unsavedChangesDetected(); break; case MotionEvent.ACTION_UP: // if(actionDownTimestamp > lastScale & !moveInitiated) { // Hold hold = new Hold(event.getX(), event.getY()); // hold.type = currentHoldType; // hold.circleRadius = circleRadius; // // Hold existingHold = getExistingHold(hold); // if (System.currentTimeMillis() - actionDownTimestamp < LONG_PRESS_DURATION) { // //SHORT PRESS // if (existingHold != null) { // //Hold exists already so remove it // removeHold(existingHold); // } else { // holds.add(hold); // } // invalidate(); // } else { // //LONG PRESS // if (existingHold != null) { // changeHoldType(existingHold); // } else { // holds.add(hold); // } // invalidate(); // } // } moveInitiated = false; holdBeingMoved = null; unsavedChangesDetected(); break; } } return true; } private void changeHoldType(Hold hold) { //holds.remove(hold); switch(hold.type){ case REGULAR_HOLD: currentHoldType = TOP_HOLD; break; case START_HOLD: currentHoldType = REGULAR_HOLD; break; case TOP_HOLD: currentHoldType = START_HOLD; break; } hold.setType(currentHoldType); //holds.add(hold); } private void removeHold(Hold existingHold) { if(holds.contains(existingHold)) holds.remove(existingHold); } private Hold getExistingHold(Hold clickedHold) { for(Hold hold : holds){ if(clickedHold.distanceFrom(hold) <= hold.circleRadius) return hold; } return null; } public Bitmap getBitmap() { //this.measure(100, 100); //this.layout(0, 0, 100, 100); this.setDrawingCacheEnabled(true); this.buildDrawingCache(); Bitmap bmp = Bitmap.createBitmap(this.getDrawingCache()); this.setDrawingCacheEnabled(false); return bmp; } private class GestureListener extends GestureDetector.SimpleOnGestureListener { @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { return false; } @Override public boolean onSingleTapConfirmed(MotionEvent e) { unsavedChangesDetected(); Hold hold = new Hold(e.getX(), e.getY()); hold.type = currentHoldType; hold.circleRadius = circleRadius; Hold existingHold = getExistingHold(hold); if (existingHold != null) { //Hold exists already so remove it removeHold(existingHold); } else { holds.add(hold); } invalidate(); return super.onSingleTapUp(e); } @Override public boolean onDoubleTap(MotionEvent e) { unsavedChangesDetected(); Hold hold = new Hold(e.getX(), e.getY()); hold.type = currentHoldType; hold.circleRadius = circleRadius; Hold existingHold = getExistingHold(hold); if (existingHold != null) { changeHoldType(existingHold); invalidate(); } return super.onDoubleTap(e); } @Override public boolean onDown(MotionEvent e) { return super.onDown(e); } @Override public void onLongPress(MotionEvent e) { super.onLongPress(e); } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { return super.onScroll(e1, e2, distanceX, distanceY); } } public class MyOnScaleGestureListener extends ScaleGestureDetector.SimpleOnScaleGestureListener { private BoulderProblemView view; public MyOnScaleGestureListener(BoulderProblemView view){ this.view = view; } @Override public boolean onScale(ScaleGestureDetector detector) { unsavedChangesDetected(); float focusX = detector.getFocusX(); float focusY = detector.getFocusY(); Hold existingHold = view.getExistingHold(new Hold(focusX, focusY)); if(existingHold != null) { float scaleFactor = detector.getScaleFactor(); if(existingHold.circleRadius * scaleFactor > minCircleRadius) { existingHold.circleRadius *= scaleFactor; lastScale = System.currentTimeMillis(); invalidate(); return true; } } return false; } @Override public boolean onScaleBegin(ScaleGestureDetector detector) { scaleOngoing = true; return true; } @Override public void onScaleEnd(ScaleGestureDetector detector) { scaleOngoing = false; } } private void unsavedChangesDetected(){ mainActivity.setHasUnsavedChanges(true); mainActivity.setSaveIconVisibility(true); } }
{ "content_hash": "437e143dbfb379b4dccb3425b6dee996", "timestamp": "", "source": "github", "line_count": 470, "max_line_length": 213, "avg_line_length": 35.88085106382979, "alnum_prop": 0.5845588235294118, "repo_name": "DarkokraD/BoulderShare", "id": "dac58a7fc25fd57856ebd70d5ac318d012e524a2", "size": "16864", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/java/com/herak/bouldershare/classes/BoulderProblemView.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "111565" } ], "symlink_target": "" }
<?xml version="1.0" encoding="iso-8859-1" ?> <project name="MobileMedia-Cosmos-v6" default="full-build-and-run-default" basedir="."> <!-- Define all relevant properties here. --> <property name="workspace.dir" location="${basedir}"/> <!-- <property file="homeBuild.properties"/>--> <property file="labBuild.properties"/> <!-- <property file="laptopBuild.properties"/>--> <property name="antenna.jar" location="${antenna.home}//antenna-bin-0.9.12.jar"/> <!-- Define COSMOS library --> <!-- property name="cosmos-embedded.jar" location="${cosmos.home}/cosmos-embedded.jar"/ --> <!-- Define JRE 6 library --> <!-- property name="jre6.jar" location="${jre6.home}/lib/rt.jar"/ --> <!-- Define core MIDP libraries --> <!-- MIDP 1.0 CLDC 1.0 --> <property name="midpapi10.jar" location="${wtk.home}/lib/midpapi10.jar"/> <property name="cldcapi10.jar" location="${wtk.home}/lib/cldcapi10.jar"/> <!-- MIDP 2.0 CLDC 1.1 --> <property name="midpapi20.jar" location="${wtk.home}/lib/midpapi20.jar"/> <property name="cldcapi11.jar" location="${wtk.home}/lib/cldcapi11.jar"/> <!-- Define Third Party and optional MIDP Libraries --> <property name="wma11.jar" location="${wtk.home}/lib/wma11.jar"/> <property name="mmapi.jar" location="${wtk.home}/lib/mmapi.jar"/> <property name="jsr75.jar" location="${wtk.home}/lib/jsr75.jar"/> <!-- the libs below was not found --> <property name="moto730.zip" location="${motorola.home}/lib/i730/Motorola730.zip"/> <property name="blackberryLib.jar" location="${blackberry.jde.home}/lib/net_rim_api.jar"/> <property name="siemensLib.zip" location="${siemens.home}/SiemensJ2MElib.zip"/> <!-- Set the classpath to be used --> <!-- <property name="build.classpath" value="${midpapi20.jar};${cldcapi11.jar};${wma.jar};${mmapi.jar};${jsr75.jar};${moto730.zip};${siemensLib.zip};${blackberryLib.jar};${antenna.jar}"/>--> <property name="build.classpath" value="${wma11.jar};${midpapi20.jar};${cldcapi11.jar};${antenna.jar};${mmapi.jar}"/> <!-- property name="build.classpath" value="${midpapi20.jar};${cldcapi11.jar};${antenna.jar};${jre6.jar}"/ --> <!-- Directories created or used during the build process --> <property name="rapc-compiled.dir" location="${workspace.dir}/rapc-compiled"/> <property name="prc-compiled.dir" location="${workspace.dir}/prc-compiled"/> <property name="midp-preprocessed.dir" location="${workspace.dir}/midp-preprocessed"/> <property name="midp-compiled.dir" location="${workspace.dir}/midp-compiled"/> <property name="src.dir" location="${workspace.dir}/src"/> <property name="preverified.dir" location="${workspace.dir}/preverified"/> <property name="jar.dir" location="${workspace.dir}/jars"/> <property name="palm.dir" location="${workspace.dir}/palm"/> <property name="rim.dir" location="${workspace.dir}/rim"/> <property name="images.dir" location="${workspace.dir}/images"/> <!-- This resource is required for Antenna based tasks --> <!-- <taskdef resource="antenna.properties" classpath="${antenna.jar}"/> --> <taskdef resource="antenna.properties" classpath="${antenna.home}/antenna-bin-0.9.15-beta.jar"/> <!-- ============================================================= --> <!-- Full Build (Default Target) --> <!-- ============================================================= --> <target name="full-build"> <antcall target="clean" /> <antcall target="midp-preprocess" /> <antcall target="midp-compile" /> <antcall target="copy-image-files" /> <antcall target="midp-preverify" /> <antcall target="make-jar" /> </target> <target name="full-build-and-run-default"> <antcall target="clean" /> <antcall target="midp-preprocess" /> <antcall target="midp-compile" /> <antcall target="copy-image-files" /> <antcall target="midp-preverify" /> <antcall target="make-jar" /> <antcall target="run-default-phone-emulator" /> </target> <!-- ============================================================= --> <!-- Clean all targets --> <!-- ============================================================= --> <target name="clean" description="clean and create classes/jar dir, .ajesym files"> <!-- Delete all the directories and their contents --> <delete quiet="on" dir="${preverified.dir}"/> <delete quiet="on" dir="${midp-compiled.dir}"/> <delete quiet="on" dir="${midp-preprocessed.dir}"/> <delete quiet="on" dir="${rapc-compiled.dir}"/> <delete quiet="on" dir="${prc-compiled.dir}"/> <!-- Update the jar, don't delete it. This is only required for the Motorola application, which needs the extra property in the jad file --> <delete quiet="on"> <fileset dir="${jar.dir}" excludes="**/*.jad"/> </delete> <delete quiet="on"> <fileset dir="${workspace.dir}" includes="**/*.ajesym"/> </delete> <!-- Recreate the directories we just deleted --> <mkdir dir="${preverified.dir}"/> <mkdir dir="${midp-preprocessed.dir}/src"/> <mkdir dir="${midp-compiled.dir}"/> <mkdir dir="${rapc-compiled.dir}"/> <mkdir dir="${prc-compiled.dir}"/> <mkdir dir="${jar.dir}"/> </target> <!-- ============================================================= --> <!-- PreProcess MIDP classes using antenna J2ME Preprocessor --> <!-- ============================================================= --> <target name="midp-preprocess"> <wtkpreprocess srcdir="${src.dir}" destdir="${midp-preprocessed.dir}/src" symbols="${preprocessor.symbols}" verbose="true" indent="false"/> </target> <!-- ============================================================= --> <!-- Compile MIDP classes using standard midp (javac) compiler --> <!-- ============================================================= --> <target name="midp-compile"> <!-- NOTE: This is not used anymore. It has been replaced by the AspectJ Compiler Task --> <!-- For Motorola Build, only update jad so it includes property: iDEN-Midlet-Phone: MainUIMidlet10 --> <wtkjad jadfile="${jar.dir}/${jad.name}" jarfile="${midp-compiled.dir}/${jar.name}" name="${midlet.name}" update="true" vendor="Trevor Young" version="1.0.0"> <midlet name="${midlet.name}" class="${main.class}"/> </wtkjad> <!-- Compile everything, but don't preverify (yet}. Use bootclasspath to override MIDP 1.0/CLDC 1.0 apis--> <wtkbuild srcdir="${midp-preprocessed.dir}" destdir="${midp-compiled.dir}" preverify="true" bootclasspath="${build.classpath};"> </wtkbuild> <!-- Package the compiled classes into a JAR and JAD file --> <!-- Don't need to do this here <wtkpackage jarfile="${midp-compiled.dir}/${jar.name}" jadfile="${jar.dir}/${jad.name}" obfuscate="false" preverify="false" > <fileset dir="${workspace.dir}" includes="${main.class}.class"/> </wtkpackage> --> </target> <!-- ============================================================= --> <!-- Copy Image Files so they are bundled with the jar file --> <!-- ============================================================= --> <target name="copy-image-files"> <mkdir dir="${preverified.dir}/images"/> <copy todir="${preverified.dir}/images"> <fileset dir="${images.dir}"/> </copy> </target> <!-- ============================================================= --> <!-- Preverify MIDP classes, --> <!-- ============================================================= --> <target name="midp-preverify"> <wtkpreverify srcdir="${midp-compiled.dir}" destdir="${preverified.dir}" classpath="${build.classpath};" /> </target> <!-- ============================================================= --> <!-- Generate the final JAR file that will run on MIDP devices and update JAD--> <!-- ============================================================= --> <target name="make-jar"> <!-- Package the compiled classes into a JAR and JAD file --> <wtkpackage jarfile="${jar.dir}/${jar.name}" jadfile="${jar.dir}/${jad.name}" basedir="${preverified.dir}" obfuscate="false" preverify="false" > </wtkpackage> </target> <!-- ============================================================= --> <!-- Compile / convert Jar file for BlackBerry using rapc.exe compiler --> <!-- ============================================================= --> <target name="rapc-compile"> <exec executable="&quot;${blackberry.jde.home}/bin/rapc.exe&quot;"> <arg line="import=&quot;${blackberry.jde.home}/lib/net_rim_api.jar;&quot; codename=${midlet.name} -midlet &quot;${jar.dir}/${jar.name}&quot; &quot;${jar.dir}/${jad.name}&quot;"/> </exec> <copy todir="${rapc-compiled.dir}"> <fileset dir="${workspace.dir}"> <include name="*.debug"/> <include name="*.cod"/> <include name="*.cso"/> </fileset> </copy> <delete quiet="on"> <fileset dir="${workspace.dir}" includes="*.debug"/> <fileset dir="${workspace.dir}" includes="*.cso"/> <fileset dir="${workspace.dir}" includes="*.cod"/> </delete> </target> <!-- ============================================================= --> <!-- Convert Jar file for Palm OS using Sun MIDP converter --> <!-- ============================================================= --> <target name="make-prc"> <!-- <wtkmakeprc jadfile="${jar.dir}/${jad.name}" prcfile="${midlet.name}.prc"/> --> <exec executable="${palm.midp.home}/palmConverter.bat"> <arg line="${jar.dir}/${jad.name} ${jar.dir}/${jar.name}"/> </exec> </target> <!-- ============================================================= --> <!-- Run the Midlet in the standard Phone Emulator --> <!-- ============================================================= --> <target name="run-default-phone-emulator"> <!-- Start the MIDlet suite --> <wtkrun jadfile="jars/${jad.name}" device="DefaultColorPhone" wait="true" heapsize="2M"/> </target> <!-- ============================================================= --> <!-- Run the Midlet in the Motorola Phone Emulator --> <!-- ============================================================= --> <target name="run-motorola-V300-phone-emulator"> <exec executable="&quot;${motorola.home}/bin/jblend&quot;"> <arg line=" -Xdevice:V360_V361 -Xdescriptor:&quot;${jar.dir}/${jad.name}&quot;"/> </exec> </target> <!-- ============================================================= --> <!-- Run the Midlet in the Motorola Phone Emulator --> <!-- ============================================================= --> <target name="run-motorola-L6-phone-emulator"> <!-- Start the MIDlet suite --> <!-- <wtkrun jadfile="${jar.dir}/${jad.name}" device="DefaultColorPhone" wait="true"/> --> <exec executable="&quot;${motorola.home}/bin/jblend&quot;"> <arg line=" -Xdevice:L2_L6_L6i -Xdescriptor:&quot;${jar.dir}/${jad.name}&quot;"/> </exec> </target> <!-- ============================================================= --> <!-- Run the Midlet in the Siemens Phone Emulator --> <!-- ============================================================= --> <!--<target name="run-siemens-phone-emulator"> --> <!-- <echo>${jar.dir}\${jad.name}</echo>--> <!-- <exec executable="${siemens.home}/Emulators/S75/bin/emulator"> --> <!-- <arg line=" -Xdescriptor:&quot;${jar.dir}\${jad.name}&quot;"/>--> <!-- </exec> --> <!--</target> --> <target name="run-siemens-phone-emulator-CX65"> <exec executable="E:\Nelio\Aplicacoes para avaliacao\MobileMedia\siemens.bat"> </exec> </target> <!-- ============================================================= --> <!-- Run the Midlet in the Nokia 3410 Phone Emulator --> <!-- ============================================================= --> <target name="run-Sony Ericsson-phone-emulator"> <exec executable="${sonyericson.home}/bin/emulatorw.exe"> <arg line="-gui -Xdescriptor:&quot;${jar.dir}/${jad.name}&quot;"/> </exec> </target> <!-- Info Target: Echo usage and information about this build script --> <target name="info" > <echo> Insert any relevant help information here... </echo> </target> </project>
{ "content_hash": "94aed8c40093b72d106b488d7ee2824c", "timestamp": "", "source": "github", "line_count": 265, "max_line_length": 191, "avg_line_length": 47.550943396226415, "alnum_prop": 0.5167843821918895, "repo_name": "leotizzei/MobileMedia-Cosmos-v6", "id": "156e397e16df91a775146f332e2a449c8a017629", "size": "12601", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "build.xml", "mode": "33261", "license": "mit", "language": [ { "name": "Java", "bytes": "341303" }, { "name": "Shell", "bytes": "241" } ], "symlink_target": "" }
var Sequelize = require('sequelize'); module.exports = function(sequelize) { var Gratitude = sequelize.define('gratitudes', { entry: Sequelize.STRING(500), interface: Sequelize.STRING(10), datetime: Sequelize.DATE, userId: { type: Sequelize.INTEGER, references: { model: 'users', // Can be both a string representing the table name, or a reference to the model key: 'id' } } }); return Gratitude; };
{ "content_hash": "761e6e11fa145065f24d157a9650387f", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 104, "avg_line_length": 25.61111111111111, "alnum_prop": 0.6355748373101953, "repo_name": "scrumptiousAmpersand/journey", "id": "c9540d1c6d41d15224498bcbb2615367769ebed8", "size": "461", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "server/db/models/journals/journeys/gratitude.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "18757" }, { "name": "HTML", "bytes": "834" }, { "name": "JavaScript", "bytes": "225308" } ], "symlink_target": "" }
using System; using Jobs.Tasks.Events; namespace Jobs.Reports { /// <summary> /// A description of a task taken as a snapshot. /// </summary> public interface iTaskReport { /// <summary> /// The history of events for this task. /// </summary> iEventRecorder EventRecorder { get; } /// <summary> /// The task ID. /// </summary> Guid ID { get; } /// <summary> /// The name of the task. /// </summary> string Name { get; } } }
{ "content_hash": "17ca976ec12e9c1693ffcd40379aaa7b", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 52, "avg_line_length": 21.03846153846154, "alnum_prop": 0.5009140767824497, "repo_name": "thinkingmedia/gems", "id": "a435cafa59b34c64f17b3fc37ebb626b21c97c03", "size": "549", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Jobs/Reports/iTaskReport.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "855132" }, { "name": "HTML", "bytes": "21249" } ], "symlink_target": "" }
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf # Data sets IRIS_TRAINING = "./iris/iris_training.csv" IRIS_TEST = "./iris/iris_test.csv" # Load datasets. # csv 文件读取方法 training_set = tf.contrib.learn.datasets.base.load_csv_with_header( filename=IRIS_TRAINING, target_dtype=np.int, features_dtype=np.float32) test_set = tf.contrib.learn.datasets.base.load_csv_with_header( filename=IRIS_TEST, target_dtype=np.int, features_dtype=np.float32) #%% train # Specify that all features have real-value data # 表示所有输入数据是4维实值向量 feature_columns = [tf.contrib.layers.real_valued_column("", dimension=4)] # Build 3 layer DNN with 10, 20, 10 units respectively. classifier = tf.contrib.learn.DNNClassifier(feature_columns=feature_columns, # 指定特性 # 指定隐含层神经元个数 hidden_units=[10, 20, 10], n_classes=3, # 指定输出层 model_dir="./iris_model") # 指定输出文件夹 def get_train_inputs(): # Define the training inputs x = tf.constant(training_set.data) y = tf.constant(training_set.target) return x, y # Fit model. classifier.fit(input_fn=get_train_inputs, steps=2000) def get_test_inputs(): # Define the test inputs x = tf.constant(test_set.data) y = tf.constant(test_set.target) return x, y #%% Evaluate accuracy. accuracy_score = classifier.evaluate(input_fn=get_test_inputs, steps=1)["accuracy"] print("\nTest Accuracy: {0:f}\n".format(accuracy_score)) def new_samples(): # Classify two new flower samples. return np.array( [[6.4, 3.2, 4.5, 1.5], [5.8, 3.1, 5.0, 1.7]], dtype=np.float32) predictions = list(classifier.predict_classes(input_fn=new_samples)) print( "New Samples, Class Predictions: {}\n" .format(predictions))
{ "content_hash": "3403df2f4fbe3e06b29821ff54776cac", "timestamp": "", "source": "github", "line_count": 69, "max_line_length": 84, "avg_line_length": 29.231884057971016, "alnum_prop": 0.623202776400595, "repo_name": "yu961549745/tfnote", "id": "18fb92a87eb20616116ae6faf6ec42ecfd1ed6ff", "size": "2123", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ls08_tf.contrib.lean.py", "mode": "33188", "license": "mit", "language": [ { "name": "Matlab", "bytes": "1974" }, { "name": "Python", "bytes": "37417" } ], "symlink_target": "" }
package asw.socket.server.connector; import asw.socket.service.Service; import java.net.*; import java.io.*; import java.util.logging.Logger; /* Remote proxy lato server per il servizio Service. */ public class ServiceServerTCPProxy { /* logger */ private Logger logger = Logger.getLogger("asw.socket.server.connector"); private Service service; // il vero servizio private int port; // porta per il servizio public ServiceServerTCPProxy(Service service, int port) { this.service = service; this.port = port; } public void run() { try { /* crea il server socket su cui ascoltare/ricevere richieste */ ServerSocket listenSocket = new ServerSocket(port); /* per il server, disabilita il timeout */ listenSocket.setSoTimeout(0); while (true) { /* aspetta/accetta una richiesta - crea il relativa socket */ Socket clientSocket = listenSocket.accept(); // bloccante /* la richiesta sara' gestita in un nuovo popup thread, separato: * crea e avvia il nuovo thread */ ServerThread thread = new ServerThread(clientSocket, service); thread.start(); /* poi torna immediatamente ad aspettare la richiesta successiva */ } } catch (IOException e) { logger.info("Server Proxy: IO Exception: " + e.getMessage()); } } }
{ "content_hash": "faab230e5aa7aeaad4b1f5228ebfce12", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 77, "avg_line_length": 31.555555555555557, "alnum_prop": 0.6387323943661972, "repo_name": "aswroma3/asw", "id": "4dfe33a5a5b3560d36eb66789f7fc24e723e8d14", "size": "1420", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "projects/asw-815-connettori-distribuiti/b-client-server-tcp/server/src/main/java/asw/socket/server/connector/ServiceServerTCPProxy.java", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "26798" }, { "name": "Java", "bytes": "321724" }, { "name": "Puppet", "bytes": "405" }, { "name": "Shell", "bytes": "22231" } ], "symlink_target": "" }
.mdc-dialog, .mdc-dialog__scrim { position: fixed; top: 0; left: 0; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; height: 100%; } .mdc-dialog { display: none; z-index: 7; } .mdc-dialog .mdc-dialog__surface { background-color: #fff; /* @alternate */ background-color: var(--mdc-theme-surface, #fff); } .mdc-dialog .mdc-dialog__scrim { background-color: rgba(0, 0, 0, 0.32); } .mdc-dialog .mdc-dialog__title { color: rgba(0, 0, 0, 0.87); } .mdc-dialog .mdc-dialog__content { color: rgba(0, 0, 0, 0.6); } .mdc-dialog.mdc-dialog--scrollable .mdc-dialog__title, .mdc-dialog.mdc-dialog--scrollable .mdc-dialog__actions { border-color: rgba(0, 0, 0, 0.12); } .mdc-dialog .mdc-dialog__surface { min-width: 280px; } @media (max-width: 592px) { .mdc-dialog .mdc-dialog__surface { max-width: calc(100vw - 32px); } } @media (min-width: 592px) { .mdc-dialog .mdc-dialog__surface { max-width: 560px; } } .mdc-dialog .mdc-dialog__surface { max-height: calc(100% - 32px); } @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { .mdc-dialog .mdc-dialog__container { /* stylelint-disable */ /* stylelint-enable*/ } } .mdc-dialog .mdc-dialog__surface { border-radius: 4px; } .mdc-dialog__scrim { opacity: 0; z-index: -1; } .mdc-dialog__container { display: flex; flex-direction: row; align-items: center; justify-content: space-around; box-sizing: border-box; height: 100%; -webkit-transform: scale(0.8); transform: scale(0.8); opacity: 0; pointer-events: none; } .mdc-dialog__surface { box-shadow: 0px 11px 15px -7px rgba(0, 0, 0, 0.2), 0px 24px 38px 3px rgba(0, 0, 0, 0.14), 0px 9px 46px 8px rgba(0, 0, 0, 0.12); display: flex; flex-direction: column; flex-grow: 0; flex-shrink: 0; box-sizing: border-box; max-width: 100%; max-height: 100%; pointer-events: auto; overflow-y: auto; } .mdc-dialog[dir=rtl] .mdc-dialog__surface, [dir=rtl] .mdc-dialog .mdc-dialog__surface { /* @noflip */ text-align: right; } .mdc-dialog__title { display: block; margin-top: 0; /* @alternate */ line-height: normal; font-family: Roboto, sans-serif; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; font-size: 1.25rem; line-height: 2rem; font-weight: 500; letter-spacing: 0.0125em; text-decoration: inherit; text-transform: inherit; display: block; position: relative; flex-shrink: 0; box-sizing: border-box; margin: 0; padding: 0 24px 9px; border-bottom: 1px solid transparent; } .mdc-dialog__title::before { display: inline-block; width: 0; height: 40px; content: ""; vertical-align: 0; } .mdc-dialog[dir=rtl] .mdc-dialog__title, [dir=rtl] .mdc-dialog .mdc-dialog__title { /* @noflip */ text-align: right; } .mdc-dialog--scrollable .mdc-dialog__title { padding-bottom: 15px; } .mdc-dialog__content { font-family: Roboto, sans-serif; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; font-size: 1rem; line-height: 1.5rem; font-weight: 400; letter-spacing: 0.03125em; text-decoration: inherit; text-transform: inherit; flex-grow: 1; box-sizing: border-box; margin: 0; padding: 20px 24px; overflow: auto; -webkit-overflow-scrolling: touch; } .mdc-dialog__content > :first-child { margin-top: 0; } .mdc-dialog__content > :last-child { margin-bottom: 0; } .mdc-dialog__title + .mdc-dialog__content { padding-top: 0; } .mdc-dialog--scrollable .mdc-dialog__content { padding-top: 8px; padding-bottom: 8px; } .mdc-dialog__content .mdc-list:first-child:last-child { padding: 6px 0 0; } .mdc-dialog--scrollable .mdc-dialog__content .mdc-list:first-child:last-child { padding: 0; } .mdc-dialog__actions { display: flex; position: relative; flex-shrink: 0; flex-wrap: wrap; align-items: center; justify-content: flex-end; box-sizing: border-box; min-height: 52px; margin: 0; padding: 8px; border-top: 1px solid transparent; } .mdc-dialog--stacked .mdc-dialog__actions { flex-direction: column; align-items: flex-end; } .mdc-dialog__button { /* @noflip */ margin-left: 8px; /* @noflip */ margin-right: 0; max-width: 100%; /* @noflip */ text-align: right; } [dir=rtl] .mdc-dialog__button, .mdc-dialog__button[dir=rtl] { /* @noflip */ margin-left: 0; /* @noflip */ margin-right: 8px; } .mdc-dialog__button:first-child { /* @noflip */ margin-left: 0; /* @noflip */ margin-right: 0; } [dir=rtl] .mdc-dialog__button:first-child, .mdc-dialog__button:first-child[dir=rtl] { /* @noflip */ margin-left: 0; /* @noflip */ margin-right: 0; } .mdc-dialog[dir=rtl] .mdc-dialog__button, [dir=rtl] .mdc-dialog .mdc-dialog__button { /* @noflip */ text-align: left; } .mdc-dialog--stacked .mdc-dialog__button:not(:first-child) { margin-top: 12px; } .mdc-dialog--open, .mdc-dialog--opening, .mdc-dialog--closing { display: flex; } .mdc-dialog--opening .mdc-dialog__scrim { transition: opacity 150ms linear; } .mdc-dialog--opening .mdc-dialog__container { transition: opacity 75ms linear, -webkit-transform 150ms 0ms cubic-bezier(0, 0, 0.2, 1); transition: opacity 75ms linear, transform 150ms 0ms cubic-bezier(0, 0, 0.2, 1); transition: opacity 75ms linear, transform 150ms 0ms cubic-bezier(0, 0, 0.2, 1), -webkit-transform 150ms 0ms cubic-bezier(0, 0, 0.2, 1); } .mdc-dialog--closing .mdc-dialog__scrim, .mdc-dialog--closing .mdc-dialog__container { transition: opacity 75ms linear; } .mdc-dialog--closing .mdc-dialog__container { -webkit-transform: scale(1); transform: scale(1); } .mdc-dialog--open .mdc-dialog__scrim { opacity: 1; } .mdc-dialog--open .mdc-dialog__container { -webkit-transform: scale(1); transform: scale(1); opacity: 1; } .mdc-dialog-scroll-lock { overflow: hidden; } /*# sourceMappingURL=mdc.dialog.css.map*/
{ "content_hash": "a1b726af675a5131d2963d3bbc392625", "timestamp": "", "source": "github", "line_count": 266, "max_line_length": 138, "avg_line_length": 22.263157894736842, "alnum_prop": 0.65467747382641, "repo_name": "Chan4077/chan4077.github.io", "id": "9b688553273927c521caa3b340e243ee7403a34f", "size": "6179", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "node_modules/@material/dialog/dist/mdc.dialog.css", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "605030" }, { "name": "JavaScript", "bytes": "56598" } ], "symlink_target": "" }
Using a schedule's specific id. display the Whencast on a page. The schedule id can be gotten from the "share/embed" section on any Whencast. This sample does not require an Access Token. ## Requirements Include the WhenHub scripts in your html file: `<script src="https://cdn.whenhub.com/lib/whenhub/whencast.helper.js"></script>` `<script src="https://cdn.whenhub.com/v1/embed.js"></script>`
{ "content_hash": "572ad1a823a29fbb3d08a28e747bad98", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 188, "avg_line_length": 66.83333333333333, "alnum_prop": 0.7456359102244389, "repo_name": "WhenHub/dev-samples", "id": "9e64d032e29ff495f66debce3e8f5ad0d36bd8e3", "size": "420", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "JavascriptEmbed/README.md", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5044" }, { "name": "HTML", "bytes": "18133" }, { "name": "JavaScript", "bytes": "3732" }, { "name": "TypeScript", "bytes": "21867" } ], "symlink_target": "" }
import java.util.*; /* * Represents the table onto which we can deal cards. Cam also * pick up cards from table if there are any present. */ public class Table { public Table (boolean debug) { _theTable = null; _debug = debug; } public boolean deal (Deck theDeck, int increment) { int numberOfCards = theDeck.numberOfCards(); int index = 0; initialise(theDeck); for (int i = 0; i < numberOfCards; i++) { if (_theTable.get(index) != -1) return false; _theTable.set(index, theDeck.dealFromTop()); index += increment; if (index >= numberOfCards) index -= numberOfCards; } return true; } public Deck collectCards () { if (_theTable == null) return null; Deck toReturn = new Deck(_theTable, _debug); _theTable = null; // make sure cards are only in one place at a time. return toReturn; } private void initialise (Deck theDeck) { _theTable = new Vector<Integer>(theDeck.numberOfCards()); for (int i = 0; i < _theTable.capacity(); i++) _theTable.add(-1); } private Vector<Integer> _theTable; private boolean _debug; }
{ "content_hash": "a87494b39742e69ad406e0168dc872e2", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 77, "avg_line_length": 21.475409836065573, "alnum_prop": 0.5465648854961832, "repo_name": "nmcl/scratch", "id": "72c2ce960f99abdbdac2d6ac2a41c26d4a1535d2", "size": "1310", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "AdventOfCode/2019/day22/part1/Table.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "37106" }, { "name": "Batchfile", "bytes": "70668" }, { "name": "C", "bytes": "139579" }, { "name": "C++", "bytes": "3001008" }, { "name": "CSS", "bytes": "2238" }, { "name": "Clojure", "bytes": "1535" }, { "name": "Dockerfile", "bytes": "4325" }, { "name": "Erlang", "bytes": "33048" }, { "name": "Go", "bytes": "333" }, { "name": "HTML", "bytes": "1423375" }, { "name": "Haskell", "bytes": "3992" }, { "name": "Io", "bytes": "11232" }, { "name": "Java", "bytes": "22796079" }, { "name": "JavaScript", "bytes": "10464" }, { "name": "Makefile", "bytes": "78159" }, { "name": "PHP", "bytes": "175" }, { "name": "PowerShell", "bytes": "3549" }, { "name": "Prolog", "bytes": "17925" }, { "name": "Python", "bytes": "23464" }, { "name": "Roff", "bytes": "3575" }, { "name": "Ruby", "bytes": "12190" }, { "name": "Rust", "bytes": "880" }, { "name": "Scala", "bytes": "4608" }, { "name": "Shell", "bytes": "165574" }, { "name": "Swift", "bytes": "211" }, { "name": "XSLT", "bytes": "16312" } ], "symlink_target": "" }
 //#define DEBUG_MOUSETRACKING using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Diagnostics; using System.Text; using System.IO; using System.Threading; using Poderosa.Document; using Poderosa.View; using Poderosa.Sessions; using Poderosa.ConnectionParam; using Poderosa.Protocols; using Poderosa.Forms; using Poderosa.Commands; namespace Poderosa.Terminal { /// <summary> /// <ja> /// ターミナルを示すコントロールです。 /// </ja> /// <en> /// Control to show the terminal. /// </en> /// </summary> /// <exclude/> /// public class TerminalControl : CharacterDocumentViewer { //ID private int _instanceID; private static int _instanceCount = 1; public string InstanceID { get { return "TC" + _instanceID; } } private System.Windows.Forms.Timer _sizeTipTimer; private ITerminalControlHost _session; private readonly TerminalEmulatorMouseHandler _terminalEmulatorMouseHandler; private readonly MouseTrackingHandler _mouseTrackingHandler; private readonly MouseWheelHandler _mouseWheelHandler; private Label _sizeTip; private delegate void AdjustIMECompositionDelegate(); private bool _inIMEComposition; //IMEによる文字入力の最中であればtrueになる private bool _ignoreValueChangeEvent; private bool _escForVI; //再描画の状態管理 private int _drawOptimizingState = 0; //この状態管理はOnWindowManagerTimer(), SmartInvalidate()参照 internal TerminalDocument GetDocument() { // FIXME: In rare case, _session may be null... return _session.Terminal.GetDocument(); } protected ITerminalSettings GetTerminalSettings() { // FIXME: In rare case, _session may be null... return _session.TerminalSettings; } protected TerminalTransmission GetTerminalTransmission() { // FIXME: In rare case, _session may be null... return _session.TerminalTransmission; } protected AbstractTerminal GetTerminal() { // FIXME: In rare case, _session may be null... return _session.Terminal; } private bool IsConnectionClosed() { // FIXME: In rare case, _session may be null... return _session.TerminalTransmission.Connection.IsClosed; } /// <summary> /// 必要なデザイナ変数です。 /// </summary> private System.ComponentModel.Container components = null; public TerminalControl() { _instanceID = _instanceCount++; _enableAutoScrollBarAdjustment = false; _escForVI = false; this.EnabledEx = false; // この呼び出しは、Windows.Forms フォーム デザイナで必要です。 InitializeComponent(); _mouseWheelHandler = new MouseWheelHandler(this, _VScrollBar); _mouseHandlerManager.AddFirstHandler(_mouseWheelHandler); // mouse wheel handler will become second handler _mouseTrackingHandler = new MouseTrackingHandler(this); _mouseHandlerManager.AddFirstHandler(_mouseTrackingHandler); // mouse tracking handler become first handler _terminalEmulatorMouseHandler = new TerminalEmulatorMouseHandler(this); _mouseHandlerManager.AddLastHandler(_terminalEmulatorMouseHandler); //TODO タイマーは共用化? _sizeTipTimer = new System.Windows.Forms.Timer(); _sizeTipTimer.Interval = 2000; _sizeTipTimer.Tick += new EventHandler(this.OnHideSizeTip); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); } public void Attach(ITerminalControlHost session) { _session = session; SetContent(session.Terminal.GetDocument()); _mouseTrackingHandler.Attach(session); _mouseWheelHandler.Attach(session); ITerminalEmulatorOptions opt = TerminalEmulatorPlugin.Instance.TerminalEmulatorOptions; _caret.Blink = opt.CaretBlink; _caret.Color = opt.CaretColor; _caret.Style = opt.CaretType; _caret.Reset(); //KeepAliveタイマ起動は最も遅らせた場合でココ TerminalEmulatorPlugin.Instance.KeepAlive.Refresh(opt.KeepAliveInterval); //ASCIIWordBreakTable : 今は共有設定だが、Session固有にデータを持つようにするかもしれない含みを持たせて。 ASCIIWordBreakTable table = ASCIIWordBreakTable.Default; table.Reset(); foreach (char ch in opt.AdditionalWordElement) table.Set(ch, ASCIIWordBreakTable.LETTER); lock (GetDocument()) { _ignoreValueChangeEvent = true; _session.Terminal.CommitScrollBar(_VScrollBar, false); _ignoreValueChangeEvent = false; if (!IsConnectionClosed()) { Size ts = CalcTerminalSize(GetRenderProfile()); //TODO ネゴ開始前はここを抑制したい if (ts.Width != GetDocument().TerminalWidth || ts.Height != GetDocument().TerminalHeight) ResizeTerminal(ts.Width, ts.Height); } } Invalidate(true); } public void Detach() { if (DebugOpt.DrawingPerformance) DrawingPerformance.Output(); if (_inIMEComposition) ClearIMEComposition(); _mouseTrackingHandler.Detach(); _mouseWheelHandler.Detach(); _session = null; SetContent(null); } /// <summary> /// 使用されているリソースに後処理を実行します。 /// </summary> protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); } private void InitializeComponent() { this.SuspendLayout(); this._sizeTip = new Label(); // // _sizeTip // this._sizeTip.Visible = false; this._sizeTip.BorderStyle = BorderStyle.FixedSingle; this._sizeTip.TextAlign = ContentAlignment.MiddleCenter; this._sizeTip.BackColor = Color.FromKnownColor(KnownColor.Info); this._sizeTip.ForeColor = Color.FromKnownColor(KnownColor.InfoText); this._sizeTip.Size = new Size(64, 16); // // TerminalPane // this.TabStop = false; this.AllowDrop = true; this.Controls.Add(_sizeTip); this.ImeMode = ImeMode.NoControl; this.ResumeLayout(false); } /// <summary> /// Sends bytes. Data may be repeated as local echo. /// </summary> /// <param name="data">Byte array that contains data to send.</param> /// <param name="offset">Offset in data</param> /// <param name="length">Length of bytes to transmit</param> internal void Transmit(byte[] data, int offset, int length) { if (this.InvokeRequired) { // UI thread may be waiting for unlocking of the current document in the OnPaint handler. // If the caller is locking the current document, Invoke() causes dead lock. this.BeginInvoke((MethodInvoker)delegate() { GetTerminalTransmission().Transmit(data, offset, length); }); } else { GetTerminalTransmission().Transmit(data, offset, length); } } /// <summary> /// Sends bytes without local echo. /// </summary> /// <param name="data">Byte array that contains data to send.</param> /// <param name="offset">Offset in data</param> /// <param name="length">Length of bytes to transmit</param> internal void TransmitDirect(byte[] data, int offset, int length) { if (this.InvokeRequired) { // UI thread may be waiting for unlocking of the current document in the OnPaint handler. // If the caller is locking the current document, Invoke() causes dead lock. this.BeginInvoke((MethodInvoker)delegate() { GetTerminalTransmission().TransmitDirect(data, offset, length); }); } else { GetTerminalTransmission().TransmitDirect(data, offset, length); } } /* * ↓ 受信スレッドによる実行のエリア */ public void DataArrived() { //よくみると、ここを実行しているときはdocumentをロック中なので、上のパターンのようにSendMessageを使うとデッドロックの危険がある InternalDataArrived(); } private void InternalDataArrived() { if (_session == null) return; // ペインを閉じる時に _tag が null になっていることがある TerminalDocument document = GetDocument(); if (!this.ITextSelection.IsEmpty) { document.InvalidatedRegion.InvalidatedAll = true; //面倒だし this.ITextSelection.Clear(); } //Debug.WriteLine(String.Format("v={0} l={1} m={2}", _VScrollBar.Value, _VScrollBar.LargeChange, _VScrollBar.Maximum)); if (DebugOpt.DrawingPerformance) DrawingPerformance.MarkReceiveData(GetDocument().InvalidatedRegion); SmartInvalidate(); //部分変換中であったときのための調整 if (_inIMEComposition) { if (this.InvokeRequired) this.Invoke(new AdjustIMECompositionDelegate(AdjustIMEComposition)); else AdjustIMEComposition(); } } private void SmartInvalidate() { //ここでDrawOptimizeStateをいじる。近接して到着するデータによる過剰な再描画を回避しつつ、タイマーで一定時間後には確実に描画されるようにする。 //状態遷移は、データ到着とタイマーをトリガとする3状態の簡単なオートマトンである。 switch (_drawOptimizingState) { case 0: _drawOptimizingState = 1; InvalidateEx(); break; case 1: if (_session.TerminalConnection.Socket.Available) Interlocked.Exchange(ref _drawOptimizingState, 2); //間引きモードへ else InvalidateEx(); break; case 2: break; //do nothing } } /* * ↑ 受信スレッドによる実行のエリア * ------------------------------- * ↓ UIスレッドによる実行のエリア */ protected override void OnWindowManagerTimer() { base.OnWindowManagerTimer(); switch (_drawOptimizingState) { case 0: break; //do nothing case 1: Interlocked.CompareExchange(ref _drawOptimizingState, 0, 1); break; case 2: //忙しくても偶には描画 _drawOptimizingState = 1; InvalidateEx(); break; } } private delegate void InvalidateDelegate1(); private delegate void InvalidateDelegate2(Rectangle rc); private void DelInvalidate(Rectangle rc) { Invalidate(rc); } private void DelInvalidate() { Invalidate(); } protected override void VScrollBarValueChanged() { if (_ignoreValueChangeEvent) return; TerminalDocument document = GetDocument(); lock (document) { document.TopLineNumber = document.FirstLineNumber + _VScrollBar.Value; _session.Terminal.TransientScrollBarValues.Value = _VScrollBar.Value; Invalidate(); } } /* キーボード処理系について *  送信は最終的にはSendChar/Stringへ行く。 * *  そこに至る過程では、 * ProcessCmdKey: Altキーの設定次第で、ベースクラスに渡す(=コマンド起動を試みる)かどうか決める * ProcessDialogKey: 文字キー以外は基本的にここで処理。 * OnKeyPress: 文字の送信 */ private byte[] _sendCharBuffer = new byte[1]; public void SendChar(char ch) { //ISからのコールバックあるので if (ch < 0x80) { //Debug.WriteLine("SendChar " + (int)ch); _sendCharBuffer[0] = (byte)ch; SendBytes(_sendCharBuffer); } else { byte[] data = EncodingProfile.Get(GetTerminalSettings().Encoding).GetBytes(ch); SendBytes(data); } } public void SendCharArray(char[] chs) { byte[] bytes = EncodingProfile.Get(GetTerminalSettings().Encoding).GetBytes(chs); SendBytes(bytes); } protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { Keys modifiers = keyData & Keys.Modifiers; if (IsAcceptableUserInput() && (modifiers & Keys.Alt) != Keys.None) { //Altキーの横取り処理を開始 Keys keybody = keyData & Keys.KeyCode; if (GEnv.Options.LeftAltKey != AltKeyAction.Menu && (Win32.GetKeyState(Win32.VK_LMENU) & 0x8000) != 0) { ProcessSpecialAltKey(GEnv.Options.LeftAltKey, modifiers, keybody); return true; } else if (GEnv.Options.RightAltKey != AltKeyAction.Menu && (Win32.GetKeyState(Win32.VK_RMENU) & 0x8000) != 0) { ProcessSpecialAltKey(GEnv.Options.RightAltKey, modifiers, keybody); return true; } } //これまでで処理できなければ上位へ渡す return base.ProcessCmdKey(ref msg, keyData); } protected override bool IsInputKey(Keys key) { Keys mod = key & Keys.Modifiers; Keys body = key & Keys.KeyCode; if (mod == Keys.None && (body == Keys.Tab || body == Keys.Escape)) return true; else return false; } protected override bool ProcessDialogKey(Keys key) { Keys modifiers = key & Keys.Modifiers; Keys keybody = key & Keys.KeyCode; //接続中でないとだめなキー if (IsAcceptableUserInput()) { //TODO Enter,Space,SequenceKey系もカスタムキーに入れてしまいたい char[] custom = TerminalEmulatorPlugin.Instance.CustomKeySettings.Scan(key); //カスタムキー if (custom != null) { SendCharArray(custom); return true; } else if (ProcessAdvancedFeatureKey(modifiers, keybody)) { return true; } else if (keybody == Keys.Enter && modifiers == Keys.None) { _escForVI = false; SendCharArray(TerminalUtil.NewLineChars(GetTerminalSettings().TransmitNL)); return true; } else if (keybody == Keys.Space && modifiers == Keys.Control) { //これはOnKeyPressにわたってくれない SendChar('\0'); return true; } if ((keybody == Keys.Tab) && (modifiers == Keys.Shift)) { this.SendChar('\t'); return true; } else if (IsSequenceKey(keybody)) { ProcessSequenceKey(modifiers, keybody); return true; } } //常に送れるキー if (keybody == Keys.Apps) { //コンテキストメニュー TerminalDocument document = GetDocument(); int x = document.CaretColumn; int y = document.CurrentLineNumber - document.TopLineNumber; SizeF p = GetRenderProfile().Pitch; _terminalEmulatorMouseHandler.ShowContextMenu(new Point((int)(p.Width * x), (int)(p.Height * y))); return true; } return base.ProcessDialogKey(key); } private bool ProcessAdvancedFeatureKey(Keys modifiers, Keys keybody) { if (_session.Terminal.TerminalMode == TerminalMode.Application) return false; if (_session.Terminal.IntelliSense.ProcessKey(modifiers, keybody)) return true; else if (_session.Terminal.PopupStyleCommandResultRecognizer.ProcessKey(modifiers, keybody)) return true; else return false; } private static bool IsSequenceKey(Keys key) { return ((int)Keys.F1 <= (int)key && (int)key <= (int)Keys.F12) || key == Keys.Insert || key == Keys.Delete || IsScrollKey(key); } private static bool IsScrollKey(Keys key) { return key == Keys.Up || key == Keys.Down || key == Keys.Left || key == Keys.Right || key == Keys.PageUp || key == Keys.PageDown || key == Keys.Home || key == Keys.End; } private void ProcessSpecialAltKey(AltKeyAction act, Keys modifiers, Keys body) { if (!this.EnabledEx) return; char ch = KeyboardInfo.Scan(body, (modifiers & Keys.Shift) != Keys.None); if (ch == '\0') return; //割り当てられていないやつは無視 if ((modifiers & Keys.Control) != Keys.None) ch = (char)((int)ch % 32); //Controlを押したら制御文字 if (act == AltKeyAction.ESC) { byte[] t = new byte[2]; t[0] = 0x1B; t[1] = (byte)ch; //Debug.WriteLine("ESC " + (int)ch); SendBytes(t); } else { //Meta ch = (char)(0x80 + ch); byte[] t = new byte[1]; t[0] = (byte)ch; //Debug.WriteLine("META " + (int)ch); SendBytes(t); } } protected override void OnKeyPress(KeyPressEventArgs e) { base.OnKeyPress(e); if (e.KeyChar == '\x001b') { _escForVI = true; } if (!IsAcceptableUserInput()) return; /* ここの処理について *  IMEで入力文字を確定すると(部分確定ではない)、WM_IME_CHAR、WM_ENDCOMPOSITION、WM_CHARの順でメッセージが送られてくる。Controlはその両方でKeyPressイベントを *  発生させるので、IMEの入力が2回送信されてしまう。 *  一方部分確定のときはWM_IME_CHARのみである。 */ //if((int)e.KeyChar>=100) { // if(_currentMessage.Msg!=Win32.WM_IME_CHAR) return; //} if (this._escForVI) { this.SendChar(e.KeyChar); } else { this.SendChar(e.KeyChar); if (_session.TerminalSettings.EnabledCharTriggerIntelliSense && _session.Terminal.TerminalMode == TerminalMode.Normal) _session.Terminal.IntelliSense.ProcessChar(e.KeyChar); } } private void SendBytes(byte[] data) { TerminalDocument doc = GetDocument(); lock (doc) { //キーを押しっぱなしにしたときにキャレットがブリンクするのはちょっと見苦しいのでキー入力があるたびにタイマをリセット _caret.KeepActiveUntilNextTick(); MakeCurrentLineVisible(); } GetTerminalTransmission().Transmit(data); } private bool IsAcceptableUserInput() { //TODO: ModalTerminalTaskの存在が理由で拒否するときはステータスバーか何かに出すのがよいかも if (!this.EnabledEx || IsConnectionClosed() || _session.Terminal.CurrentModalTerminalTask != null) return false; else return true; } private void ProcessScrollKey(Keys key) { TerminalDocument doc = GetDocument(); int current = doc.TopLineNumber - doc.FirstLineNumber; int newvalue = 0; switch (key) { case Keys.Up: newvalue = current - 1; break; case Keys.Down: newvalue = current + 1; break; case Keys.PageUp: newvalue = current - doc.TerminalHeight; break; case Keys.PageDown: newvalue = current + doc.TerminalHeight; break; case Keys.Home: newvalue = 0; break; case Keys.End: newvalue = doc.LastLineNumber - doc.FirstLineNumber + 1 - doc.TerminalHeight; break; } if (newvalue < 0) newvalue = 0; else if (newvalue > _VScrollBar.Maximum + 1 - _VScrollBar.LargeChange) newvalue = _VScrollBar.Maximum + 1 - _VScrollBar.LargeChange; _VScrollBar.Value = newvalue; //これでイベントも発生するのでマウスで動かした場合と同じ挙動になる } private void ProcessSequenceKey(Keys modifier, Keys body) { byte[] data; data = GetTerminal().SequenceKeyData(modifier, body); SendBytes(data); } private void MakeCurrentLineVisible() { TerminalDocument document = GetDocument(); if (document.CurrentLineNumber - document.FirstLineNumber < _VScrollBar.Value) { //上に隠れた document.TopLineNumber = document.CurrentLineNumber; _session.Terminal.TransientScrollBarValues.Value = document.TopLineNumber - document.FirstLineNumber; } else if (_VScrollBar.Value + document.TerminalHeight <= document.CurrentLineNumber - document.FirstLineNumber) { //下に隠れた int n = document.CurrentLineNumber - document.FirstLineNumber - document.TerminalHeight + 1; if (n < 0) n = 0; GetTerminal().TransientScrollBarValues.Value = n; GetDocument().TopLineNumber = n + document.FirstLineNumber; } } protected override void OnResize(EventArgs args) { base.OnResize(args); //Debug.WriteLine(String.Format("TC RESIZE {0} {1} {2},{3}", _resizeCount++, DateTime.Now.ToString(), this.Size.Width, this.Size.Height)); //Debug.WriteLine(new StackTrace(true).ToString()); //最小化時にはなぜか自身の幅だけが0になってしまう if (this.DesignMode || this.FindForm() == null || this.FindForm().WindowState == FormWindowState.Minimized || _session == null) return; Size ts = CalcTerminalSize(GetRenderProfile()); if (!IsConnectionClosed() && (ts.Width != GetDocument().TerminalWidth || ts.Height != GetDocument().TerminalHeight)) { ResizeTerminal(ts.Width, ts.Height); ShowSizeTip(ts.Width, ts.Height); CommitTransientScrollBar(); } } private void OnHideSizeTip(object sender, EventArgs args) { Debug.Assert(!this.InvokeRequired); _sizeTip.Visible = false; _sizeTipTimer.Stop(); } public override RenderProfile GetRenderProfile() { if (_session != null) { ITerminalSettings ts = _session.TerminalSettings; if (ts.UsingDefaultRenderProfile) return GEnv.DefaultRenderProfile; else return ts.RenderProfile; } else return GEnv.DefaultRenderProfile; } protected override void CommitTransientScrollBar() { if (_session != null) { // TerminalPaneを閉じるタイミングでこのメソッドが呼ばれたときにNullReferenceExceptionになるのを防ぐ _ignoreValueChangeEvent = true; GetTerminal().CommitScrollBar(_VScrollBar, true); //!! ここ(スクロールバー)の処理は重い _ignoreValueChangeEvent = false; } } public override GLine GetTopLine() { //TODO Pane内のクラスチェンジができるようになったらここを改善 return _session == null ? base.GetTopLine() : GetDocument().TopLine; } protected override void AdjustCaret(Caret caret) { if (_session == null) return; if (IsConnectionClosed() || !this.Focused || _inIMEComposition) caret.Enabled = false; else { TerminalDocument d = GetDocument(); caret.X = d.CaretColumn; caret.Y = d.CurrentLineNumber - d.TopLineNumber; caret.Enabled = caret.Y >= 0 && caret.Y < d.TerminalHeight; } } public Size CalcTerminalSize(RenderProfile prof) { SizeF charPitch = prof.Pitch; Win32.SystemMetrics sm = GEnv.SystemMetrics; int width = (int)Math.Floor((float)(this.ClientSize.Width - sm.ScrollBarWidth - CharacterDocumentViewer.BORDER * 2) / charPitch.Width); int height = (int)Math.Floor((float)(this.ClientSize.Height - CharacterDocumentViewer.BORDER * 2 + prof.LineSpacing) / (charPitch.Height + prof.LineSpacing)); if (width <= 0) width = 1; //極端なリサイズをすると負の値になることがある if (height <= 0) height = 1; return new Size(width, height); } private void ShowSizeTip(int width, int height) { const int MARGIN = 8; //Form form = GEnv.Frame.AsForm(); //if(form==null || !form.Visible) return; //起動時には表示しない if (!this.Visible) return; Point pt = new Point(this.Width - _VScrollBar.Width - _sizeTip.Width - MARGIN, this.Height - _sizeTip.Height - MARGIN); _sizeTip.Text = String.Format("{0} * {1}", width, height); _sizeTip.Location = pt; _sizeTip.Visible = true; _sizeTipTimer.Stop(); _sizeTipTimer.Start(); } //ピクセル単位のサイズを受け取り、チップを表示 public void SplitterDragging(int width, int height) { SizeF charSize = GetRenderProfile().Pitch; Win32.SystemMetrics sm = GEnv.SystemMetrics; width = (int)Math.Floor(((float)width - sm.ScrollBarWidth - sm.ControlBorderWidth * 2) / charSize.Width); height = (int)Math.Floor((float)(height - sm.ControlBorderHeight * 2) / charSize.Height); ShowSizeTip(width, height); } private void ResizeTerminal(int width, int height) { //Debug.WriteLine(String.Format("Resize {0} {1}", width, height)); //Documentへ通知 GetDocument().Resize(width, height); if (_session.Terminal.CurrentModalTerminalTask != null) return; //別タスクが走っているときは無視 if (GetTerminal().TerminalMode == TerminalMode.Application) //リサイズしてもスクロールリージョンも更新されるかは分からないが、一応全画面を更新する GetDocument().SetScrollingRegion(0, height - 1); GetTerminal().Reset(); if (_VScrollBar.Enabled) { bool scroll = IsAutoScrollMode(); _VScrollBar.LargeChange = height; if (scroll) MakeCurrentLineVisible(); } //接続先へ通知 GetTerminalTransmission().Resize(width, height); InvalidateEx(); } //現在行が見えるように自動的に追随していくべきかどうかの判定 private bool IsAutoScrollMode() { TerminalDocument doc = GetDocument(); return GetTerminal().TerminalMode == TerminalMode.Normal && doc.CurrentLineNumber >= doc.TopLineNumber + doc.TerminalHeight - 1 && (!_VScrollBar.Enabled || _VScrollBar.Value + _VScrollBar.LargeChange > _VScrollBar.Maximum); } //IMEの位置合わせなど。日本語入力開始時、現在のキャレット位置からIMEをスタートさせる。 private void AdjustIMEComposition() { TerminalDocument document = GetDocument(); IntPtr hIMC = Win32.ImmGetContext(this.Handle); RenderProfile prof = GetRenderProfile(); //フォントのセットは1回やればよいのか? Win32.LOGFONT lf = new Win32.LOGFONT(); prof.CalcFont(null, CharGroup.CJKZenkaku).ToLogFont(lf); Win32.ImmSetCompositionFont(hIMC, lf); Win32.COMPOSITIONFORM form = new Win32.COMPOSITIONFORM(); form.dwStyle = Win32.CFS_POINT; Win32.SystemMetrics sm = GEnv.SystemMetrics; //Debug.WriteLine(String.Format("{0} {1} {2}", document.CaretColumn, charwidth, document.CurrentLine.CharPosToDisplayPos(document.CaretColumn))); form.ptCurrentPos.x = sm.ControlBorderWidth + (int)(prof.Pitch.Width * (document.CaretColumn)); form.ptCurrentPos.y = sm.ControlBorderHeight + (int)((prof.Pitch.Height + prof.LineSpacing) * (document.CurrentLineNumber - document.TopLineNumber)); bool r = Win32.ImmSetCompositionWindow(hIMC, ref form); Debug.Assert(r); Win32.ImmReleaseContext(this.Handle, hIMC); } private void ClearIMEComposition() { IntPtr hIMC = Win32.ImmGetContext(this.Handle); Win32.ImmNotifyIME(hIMC, Win32.NI_COMPOSITIONSTR, Win32.CPS_CANCEL, 0); Win32.ImmReleaseContext(this.Handle, hIMC); _inIMEComposition = false; } public void ApplyRenderProfile(RenderProfile prof) { if (this.EnabledEx) { this.BackColor = prof.BackColor; Size ts = CalcTerminalSize(prof); if (!IsConnectionClosed() && (ts.Width != GetDocument().TerminalWidth || ts.Height != GetDocument().TerminalHeight)) { ResizeTerminal(ts.Width, ts.Height); } Invalidate(); } } public void ApplyTerminalOptions(ITerminalEmulatorOptions opt) { if (this.EnabledEx) { if (GetTerminalSettings().UsingDefaultRenderProfile) { ApplyRenderProfile(opt.CreateRenderProfile()); } _caret.Style = opt.CaretType; _caret.Blink = opt.CaretBlink; _caret.Color = opt.CaretColor; _caret.Reset(); } } // Overrides CharacterDocumentViewer's scrollbar control protected override void OnMouseWheelCore(MouseEventArgs e) { // do nothing. // Scrollbar control will be done by MouseWheelHandler. } protected override void OnGotFocus(EventArgs args) { base.OnGotFocus(args); if (!this.EnabledEx) return; if (GetTerminal().GetFocusReportingMode()) { byte[] data = new byte[] { 0x1b, 0x5b, 0x49 }; TransmitDirect(data, 0, data.Length); } if (this.CharacterDocument != null) { //初期化過程のときは無視 //NOTE TerminalControlはSessionについては無知、という前提にしたほうがいいのかもしれない TerminalEmulatorPlugin.Instance.GetSessionManager().ActivateDocument(this.CharacterDocument, ActivateReason.ViewGotFocus); } } protected override void OnLostFocus(EventArgs args) { base.OnLostFocus(args); if (!this.EnabledEx) return; if (GetTerminal().GetFocusReportingMode()) { byte[] data = new byte[] { 0x1b, 0x5b, 0x4f }; TransmitDirect(data, 0, data.Length); } if (_inIMEComposition) ClearIMEComposition(); } //Drag&Drop関係 protected override void OnDragEnter(DragEventArgs args) { base.OnDragEnter(args); try { IWinFormsService wfs = TerminalEmulatorPlugin.Instance.GetWinFormsService(); IPoderosaDocument document = (IPoderosaDocument)wfs.GetDraggingObject(args.Data, typeof(IPoderosaDocument)); if (document != null) args.Effect = DragDropEffects.Move; else wfs.BypassDragEnter(this, args); } catch (Exception ex) { RuntimeUtil.ReportException(ex); } } protected override void OnDragDrop(DragEventArgs args) { base.OnDragDrop(args); try { IWinFormsService wfs = TerminalEmulatorPlugin.Instance.GetWinFormsService(); IPoderosaDocument document = (IPoderosaDocument)wfs.GetDraggingObject(args.Data, typeof(IPoderosaDocument)); if (document != null) { IPoderosaView view = (IPoderosaView)this.GetAdapter(typeof(IPoderosaView)); TerminalEmulatorPlugin.Instance.GetSessionManager().AttachDocumentAndView(document, view); TerminalEmulatorPlugin.Instance.GetSessionManager().ActivateDocument(document, ActivateReason.DragDrop); } else wfs.BypassDragDrop(this, args); } catch (Exception ex) { RuntimeUtil.ReportException(ex); } } private void ProcessVScrollMessage(int cmd) { int newval = _VScrollBar.Value; switch (cmd) { case 0: //SB_LINEUP newval--; break; case 1: //SB_LINEDOWN newval++; break; case 2: //SB_PAGEUP newval -= GetDocument().TerminalHeight; break; case 3: //SB_PAGEDOWN newval += GetDocument().TerminalHeight; break; } if (newval < 0) newval = 0; if (newval > _VScrollBar.Maximum - _VScrollBar.LargeChange) newval = _VScrollBar.Maximum - _VScrollBar.LargeChange + 1; _VScrollBar.Value = newval; } /* * この周辺で使いそうなデバッグ用のコード断片 private static bool _IMEFlag; private static int _callnest; _callnest++; if(_IMEFlag) { if(msg.Msg!=13 && msg.Msg!=14 && msg.Msg!=15 && msg.Msg!=0x14 && msg.Msg!=0x85 && msg.Msg!=0x20 && msg.Msg!=0x84) //うざいのはきる Debug.WriteLine(String.Format("{0} Msg {1:X} WP={2:X} LP={3:X}", _callnest, msg.Msg, msg.WParam.ToInt32(), msg.LParam.ToInt32())); } base.WndProc(ref msg); _callnest--; */ private bool _lastCompositionFlag; //IME関係を処理するためにかなりの苦労。なぜこうなのかについては別ドキュメント参照 protected override void WndProc(ref Message msg) { if (_lastCompositionFlag) { LastCompositionWndProc(ref msg); return; } int m = msg.Msg; if (m == Win32.WM_IME_COMPOSITION) { if ((msg.LParam.ToInt32() & 0xFF) == 0) { //最終確定時の特殊処理へ迂回させるフラグを立てる _lastCompositionFlag = true; base.WndProc(ref msg); //この中で送られてくるWM_IME_CHARは無視 _lastCompositionFlag = false; return; } } base.WndProc(ref msg); //通常時 if (m == Win32.WM_IME_STARTCOMPOSITION) { _inIMEComposition = true; //_inIMECompositionはWM_IME_STARTCOMPOSITIONでしかセットしない AdjustIMEComposition(); } else if (m == Win32.WM_IME_ENDCOMPOSITION) { _inIMEComposition = false; } } private void LastCompositionWndProc(ref Message msg) { if (msg.Msg == Win32.WM_IME_CHAR) { char ch = (char)msg.WParam; SendChar(ch); } else base.WndProc(ref msg); } } /// <summary> /// Mouse wheel handler. /// </summary> internal class MouseWheelHandler : DefaultMouseHandler { private readonly TerminalControl _control; private readonly VScrollBar _scrollBar; private AbstractTerminal _terminal = null; private readonly object _terminalSync = new object(); public MouseWheelHandler(TerminalControl control, VScrollBar scrollBar) : base("mousewheel") { _control = control; _scrollBar = scrollBar; } public void Attach(ITerminalControlHost session) { lock (_terminalSync) { _terminal = session.Terminal; } } public void Detach() { lock (_terminalSync) { _terminal = null; } } public override UIHandleResult OnMouseWheel(MouseEventArgs args) { if (!_control.EnabledEx) return UIHandleResult.Pass; lock (_terminalSync) { if (_terminal != null && !GEnv.Options.AllowsScrollInAppMode && _terminal.TerminalMode == TerminalMode.Application) { // Emulate Up Down keys int m = GEnv.Options.WheelAmount; for (int i = 0; i < m; i++) { byte[] data = _terminal.SequenceKeyData(Keys.None, args.Delta > 0 ? Keys.Up : Keys.Down); _control.TransmitDirect(data, 0, data.Length); } return UIHandleResult.Stop; } } if (_scrollBar.Enabled) { int d = args.Delta / 120; //開発環境だとDeltaに120。これで1か-1が入るはず d *= GEnv.Options.WheelAmount; int newval = _scrollBar.Value - d; if (newval < 0) newval = 0; if (newval > _scrollBar.Maximum - _scrollBar.LargeChange) newval = _scrollBar.Maximum - _scrollBar.LargeChange + 1; _scrollBar.Value = newval; } return UIHandleResult.Stop; } } /// <summary> /// XTerm mouse tracking support. /// </summary> /// <remarks> /// <para>This handler must be placed on the head of the handler list.</para> /// <para>This handler controls whether other handler should process the incoming event. /// Actual processes for the mouse tracking are delegated to the AbstractTerminal.</para> /// </remarks> internal class MouseTrackingHandler : DefaultMouseHandler { private readonly TerminalControl _control; private AbstractTerminal _terminal = null; private readonly object _terminalSync = new object(); private MouseButtons _pressedButtons = MouseButtons.None; // buttons that being grabbed by mouse tracking #if DEBUG_MOUSETRACKING private static int _instanceCounter = 0; private readonly string _instance; #endif public MouseTrackingHandler(TerminalControl control) : base("mousetracking") { _control = control; #if DEBUG_MOUSETRACKING _instance = "MT[" + (++_instanceCounter).ToString() + "]"; #endif } public void Attach(ITerminalControlHost session) { lock (_terminalSync) { _terminal = session.Terminal; } } public void Detach() { lock (_terminalSync) { _terminal = null; } } private bool IsGrabbing() { return _pressedButtons != MouseButtons.None; } private bool IsEscaped() { return false; // TODO } public override UIHandleResult OnMouseDown(MouseEventArgs args) { Keys modKeys = Control.ModifierKeys; #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseDown: Buttons = " + _pressedButtons.ToString()); #endif if (!IsGrabbing()) { if (IsEscaped()) return UIHandleResult.Pass; // bypass mouse tracking } int col, row; _control.MousePosToTextPos(args.X, args.Y, out col, out row); bool processed; lock (_terminalSync) { if (_terminal == null) return UIHandleResult.Pass; processed = _terminal.ProcessMouse(TerminalMouseAction.ButtonDown, args.Button, modKeys, row, col); } if (processed) { _pressedButtons |= args.Button; #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseDown: Processed --> Capture : Buttons = " + _pressedButtons.ToString()); #endif return UIHandleResult.Capture; // process next mouse events exclusively. } else { #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseDown: Not Processed : Buttons = " + _pressedButtons.ToString()); #endif if (IsGrabbing()) return UIHandleResult.Stop; else return UIHandleResult.Pass; } } public override UIHandleResult OnMouseUp(MouseEventArgs args) { #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseUp: Buttons = " + _pressedButtons.ToString()); #endif if (!IsGrabbing()) return UIHandleResult.Pass; Keys modKeys = Control.ModifierKeys; int col, row; _control.MousePosToTextPos(args.X, args.Y, out col, out row); // Note: // We keep this handler in "Captured" status while any other mouse buttons being pressed. // "Captured" handler can process mouse events exclusively. // // This trick would provide good experience to the user, // but it doesn't work expectedly in the following scenario. // // 1. Press left button on Terminal-1 // 2. Press right button on Terminal-1 // 3. Move (drag) mouse to Terminal-2 // 4. Release left button on Terminal-2 // 5. Release right button on Terminal-2 // // In step 1, System.Windows.Forms.Control object starts mouse capture automatically // when left button was pressed. // So the next mouse-up event will be notified to the Terminal-1 (step 4). // But Control object stops mouse capture by mouse-up event for any button. // Mouse-up event of the right button in step 5 will not be notified to the Terminal-1, // and the handler of the Terminal-1 will not end "Captured" status. // // The case like above will happen rarely. // To avoid never ending "Captured" status, OnMouseMove() ends "Captured" status // if no mouse buttons were set in the MouseEventArgs.Button. // lock (_terminalSync) { if (_terminal != null) { // Mouse tracking mode may be already turned off. // We just ignore result of ProcessMouse(). _terminal.ProcessMouse(TerminalMouseAction.ButtonUp, args.Button, modKeys, row, col); } } _pressedButtons &= ~args.Button; if (IsGrabbing()) { #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseUp: Continue Capture : Buttons = " + _pressedButtons.ToString()); #endif return UIHandleResult.Stop; } else { #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseUp: End Capture : Buttons = " + _pressedButtons.ToString()); #endif return UIHandleResult.EndCapture; } } public override UIHandleResult OnMouseMove(MouseEventArgs args) { Keys modKeys = Control.ModifierKeys; #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseMove: Buttons = " + _pressedButtons.ToString()); #endif if (!IsGrabbing()) { if (IsEscaped()) return UIHandleResult.Pass; // bypass mouse tracking } int col, row; _control.MousePosToTextPos(args.X, args.Y, out col, out row); if (IsGrabbing() && args.Button == MouseButtons.None) { // mouse button has been released in another terminal ? #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseMove: End Capture (Reset)"); #endif lock (_terminalSync) { if (_terminal != null) { int buttons = (int)_pressedButtons; int buttonBit = 1; while (buttonBit != 0) { if ((buttons & buttonBit) != 0) { #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseMove: MouseUp " + ((MouseButtons)buttonBit).ToString()); #endif _terminal.ProcessMouse(TerminalMouseAction.ButtonUp, (MouseButtons)buttonBit, modKeys, row, col); } buttonBit <<= 1; } } } _pressedButtons = MouseButtons.None; return UIHandleResult.EndCapture; } bool processed; lock (_terminalSync) { if (_terminal == null) return UIHandleResult.Pass; processed = _terminal.ProcessMouse(TerminalMouseAction.MouseMove, MouseButtons.None, modKeys, row, col); } if (processed) { #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseMove: Processed"); #endif return UIHandleResult.Stop; } else { #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseMove: Ignored"); #endif return UIHandleResult.Pass; } } public override UIHandleResult OnMouseWheel(MouseEventArgs args) { Keys modKeys = Control.ModifierKeys; #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseWheel: Buttons = " + _pressedButtons.ToString()); #endif if (!IsGrabbing()) { if (IsEscaped()) return UIHandleResult.Pass; // bypass mouse tracking } int col, row; _control.MousePosToTextPos(args.X, args.Y, out col, out row); TerminalMouseAction action = (args.Delta > 0) ? TerminalMouseAction.WheelUp : TerminalMouseAction.WheelDown; bool processed; lock (_terminalSync) { if (_terminal == null) return UIHandleResult.Pass; processed = _terminal.ProcessMouse(action, MouseButtons.None, modKeys, row, col); } if (processed) { #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseWheel: Processed"); #endif return UIHandleResult.Stop; } else { #if DEBUG_MOUSETRACKING Debug.WriteLine(_instance + " OnMouseWheel: Ignored"); #endif return UIHandleResult.Pass; } } } internal class TerminalEmulatorMouseHandler : DefaultMouseHandler { private TerminalControl _control; public TerminalEmulatorMouseHandler(TerminalControl control) : base("terminal") { _control = control; } public override UIHandleResult OnMouseDown(MouseEventArgs args) { return UIHandleResult.Pass; } public override UIHandleResult OnMouseMove(MouseEventArgs args) { return UIHandleResult.Pass; } public override UIHandleResult OnMouseUp(MouseEventArgs args) { if (!_control.EnabledEx) return UIHandleResult.Pass; if (args.Button == MouseButtons.Right || args.Button == MouseButtons.Middle) { ITerminalEmulatorOptions opt = TerminalEmulatorPlugin.Instance.TerminalEmulatorOptions; MouseButtonAction act = args.Button == MouseButtons.Right ? opt.RightButtonAction : opt.MiddleButtonAction; if (act != MouseButtonAction.None) { if (Control.ModifierKeys == Keys.Shift ^ act == MouseButtonAction.ContextMenu) //シフトキーで動作反転 ShowContextMenu(new Point(args.X, args.Y)); else { //Paste IGeneralViewCommands vc = (IGeneralViewCommands)_control.GetAdapter(typeof(IGeneralViewCommands)); TerminalEmulatorPlugin.Instance.GetCommandManager().Execute(vc.Paste, (ICommandTarget)vc.GetAdapter(typeof(ICommandTarget))); //ペースト後はフォーカス if (!_control.Focused) _control.Focus(); } return UIHandleResult.Stop; } } return UIHandleResult.Pass; } public void ShowContextMenu(Point pt) { IPoderosaView view = (IPoderosaView)_control.GetAdapter(typeof(IPoderosaView)); view.ParentForm.ShowContextMenu(TerminalEmulatorPlugin.Instance.ContextMenu, view, _control.PointToScreen(pt), ContextMenuFlags.None); //コマンド実行後自分にフォーカス if (!_control.Focused) _control.Focus(); } } //描画パフォーマンス調査用クラス internal static class DrawingPerformance { private static int _receiveDataCount; private static long _lastReceivedTime; private static int _shortReceiveTimeCount; private static int _fullInvalidateCount; private static int _partialInvalidateCount; private static int _totalInvalidatedLineCount; private static int _invalidate1LineCount; public static void MarkReceiveData(InvalidatedRegion region) { _receiveDataCount++; long now = DateTime.Now.Ticks; if (_lastReceivedTime != 0) { if (now - _lastReceivedTime < 10 * 1000 * 100) _shortReceiveTimeCount++; } _lastReceivedTime = now; if (region.InvalidatedAll) _fullInvalidateCount++; else { _partialInvalidateCount++; _totalInvalidatedLineCount += region.LineIDEnd - region.LineIDStart + 1; if (region.LineIDStart == region.LineIDEnd) _invalidate1LineCount++; } } public static void Output() { Debug.WriteLine(String.Format("ReceiveData:{0} (short:{1})", _receiveDataCount, _shortReceiveTimeCount)); Debug.WriteLine(String.Format("FullInvalidate:{0} PartialInvalidate:{1} 1-Line:{2} AvgLine:{3:F2}", _fullInvalidateCount, _partialInvalidateCount, _invalidate1LineCount, (double)_totalInvalidatedLineCount / _partialInvalidateCount)); } } }
{ "content_hash": "c7eeedfaf0034c3653f23c0dd9e8a872", "timestamp": "", "source": "github", "line_count": 1301, "max_line_length": 245, "avg_line_length": 39.068408916218296, "alnum_prop": 0.5522153143936414, "repo_name": "ArsenShnurkov/poderosa", "id": "558ace07c27bb601b20db875a08e64854f9184a0", "size": "53952", "binary": false, "copies": "1", "ref": "refs/heads/Terminosa", "path": "TerminalEmulator/TerminalControl.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "8344" }, { "name": "C#", "bytes": "4206347" }, { "name": "C++", "bytes": "37929" }, { "name": "JavaScript", "bytes": "13425" }, { "name": "Makefile", "bytes": "856" } ], "symlink_target": "" }
import {HttpModule, Http} from '@angular/http'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import {TranslateModule, TranslateLoader} from '@ngx-translate/core'; import {TranslateHttpLoader} from '@ngx-translate/http-loader'; import { PanelModule, InputTextModule, ButtonModule, TabViewModule } from 'primeng/primeng'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { HeaderComponent } from './header/header.component'; import { SearchComponent } from './search/search.component'; import { TestListComponent } from './test-list/test-list.component'; import { TestItemComponent } from './test-item/test-item.component'; import { TestItemDetailComponent } from './test-item-detail/test-item-detail.component'; import { HomeComponent } from './home/home.component'; import { LoaderService } from './loader.service'; // AoT requires an exported function for factories export function HttpLoaderFactory(http: Http) { return new TranslateHttpLoader(http, './i18n/', '.json'); } @NgModule({ declarations: [ AppComponent, HeaderComponent, SearchComponent, TestListComponent, TestItemComponent, TestItemDetailComponent, HomeComponent, ], imports: [ BrowserAnimationsModule, BrowserModule, HttpModule, TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: HttpLoaderFactory, deps: [Http] } }), FormsModule, AppRoutingModule, // primeng PanelModule, InputTextModule, ButtonModule, TabViewModule ], providers: [ LoaderService, ], bootstrap: [AppComponent] }) export class AppModule { }
{ "content_hash": "637ad9696d3a16e8dd26d328bf9d4e73", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 92, "avg_line_length": 29.390625, "alnum_prop": 0.7150451887293993, "repo_name": "Pencroff/PerfJS", "id": "a3702aae68cfb85772dcdb07df71778aae6dd9e8", "size": "1882", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "ng/src/app/app.module.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "67333" }, { "name": "HTML", "bytes": "13848" }, { "name": "JavaScript", "bytes": "438560" }, { "name": "TypeScript", "bytes": "28404" } ], "symlink_target": "" }
/* Generated by CIL v. 1.7.0 */ /* print_CIL_Input is false */ struct _IO_FILE; struct timeval; extern float strtof(char const *str , char const *endptr ) ; extern void signal(int sig , void *func ) ; typedef struct _IO_FILE FILE; extern int atoi(char const *s ) ; extern double strtod(char const *str , char const *endptr ) ; extern int fclose(void *stream ) ; extern void *fopen(char const *filename , char const *mode ) ; extern void abort() ; extern void exit(int status ) ; extern int raise(int sig ) ; extern int fprintf(struct _IO_FILE *stream , char const *format , ...) ; extern int strcmp(char const *a , char const *b ) ; extern int rand() ; extern unsigned long strtoul(char const *str , char const *endptr , int base ) ; void RandomFunc(unsigned long input[1] , unsigned long output[1] ) ; extern int strncmp(char const *s1 , char const *s2 , unsigned long maxlen ) ; extern int gettimeofday(struct timeval *tv , void *tz , ...) ; extern int printf(char const *format , ...) ; int main(int argc , char *argv[] ) ; void megaInit(void) ; extern unsigned long strlen(char const *s ) ; extern long strtol(char const *str , char const *endptr , int base ) ; extern unsigned long strnlen(char const *s , unsigned long maxlen ) ; extern void *memcpy(void *s1 , void const *s2 , unsigned long size ) ; struct timeval { long tv_sec ; long tv_usec ; }; extern void *malloc(unsigned long size ) ; extern int scanf(char const *format , ...) ; int main(int argc , char *argv[] ) { unsigned long input[1] ; unsigned long output[1] ; int randomFuns_i5 ; unsigned long randomFuns_value6 ; int randomFuns_main_i7 ; { megaInit(); if (argc != 2) { printf("Call this program with %i arguments\n", 1); exit(-1); } else { } randomFuns_i5 = 0; while (randomFuns_i5 < 1) { randomFuns_value6 = strtoul(argv[randomFuns_i5 + 1], 0, 10); input[randomFuns_i5] = randomFuns_value6; randomFuns_i5 ++; } RandomFunc(input, output); if (output[0] == 4242424242UL) { printf("You win!\n"); } else { } randomFuns_main_i7 = 0; while (randomFuns_main_i7 < 1) { printf("%lu\n", output[randomFuns_main_i7]); randomFuns_main_i7 ++; } } } void megaInit(void) { { } } void RandomFunc(unsigned long input[1] , unsigned long output[1] ) { unsigned long state[1] ; unsigned long local2 ; unsigned long local1 ; unsigned short copy11 ; { state[0UL] = (input[0UL] + 914778474UL) * 67330564296145686UL; local1 = 0UL; while (local1 < 0UL) { local2 = 0UL; while (local2 < 0UL) { copy11 = *((unsigned short *)(& state[local2]) + 0); *((unsigned short *)(& state[local2]) + 0) = *((unsigned short *)(& state[local2]) + 1); *((unsigned short *)(& state[local2]) + 1) = copy11; state[local1] = state[0UL] + state[local1]; local2 ++; } local1 ++; } output[0UL] = (state[0UL] + 447621010UL) + 0xfffffffff4a61947UL; } }
{ "content_hash": "7d4a747dfb94c604e024dc17f80d3ede", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 94, "avg_line_length": 29.215686274509803, "alnum_prop": 0.6335570469798658, "repo_name": "tum-i22/obfuscated-programs", "id": "3b15634354dd2cb386837e7a99673f1426a1cea9", "size": "2980", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tigress-generated-programs/empty-Seed4-RandomFuns-Type_long-ControlStructures_11-BB2-ForBound_boundedInput-Operators_PlusA_MinusA_Lt_Gt_Le_Ge_Eq_Ne_Mult_Div_Mod.c", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "11630" }, { "name": "C", "bytes": "208713340" }, { "name": "LLVM", "bytes": "116787620" }, { "name": "SMT", "bytes": "571425" } ], "symlink_target": "" }
This is a set of tools to output sensor (or other) data from an arduino, graph it with Processing, and log it with a C# Console Application to a file, a database, or both. The Console application is TopShelf enabled so it can be installed as a Windows Service. ### General Requirements - To upload the Arduino Sketch, [Arduino IDE](http://arduino.cc/en/main/software) - To run the Processing Sketch, [Processing](https://processing.org/download/) - To run the console application, Windows with .NET - To log to a database, a SQL Server instance (Express would work), or a database to connect to ### Sample Output ![Serial Output](Documentation/SampleSerial.png) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ![Graph](Documentation/SampleGraph.png) ![Console Application](Documentation/SampleOutput.png) ### Setup 1. Add sensors to your Arduino 1. Modify the sketch to read from them and output the data over the serial port 1. Upload the Arduino Sketch 1. Launch the Graph processing sketch to verify operation 1. Create the Database and tables from the scripts (optional) 1. Set up the Database connection string (optional) 1. Run the ArduinoMonitor console application to start logging 1. Install the ArduinoMonitor as a windows service (optional) ### Known issues
{ "content_hash": "bb14391a5fee74736fc5f2f264238198", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 260, "avg_line_length": 45.107142857142854, "alnum_prop": 0.7695961995249406, "repo_name": "Ehryk/ArduinoMonitor", "id": "a3778729cae7a6f22c11d0460a3dea807a7246f6", "size": "1281", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "ASP", "bytes": "104" }, { "name": "Arduino", "bytes": "4460" }, { "name": "C#", "bytes": "109272" }, { "name": "C++", "bytes": "3880" }, { "name": "CSS", "bytes": "126992" }, { "name": "HTML", "bytes": "5069" }, { "name": "JavaScript", "bytes": "1282216" }, { "name": "Processing", "bytes": "3130" }, { "name": "SQLPL", "bytes": "601" } ], "symlink_target": "" }
using content::BrowserContext; namespace quota_internals { QuotaInternalsHandler::QuotaInternalsHandler() {} QuotaInternalsHandler::~QuotaInternalsHandler() { if (proxy_.get()) proxy_->handler_ = NULL; } void QuotaInternalsHandler::RegisterMessages() { web_ui()->RegisterMessageCallback("requestInfo", base::Bind(&QuotaInternalsHandler::OnRequestInfo, base::Unretained(this))); } void QuotaInternalsHandler::ReportAvailableSpace(int64_t available_space) { SendMessage("AvailableSpaceUpdated", base::FundamentalValue(static_cast<double>(available_space))); } void QuotaInternalsHandler::ReportGlobalInfo(const GlobalStorageInfo& data) { std::unique_ptr<base::Value> value(data.NewValue()); SendMessage("GlobalInfoUpdated", *value); } void QuotaInternalsHandler::ReportPerHostInfo( const std::vector<PerHostStorageInfo>& hosts) { base::ListValue values; typedef std::vector<PerHostStorageInfo>::const_iterator iterator; for (iterator itr(hosts.begin()); itr != hosts.end(); ++itr) { values.Append(itr->NewValue()); } SendMessage("PerHostInfoUpdated", values); } void QuotaInternalsHandler::ReportPerOriginInfo( const std::vector<PerOriginStorageInfo>& origins) { base::ListValue origins_value; typedef std::vector<PerOriginStorageInfo>::const_iterator iterator; for (iterator itr(origins.begin()); itr != origins.end(); ++itr) { origins_value.Append(itr->NewValue()); } SendMessage("PerOriginInfoUpdated", origins_value); } void QuotaInternalsHandler::ReportStatistics(const Statistics& stats) { base::DictionaryValue dict; typedef Statistics::const_iterator iterator; for (iterator itr(stats.begin()); itr != stats.end(); ++itr) { dict.SetString(itr->first, itr->second); } SendMessage("StatisticsUpdated", dict); } void QuotaInternalsHandler::SendMessage(const std::string& message, const base::Value& value) { web_ui()->CallJavascriptFunctionUnsafe("cr.quota.messageHandler", base::StringValue(message), value); } void QuotaInternalsHandler::OnRequestInfo(const base::ListValue*) { if (!proxy_.get()) proxy_ = new QuotaInternalsProxy(this); proxy_->RequestInfo( BrowserContext::GetDefaultStoragePartition( Profile::FromWebUI(web_ui()))->GetQuotaManager()); } } // namespace quota_internals
{ "content_hash": "2f847668608cf7bdf0088921e36a32d2", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 77, "avg_line_length": 32.63513513513514, "alnum_prop": 0.7060041407867494, "repo_name": "danakj/chromium", "id": "62af29aff01fe0d9c98f98801ba5b1432690fa8d", "size": "3054", "binary": false, "copies": "6", "ref": "refs/heads/master", "path": "chrome/browser/ui/webui/quota_internals/quota_internals_handler.cc", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "d596818812634839cb01fa1af16a5e69", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "33768a129560a17ab41582abb417908bc15f3461", "size": "172", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Cnicus/Cnicus norrisii/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
package com.github.assisstion.Quizzer.vocab; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import com.github.assisstion.Quizzer.system.QuestionFactory; import com.github.assisstion.Quizzer.system.Quiz; public class VocabQuiz extends Quiz{ private static final int MAX_MODES = 3; private int mode = 0; public VocabQuiz(){ for(int i = 0; i <= MAX_MODES; i++){ answerList.add(new ArrayList<String>()); } } public VocabQuiz(int mode){ this(); this.mode = mode; } @Override public void load(String location){ int counter = 0; BufferedReader br = null; try{ br = new BufferedReader(new FileReader(location)); String s = br.readLine(); while(s != null){ if(s.length() <= 0 || s.substring(0, 1).equals("#")){ s = br.readLine(); continue; } String[] strings = s.split(";", -1); for(int i = 0; i < strings.length; i++){ String sx = cleanup(strings[i]); strings[i] = sx; } if(strings.length != 6){ System.out.println(s); System.out.println("Loading Problem; Code: 201"); s = br.readLine(); continue; } factorize(counter++, strings); s = br.readLine(); } } catch(IOException e){ System.out.println("IO Exception Caught; Code: 010"); e.printStackTrace(); if(br != null){ try{ br.close(); } catch(IOException e1){ System.out.println("IO Exception Caught; Code: 010"); e.printStackTrace(); } } } } private void factorize(int counter, String[] strings){ switch(mode){ case 0: return; case 1: factorize1(counter, strings); return; case 2: factorize2(counter, strings); return; case 3: factorize3(counter, strings); return; default: System.out.println("Loading Problem; Code: 202"); return; } } private void factorize1(int counter, String[] strings){ if(strings[0] == null || strings[2] == null || strings[0].equals("") || strings[2].equals("")){ System.out.println("Loading Problem; Code: 211"); return; } String query = "What is the definition of " + strings[0] + "?"; String answer = strings[2]; String hint = strings[3]; String info = "Synonyms: " + strings[4]; QuestionFactory.generateQuestion(questionMap, answerList.get(1), counter++, 1, hint, query, Collections.singleton(answer), info, strings[0]); } private void factorize2(int counter, String[] strings){ if(strings[4] == null || strings[4].equals("")){ return; } if(strings[0] == null || strings[0].equals("")){ System.out.println("Loading Problem; Code: 212"); return; } String query = "What are synonyms of " + strings[0] + "?"; String answer = strings[4]; String hint = strings[3]; String info = "Definition: " + strings[2]; QuestionFactory.generateQuestion(questionMap, answerList.get(2), counter++, 2, hint, query, Collections.singleton(answer), info, strings[0]); } private void factorize3(int counter, String[] strings){ if(strings[4] == null || strings[4].equals("")){ return; } if(strings[0] == null || strings[0].equals("")){ System.out.println("Loading Problem; Code: 212"); return; } String query = "What is a synonym of " + strings[0] + "?"; String answer = strings[4]; String[] answerParts = answer.split(","); HashSet<String> realAnswer = new HashSet<String>(); for(String s : answerParts){ String sa = cleanup(s).toLowerCase(); realAnswer.add(sa); } String hint = strings[3]; String info = "Definition: " + strings[2]; QuestionFactory.generateQuestion(questionMap, answerList.get(3), counter++, 2, hint, query, realAnswer, info, strings[0]); } private String cleanup(String string){ String s = string; while(s.length() > 0){ if(s.substring(s.length() - 1).equals(" ")){ s = s.substring(0, s.length() - 1); } else{ break; } } while(s.length() > 0){ if(s.substring(0, 1).equals(" ")){ s = s.substring(1); } else{ break; } } return s; } @Override public boolean showHint(){ switch(mode){ case 0: return false; case 1: return false; case 2: return false; case 3: return false; default: System.out.println("Loading Problem; Code: 221"); return false; } } @Override public boolean showInfo(){ switch(mode){ case 0: return false; case 1: return false; case 2: return true; case 3: return true; default: System.out.println("Loading Problem; Code: 221"); return false; } } public int getMode(){ return mode; } }
{ "content_hash": "2f10269658b53f1c40ab88da18cb982e", "timestamp": "", "source": "github", "line_count": 198, "max_line_length": 143, "avg_line_length": 23.646464646464647, "alnum_prop": 0.6247330200768902, "repo_name": "assisstion/Quizzer", "id": "d4eb50b2fac65eeb1a556d4ddcb1afafa72ae17e", "size": "4682", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/com/github/assisstion/Quizzer/vocab/VocabQuiz.java", "mode": "33188", "license": "mit", "language": [ { "name": "Java", "bytes": "67290" } ], "symlink_target": "" }
package commandline.language.parser.specific; import org.junit.Test; import java.io.File; import static org.junit.Assert.assertEquals; /** * User: gno, Date: 01.08.13 - 11:13 */ public class FileArgumentParserTest { public FileArgumentParserTest() { super(); } @Test public void testParse() { FileArgumentParser parser; File file; String path; parser = new FileArgumentParser(); path = "C:\\test.txt"; file = parser.parse(path); assertEquals(path, file.getAbsolutePath()); } }
{ "content_hash": "a38a3856be527f28b0f85bfd6ddc79e7", "timestamp": "", "source": "github", "line_count": 28, "max_line_length": 45, "avg_line_length": 18.071428571428573, "alnum_prop": 0.7055335968379447, "repo_name": "Gabro86/java-command-line-interface", "id": "4e30d6deab4645271548163455862cc9640d7462", "size": "506", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/test/java/commandline/language/parser/specific/FileArgumentParserTest.java", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "95" }, { "name": "HTML", "bytes": "482147" }, { "name": "Java", "bytes": "322024" } ], "symlink_target": "" }
package deprecated.org.crf.utilities; import deprecated.org.crf.function.DerivableFunction; import org.apache.log4j.Logger; /** * A {@link DerivableFunction} that remembers the last computed value and gradient. * So, if the user calls {@link #value(double[])} for the same point (and there was * no other call to {@link #value(double[])} in between) then the value will no be computed twice. Rather, the value * computed by the first call is stored, and will be returned. * The same applies to {@link #gradient(double[])}. * * @author Asher Stern * Date: Nov 13, 2014 * */ public class DerivableFunctionWithLastCache implements DerivableFunction { private static final Logger logger = Logger.getLogger(DerivableFunctionWithLastCache.class); private final LastCache<DoubleArrayWrapper, Double> valueCache = new LastCache<DoubleArrayWrapper, Double>(); private final LastCache<DoubleArrayWrapper, double[]> gradientCache = new LastCache<DoubleArrayWrapper, double[]>(); private final DerivableFunction realFunction; public DerivableFunctionWithLastCache(DerivableFunction realFunction) { super(); this.realFunction = realFunction; } @Override public double value(double[] point) { double ret = 0.0; DoubleArrayWrapper wrappedPoint = new DoubleArrayWrapper(point); Double fromCache = valueCache.get(wrappedPoint); if (null==fromCache) { double calculatedValue = realFunction.value(point); valueCache.put(wrappedPoint,calculatedValue); ret = calculatedValue; } else { logger.debug("Returning value from cache"); ret = fromCache; } return ret; } @Override public double[] gradient(double[] point) { double[] ret = null; DoubleArrayWrapper wrappedPoint = new DoubleArrayWrapper(point); double[] fromCache = gradientCache.get(wrappedPoint); if (null==fromCache) { double[] calculatedGradient = realFunction.gradient(point); gradientCache.put(wrappedPoint, calculatedGradient); ret = calculatedGradient; } else { logger.debug("Returning gradient from cache"); ret = fromCache; } return ret; } @Override public int size() { return realFunction.size(); } }
{ "content_hash": "f45b3153336d7e80a39de4e9c7bba5f3", "timestamp": "", "source": "github", "line_count": 76, "max_line_length": 117, "avg_line_length": 28.43421052631579, "alnum_prop": 0.7399352151781583, "repo_name": "digitalheir/java-rechtspraak-library", "id": "4636565c51c83b7c4c64d7168bb28e96e37cd677", "size": "2161", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "deprecated/crf/main/java/deprecated/org/crf/utilities/DerivableFunctionWithLastCache.java", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "1945" }, { "name": "Java", "bytes": "1433810" }, { "name": "Ruby", "bytes": "12077" }, { "name": "Shell", "bytes": "69" }, { "name": "XSLT", "bytes": "60431" } ], "symlink_target": "" }
'use strict'; /** * Placeholder `render` function. * * @private * @param {string} fmt - render format * @throws {Error} must be implemented by descendant classes */ function render() { throw new Error( 'not implemented' ); } // EXPORTS // module.exports = render;
{ "content_hash": "886b8492b8cbe858e12f5550c1307ca9", "timestamp": "", "source": "github", "line_count": 19, "max_line_length": 59, "avg_line_length": 14.263157894736842, "alnum_prop": 0.6678966789667896, "repo_name": "stdlib-js/stdlib", "id": "d7046a7a64631bce4aa0734f34672caf2fec27ba", "size": "887", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "lib/node_modules/@stdlib/plot/base/ctor/lib/render/stub.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Awk", "bytes": "21739" }, { "name": "C", "bytes": "15336495" }, { "name": "C++", "bytes": "1349482" }, { "name": "CSS", "bytes": "58039" }, { "name": "Fortran", "bytes": "198059" }, { "name": "HTML", "bytes": "56181" }, { "name": "Handlebars", "bytes": "16114" }, { "name": "JavaScript", "bytes": "85975525" }, { "name": "Julia", "bytes": "1508654" }, { "name": "Makefile", "bytes": "4806816" }, { "name": "Python", "bytes": "3343697" }, { "name": "R", "bytes": "576612" }, { "name": "Shell", "bytes": "559315" }, { "name": "TypeScript", "bytes": "19309407" }, { "name": "WebAssembly", "bytes": "5980" } ], "symlink_target": "" }
"""Test Notebook plugin.""" #------------------------------------------------------------------------------------------------- # Imports #------------------------------------------------------------------------------------------------- import os.path as op import re from textwrap import dedent from podoc.ast import ASTPlugin, ASTNode from podoc.markdown import MarkdownPlugin from podoc.utils import get_test_file_path, load_text from .._notebook import (_get_b64_resource, open_notebook, NotebookReader, NotebookWriter, wrap_code_cells, ) #------------------------------------------------------------------------------------------------- # Test Notebook utils #------------------------------------------------------------------------------------------------- def test_get_b64_resource(): assert not _get_b64_resource(None) assert len(_get_b64_resource(b'abcdef')) >= 4 def test_wrap_code_cells_1(): # Test wrap_code_cells() with a single code cell. ast = ASTNode('root') ast.add_child(ASTNode('CodeBlock', lang='python', children=[''])) ast_wrapped = wrap_code_cells(ast) ast_wrapped.show() ast_expected = ASTNode('root') ast_expected.add_child(ASTNode('CodeCell', children=[ast.children[0]])) assert ast_wrapped == ast_expected def test_wrap_code_cells_2(): # Test wrap_code_cells() with two code cells. ast = ASTNode('root') cb0 = ASTNode('CodeBlock', lang='python', children=['a']) cb1 = ASTNode('CodeBlock', lang='python', children=['b']) ast.add_child(cb0) ast.add_child(cb1) ast.show() ast_wrapped = wrap_code_cells(ast) ast_wrapped.show() ast_expected = ASTNode('root') # First code cell. code_cell0 = ASTNode('CodeCell') code_cell0.add_child(cb0) ast_expected.add_child(code_cell0) # Second code cell. code_cell1 = ASTNode('CodeCell') code_cell1.add_child(cb1) ast_expected.add_child(code_cell1) ast_expected.show() assert ast_wrapped == ast_expected #------------------------------------------------------------------------------------------------- # Test NotebookReader #------------------------------------------------------------------------------------------------- def test_notebook_reader_hello(): # Open a test notebook with just 1 Markdown cell. path = get_test_file_path('notebook', 'hello.ipynb') notebook = open_notebook(path) # Convert it to an AST. ast = NotebookReader().read(notebook) ast.show() # Check that the AST is equal to the one of a simple Mardown line. ast_1 = MarkdownPlugin().read('hello *world*') assert ast == ast_1 def test_notebook_reader_notebook(): # Open a test notebook with a code cell. path = get_test_file_path('notebook', 'simplenb.ipynb') notebook = open_notebook(path) # Convert it to an AST. reader = NotebookReader() ast = reader.read(notebook) ast.show() # Compare with the markdown version. path = get_test_file_path('markdown', 'simplenb.md') markdown_expected = load_text(path) markdown_converted = MarkdownPlugin().write(ast) markdown_converted = re.sub(r'\{resource:([^\}]+)\}', r'simplenb_files/\1', markdown_converted) # The test file has a trailing new line, but not the AST. markdown_converted += '\n' # Replace the image filename because the conversion is done without output path. markdown_expected = markdown_expected.replace('simplenb_4_1.png', 'output_4_1.png') assert markdown_converted == markdown_expected assert 'output_4_1.png' in reader.resources def test_output_text(podoc): img_path = get_test_file_path('markdown', 'simplenb_files/simplenb_4_1.png') markdown = dedent(''' ```python print("hello") ``` ![Some text](%s) ''' % img_path) nb = podoc.convert_text(markdown, source='markdown', target='notebook') nb.cells[0].outputs[0].data['text/plain'] = 'Replaced text' md = podoc.convert_text(nb, source='notebook', target='markdown') assert 'Replaced' not in md assert 'Some text' in md #------------------------------------------------------------------------------------------------- # Test NotebookWriter #------------------------------------------------------------------------------------------------- def test_notebook_empty(): ast = ASTNode('root') ast.add_child(ASTNode('Para')) nb = NotebookWriter().write(ast) reader = NotebookReader() ast = reader.read(nb) assert not ast.children def test_notebook_writer_hello(): path = get_test_file_path('ast', 'hello.json') ast = ASTPlugin().load(path) nb = NotebookWriter().write(ast) # Compare the notebooks. nb_expected = open_notebook(get_test_file_path('notebook', 'hello.ipynb')) # Ignore some fields when comparing the notebooks. assert nb == nb_expected def test_notebook_writer_notebook(): path = get_test_file_path('ast', 'simplenb.json') ast = ASTPlugin().load(path) # TODO: save resource files in JSON serializer # Load the image. fn = get_test_file_path('markdown', 'simplenb_files/simplenb_4_1.png') with open(fn, 'rb') as f: img = f.read() # Convert the AST to a notebook. nb = NotebookWriter().write(ast, context={'resources': {op.basename(fn): img}, 'path': path}) # Compare the notebooks. nb_expected = open_notebook(get_test_file_path('notebook', 'simplenb.ipynb')) # Ignore some fields when comparing the notebooks. assert nb == nb_expected
{ "content_hash": "f23097e253296ffd22419daebe2c051c", "timestamp": "", "source": "github", "line_count": 172, "max_line_length": 98, "avg_line_length": 32.96511627906977, "alnum_prop": 0.5534391534391534, "repo_name": "rossant/podoc", "id": "756865ac510bf81df156345313a16d171c51e1e5", "size": "5695", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "podoc/notebook/tests/test_notebook.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Jupyter Notebook", "bytes": "3416" }, { "name": "Makefile", "bytes": "475" }, { "name": "Python", "bytes": "155183" }, { "name": "Shell", "bytes": "246" } ], "symlink_target": "" }
package helios import ( "io/ioutil" "net/http" "testing" ) const ( ServerAddress = "http://localhost:8080" ) func skipInShortMode(t *testing.T) { if testing.Short() { t.Skip("Skipping E2e test in short mode.") } } func getResponse(address string, t *testing.T) []byte { resp, err := http.Get(address) if err != nil { t.Fatal("Error getting response", err) } var body []byte if body, err = ioutil.ReadAll(resp.Body); err != nil { t.Fatal("Error reading response body", err) } resp.Body.Close() return body }
{ "content_hash": "7860d3d1de889cd4d54ed35eec3f0688", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 55, "avg_line_length": 16.65625, "alnum_prop": 0.6585365853658537, "repo_name": "ArturKlajnerok/helios", "id": "c961aab9f458ee4ed6dc00dd24096d3674b872d6", "size": "533", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "helios/common_e2e_test.go", "mode": "33188", "license": "mit", "language": [ { "name": "Go", "bytes": "36078" }, { "name": "Shell", "bytes": "755" } ], "symlink_target": "" }
import React, { Component } from 'react'; import MapView from './map-view'; import RecentPins from './recent-pins'; import PinControls from './pin-controls'; import UserStatusBar from './user-status-bar'; export default ({ pins, auth, mapOptions, updateMapPrefs, addPin, removeAllPins, loginAttempt, logoutAttempt, recentPinClicked, logs }) => ( <div> <div className="row"> <div className="col-md-12"> <div className="page-header" id="header"> <h1>whereyouat <small>share your memorable locations</small></h1> <UserStatusBar loginAttempt={loginAttempt} logoutAttempt={logoutAttempt} authData={auth.data} /> </div> </div> </div> <div className="row"> <MapView pins={pins} center={mapOptions.center} zoom={mapOptions.zoom} updateMapPrefs={updateMapPrefs} onRightClick={addPin} /> <RecentPins pins={pins} recentPinClicked={recentPinClicked} /> <PinControls removeAllPins={removeAllPins} /> </div> </div> );
{ "content_hash": "9be368a3dd3d12fc18339cb1cc926c23", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 85, "avg_line_length": 27.176470588235293, "alnum_prop": 0.487012987012987, "repo_name": "mtharrison/whereyouat", "id": "bc850e5f8f3bd73dd175b0bd7c46c0411a9bb252", "size": "1386", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/js/components/app.js", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "778" }, { "name": "HTML", "bytes": "471" }, { "name": "JavaScript", "bytes": "11084" } ], "symlink_target": "" }
{% load staticfiles %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet"> <link href="{% static 'css/bootstrap-theme.min.css' %}" rel="stylesheet"> <link href="{% static 'css/font-awesome.css' %}" rel="stylesheet"> <link href="{% static 'css/wordplease.css' %}" rel="stylesheet"> <script type="text/javascript" src="{% static 'js/jquery-1.11.3.js' %}"></script> <script type="text/javascript" src="{% static 'js/bootstrap.js' %}"></script> <title> {% block title %} Bienvenido a WordPlease {% endblock %} </title> </head> <body> <div class="container-fluid" style="margin-top:5px;"> <div class="row"> <div class="col-md-12"> <nav class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span> </button> <a class="navbar-brand" href="#"><img src="{% static 'img/wp-logo.png' %}" style="width:30px;height:30px;float:left;margin-top:-7px;"> WordPlease</a> </div> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <ul class="nav navbar-nav"> <li class="active"> <a href="{% url 'blogs_home' %}"><i class="fa fa-home"></i> Home</a> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-hand-o-up"></i> Go to <strong class="caret"></strong></a> <ul class="dropdown-menu"> <li> <a href="{% url 'blogs_list' %}"><i class="fa fa-eye"></i> Blog List</a> </li> {% if user.is_authenticated %} <li> <a href="{% url 'user_posts' user.username %}"><i class="fa fa-wordpress"></i> My Posts</a> </li> {% endif %} <li class="divider"> </li> <li> <a href="{% url 'post_create' %}"><i class="fa fa-plus"></i> New Post</a> </li> </ul> </li> </ul> <ul class="nav navbar-nav navbar-right"> <form class="navbar-form navbar-left" role="search"> <div class="form-group"> <input type="text" class="form-control" placeholder="Search here!"/> </div> <button type="submit" class="btn btn-info"> <i class="fa fa-search"></i> </button> </form> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-users"></i> {% if user.is_authenticated %} {{user.username}} {% else %} User Login {% endif %} <strong class="caret"></strong></a> <ul class="dropdown-menu"> <li> <a href="{% url 'users_signup' %}"><i class="fa fa-user-plus"></i> Register</a> </li> <li class="divider"> </li> {% if user.is_authenticated == False %} <li> <a href="{% url 'users_login' %}"><i class="fa fa-sign-in"></i> Login</a> </li> {% else %} <li> <a href="#"><i class="fa fa-cogs"></i> User Area</a> </li> <li> <a href="{% url 'users_logout' %}"><i class="fa fa-sign-out"></i> Logout</a> </li> {% endif %} <li class="divider"> </li> <li> <a href="{% url 'admin:index' %}"><i class="fa fa-lock"></i> Admin</a> </li> </ul> </li> </ul> </div> </nav> </div> </div> <div class="row"> <div class="col-md-12"> <section> {% block section %} {% endblock %} </section> </div> </div> <div class="container-fluid"> <div class="row"> <div class="col-md-12 text-center well"> <footer> <small>WordPlease Inc &copy; Todos los derechos reservados</small> </footer> </div> </div> </div> </div> </body> </html>
{ "content_hash": "bf7c83f29a73ebb268845574963c47cd", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 169, "avg_line_length": 47.31967213114754, "alnum_prop": 0.37103758877533344, "repo_name": "krainet/Wordplease", "id": "c4b24a6e33dac17603a52aa0d39367b7de3535ca", "size": "5773", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "wordplease/templates/base.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "36" }, { "name": "HTML", "bytes": "15371" }, { "name": "JavaScript", "bytes": "484" }, { "name": "Python", "bytes": "35229" } ], "symlink_target": "" }
<?xml version="1.0"?> <InterchangeStudentGrade xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ed-fi.org/0100" xsi:schemaLocation="http://ed-fi.org/0100 ../../../../../../../sli/edfi-schema/src/main/resources/edfiXsd-SLI/SLI-Interchange-StudentGrade.xsd"> <Action ActionType="DELETE" Cascade="false" Force="false"> <Grade> <LetterGradeEarned>B</LetterGradeEarned> <GradeType>Final</GradeType> <StudentSectionAssociationReference> <StudentSectionAssociationIdentity> <StudentReference> <StudentIdentity> <StudentUniqueStateId>G-800000025</StudentUniqueStateId> </StudentIdentity> </StudentReference> <SectionReference> <SectionIdentity> <EducationalOrgReference> <EducationalOrgIdentity> <StateOrganizationId>G-South Daybreak Elementary</StateOrganizationId> </EducationalOrgIdentity> </EducationalOrgReference> <UniqueSectionCode>G-Mrs. Braverman's Homeroom #38</UniqueSectionCode> </SectionIdentity> </SectionReference> <BeginDate>2011-09-01</BeginDate> </StudentSectionAssociationIdentity> </StudentSectionAssociationReference> <GradingPeriodReference> <GradingPeriodIdentity> <EducationalOrgReference> <EducationalOrgIdentity> <StateOrganizationId>G-South Daybreak Elementary</StateOrganizationId> </EducationalOrgIdentity> </EducationalOrgReference> <GradingPeriod>Sixth Six Weeks</GradingPeriod> <BeginDate>2011-04-11</BeginDate> </GradingPeriodIdentity> </GradingPeriodReference> <SchoolYear>2011-2012</SchoolYear> </Grade> </Action> </InterchangeStudentGrade>
{ "content_hash": "f0ec975589c63d0c5d96b72ccf6f7350", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 169, "avg_line_length": 53.5, "alnum_prop": 0.5393858477970628, "repo_name": "inbloom/secure-data-service", "id": "625873e9fb740cf8f573b0ebb18e2be77272b25b", "size": "2247", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "sli/acceptance-tests/test/features/ingestion/test_data/OrphanGradeDelete/InterchangeStudentGrades.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "AspectJ", "bytes": "9748" }, { "name": "CSS", "bytes": "112888" }, { "name": "Clojure", "bytes": "37861" }, { "name": "CoffeeScript", "bytes": "18305" }, { "name": "Groovy", "bytes": "26568" }, { "name": "Java", "bytes": "12115410" }, { "name": "JavaScript", "bytes": "390822" }, { "name": "Objective-C", "bytes": "490386" }, { "name": "Python", "bytes": "34255" }, { "name": "Ruby", "bytes": "2543748" }, { "name": "Shell", "bytes": "111267" }, { "name": "XSLT", "bytes": "144746" } ], "symlink_target": "" }
#ifndef _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CNPPD_ED_Signature #define _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CNPPD_ED_Signature #include "type_iso.CANY.h" namespace AIMXML { namespace iso { class CNPPD_ED_Signature : public ::AIMXML::iso::CANY { public: AIMXML_EXPORT CNPPD_ED_Signature(xercesc::DOMNode* const& init); AIMXML_EXPORT CNPPD_ED_Signature(CNPPD_ED_Signature const& init); void operator=(CNPPD_ED_Signature const& other) { m_node = other.m_node; } static altova::meta::ComplexType StaticInfo() { return altova::meta::ComplexType(types + _altova_ti_iso_altova_CNPPD_ED_Signature); } MemberElement<iso::CUVP_ED_Signature, _altova_mi_iso_altova_CNPPD_ED_Signature_altova_item> item; struct item { typedef Iterator<iso::CUVP_ED_Signature> iterator; }; AIMXML_EXPORT void SetXsiType(); }; } // namespace iso } // namespace AIMXML #endif // _ALTOVA_INCLUDED_AIMXML_ALTOVA_iso_ALTOVA_CNPPD_ED_Signature
{ "content_hash": "f6bcde001dec26a3c9d441087a5cdc16", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 134, "avg_line_length": 28.424242424242426, "alnum_prop": 0.7494669509594882, "repo_name": "NCIP/annotation-and-image-markup", "id": "5d5c1be37030c32e3a90b7a40c2fb4fb014951dc", "size": "2461", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "AIMToolkit_v4.1.0_rv44/source/AIMLib/AIMXML/type_iso.CNPPD_ED_Signature.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "31363450" }, { "name": "C#", "bytes": "5152916" }, { "name": "C++", "bytes": "148605530" }, { "name": "CSS", "bytes": "85406" }, { "name": "Java", "bytes": "2039090" }, { "name": "Objective-C", "bytes": "381107" }, { "name": "Perl", "bytes": "502054" }, { "name": "Shell", "bytes": "11832" }, { "name": "Tcl", "bytes": "30867" } ], "symlink_target": "" }
package fixtures.http.implementation; import retrofit2.Retrofit; import fixtures.http.HttpServerFailures; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.ServiceResponseBuilder; import com.microsoft.rest.ServiceResponseCallback; import com.microsoft.rest.ServiceResponseEmptyCallback; import fixtures.http.models.Error; import fixtures.http.models.ErrorException; import java.io.IOException; import okhttp3.ResponseBody; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.HEAD; import retrofit2.http.Headers; import retrofit2.http.HTTP; import retrofit2.http.POST; import retrofit2.Response; /** * An instance of this class provides access to all the operations defined * in HttpServerFailures. */ public final class HttpServerFailuresImpl implements HttpServerFailures { /** The Retrofit service to perform REST calls. */ private HttpServerFailuresService service; /** The service client containing this operation class. */ private AutoRestHttpInfrastructureTestServiceImpl client; /** * Initializes an instance of HttpServerFailures. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ public HttpServerFailuresImpl(Retrofit retrofit, AutoRestHttpInfrastructureTestServiceImpl client) { this.service = retrofit.create(HttpServerFailuresService.class); this.client = client; } /** * The interface defining all the services for HttpServerFailures to be * used by Retrofit to perform actually REST calls. */ interface HttpServerFailuresService { @Headers("Content-Type: application/json; charset=utf-8") @HEAD("http/failure/server/501") Call<Void> head501(); @Headers("Content-Type: application/json; charset=utf-8") @GET("http/failure/server/501") Call<ResponseBody> get501(); @Headers("Content-Type: application/json; charset=utf-8") @POST("http/failure/server/505") Call<ResponseBody> post505(@Body Boolean booleanValue); @Headers("Content-Type: application/json; charset=utf-8") @HTTP(path = "http/failure/server/505", method = "DELETE", hasBody = true) Call<ResponseBody> delete505(@Body Boolean booleanValue); } /** * Return 501 status code - should be represented in the client as an error. * * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the Error object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse<Error> head501() throws ErrorException, IOException { Call<Void> call = service.head501(); return head501Delegate(call.execute()); } /** * Return 501 status code - should be represented in the client as an error. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link Call} object */ public ServiceCall<Error> head501Async(final ServiceCallback<Error> serviceCallback) { Call<Void> call = service.head501(); final ServiceCall<Error> serviceCall = new ServiceCall<>(call); call.enqueue(new ServiceResponseEmptyCallback<Error>(serviceCall, serviceCallback) { @Override public void onResponse(Call<Void> call, Response<Void> response) { try { ServiceResponse<Error> clientResponse = head501Delegate(response); if (serviceCallback != null) { serviceCallback.success(clientResponse); } serviceCall.success(clientResponse); } catch (ErrorException | IOException exception) { if (serviceCallback != null) { serviceCallback.failure(exception); } serviceCall.failure(exception); } } }); return serviceCall; } private ServiceResponse<Error> head501Delegate(Response<Void> response) throws ErrorException, IOException { return new ServiceResponseBuilder<Error, ErrorException>(this.client.mapperAdapter()) .registerError(ErrorException.class) .buildEmpty(response); } /** * Return 501 status code - should be represented in the client as an error. * * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the Error object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse<Error> get501() throws ErrorException, IOException { Call<ResponseBody> call = service.get501(); return get501Delegate(call.execute()); } /** * Return 501 status code - should be represented in the client as an error. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link Call} object */ public ServiceCall<Error> get501Async(final ServiceCallback<Error> serviceCallback) { Call<ResponseBody> call = service.get501(); final ServiceCall<Error> serviceCall = new ServiceCall<>(call); call.enqueue(new ServiceResponseCallback<Error>(serviceCall, serviceCallback) { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { try { ServiceResponse<Error> clientResponse = get501Delegate(response); if (serviceCallback != null) { serviceCallback.success(clientResponse); } serviceCall.success(clientResponse); } catch (ErrorException | IOException exception) { if (serviceCallback != null) { serviceCallback.failure(exception); } serviceCall.failure(exception); } } }); return serviceCall; } private ServiceResponse<Error> get501Delegate(Response<ResponseBody> response) throws ErrorException, IOException { return new ServiceResponseBuilder<Error, ErrorException>(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } /** * Return 505 status code - should be represented in the client as an error. * * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the Error object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse<Error> post505() throws ErrorException, IOException { final Boolean booleanValue = null; Call<ResponseBody> call = service.post505(booleanValue); return post505Delegate(call.execute()); } /** * Return 505 status code - should be represented in the client as an error. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link Call} object */ public ServiceCall<Error> post505Async(final ServiceCallback<Error> serviceCallback) { final Boolean booleanValue = null; Call<ResponseBody> call = service.post505(booleanValue); final ServiceCall<Error> serviceCall = new ServiceCall<>(call); call.enqueue(new ServiceResponseCallback<Error>(serviceCall, serviceCallback) { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { try { ServiceResponse<Error> clientResponse = post505Delegate(response); if (serviceCallback != null) { serviceCallback.success(clientResponse); } serviceCall.success(clientResponse); } catch (ErrorException | IOException exception) { if (serviceCallback != null) { serviceCallback.failure(exception); } serviceCall.failure(exception); } } }); return serviceCall; } /** * Return 505 status code - should be represented in the client as an error. * * @param booleanValue Simple boolean value true * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the Error object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse<Error> post505(Boolean booleanValue) throws ErrorException, IOException { Call<ResponseBody> call = service.post505(booleanValue); return post505Delegate(call.execute()); } /** * Return 505 status code - should be represented in the client as an error. * * @param booleanValue Simple boolean value true * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link Call} object */ public ServiceCall<Error> post505Async(Boolean booleanValue, final ServiceCallback<Error> serviceCallback) { Call<ResponseBody> call = service.post505(booleanValue); final ServiceCall<Error> serviceCall = new ServiceCall<>(call); call.enqueue(new ServiceResponseCallback<Error>(serviceCall, serviceCallback) { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { try { ServiceResponse<Error> clientResponse = post505Delegate(response); if (serviceCallback != null) { serviceCallback.success(clientResponse); } serviceCall.success(clientResponse); } catch (ErrorException | IOException exception) { if (serviceCallback != null) { serviceCallback.failure(exception); } serviceCall.failure(exception); } } }); return serviceCall; } private ServiceResponse<Error> post505Delegate(Response<ResponseBody> response) throws ErrorException, IOException { return new ServiceResponseBuilder<Error, ErrorException>(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } /** * Return 505 status code - should be represented in the client as an error. * * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the Error object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse<Error> delete505() throws ErrorException, IOException { final Boolean booleanValue = null; Call<ResponseBody> call = service.delete505(booleanValue); return delete505Delegate(call.execute()); } /** * Return 505 status code - should be represented in the client as an error. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link Call} object */ public ServiceCall<Error> delete505Async(final ServiceCallback<Error> serviceCallback) { final Boolean booleanValue = null; Call<ResponseBody> call = service.delete505(booleanValue); final ServiceCall<Error> serviceCall = new ServiceCall<>(call); call.enqueue(new ServiceResponseCallback<Error>(serviceCall, serviceCallback) { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { try { ServiceResponse<Error> clientResponse = delete505Delegate(response); if (serviceCallback != null) { serviceCallback.success(clientResponse); } serviceCall.success(clientResponse); } catch (ErrorException | IOException exception) { if (serviceCallback != null) { serviceCallback.failure(exception); } serviceCall.failure(exception); } } }); return serviceCall; } /** * Return 505 status code - should be represented in the client as an error. * * @param booleanValue Simple boolean value true * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the Error object wrapped in {@link ServiceResponse} if successful. */ public ServiceResponse<Error> delete505(Boolean booleanValue) throws ErrorException, IOException { Call<ResponseBody> call = service.delete505(booleanValue); return delete505Delegate(call.execute()); } /** * Return 505 status code - should be represented in the client as an error. * * @param booleanValue Simple boolean value true * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link Call} object */ public ServiceCall<Error> delete505Async(Boolean booleanValue, final ServiceCallback<Error> serviceCallback) { Call<ResponseBody> call = service.delete505(booleanValue); final ServiceCall<Error> serviceCall = new ServiceCall<>(call); call.enqueue(new ServiceResponseCallback<Error>(serviceCall, serviceCallback) { @Override public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) { try { ServiceResponse<Error> clientResponse = delete505Delegate(response); if (serviceCallback != null) { serviceCallback.success(clientResponse); } serviceCall.success(clientResponse); } catch (ErrorException | IOException exception) { if (serviceCallback != null) { serviceCallback.failure(exception); } serviceCall.failure(exception); } } }); return serviceCall; } private ServiceResponse<Error> delete505Delegate(Response<ResponseBody> response) throws ErrorException, IOException { return new ServiceResponseBuilder<Error, ErrorException>(this.client.mapperAdapter()) .registerError(ErrorException.class) .build(response); } }
{ "content_hash": "c3c64d0e5da92702569424b5f37d7d3a", "timestamp": "", "source": "github", "line_count": 348, "max_line_length": 122, "avg_line_length": 43.55747126436781, "alnum_prop": 0.6451378809869376, "repo_name": "AzCiS/autorest", "id": "4a625a16d15130a722f76409c6054423e4f74fb3", "size": "15476", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/http/implementation/HttpServerFailuresImpl.java", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "12942" }, { "name": "C#", "bytes": "11435278" }, { "name": "CSS", "bytes": "110" }, { "name": "HTML", "bytes": "274" }, { "name": "Java", "bytes": "4693719" }, { "name": "JavaScript", "bytes": "4685941" }, { "name": "PowerShell", "bytes": "29614" }, { "name": "Python", "bytes": "2274436" }, { "name": "Ruby", "bytes": "232193" }, { "name": "Shell", "bytes": "423" }, { "name": "TypeScript", "bytes": "179577" } ], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Data; using FluentMigrator.Builders.Execute; using FluentMigrator.Expressions; namespace FluentMigrator { public interface IMigrationProcessor : IQuerySchema, IDisposable { IMigrationProcessorOptions Options { get; } string ConnectionString { get; } void Execute(string template, params object[] args); DataSet ReadTableData(string schemaName, string tableName); DataSet Read(string template, params object[] args); bool Exists(string template, params object[] args); string QuoteColumnNameIfRequired(string columnName); string QuoteTableNameIfRequired(string tableName); string BuildSelect(string tableName, List<string> columns); void BeginTransaction(); void CommitTransaction(); void RollbackTransaction(); void Process(CreateSchemaExpression expression); void Process(DeleteSchemaExpression expression); void Process(AlterTableExpression expression); void Process(AlterColumnExpression expression); void Process(CreateTableExpression expression); void Process(CreateColumnExpression expression); void Process(DeleteTableExpression expression); void Process(DeleteColumnExpression expression); void Process(CreateForeignKeyExpression expression); void Process(DeleteForeignKeyExpression expression); void Process(CreateIndexExpression expression); void Process(DeleteIndexExpression expression); void Process(RenameTableExpression expression); void Process(RenameColumnExpression expression); void Process(InsertDataExpression expression); void Process(AlterDefaultConstraintExpression expression); void Process(PerformDBOperationExpression expression); void Process(DeleteDataExpression expression); void Process(UpdateDataExpression expression); void Process(AlterSchemaExpression expression); void Process(CreateSequenceExpression expression); void Process(DeleteSequenceExpression expression); void Process(CreateConstraintExpression expression); void Process(DeleteConstraintExpression expression); void Process(DeleteDefaultConstraintExpression expression); } }
{ "content_hash": "0572e78f483bde3a725191cdb19eae81", "timestamp": "", "source": "github", "line_count": 56, "max_line_length": 68, "avg_line_length": 41.94642857142857, "alnum_prop": 0.7428693060876969, "repo_name": "jogibear9988/fluentmigrator", "id": "dd3887bf6045dc315f45dbfae10319bd72f2ebf0", "size": "3007", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/FluentMigrator/IMigrationProcessor.cs", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "156" }, { "name": "C#", "bytes": "2746863" }, { "name": "PowerShell", "bytes": "266" }, { "name": "Ruby", "bytes": "8590" } ], "symlink_target": "" }
namespace taichi::lang { class LowerAccessPass : public Pass { public: static const PassID id; struct Args { std::vector<SNode *> kernel_forces_no_activate; bool lower_atomic; }; }; } // namespace taichi::lang
{ "content_hash": "255f98d7ba31a8134be065b6fac2814f", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 51, "avg_line_length": 17.615384615384617, "alnum_prop": 0.6724890829694323, "repo_name": "yuanming-hu/taichi", "id": "68f764fbddd1ccbc0a483e51ba3b47f296e353a6", "size": "272", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "taichi/transforms/lower_access.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "66677" }, { "name": "C++", "bytes": "3713898" }, { "name": "CMake", "bytes": "69354" }, { "name": "Cuda", "bytes": "20566" }, { "name": "GLSL", "bytes": "10756" }, { "name": "Makefile", "bytes": "994" }, { "name": "PowerShell", "bytes": "9227" }, { "name": "Python", "bytes": "2209929" }, { "name": "Shell", "bytes": "12216" } ], "symlink_target": "" }
package com.amazonaws.sample.lex; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; public class MessagesListAdapter extends BaseAdapter { private Context context; private int count; private static LayoutInflater layoutInflater; public MessagesListAdapter(Context context) { this.context = context; count = Conversation.getCount(); layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return count; } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { Holder holder; TextMessage item = Conversation.getMessage(position); if (convertView == null) { if ("tx".equals(item.getFrom())) { convertView = layoutInflater.inflate(R.layout.message_sent, null); holder = new Holder(); holder.data = (TextView) convertView.findViewById(R.id.editTextUserDetailInput_tx); } else { convertView = layoutInflater.inflate(R.layout.message_response, null); holder = new Holder(); holder.data = (TextView) convertView.findViewById(R.id.editTextUserDetailInput_rx); } convertView.setTag(holder); } else { holder = (Holder) convertView.getTag(); } holder.data.setText(item.getMessage()); return convertView; } // Helper class to recycle View's static class Holder { TextView data; } // Add new items public void refreshList(TextMessage message) { Conversation.add(message); notifyDataSetChanged(); } }
{ "content_hash": "54add707759403eac30b982009f15fc3", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 100, "avg_line_length": 27.743243243243242, "alnum_prop": 0.6385776911836337, "repo_name": "awslabs/aws-sdk-android-samples", "id": "d111c63d78113dd54cd672ec6d6d8f45f57f114d", "size": "2637", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "LexSample/app/src/main/java/com/amazonaws/sample/lex/MessagesListAdapter.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "174527" }, { "name": "Kotlin", "bytes": "7604" } ], "symlink_target": "" }
@interface SamuraiHtmlStyleObject(NumberPt) - (BOOL)isPt; @end #pragma mark - @interface SamuraiHtmlNumberPt : SamuraiHtmlNumber @end #endif // #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR)
{ "content_hash": "3ba50de9f6ad1c53a1ac8de5aac31fc8", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 59, "avg_line_length": 16.583333333333332, "alnum_prop": 0.7537688442211056, "repo_name": "cyndibaby905/samurai-native", "id": "3504a813fa0aa2a6f951134b03c2123bb7bb5d19", "size": "1924", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "samurai-framework/samurai-ui/extension-html/style/values/Samurai_HtmlNumberPt.h", "mode": "33188", "license": "mit", "language": [ { "name": "C++", "bytes": "35712" }, { "name": "CSS", "bytes": "87901" }, { "name": "Groff", "bytes": "857" }, { "name": "HTML", "bytes": "3708176" }, { "name": "JavaScript", "bytes": "22922" }, { "name": "Objective-C", "bytes": "2516266" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Coq bench</title> <link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" /> <link href="../../../../../bootstrap.min.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"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <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="../../..">Unstable</a></li> <li><a href=".">8.4.5 / contrib:minic 8.4.dev</a></li> <li class="active"><a href="">2014-12-05 13:08:54</a></li> </ul> <ul class="nav navbar-nav navbar-right"> <li><a href="../../../../../about.html">About</a></li> </ul> </div> </div> </div> <div class="article"> <div class="row"> <div class="col-md-12"> <a href=".">« Up</a> <h1> contrib:minic <small> 8.4.dev <span class="label label-success">9 s</span> </small> </h1> <p><em><script>document.write(moment("2014-12-05 13:08:54 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2014-12-05 13:08:54 UTC)</em><p> <h2>Lint</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>ruby lint.rb unstable ../unstable/packages/coq:contrib:minic/coq:contrib:minic.8.4.dev</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>0 s</dd> <dt>Output</dt> <dd><pre>The package is valid. </pre></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 --dry-run coq:contrib:minic.8.4.dev coq.8.4.5</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>1 s</dd> <dt>Output</dt> <dd><pre>[NOTE] Package coq is already installed (current version is 8.4.5). The following actions will be performed: - install coq:contrib:minic.8.4.dev === 1 to install === =-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= =-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Building coq:contrib:minic.8.4.dev: coq_makefile -f Make -o Makefile make -j4 make install Installing coq:contrib:minic.8.4.dev. </pre></dd> </dl> <p>Dry install without Coq, to test if the problem was incompatibility with the current Coq version:</p> <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 dependencies</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --deps-only coq:contrib:minic.8.4.dev</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>1 s</dd> </dl> <h2>Install</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam install -y --verbose coq:contrib:minic.8.4.dev</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>9 s</dd> <dt>Output</dt> <dd><pre>The following actions will be performed: - install coq:contrib:minic.8.4.dev === 1 to install === =-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= [coq:contrib:minic] Fetching https://gforge.inria.fr/git/coq-contribs/minic.git#v8.4 Initialized empty Git repository in /home/bench/.opam/packages.dev/coq:contrib:minic.8.4.dev/.git/ [master (root-commit) ff9f320] opam-git-init From https://gforge.inria.fr/git/coq-contribs/minic * [new branch] v8.4 -&gt; opam-ref * [new branch] v8.4 -&gt; origin/v8.4 LICENSE Make Makefile MiniC/BasicTypes.v MiniC/CAbstractSyntax.v MiniC/CSemantics.v MiniC/Memory.v MiniC/README MiniC/Stack.v MiniC/State.v MiniC/test.c MiniC/test1.c MiniC/test2.c Utilitaires/BlockDecl.v Utilitaires/DecisionProcedures.v Utilitaires/Dictionary.v Utilitaires/Exceptions.v Utilitaires/ListDefs.v Utilitaires/MLImport.v Utilitaires/PrettyPrint.v Utilitaires/README Utilitaires/SetOf.v Utilitaires/SimplDecl.v Utilitaires/StreamDefs.v bench.log description HEAD is now at 3138f9a Remove dependencies on legacy TheoryList =-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Building coq:contrib:minic.8.4.dev: coq_makefile -f Make -o Makefile make -j4 make install &quot;coqdep&quot; -c -slash -R . MiniC &quot;Utilitaires/StreamDefs.v&quot; &gt; &quot;Utilitaires/StreamDefs.v.d&quot; || ( RV=$?; rm -f &quot;Utilitaires/StreamDefs.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;Utilitaires/Exceptions.v&quot; &gt; &quot;Utilitaires/Exceptions.v.d&quot; || ( RV=$?; rm -f &quot;Utilitaires/Exceptions.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;Utilitaires/SimplDecl.v&quot; &gt; &quot;Utilitaires/SimplDecl.v.d&quot; || ( RV=$?; rm -f &quot;Utilitaires/SimplDecl.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;Utilitaires/MLImport.v&quot; &gt; &quot;Utilitaires/MLImport.v.d&quot; || ( RV=$?; rm -f &quot;Utilitaires/MLImport.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;Utilitaires/SetOf.v&quot; &gt; &quot;Utilitaires/SetOf.v.d&quot; || ( RV=$?; rm -f &quot;Utilitaires/SetOf.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;Utilitaires/DecisionProcedures.v&quot; &gt; &quot;Utilitaires/DecisionProcedures.v.d&quot; || ( RV=$?; rm -f &quot;Utilitaires/DecisionProcedures.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;Utilitaires/PrettyPrint.v&quot; &gt; &quot;Utilitaires/PrettyPrint.v.d&quot; || ( RV=$?; rm -f &quot;Utilitaires/PrettyPrint.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;Utilitaires/Dictionary.v&quot; &gt; &quot;Utilitaires/Dictionary.v.d&quot; || ( RV=$?; rm -f &quot;Utilitaires/Dictionary.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;Utilitaires/ListDefs.v&quot; &gt; &quot;Utilitaires/ListDefs.v.d&quot; || ( RV=$?; rm -f &quot;Utilitaires/ListDefs.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;Utilitaires/BlockDecl.v&quot; &gt; &quot;Utilitaires/BlockDecl.v.d&quot; || ( RV=$?; rm -f &quot;Utilitaires/BlockDecl.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;MiniC/CSemantics.v&quot; &gt; &quot;MiniC/CSemantics.v.d&quot; || ( RV=$?; rm -f &quot;MiniC/CSemantics.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;MiniC/Memory.v&quot; &gt; &quot;MiniC/Memory.v.d&quot; || ( RV=$?; rm -f &quot;MiniC/Memory.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;MiniC/BasicTypes.v&quot; &gt; &quot;MiniC/BasicTypes.v.d&quot; || ( RV=$?; rm -f &quot;MiniC/BasicTypes.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;MiniC/State.v&quot; &gt; &quot;MiniC/State.v.d&quot; || ( RV=$?; rm -f &quot;MiniC/State.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;MiniC/Stack.v&quot; &gt; &quot;MiniC/Stack.v.d&quot; || ( RV=$?; rm -f &quot;MiniC/Stack.v.d&quot;; exit ${RV} ) &quot;coqdep&quot; -c -slash -R . MiniC &quot;MiniC/CAbstractSyntax.v&quot; &gt; &quot;MiniC/CAbstractSyntax.v.d&quot; || ( RV=$?; rm -f &quot;MiniC/CAbstractSyntax.v.d&quot;; exit ${RV} ) &quot;coqc&quot; -q -R . MiniC Utilitaires/MLImport &quot;coqc&quot; -q -R . MiniC Utilitaires/Exceptions &quot;coqc&quot; -q -R . MiniC Utilitaires/PrettyPrint &quot;coqc&quot; -q -R . MiniC Utilitaires/StreamDefs Identifier &#39;try&#39; now a keyword &quot;coqc&quot; -q -R . MiniC Utilitaires/DecisionProcedures Identifier &#39;If&#39; now a keyword &quot;coqc&quot; -q -R . MiniC Utilitaires/ListDefs &quot;coqc&quot; -q -R . MiniC Utilitaires/SimplDecl &quot;coqc&quot; -q -R . MiniC Utilitaires/Dictionary &quot;coqc&quot; -q -R . MiniC Utilitaires/BlockDecl &quot;coqc&quot; -q -R . MiniC Utilitaires/SetOf &quot;coqc&quot; -q -R . MiniC MiniC/BasicTypes &quot;coqc&quot; -q -R . MiniC MiniC/Stack &quot;coqc&quot; -q -R . MiniC MiniC/CAbstractSyntax &quot;coqc&quot; -q -R . MiniC MiniC/Memory &quot;coqc&quot; -q -R . MiniC MiniC/State &quot;coqc&quot; -q -R . MiniC MiniC/CSemantics for i in MiniC/CAbstractSyntax.vo MiniC/Stack.vo MiniC/State.vo MiniC/BasicTypes.vo MiniC/Memory.vo MiniC/CSemantics.vo Utilitaires/BlockDecl.vo Utilitaires/ListDefs.vo Utilitaires/Dictionary.vo Utilitaires/PrettyPrint.vo Utilitaires/DecisionProcedures.vo Utilitaires/SetOf.vo Utilitaires/MLImport.vo Utilitaires/SimplDecl.vo Utilitaires/Exceptions.vo Utilitaires/StreamDefs.vo; do \ install -d `dirname &quot;/home/bench/.opam/system/lib/coq/user-contrib&quot;/MiniC/$i`; \ install -m 0644 $i &quot;/home/bench/.opam/system/lib/coq/user-contrib&quot;/MiniC/$i; \ done Installing coq:contrib:minic.8.4.dev. </pre></dd> </dl> <h2>Installation size</h2> <p>Total: 680 K</p> <ul> <li>181 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/MiniC/CSemantics.vo</code></li> <li>69 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/Utilitaires/ListDefs.vo</code></li> <li>67 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/Utilitaires/BlockDecl.vo</code></li> <li>59 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/Utilitaires/SimplDecl.vo</code></li> <li>52 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/Utilitaires/Dictionary.vo</code></li> <li>51 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/MiniC/CAbstractSyntax.vo</code></li> <li>50 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/MiniC/State.vo</code></li> <li>32 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/MiniC/BasicTypes.vo</code></li> <li>29 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/Utilitaires/SetOf.vo</code></li> <li>28 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/Utilitaires/StreamDefs.vo</code></li> <li>23 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/MiniC/Memory.vo</code></li> <li>17 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/MiniC/Stack.vo</code></li> <li>6 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/Utilitaires/Exceptions.vo</code></li> <li>5 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/Utilitaires/DecisionProcedures.vo</code></li> <li>3 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/Utilitaires/MLImport.vo</code></li> <li>1 K <code>/home/bench/.opam/system/lib/coq/user-contrib/MiniC/Utilitaires/PrettyPrint.vo</code></li> <li>1 K <code>/home/bench/.opam/system/lib/coq:contrib:minic/opam.config</code></li> <li>1 K <code>/home/bench/.opam/system/install/coq:contrib:minic.install</code></li> </ul> <h2>Uninstall</h2> <dl class="dl-horizontal"> <dt>Command</dt> <dd><code>opam remove -y coq:contrib:minic.8.4.dev</code></dd> <dt>Return code</dt> <dd>0</dd> <dt>Duration</dt> <dd>1 s</dd> <dt>Output</dt> <dd><pre>The following actions will be performed: - remove coq:contrib:minic.8.4.dev === 1 to remove === =-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= [coq:contrib:minic] Fetching https://gforge.inria.fr/git/coq-contribs/minic.git#v8.4 =-=- Removing Packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Removing coq:contrib:minic.8.4.dev. rm -R /home/bench/.opam/system/lib/coq/user-contrib/MiniC </pre></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"> <small>Sources are on <a href="https://github.com/coq-bench">GitHub</a>. © Guillaume Claret.</small> </p> </div> </div> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="../../../../../bootstrap.min.js"></script> </body> </html>
{ "content_hash": "6c130a5f79fa374dbe9fe27ff9a07b0e", "timestamp": "", "source": "github", "line_count": 262, "max_line_length": 383, "avg_line_length": 54.843511450381676, "alnum_prop": 0.5902985593987056, "repo_name": "coq-bench/coq-bench.github.io-old", "id": "1ffc53468389ab0333b9c010c82f4f66d8ddcb47", "size": "14371", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "clean/Linux-x86_64-4.01.0-1.2.0/unstable/8.4.5/contrib:minic/8.4.dev/2014-12-05_13-08-54.html", "mode": "33188", "license": "mit", "language": [], "symlink_target": "" }
import { difference } from 'lodash' export default difference
{ "content_hash": "2b6d9f0f7396239e1e5458e6c2ab400d", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 35, "avg_line_length": 21, "alnum_prop": 0.7777777777777778, "repo_name": "WorldBrain/WebMemex", "id": "7b4319c1e91537d7690091e3883c3dc9c5861530", "size": "63", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "__mocks__/lodash/fp/difference.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "40948" }, { "name": "HTML", "bytes": "2815" }, { "name": "JavaScript", "bytes": "335294" }, { "name": "Makefile", "bytes": "1114" } ], "symlink_target": "" }