text
stringlengths 18
215k
|
|---|
import { stringify } from 'qs'
import _request from '@/utils/request'
import mini from '@/utils/mini'
import env from '@/config/env'
// import { modelApis, commonParams } from './model'
// import { version } from '../package.json'
let apiBaseUrl
apiBaseUrl = `${env.apiBaseUrl}`
const regHttp = /^https?/i
const isMock = true;
// const regMock = /^mock?/i
function compact(obj) {
for (const key in obj) {
if (!obj[key]) {
delete obj[key]
}
}
return obj
}
function request(url, options, success, fail) {
const originUrl = regHttp.test(url) ? url : `${apiBaseUrl}${url}`
return _request(originUrl, compact(options), success, fail)
}
/**
* API 命名规则
* - 使用 camelCase 命名格式(小驼峰命名)
* - 命名尽量对应 RESTful 风格,`${动作}${资源}`
* - 假数据增加 fake 前缀
* - 便捷易用大于规则,程序是给人看的
*/
// api 列表
const modelApis = {
// 初始化配置
test: 'https://easy-mock.com/mock/5aa79bf26701e17a67bde1d7/',
getConfig: '/common/initconfig',
getWxSign: '/common/getwxsign',
// 积分兑换
getPointIndex: '/point/index',
getPointList: '/point/skulist',
getPointDetail: '/point/iteminfo',
getPointDetaiMore: '/product/productdetail',
getRList: '/point/recommenditems',
// 专题
getPointTopicInfo: '/point/topicinfo',
getPointTopicList: '/point/topicbuskulist',
// 主站专题
getTopicInfo: '/product/topicskusinfo',
getTopicList: '/product/topicskulist',
// 个人中心
getProfile: '/user/usercenter',
// 拼团相关
getCoupleList: '/product/coupleskulist',
getCoupleDetail: '/product/coupleskudetail',
getMerchantList: '/merchant/coupleskulist',
coupleOrderInit: 'POST /order/coupleorderinit',
coupleOrderList: '/user/usercouplelist',
coupleOrderDetail: '/user/usercoupleorderdetail',
coupleUserList: '/market/pinactivitiesuserlist', // 分享页拼团头像列表
coupleShareDetail: '/user/coupleactivitiedetail', // 分享详情
// 首页
getIndex: '/common/index',
getIndexNew: '/common/index_v1',
getHotSearch: '/common/hotsearchsug',
// 主流程
orderInit: 'POST /order/orderinit',
orderSubmit: 'POST /order/submitorder',
orderPay: 'POST /order/orderpay',
orderPayConfirm: '/order/orderpayconfirm', // 确认支付状态
getUserOrders: '/order/getuserorders', // 订单列表
getNeedCommentOrders: '/order/waitcommentlist', // 待评论
getUserRefundorders: '/order/userrefundorder', // 退款
getUserServiceOrders: '/order/userserviceorders', // 售后
orderCancel: 'POST /order/cancelorder', // 取消订单
orderDetail: '/order/orderdetail',
confirmReceived: 'POST /order/userorderconfirm', // 确认收货
orderComplaint: 'POST /refund/complaint', // 订单申诉
// 积分订单相关
pointOrderInit: 'POST /tradecenter/pointorderpreview',
pointOrderSubmit: 'POST /tradecenter/pointordersubmit',
pointOrderCancel: 'POST /tradecenter/ordercancel',
pointOrderList: '/tradecenter/orderlist',
pointOrderDetail: '/tradecenter/orderinfo',
pointOrderSuccess: '/tradecenter/ordersuccess',
// 退款相关
refundInit: '/refund/init',
refundDetail: '/refund/detail',
refundApply: 'POST /refund/apply',
// 登录注销
login: 'POST /user/login',
logout: 'POST /user/logout',
// 地址管理
addressList: '/user/addresslist',
addAddress: 'POST /user/addaddress',
updateAddress: 'POST /user/updateaddress',
setDefaultAddress: 'POST /user/setdefaultaddress',
deleteAddress: 'POST /user/deleteaddress',
provinceList: '/nation/provincelist',
cityList: '/nation/citylist',
districtList: '/nation/districtlist',
// 查看物流
getDelivery: '/order/deliverymessage',
// 获取七牛 token
getQiniuToken: '/common/qiniutoken',
}
// 仅限本地调试支持
// if (__DEV__ && env.mock) {
if (__DEV__ && isMock) {
apiBaseUrl = `${env.apiMockUrl}`
// Object.assign(modelApis, require('../mock'))
}
// 线上代理
if (__DEV__ && env.proxy) {
const proxyUrl = '/proxy'
apiBaseUrl = `${env.origin}${proxyUrl}`
}
const {
width,
height,
} = window.screen
// 公共参数
const commonParams = {
uuid: '', // 用户唯一标志
udid: '', // 设备唯一标志
device: '', // 设备
net: '', // 网络
uid: '',
token: '',
timestamp: '', // 时间
channel: 'h5', // 渠道
spm: 'h5',
v: env.version, // 系统版本
terminal: env.terminal, // 终端
swidth: width, // 屏幕宽度 分辨率
sheight: height, // 屏幕高度
location: '', // 地理位置
zoneId: 857, // 必须
}
// console.log(Object.keys(modelApis))
const apiList = Object.keys(modelApis).reduce((api, key) => {
const val = modelApis[key]
const [url, methodType = 'GET'] = val.split(/\s+/).reverse()
const method = methodType.toUpperCase()
// let originUrl = regHttp.test(url) ? url : `${env.apiBaseUrl}${url}`;
// NOTE: headers 在此处设置?
// if (__DEV__ && regLocalMock.test(url)) {
// api[key] = function postRequest(params, success, fail) {
// const res = require(`../${url}.json`)
// mini.hideLoading()
// res.errno === 0 ? success(res) : fail(res)
// }
// return api
// }
switch (method) {
case 'POST':
// originUrl = `${originUrl}`;
api[key] = function postRequest(params, success, fail) {
return request(url, {
headers: {
// Accept: 'application/json',
// 我们的 post 请求,使用的这个,不是 application/json
// 'Content-Type': 'application/x-www-form-urlencoded',
},
method,
data: compact(Object.assign({}, getCommonParams(), params)),
}, success, fail)
}
break
case 'GET':
default:
api[key] = function getRequest(params, success, fail) {
params = compact(Object.assign({}, getCommonParams(), params))
let query = stringify(params)
if (query) query = `?${query}`
return request(`${url}${query}`, {}, success, fail)
}
break
}
return api
}, {})
function setCommonParams(params) {
return Object.assign(commonParams, params)
}
function getCommonParams(key) {
return key ? commonParams[key] : {
// ...commonParams,
}
}
apiList.getCommonParams = getCommonParams
apiList.setCommonParams = setCommonParams
// console.log(apiList)
export default apiList
|
b'Calculate -15 + 25 + (-1 - (-2 + 0 + 4)).\n'
|
b'11 - 7 - (-27 - -13)\n'
|
/*
* THIS FILE IS AUTO GENERATED FROM 'lib/lex/lexer.kep'
* DO NOT EDIT
*/
define(["require", "exports", "bennu/parse", "bennu/lang", "nu-stream/stream", "ecma-ast/token", "ecma-ast/position",
"./boolean_lexer", "./comment_lexer", "./identifier_lexer", "./line_terminator_lexer", "./null_lexer",
"./number_lexer", "./punctuator_lexer", "./reserved_word_lexer", "./string_lexer", "./whitespace_lexer",
"./regular_expression_lexer"
], (function(require, exports, parse, __o, __o0, lexToken, __o1, __o2, comment_lexer, __o3, line_terminator_lexer,
__o4, __o5, __o6, __o7, __o8, whitespace_lexer, __o9) {
"use strict";
var lexer, lexStream, lex, always = parse["always"],
attempt = parse["attempt"],
binds = parse["binds"],
choice = parse["choice"],
eof = parse["eof"],
getPosition = parse["getPosition"],
modifyState = parse["modifyState"],
getState = parse["getState"],
enumeration = parse["enumeration"],
next = parse["next"],
many = parse["many"],
runState = parse["runState"],
never = parse["never"],
ParserState = parse["ParserState"],
then = __o["then"],
streamFrom = __o0["from"],
SourceLocation = __o1["SourceLocation"],
SourcePosition = __o1["SourcePosition"],
booleanLiteral = __o2["booleanLiteral"],
identifier = __o3["identifier"],
nullLiteral = __o4["nullLiteral"],
numericLiteral = __o5["numericLiteral"],
punctuator = __o6["punctuator"],
reservedWord = __o7["reservedWord"],
stringLiteral = __o8["stringLiteral"],
regularExpressionLiteral = __o9["regularExpressionLiteral"],
type, type0, type1, type2, type3, p, type4, type5, type6, type7, p0, type8, p1, type9, p2, consume = (
function(tok, self) {
switch (tok.type) {
case "Comment":
case "Whitespace":
case "LineTerminator":
return self;
default:
return tok;
}
}),
isRegExpCtx = (function(prev) {
if ((!prev)) return true;
switch (prev.type) {
case "Keyword":
case "Punctuator":
return true;
}
return false;
}),
enterRegExpCtx = getState.chain((function(prev) {
return (isRegExpCtx(prev) ? always() : never());
})),
literal = choice(((type = lexToken.StringToken.create), stringLiteral.map((function(x) {
return [type, x];
}))), ((type0 = lexToken.BooleanToken.create), booleanLiteral.map((function(x) {
return [type0, x];
}))), ((type1 = lexToken.NullToken.create), nullLiteral.map((function(x) {
return [type1, x];
}))), ((type2 = lexToken.NumberToken.create), numericLiteral.map((function(x) {
return [type2, x];
}))), ((type3 = lexToken.RegularExpressionToken.create), (p = next(enterRegExpCtx,
regularExpressionLiteral)), p.map((function(x) {
return [type3, x];
})))),
token = choice(attempt(((type4 = lexToken.IdentifierToken), identifier.map((function(x) {
return [type4, x];
})))), literal, ((type5 = lexToken.KeywordToken), reservedWord.map((function(x) {
return [type5, x];
}))), ((type6 = lexToken.PunctuatorToken), punctuator.map((function(x) {
return [type6, x];
})))),
inputElement = choice(((type7 = lexToken.CommentToken), (p0 = comment_lexer.comment), p0.map((function(
x) {
return [type7, x];
}))), ((type8 = lexToken.WhitespaceToken), (p1 = whitespace_lexer.whitespace), p1.map((function(x) {
return [type8, x];
}))), ((type9 = lexToken.LineTerminatorToken), (p2 = line_terminator_lexer.lineTerminator), p2.map(
(function(x) {
return [type9, x];
}))), token);
(lexer = then(many(binds(enumeration(getPosition, inputElement, getPosition), (function(start, __o10, end) {
var type10 = __o10[0],
value = __o10[1];
return always(new(type10)(new(SourceLocation)(start, end, (start.file || end.file)),
value));
}))
.chain((function(tok) {
return next(modifyState(consume.bind(null, tok)), always(tok));
}))), eof));
(lexStream = (function(s, file) {
return runState(lexer, new(ParserState)(s, new(SourcePosition)(1, 0, file), null));
}));
var y = lexStream;
(lex = (function(z) {
return y(streamFrom(z));
}));
(exports["lexer"] = lexer);
(exports["lexStream"] = lexStream);
(exports["lex"] = lex);
}));
|
<!DOCTYPE html>
<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />
<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />
<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">
<link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">
<meta name="keywords" content="Hexo, NexT" />
<meta name="description" content="About technology and about life.">
<meta property="og:type" content="website">
<meta property="og:title" content="Ice summer bug's notes">
<meta property="og:url" content="https://summerbuger.github.io/archives/2016/index.html">
<meta property="og:site_name" content="Ice summer bug's notes">
<meta property="og:description" content="About technology and about life.">
<meta property="og:locale" content="zh-Hans">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Ice summer bug's notes">
<meta name="twitter:description" content="About technology and about life.">
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Mist',
version: '5.1.4',
sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
fancybox: true,
tabs: true,
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
duoshuo: {
userId: '0',
author: '博主'
},
algolia: {
applicationID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
}
};
</script>
<link rel="canonical" href="https://summerbuger.github.io/archives/2016/"/>
<title>归档 | Ice summer bug's notes</title>
</head>
<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">
<div class="container sidebar-position-left page-archive">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-wrapper">
<div class="site-meta ">
<div class="custom-logo-site-title">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">Ice summer bug's notes</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle"></p>
</div>
<div class="site-nav-toggle">
<button>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
<span class="btn-bar"></span>
</button>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section">
<i class="menu-item-icon fa fa-fw fa-home"></i> <br />
首页
</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section">
<i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
标签
</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section">
<i class="menu-item-icon fa fa-fw fa-th"></i> <br />
分类
</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section">
<i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
归档
</a>
</li>
</ul>
</nav>
</div>
</header>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<div class="post-block archive">
<div id="posts" class="posts-collapse">
<span class="archive-move-on"></span>
<span class="archive-page-counter">
好! 目前共计 55 篇日志。 继续努力。
</span>
<div class="collection-title">
<h1 class="archive-year" id="archive-year-2016">2016</h1>
</div>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h2 class="post-title">
<a class="post-title-link" href="/2016/12/10/技术/spring/2016-12-10-SpringMvc-@ControllerAdvice/" itemprop="url">
<span itemprop="name">SpringMVC 中的 @ControllerAdvice</span>
</a>
</h2>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
datetime="2016-12-10T21:00:00+08:00"
content="2016-12-10" >
12-10
</time>
</div>
</header>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h2 class="post-title">
<a class="post-title-link" href="/2016/12/01/技术/spring/2016-12-01-SpringMVC源码学习-mvc加载过程/" itemprop="url">
<span itemprop="name">SpringMVC源码学习 —— MVC 配置加载过程</span>
</a>
</h2>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
datetime="2016-12-01T21:00:00+08:00"
content="2016-12-01" >
12-01
</time>
</div>
</header>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h2 class="post-title">
<a class="post-title-link" href="/2016/10/26/技术/java/2016-10-26-分布式锁/" itemprop="url">
<span itemprop="name">几种分布式锁的实现方式</span>
</a>
</h2>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
datetime="2016-10-26T21:00:00+08:00"
content="2016-10-26" >
10-26
</time>
</div>
</header>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h2 class="post-title">
<a class="post-title-link" href="/2016/10/16/技术/mybatis/2016-10-16-mybatis-XMLMapperBuilder/" itemprop="url">
<span itemprop="name">mybatis 中的 Configuration</span>
</a>
</h2>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
datetime="2016-10-16T21:00:00+08:00"
content="2016-10-16" >
10-16
</time>
</div>
</header>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h2 class="post-title">
<a class="post-title-link" href="/2016/10/16/技术/mybatis/2016-10-16-mybatis-MapperBuilderAssistant/" itemprop="url">
<span itemprop="name">mybatis 中的 MapperBuilderAssistant</span>
</a>
</h2>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
datetime="2016-10-16T21:00:00+08:00"
content="2016-10-16" >
10-16
</time>
</div>
</header>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h2 class="post-title">
<a class="post-title-link" href="/2016/10/16/技术/mybatis/2016-10-16-mybatis-Configuration/" itemprop="url">
<span itemprop="name">mybatis 中的 Configuration</span>
</a>
</h2>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
datetime="2016-10-16T21:00:00+08:00"
content="2016-10-16" >
10-16
</time>
</div>
</header>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h2 class="post-title">
<a class="post-title-link" href="/2016/10/16/技术/mybatis/2016-10-16-mybatis-MapperAnnotationBuilder/" itemprop="url">
<span itemprop="name">mybatis 中的 MapperAnnotationBuilder</span>
</a>
</h2>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
datetime="2016-10-16T21:00:00+08:00"
content="2016-10-16" >
10-16
</time>
</div>
</header>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h2 class="post-title">
<a class="post-title-link" href="/2016/10/16/技术/mybatis/2016-10-16-mybatis-MapperMethod/" itemprop="url">
<span itemprop="name">mybatis 中的 MapperMethod</span>
</a>
</h2>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
datetime="2016-10-16T21:00:00+08:00"
content="2016-10-16" >
10-16
</time>
</div>
</header>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h2 class="post-title">
<a class="post-title-link" href="/2016/09/20/技术/mybatis/2016-09-20-mybatis源码阅读/" itemprop="url">
<span itemprop="name">mybatis 源码阅读(一)</span>
</a>
</h2>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
datetime="2016-09-20T21:00:00+08:00"
content="2016-09-20" >
09-20
</time>
</div>
</header>
</article>
<article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
<header class="post-header">
<h2 class="post-title">
<a class="post-title-link" href="/2016/09/13/技术/java/2016-09-13-CPU占用过高处理过程/" itemprop="url">
<span itemprop="name">线上应用故障排查</span>
</a>
</h2>
<div class="post-meta">
<time class="post-time" itemprop="dateCreated"
datetime="2016-09-13T21:00:00+08:00"
content="2016-09-13" >
09-13
</time>
</div>
</header>
</article>
</div>
</div>
<nav class="pagination">
<span class="page-number current">1</span><a class="page-number" href="/archives/2016/page/2/">2</a><a class="extend next" rel="next" href="/archives/2016/page/2/"><i class="fa fa-angle-right"></i></a>
</nav>
</div>
</div>
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
<span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
</div>
</div>
<aside id="sidebar" class="sidebar">
<div class="sidebar-inner">
<section class="site-overview-wrap sidebar-panel sidebar-panel-active">
<div class="site-overview">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<img class="site-author-image" itemprop="image"
src="/images/headPicture.png"
alt="Liam Chen" />
<p class="site-author-name" itemprop="name">Liam Chen</p>
<p class="site-description motion-element" itemprop="description">About technology and about life.</p>
</div>
<nav class="site-state motion-element">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">55</span>
<span class="site-state-item-name">日志</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="/categories/index.html">
<span class="site-state-item-count">21</span>
<span class="site-state-item-name">分类</span>
</a>
</div>
<div class="site-state-item site-state-tags">
<a href="/tags/index.html">
<span class="site-state-item-count">41</span>
<span class="site-state-item-name">标签</span>
</a>
</div>
</nav>
</div>
</section>
</div>
</aside>
</div>
</main>
<footer id="footer" class="footer">
<div class="footer-inner">
<div class="copyright">© <span itemprop="copyrightYear">2019</span>
<span class="with-love">
<i class="fa fa-user"></i>
</span>
<span class="author" itemprop="copyrightHolder">Liam Chen</span>
</div>
<div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>
<span class="post-meta-divider">|</span>
<div class="theme-info">主题 — <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.4</div>
</div>
</footer>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
</div>
</div>
<script type="text/javascript">
if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
window.Promise = null;
}
</script>
<script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
<script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
<script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
<script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
<script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>
</body>
</html>
|
package com.gmail.hexragon.gn4rBot.command.ai;
import com.gmail.hexragon.gn4rBot.managers.commands.CommandExecutor;
import com.gmail.hexragon.gn4rBot.managers.commands.annotations.Command;
import com.gmail.hexragon.gn4rBot.util.GnarMessage;
import com.google.code.chatterbotapi.ChatterBot;
import com.google.code.chatterbotapi.ChatterBotFactory;
import com.google.code.chatterbotapi.ChatterBotSession;
import com.google.code.chatterbotapi.ChatterBotType;
import net.dv8tion.jda.entities.User;
import org.apache.commons.lang3.StringUtils;
import java.util.Map;
import java.util.WeakHashMap;
@Command(
aliases = {"cbot", "cleverbot"},
usage = "(query)",
description = "Talk to Clever-Bot."
)
public class PrivateCleverbotCommand extends CommandExecutor
{
private ChatterBotFactory factory = new ChatterBotFactory();
private ChatterBotSession session = null;
private Map<User, ChatterBotSession> sessionMap = new WeakHashMap<>();
@Override
public void execute(GnarMessage message, String[] args)
{
try
{
if (!sessionMap.containsKey(message.getAuthor()))
{
ChatterBot bot = factory.create(ChatterBotType.CLEVERBOT);
sessionMap.put(message.getAuthor(), bot.createSession());
}
message.replyRaw(sessionMap.get(message.getAuthor()).think(StringUtils.join(args, " ")));
}
catch (Exception e)
{
message.reply("Chat Bot encountered an exception. Restarting. `:[`");
sessionMap.remove(message.getAuthor());
}
}
}
|
CREATE TABLE <table-name>_nf (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`request_uri` VARCHAR(255) NOT NULL,
`referrer` VARCHAR(255) DEFAULT '',
`user_agent` VARCHAR(255) DEFAULT '',
`created_at` TIMESTAMP,
PRIMARY KEY (id)
) ENGINE = MyISAM DEFAULT CHARSET=utf8;
|
h1 {
/* inline || block || */
display: inline;
/* padding-box || border-box */
box-sizing: content-box;
padding: 0;
margin: 0;
}
/* Important Auto */
.auto-parent {
width: 500px;
}
.auto-child {
/* With Auto Width - it will fill up to take all the remaining space - 400 px */
margin-left: auto;
width: auto;
margin-right: 100px;
}
.three-autos-child {
/* With all 3 the Width is taking all the space - 500px */
margin-left: auto;
width: auto;
margin-right: auto;
}
|
# docker_runner
Run docker containers on the fly with ansible roles
# running program
Must be run with sudo privlegies
example
"sudo ruby drun.rb"
The program launches a docker container that self-provisions based on the ROLE
The ROLE value in the ruby file is the Ansible role, which will be run on the container
The docker container shares a common directory with all other docker containers, the host and a private host folder
The common directory should contain the ansible code used to self-provision the docker container
The host directory will be the same as the container name, which is randomly generated
# things to do
Have Ruby code ask for the role to be run
Enable multiple roles to be run on a single container
Create a UI for deployment
Enable easy creation of custom docker containers (templates of roles to run)
* example: a go container with vim, zsh etc
* one click deploy from a UI
|
b'Calculate (51 - 12) + -30 - (-5 + 2).\n'
|
b'Evaluate -29 - (-52 + 30 + 3).\n'
|
b'Evaluate 16 + -15 + 11 + -6.\n'
|
b'What is -21 - (-1 - (6 + (-21 - 1) + 9))?\n'
|
b'What is -9 + (3 + 37 - -2) + -14?\n'
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
////////////////////////////////////////////////////////////////////////////
//
//
// Purpose: This class defines behaviors specific to a writing system.
// A writing system is the collection of scripts and
// orthographic rules required to represent a language as text.
//
//
////////////////////////////////////////////////////////////////////////////
namespace System.Globalization {
using System;
using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Diagnostics.Contracts;
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class StringInfo
{
[OptionalField(VersionAdded = 2)]
private String m_str;
// We allow this class to be serialized but there is no conceivable reason
// for them to do so. Thus, we do not serialize the instance variables.
[NonSerialized] private int[] m_indexes;
// Legacy constructor
public StringInfo() : this(""){}
// Primary, useful constructor
public StringInfo(String value) {
this.String = value;
}
#region Serialization
[OnDeserializing]
private void OnDeserializing(StreamingContext ctx)
{
m_str = String.Empty;
}
[OnDeserialized]
private void OnDeserialized(StreamingContext ctx)
{
if (m_str.Length == 0)
{
m_indexes = null;
}
}
#endregion Serialization
[System.Runtime.InteropServices.ComVisible(false)]
public override bool Equals(Object value)
{
StringInfo that = value as StringInfo;
if (that != null)
{
return (this.m_str.Equals(that.m_str));
}
return (false);
}
[System.Runtime.InteropServices.ComVisible(false)]
public override int GetHashCode()
{
return this.m_str.GetHashCode();
}
// Our zero-based array of index values into the string. Initialize if
// our private array is not yet, in fact, initialized.
private int[] Indexes {
get {
if((null == this.m_indexes) && (0 < this.String.Length)) {
this.m_indexes = StringInfo.ParseCombiningCharacters(this.String);
}
return(this.m_indexes);
}
}
public String String {
get {
return(this.m_str);
}
set {
if (null == value) {
throw new ArgumentNullException(nameof(String),
Environment.GetResourceString("ArgumentNull_String"));
}
Contract.EndContractBlock();
this.m_str = value;
this.m_indexes = null;
}
}
public int LengthInTextElements {
get {
if(null == this.Indexes) {
// Indexes not initialized, so assume length zero
return(0);
}
return(this.Indexes.Length);
}
}
public String SubstringByTextElements(int startingTextElement) {
// If the string is empty, no sense going further.
if(null == this.Indexes) {
// Just decide which error to give depending on the param they gave us....
if(startingTextElement < 0) {
throw new ArgumentOutOfRangeException(nameof(startingTextElement),
Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
}
else {
throw new ArgumentOutOfRangeException(nameof(startingTextElement),
Environment.GetResourceString("Arg_ArgumentOutOfRangeException"));
}
}
return (this.SubstringByTextElements(startingTextElement, this.Indexes.Length - startingTextElement));
}
public String SubstringByTextElements(int startingTextElement, int lengthInTextElements) {
//
// Parameter checking
//
if(startingTextElement < 0) {
throw new ArgumentOutOfRangeException(nameof(startingTextElement),
Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
}
if(this.String.Length == 0 || startingTextElement >= this.Indexes.Length) {
throw new ArgumentOutOfRangeException(nameof(startingTextElement),
Environment.GetResourceString("Arg_ArgumentOutOfRangeException"));
}
if(lengthInTextElements < 0) {
throw new ArgumentOutOfRangeException(nameof(lengthInTextElements),
Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
}
if(startingTextElement > this.Indexes.Length - lengthInTextElements) {
throw new ArgumentOutOfRangeException(nameof(lengthInTextElements),
Environment.GetResourceString("Arg_ArgumentOutOfRangeException"));
}
int start = this.Indexes[startingTextElement];
if(startingTextElement + lengthInTextElements == this.Indexes.Length) {
// We are at the last text element in the string and because of that
// must handle the call differently.
return(this.String.Substring(start));
}
else {
return(this.String.Substring(start, (this.Indexes[lengthInTextElements + startingTextElement] - start)));
}
}
public static String GetNextTextElement(String str)
{
return (GetNextTextElement(str, 0));
}
////////////////////////////////////////////////////////////////////////
//
// Get the code point count of the current text element.
//
// A combining class is defined as:
// A character/surrogate that has the following Unicode category:
// * NonSpacingMark (e.g. U+0300 COMBINING GRAVE ACCENT)
// * SpacingCombiningMark (e.g. U+ 0903 DEVANGARI SIGN VISARGA)
// * EnclosingMark (e.g. U+20DD COMBINING ENCLOSING CIRCLE)
//
// In the context of GetNextTextElement() and ParseCombiningCharacters(), a text element is defined as:
//
// 1. If a character/surrogate is in the following category, it is a text element.
// It can NOT further combine with characters in the combinging class to form a text element.
// * one of the Unicode category in the combinging class
// * UnicodeCategory.Format
// * UnicodeCateogry.Control
// * UnicodeCategory.OtherNotAssigned
// 2. Otherwise, the character/surrogate can be combined with characters in the combinging class to form a text element.
//
// Return:
// The length of the current text element
//
// Parameters:
// String str
// index The starting index
// len The total length of str (to define the upper boundary)
// ucCurrent The Unicode category pointed by Index. It will be updated to the uc of next character if this is not the last text element.
// currentCharCount The char count of an abstract char pointed by Index. It will be updated to the char count of next abstract character if this is not the last text element.
//
////////////////////////////////////////////////////////////////////////
internal static int GetCurrentTextElementLen(String str, int index, int len, ref UnicodeCategory ucCurrent, ref int currentCharCount)
{
Contract.Assert(index >= 0 && len >= 0, "StringInfo.GetCurrentTextElementLen() : index = " + index + ", len = " + len);
Contract.Assert(index < len, "StringInfo.GetCurrentTextElementLen() : index = " + index + ", len = " + len);
if (index + currentCharCount == len)
{
// This is the last character/surrogate in the string.
return (currentCharCount);
}
// Call an internal GetUnicodeCategory, which will tell us both the unicode category, and also tell us if it is a surrogate pair or not.
int nextCharCount;
UnicodeCategory ucNext = CharUnicodeInfo.InternalGetUnicodeCategory(str, index + currentCharCount, out nextCharCount);
if (CharUnicodeInfo.IsCombiningCategory(ucNext)) {
// The next element is a combining class.
// Check if the current text element to see if it is a valid base category (i.e. it should not be a combining category,
// not a format character, and not a control character).
if (CharUnicodeInfo.IsCombiningCategory(ucCurrent)
|| (ucCurrent == UnicodeCategory.Format)
|| (ucCurrent == UnicodeCategory.Control)
|| (ucCurrent == UnicodeCategory.OtherNotAssigned)
|| (ucCurrent == UnicodeCategory.Surrogate)) // An unpair high surrogate or low surrogate
{
// Will fall thru and return the currentCharCount
} else {
int startIndex = index; // Remember the current index.
// We have a valid base characters, and we have a character (or surrogate) that is combining.
// Check if there are more combining characters to follow.
// Check if the next character is a nonspacing character.
index += currentCharCount + nextCharCount;
while (index < len)
{
ucNext = CharUnicodeInfo.InternalGetUnicodeCategory(str, index, out nextCharCount);
if (!CharUnicodeInfo.IsCombiningCategory(ucNext)) {
ucCurrent = ucNext;
currentCharCount = nextCharCount;
break;
}
index += nextCharCount;
}
return (index - startIndex);
}
}
// The return value will be the currentCharCount.
int ret = currentCharCount;
ucCurrent = ucNext;
// Update currentCharCount.
currentCharCount = nextCharCount;
return (ret);
}
// Returns the str containing the next text element in str starting at
// index index. If index is not supplied, then it will start at the beginning
// of str. It recognizes a base character plus one or more combining
// characters or a properly formed surrogate pair as a text element. See also
// the ParseCombiningCharacters() and the ParseSurrogates() methods.
public static String GetNextTextElement(String str, int index) {
//
// Validate parameters.
//
if (str==null) {
throw new ArgumentNullException(nameof(str));
}
Contract.EndContractBlock();
int len = str.Length;
if (index < 0 || index >= len) {
if (index == len) {
return (String.Empty);
}
throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
}
int charLen;
UnicodeCategory uc = CharUnicodeInfo.InternalGetUnicodeCategory(str, index, out charLen);
return (str.Substring(index, GetCurrentTextElementLen(str, index, len, ref uc, ref charLen)));
}
public static TextElementEnumerator GetTextElementEnumerator(String str)
{
return (GetTextElementEnumerator(str, 0));
}
public static TextElementEnumerator GetTextElementEnumerator(String str, int index)
{
//
// Validate parameters.
//
if (str==null)
{
throw new ArgumentNullException(nameof(str));
}
Contract.EndContractBlock();
int len = str.Length;
if (index < 0 || (index > len))
{
throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
}
return (new TextElementEnumerator(str, index, len));
}
/*
* Returns the indices of each base character or properly formed surrogate pair
* within the str. It recognizes a base character plus one or more combining
* characters or a properly formed surrogate pair as a text element and returns
* the index of the base character or high surrogate. Each index is the
* beginning of a text element within a str. The length of each element is
* easily computed as the difference between successive indices. The length of
* the array will always be less than or equal to the length of the str. For
* example, given the str \u4f00\u302a\ud800\udc00\u4f01, this method would
* return the indices: 0, 2, 4.
*/
public static int[] ParseCombiningCharacters(String str)
{
if (str == null)
{
throw new ArgumentNullException(nameof(str));
}
Contract.EndContractBlock();
int len = str.Length;
int[] result = new int[len];
if (len == 0)
{
return (result);
}
int resultCount = 0;
int i = 0;
int currentCharLen;
UnicodeCategory currentCategory = CharUnicodeInfo.InternalGetUnicodeCategory(str, 0, out currentCharLen);
while (i < len) {
result[resultCount++] = i;
i += GetCurrentTextElementLen(str, i, len, ref currentCategory, ref currentCharLen);
}
if (resultCount < len)
{
int[] returnArray = new int[resultCount];
Array.Copy(result, returnArray, resultCount);
return (returnArray);
}
return (result);
}
}
}
|
#!/usr/bin/env python
from ansible.module_utils.hashivault import hashivault_argspec
from ansible.module_utils.hashivault import hashivault_auth_client
from ansible.module_utils.hashivault import hashivault_init
from ansible.module_utils.hashivault import hashiwrapper
ANSIBLE_METADATA = {'status': ['stableinterface'], 'supported_by': 'community', 'version': '1.1'}
DOCUMENTATION = '''
---
module: hashivault_approle_role_get
version_added: "3.8.0"
short_description: Hashicorp Vault approle role get module
description:
- Module to get a approle role from Hashicorp Vault.
options:
name:
description:
- role name.
mount_point:
description:
- mount point for role
default: approle
extends_documentation_fragment: hashivault
'''
EXAMPLES = '''
---
- hosts: localhost
tasks:
- hashivault_approle_role_get:
name: 'ashley'
register: 'vault_approle_role_get'
- debug: msg="Role is {{vault_approle_role_get.role}}"
'''
def main():
argspec = hashivault_argspec()
argspec['name'] = dict(required=True, type='str')
argspec['mount_point'] = dict(required=False, type='str', default='approle')
module = hashivault_init(argspec)
result = hashivault_approle_role_get(module.params)
if result.get('failed'):
module.fail_json(**result)
else:
module.exit_json(**result)
@hashiwrapper
def hashivault_approle_role_get(params):
name = params.get('name')
client = hashivault_auth_client(params)
result = client.get_role(name, mount_point=params.get('mount_point'))
return {'role': result}
if __name__ == '__main__':
main()
|
b'Calculate -22 - (-1 - 10 - 26).\n'
|
b'Calculate -26 - (17 - 26 - -12).\n'
|
b'What is the value of -35 + (-72 - -46 - -80)?\n'
|
b'Calculate 2 - (12 + 2 + -7 + -3).\n'
|
b'52 + -43 + (1 - 0) + 0\n'
|
<?php
namespace Faker\Provider\fa_IR;
class PhoneNumber extends \Faker\Provider\PhoneNumber
{
/**
* @link https://fa.wikipedia.org/wiki/%D8%B4%D9%85%D8%A7%D8%B1%D9%87%E2%80%8C%D9%87%D8%A7%DB%8C_%D8%AA%D9%84%D9%81%D9%86_%D8%AF%D8%B1_%D8%A7%DB%8C%D8%B1%D8%A7%D9%86#.D8.AA.D9.84.D9.81.D9.86.E2.80.8C.D9.87.D8.A7.DB.8C_.D9.87.D9.85.D8.B1.D8.A7.D9.87
*/
protected static $formats = array( // land line formts seprated by province
"011########", //Mazandaran
"013########", //Gilan
"017########", //Golestan
"021########", //Tehran
"023########", //Semnan
"024########", //Zanjan
"025########", //Qom
"026########", //Alborz
"028########", //Qazvin
"031########", //Isfahan
"034########", //Kerman
"035########", //Yazd
"038########", //Chaharmahal and Bakhtiari
"041########", //East Azerbaijan
"044########", //West Azerbaijan
"045########", //Ardabil
"051########", //Razavi Khorasan
"054########", //Sistan and Baluchestan
"056########", //South Khorasan
"058########", //North Khorasan
"061########", //Khuzestan
"066########", //Lorestan
"071########", //Fars
"074########", //Kohgiluyeh and Boyer-Ahmad
"076########", //Hormozgan
"077########", //Bushehr
"081########", //Hamadan
"083########", //Kermanshah
"084########", //Ilam
"086########", //Markazi
"087########", //Kurdistan
);
protected static $mobileNumberPrefixes = array(
'0910#######',//mci
'0911#######',
'0912#######',
'0913#######',
'0914#######',
'0915#######',
'0916#######',
'0917#######',
'0918#######',
'0919#######',
'0901#######',
'0901#######',
'0902#######',
'0903#######',
'0930#######',
'0933#######',
'0935#######',
'0936#######',
'0937#######',
'0938#######',
'0939#######',
'0920#######',
'0921#######',
'0937#######',
'0990#######', // MCI
);
public static function mobileNumber()
{
return static::numerify(static::randomElement(static::$mobileNumberPrefixes));
}
}
|
/*
* WARNING: do not edit!
* Generated by util/mkbuildinf.pl
*
* Copyright 2014-2017 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#define PLATFORM "platform: linux-armv4"
#define DATE "built on: Fri Sep 13 15:59:17 2019 UTC"
/*
* Generate compiler_flags as an array of individual characters. This is a
* workaround for the situation where CFLAGS gets too long for a C90 string
* literal
*/
static const char compiler_flags[] = {
'c','o','m','p','i','l','e','r',':',' ','.','.','/','c','o','n',
'f','i','g','/','f','a','k','e','_','g','c','c','.','p','l',' ',
'-','f','P','I','C',' ','-','p','t','h','r','e','a','d',' ','-',
'W','a',',','-','-','n','o','e','x','e','c','s','t','a','c','k',
' ','-','W','a','l','l',' ','-','O','3',' ','-','D','O','P','E',
'N','S','S','L','_','U','S','E','_','N','O','D','E','L','E','T',
'E',' ','-','D','O','P','E','N','S','S','L','_','P','I','C',' ',
'-','D','O','P','E','N','S','S','L','_','C','P','U','I','D','_',
'O','B','J',' ','-','D','O','P','E','N','S','S','L','_','B','N',
'_','A','S','M','_','M','O','N','T',' ','-','D','O','P','E','N',
'S','S','L','_','B','N','_','A','S','M','_','G','F','2','m',' ',
'-','D','S','H','A','1','_','A','S','M',' ','-','D','S','H','A',
'2','5','6','_','A','S','M',' ','-','D','S','H','A','5','1','2',
'_','A','S','M',' ','-','D','K','E','C','C','A','K','1','6','0',
'0','_','A','S','M',' ','-','D','A','E','S','_','A','S','M',' ',
'-','D','B','S','A','E','S','_','A','S','M',' ','-','D','G','H',
'A','S','H','_','A','S','M',' ','-','D','E','C','P','_','N','I',
'S','T','Z','2','5','6','_','A','S','M',' ','-','D','P','O','L',
'Y','1','3','0','5','_','A','S','M',' ','-','D','N','D','E','B',
'U','G','\0'
};
|
/*
* database.hpp
*
* Created on: Sep 22, 2016
* Author: dan
*/
#ifndef SRC_TURBO_BROCCOLI_DATABASE_HPP_
#define SRC_TURBO_BROCCOLI_DATABASE_HPP_
#include <boost/filesystem.hpp>
#include <turbo_broccoli/type/key.hpp>
#include <turbo_broccoli/type/value.hpp>
#include <turbo_broccoli/type/blob.hpp>
#include <turbo_broccoli/type/tags.hpp>
#include <turbo_broccoli/type/tagged_records.hpp>
#include <turbo_broccoli/type/result_find.hpp>
#include <turbo_broccoli/type/result_key.hpp>
#include <turbo_broccoli/detail/utils.hpp>
namespace turbo_broccoli {
using types::blob;
using types::db_key;
using types::result_key;
using types::result_find;
struct database {
database(const std::string& path) : path_(path) {
namespace fs = boost::filesystem;
if(!fs::exists(path_) ) {
if(!fs::create_directories(path_)) {
throw std::runtime_error("cannot open db, cannot create directory: " + path_.generic_string());
}
}
else {
if(!fs::is_directory(path_)) {
throw std::runtime_error("cannot open db, is not a directory: " + path_.generic_string());
}
}
}
result_find find(const std::string& key) {
return find(detail::calculate_key(key));
}
result_find find(const db_key& key) {
result_find result{};
result.success = false;
if(!record_exists(key)) {
std::cout << "no record with key" << types::to_string(key) << std::endl;
return result;
}
auto record = read_record(key);
if( is_blob(record)) {
result.success = true;
result.results.push_back(detail::deserialize<blob>(record.data));
}
if(is_tag_list(record)) {
auto records = detail::deserialize<types::tagged_records>(record.data);
for(auto& t : records.keys) {
auto k = types::string_to_key(t);
if(record_exists(k)) {
auto r = read_record(k);
if( is_blob(r)) {
result.success = true;
result.results.push_back(detail::deserialize<blob>(r.data));
}
else {
std::cout << "inconsistent: record is not blob " << t << std::endl;
}
}
else {
std::cout << "inconsistent no record from tag list " << t << std::endl;
}
}
}
return result;
}
result_key store(const blob& new_blob) {
static const result_key failed_result{false, turbo_broccoli::types::nil_key() };
if(record_exists(new_blob)) {
/*
* read all tags and update them!
*/
auto r = read_record(new_blob.key_hash());
auto old_blob = detail::deserialize<blob>(r.data);
types::tag_list::list_type to_delete = diff( old_blob.tags().tags, new_blob.tags().tags);
types::tag_list::list_type to_add = diff( new_blob.tags().tags, old_blob.tags().tags);
for(auto& t : to_add ) {
update_tag_add(t, types::to_string(new_blob.key_hash()));
}
for(auto& t : to_delete ) {
update_tag_remove(t, types::to_string(new_blob.key_hash()));
}
}
else {
detail::create_folder(path_, new_blob.key_hash());
for(auto& t : new_blob.tags().tags ) {
update_tag_add(t, types::to_string(new_blob.key_hash()));
}
}
write_blob(new_blob);
return {true, new_blob.key_hash()};
return failed_result;
}
private:
inline bool record_exists(const blob& b) {
namespace fs = boost::filesystem;
return fs::exists(detail::to_filename(path_, b.key_hash()));
}
inline bool record_exists(const db_key& k) {
namespace fs = boost::filesystem;
return fs::exists(detail::to_filename(path_, k));
}
inline void write_blob(const blob& b) {
namespace fs = boost::filesystem;
types::value_t v;
v.data = detail::serialize(b);
v.reccord_type = types::value_type::blob;
v.key = b.key();
detail::create_folder(path_, b.key_hash());
detail::write_file(detail::to_filename(path_, b.key_hash()).generic_string(), detail::serialize(v));
}
inline types::value_t read_record(const db_key& k) {
namespace fs = boost::filesystem;
auto tmp = detail::read_file(detail::to_filename(path_, k).generic_string() );
return detail::deserialize<types::value_t>(tmp);
}
inline void update_tag_add(const std::string& tag_name, const std::string& record_key) {
auto tag_key = detail::calculate_key(tag_name);
types::value_t v;
types::tagged_records records;
if(record_exists(tag_key)) {
v = read_record(tag_key);
if(types::is_tag_list(v)) {
records = detail::deserialize<types::tagged_records>(v.data);
for(auto& r : records.keys) {
if(record_key.compare(r) == 0) {
return;
}
}
records.keys.push_back(record_key);
}
else {
throw std::runtime_error("record exissts and is not a tagged_list: " + tag_name);
}
}
else {
records.keys.push_back(record_key);
v.key = tag_name;
v.reccord_type = types::value_type::tag_list;
v.data = detail::serialize(records);
detail::create_folder(path_, tag_key);
}
v.data = detail::serialize(records);
detail::write_file(detail::to_filename(path_, tag_key).generic_string(), detail::serialize(v));
}
inline void update_tag_remove(const std::string& tag_name, const std::string& record_key) {
auto tag_key = detail::calculate_key(tag_name);
types::value_t v = read_record(tag_key);
if(types::is_tag_list(v)) {
types::tagged_records records = detail::deserialize<types::tagged_records>(v.data);
records.keys.erase(std::remove(records.keys.begin(), records.keys.end(), record_key), records.keys.end());
v.data = detail::serialize(records);
detail::write_file(detail::to_filename(path_, tag_key).generic_string(), detail::serialize(v));
}
}
/*
* \brief return list of all elements that are only in a
* a{0, 1, 2, 3, 4}
* b{3, 4, 5, 6, 7}
* d{0, 1, 2}
*/
inline std::vector<std::string> diff(const std::vector<std::string>& a, const std::vector<std::string>& b) {
std::vector<std::string> d;
for(auto& a_i : a) {
bool contains_b_i{false};
for(auto& b_i : b) {
if(a_i.compare(b_i) == 0) {
contains_b_i = true;
break;
}
}
if(!contains_b_i) {
d.push_back(a_i);
}
}
return d;
}
using path_t = boost::filesystem::path;
path_t path_;
};
}
#endif /* SRC_TURBO_BROCCOLI_DATABASE_HPP_ */
|
b'(10 - 1) + (17 - 19 - (3 - -1))\n'
|
<!--
Safe sample
input : backticks interpretation, reading the file /tmp/tainted.txt
SANITIZE : use of preg_replace with another regex
File : use of untrusted data in one side of a quoted expression in a script
-->
<!--Copyright 2015 Bertrand STIVALET
Permission is hereby granted, without written agreement or royalty fee, to
use, copy, modify, and distribute this software and its documentation for
any purpose, provided that the above copyright notice and the following
three paragraphs appear in all copies of this software.
IN NO EVENT SHALL AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF AUTHORS HAVE
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AUTHORS SPECIFICALLY DISCLAIM ANY WARRANTIES INCLUDING, BUT NOT
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
THE SOFTWARE IS PROVIDED ON AN "AS-IS" BASIS AND AUTHORS HAVE NO
OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.-->
<!DOCTYPE html>
<html>
<head>
<script>
<?php
$tainted = `cat /tmp/tainted.txt`;
$tainted = preg_replace('/\W/si','',$tainted);
echo "x='". $tainted ."'" ;
?>
</script>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
|
---
author: admin
comments: true
date: 2010-03-26 09:48:35+00:00
layout: post
slug: what-to-do-when-ubuntu-device-mapper-seems-to-be-invincible
title: 'What to do when Ubuntu Device-mapper seems to be invincible! '
categories:
- Instructional
tags:
- 64-bit
- hard drive
- hardware
- linux
- lucid lynx
- Ubuntu
- workstation
---
I've been trying a dozen different configurations of my 2x500GB SATA drives over the past few days involving switching between ACHI/IDE/RAID in my bios (This was after trying different things to solve [my problems with Ubuntu Lucid Lynx]({{ BASE_PATH }}/2010/03/my-experience-with-ubuntu-10-04-lucid-lynx/)) ; After each attempt I've reset the bios option, booted into a live CD, deleting partitions and rewriting partition tables left on the drives.
Now, however, I've been sitting with a /dev/mapper/nvidia_XXXXXXX1 that seems to be impossible to kill!
It's the only 'partition' that I see in the Ubuntu install (but I can see the others in parted) but it is only the size of one of the drives, and I know I did not set any RAID levels other than RAID0.
Thanks to [wazoox](http://perlmonks.org/?node_id=292373) for eliminating a possibility involving LVM issues with lvremove and vgremove, but I found what works for me.
After a bit of experimenting, I tried
>
>
> <code>$dmraid -r
> </code>
>
>
so see what raid sets were set up, then did
>
>
> <code>$dmraid -x
> </code>
>
>
but was presented with
> ERROR: Raid set deletion is not supported in "nvidia" format
Googled this and found [this forum post](http://ubuntuforums.org/showthread.php?p=8417410) that told me to do this;
>
>
> <code>$dmraid -rE
> </code>
>
>
And that went through, rebooted, hoped, waited (well, while i was waiting, set the bios back to AHCI), and repartitioned, and all of (this particular issue) was well again. Hope this helps someone else down the line!
(This is a duplicate of my [ServerFault query](http://serverfault.com/questions/125976/ubuntu-device-mapper-seems-to-be-invincible) on this that I answered myself)
|
b'Calculate (13 + -20 + 6 - 5) + -4 + 0.\n'
|
b'What is (-1 - -19) + (-48 - -28)?\n'
|
<?php
/*
* This file is part of the sfOauthServerPlugin package.
* (c) Jean-Baptiste Cayrou <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
*/
/**
* sfOauthServerRouting configuration.
*
* @package sfOauthServerPlugin
* @subpackage routing
* @author Matthias Krauser <[email protected]>
*/
class sfOauthServerRouting
{
/**
* Listens to the routing.load_configuration event.
*
* @param sfEvent An sfEvent instance
* @static
*/
static public function listenToRoutingLoadConfigurationEvent(sfEvent $event)
{
$r = $event->getSubject();
/* @var $r sfPatternRouting */
// preprend our routes
$r->prependRoute('sf_oauth_server_consumer_sfOauthAdmin', new sfPropelRouteCollection(array(
'name' => 'sf_oauth_server_consumer_sfOauthAdmin',
'model' => 'sfOauthServerConsumer',
'module' => 'sfOauthAdmin',
'prefix_path' => '/oauth/admin',
'with_wildcard_routes' => true
)));
}
}
|
b'What is -9 + (10 - 8) - 2?\n'
|
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# 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.
# 操作失败。
FAILEDOPERATION = 'FailedOperation'
# API网关触发器创建失败。
FAILEDOPERATION_APIGATEWAY = 'FailedOperation.ApiGateway'
# 创建触发器失败。
FAILEDOPERATION_APIGW = 'FailedOperation.Apigw'
# 获取Apm InstanceId失败。
FAILEDOPERATION_APMCONFIGINSTANCEID = 'FailedOperation.ApmConfigInstanceId'
# 当前异步事件状态不支持此操作,请稍后重试。
FAILEDOPERATION_ASYNCEVENTSTATUS = 'FailedOperation.AsyncEventStatus'
# 复制函数失败。
FAILEDOPERATION_COPYFAILED = 'FailedOperation.CopyFailed'
# 不支持复制到该地域。
FAILEDOPERATION_COPYFUNCTION = 'FailedOperation.CopyFunction'
# 操作COS资源失败。
FAILEDOPERATION_COS = 'FailedOperation.Cos'
# 创建别名失败。
FAILEDOPERATION_CREATEALIAS = 'FailedOperation.CreateAlias'
# 操作失败。
FAILEDOPERATION_CREATEFUNCTION = 'FailedOperation.CreateFunction'
# 创建命名空间失败。
FAILEDOPERATION_CREATENAMESPACE = 'FailedOperation.CreateNamespace'
# 当前函数状态无法进行此操作。
FAILEDOPERATION_CREATETRIGGER = 'FailedOperation.CreateTrigger'
# 当前调试状态无法执行此操作。
FAILEDOPERATION_DEBUGMODESTATUS = 'FailedOperation.DebugModeStatus'
# 调试状态下无法更新执行超时时间。
FAILEDOPERATION_DEBUGMODEUPDATETIMEOUTFAIL = 'FailedOperation.DebugModeUpdateTimeOutFail'
# 删除别名失败。
FAILEDOPERATION_DELETEALIAS = 'FailedOperation.DeleteAlias'
# 当前函数状态无法进行此操作,请在函数状态正常时重试。
FAILEDOPERATION_DELETEFUNCTION = 'FailedOperation.DeleteFunction'
# 删除layer版本失败。
FAILEDOPERATION_DELETELAYERVERSION = 'FailedOperation.DeleteLayerVersion'
# 无法删除默认Namespace。
FAILEDOPERATION_DELETENAMESPACE = 'FailedOperation.DeleteNamespace'
# 删除触发器失败。
FAILEDOPERATION_DELETETRIGGER = 'FailedOperation.DeleteTrigger'
# 当前函数状态无法更新代码,请在状态为正常时更新。
FAILEDOPERATION_FUNCTIONNAMESTATUSERROR = 'FailedOperation.FunctionNameStatusError'
# 函数在部署中,无法做此操作。
FAILEDOPERATION_FUNCTIONSTATUSERROR = 'FailedOperation.FunctionStatusError'
# 当前函数版本状态无法进行此操作,请在版本状态为正常时重试。
FAILEDOPERATION_FUNCTIONVERSIONSTATUSNOTACTIVE = 'FailedOperation.FunctionVersionStatusNotActive'
# 获取别名信息失败。
FAILEDOPERATION_GETALIAS = 'FailedOperation.GetAlias'
# 获取函数代码地址失败。
FAILEDOPERATION_GETFUNCTIONADDRESS = 'FailedOperation.GetFunctionAddress'
# 当前账号或命名空间处于欠费状态,请在可用时重试。
FAILEDOPERATION_INSUFFICIENTBALANCE = 'FailedOperation.InsufficientBalance'
# 调用函数失败。
FAILEDOPERATION_INVOKEFUNCTION = 'FailedOperation.InvokeFunction'
# 命名空间已存在,请勿重复创建。
FAILEDOPERATION_NAMESPACE = 'FailedOperation.Namespace'
# 服务开通失败。
FAILEDOPERATION_OPENSERVICE = 'FailedOperation.OpenService'
# 操作冲突。
FAILEDOPERATION_OPERATIONCONFLICT = 'FailedOperation.OperationConflict'
# 创建定时预置任务失败。
FAILEDOPERATION_PROVISIONCREATETIMER = 'FailedOperation.ProvisionCreateTimer'
# 删除定时预置任务失败。
FAILEDOPERATION_PROVISIONDELETETIMER = 'FailedOperation.ProvisionDeleteTimer'
# 当前函数版本已有预置任务处于进行中,请稍后重试。
FAILEDOPERATION_PROVISIONEDINPROGRESS = 'FailedOperation.ProvisionedInProgress'
# 发布layer版本失败。
FAILEDOPERATION_PUBLISHLAYERVERSION = 'FailedOperation.PublishLayerVersion'
# 当前函数状态无法发布版本,请在状态为正常时发布。
FAILEDOPERATION_PUBLISHVERSION = 'FailedOperation.PublishVersion'
# 角色不存在。
FAILEDOPERATION_QCSROLENOTFOUND = 'FailedOperation.QcsRoleNotFound'
# 当前函数已有保留并发设置任务处于进行中,请稍后重试。
FAILEDOPERATION_RESERVEDINPROGRESS = 'FailedOperation.ReservedInProgress'
# Topic不存在。
FAILEDOPERATION_TOPICNOTEXIST = 'FailedOperation.TopicNotExist'
# 用户并发内存配额设置任务处于进行中,请稍后重试。
FAILEDOPERATION_TOTALCONCURRENCYMEMORYINPROGRESS = 'FailedOperation.TotalConcurrencyMemoryInProgress'
# 指定的服务未开通,可以提交工单申请开通服务。
FAILEDOPERATION_UNOPENEDSERVICE = 'FailedOperation.UnOpenedService'
# 更新别名失败。
FAILEDOPERATION_UPDATEALIAS = 'FailedOperation.UpdateAlias'
# 当前函数状态无法更新代码,请在状态为正常时更新。
FAILEDOPERATION_UPDATEFUNCTIONCODE = 'FailedOperation.UpdateFunctionCode'
# UpdateFunctionConfiguration操作失败。
FAILEDOPERATION_UPDATEFUNCTIONCONFIGURATION = 'FailedOperation.UpdateFunctionConfiguration'
# 内部错误。
INTERNALERROR = 'InternalError'
# 创建apigw触发器内部错误。
INTERNALERROR_APIGATEWAY = 'InternalError.ApiGateway'
# ckafka接口失败。
INTERNALERROR_CKAFKA = 'InternalError.Ckafka'
# 删除cmq触发器失败。
INTERNALERROR_CMQ = 'InternalError.Cmq'
# 更新触发器失败。
INTERNALERROR_COS = 'InternalError.Cos'
# ES错误。
INTERNALERROR_ES = 'InternalError.ES'
# 内部服务异常。
INTERNALERROR_EXCEPTION = 'InternalError.Exception'
# 内部服务错误。
INTERNALERROR_GETROLEERROR = 'InternalError.GetRoleError'
# 内部系统错误。
INTERNALERROR_SYSTEM = 'InternalError.System'
# 内部服务错误。
INTERNALERROR_SYSTEMERROR = 'InternalError.SystemError'
# FunctionName取值与规范不符,请修正后再试。可参考:https://tencentcs.com/5jXKFnBW。
INVALIDPARAMETER_FUNCTIONNAME = 'InvalidParameter.FunctionName'
# 请求参数不合法。
INVALIDPARAMETER_PAYLOAD = 'InvalidParameter.Payload'
# RoutingConfig参数传入错误。
INVALIDPARAMETER_ROUTINGCONFIG = 'InvalidParameter.RoutingConfig'
# 参数取值错误。
INVALIDPARAMETERVALUE = 'InvalidParameterValue'
# Action取值与规范不符,请修正后再试。可参考:https://tencentcs.com/5jXKFnBW。
INVALIDPARAMETERVALUE_ACTION = 'InvalidParameterValue.Action'
# AdditionalVersionWeights参数传入错误。
INVALIDPARAMETERVALUE_ADDITIONALVERSIONWEIGHTS = 'InvalidParameterValue.AdditionalVersionWeights'
# 不支持删除默认别名,请修正后重试。
INVALIDPARAMETERVALUE_ALIAS = 'InvalidParameterValue.Alias'
# ApiGateway参数错误。
INVALIDPARAMETERVALUE_APIGATEWAY = 'InvalidParameterValue.ApiGateway'
# ApmConfig参数传入错误。
INVALIDPARAMETERVALUE_APMCONFIG = 'InvalidParameterValue.ApmConfig'
# ApmConfigInstanceId参数传入错误。
INVALIDPARAMETERVALUE_APMCONFIGINSTANCEID = 'InvalidParameterValue.ApmConfigInstanceId'
# ApmConfigRegion参数传入错误。
INVALIDPARAMETERVALUE_APMCONFIGREGION = 'InvalidParameterValue.ApmConfigRegion'
# Args 参数值有误。
INVALIDPARAMETERVALUE_ARGS = 'InvalidParameterValue.Args'
# 函数异步重试配置参数无效。
INVALIDPARAMETERVALUE_ASYNCTRIGGERCONFIG = 'InvalidParameterValue.AsyncTriggerConfig'
# Cdn传入错误。
INVALIDPARAMETERVALUE_CDN = 'InvalidParameterValue.Cdn'
# cfs配置项重复。
INVALIDPARAMETERVALUE_CFSPARAMETERDUPLICATE = 'InvalidParameterValue.CfsParameterDuplicate'
# cfs配置项取值与规范不符。
INVALIDPARAMETERVALUE_CFSPARAMETERERROR = 'InvalidParameterValue.CfsParameterError'
# cfs参数格式与规范不符。
INVALIDPARAMETERVALUE_CFSSTRUCTIONERROR = 'InvalidParameterValue.CfsStructionError'
# Ckafka传入错误。
INVALIDPARAMETERVALUE_CKAFKA = 'InvalidParameterValue.Ckafka'
# 运行函数时的参数传入有误。
INVALIDPARAMETERVALUE_CLIENTCONTEXT = 'InvalidParameterValue.ClientContext'
# Cls传入错误。
INVALIDPARAMETERVALUE_CLS = 'InvalidParameterValue.Cls'
# 修改Cls配置需要传入Role参数,请修正后重试。
INVALIDPARAMETERVALUE_CLSROLE = 'InvalidParameterValue.ClsRole'
# Cmq传入错误。
INVALIDPARAMETERVALUE_CMQ = 'InvalidParameterValue.Cmq'
# Code传入错误。
INVALIDPARAMETERVALUE_CODE = 'InvalidParameterValue.Code'
# CodeSecret传入错误。
INVALIDPARAMETERVALUE_CODESECRET = 'InvalidParameterValue.CodeSecret'
# CodeSource传入错误。
INVALIDPARAMETERVALUE_CODESOURCE = 'InvalidParameterValue.CodeSource'
# Command[Entrypoint] 参数值有误。
INVALIDPARAMETERVALUE_COMMAND = 'InvalidParameterValue.Command'
# CompatibleRuntimes参数传入错误。
INVALIDPARAMETERVALUE_COMPATIBLERUNTIMES = 'InvalidParameterValue.CompatibleRuntimes'
# Content参数传入错误。
INVALIDPARAMETERVALUE_CONTENT = 'InvalidParameterValue.Content'
# Cos传入错误。
INVALIDPARAMETERVALUE_COS = 'InvalidParameterValue.Cos'
# CosBucketName不符合规范。
INVALIDPARAMETERVALUE_COSBUCKETNAME = 'InvalidParameterValue.CosBucketName'
# CosBucketRegion取值与规范不符,请修正后再试。可参考:https://tencentcs.com/5jXKFnBW。
INVALIDPARAMETERVALUE_COSBUCKETREGION = 'InvalidParameterValue.CosBucketRegion'
# CosObjectName不符合规范。
INVALIDPARAMETERVALUE_COSOBJECTNAME = 'InvalidParameterValue.CosObjectName'
# CustomArgument参数长度超限。
INVALIDPARAMETERVALUE_CUSTOMARGUMENT = 'InvalidParameterValue.CustomArgument'
# DateTime传入错误。
INVALIDPARAMETERVALUE_DATETIME = 'InvalidParameterValue.DateTime'
# DeadLetterConfig取值与规范不符,请修正后再试。可参考:https://tencentcs.com/5jXKFnBW。
INVALIDPARAMETERVALUE_DEADLETTERCONFIG = 'InvalidParameterValue.DeadLetterConfig'
# 默认Namespace无法创建。
INVALIDPARAMETERVALUE_DEFAULTNAMESPACE = 'InvalidParameterValue.DefaultNamespace'
# Description传入错误。
INVALIDPARAMETERVALUE_DESCRIPTION = 'InvalidParameterValue.Description'
# 环境变量DNS[OS_NAMESERVER]配置有误。
INVALIDPARAMETERVALUE_DNSINFO = 'InvalidParameterValue.DnsInfo'
# EipConfig参数错误。
INVALIDPARAMETERVALUE_EIPCONFIG = 'InvalidParameterValue.EipConfig'
# Enable取值与规范不符,请修正后再试。可参考:https://tencentcs.com/5jXKFnBW。
INVALIDPARAMETERVALUE_ENABLE = 'InvalidParameterValue.Enable'
# Environment传入错误。
INVALIDPARAMETERVALUE_ENVIRONMENT = 'InvalidParameterValue.Environment'
# 环境变量大小超限,请保持在 4KB 以内。
INVALIDPARAMETERVALUE_ENVIRONMENTEXCEEDEDLIMIT = 'InvalidParameterValue.EnvironmentExceededLimit'
# 不支持修改函数系统环境变量和运行环境变量。
INVALIDPARAMETERVALUE_ENVIRONMENTSYSTEMPROTECT = 'InvalidParameterValue.EnvironmentSystemProtect'
# Filters参数错误。
INVALIDPARAMETERVALUE_FILTERS = 'InvalidParameterValue.Filters'
# Function取值与规范不符,请修正后再试。可参考:https://tencentcs.com/5jXKFnBW。
INVALIDPARAMETERVALUE_FUNCTION = 'InvalidParameterValue.Function'
# 函数不存在。
INVALIDPARAMETERVALUE_FUNCTIONNAME = 'InvalidParameterValue.FunctionName'
# GitBranch不符合规范。
INVALIDPARAMETERVALUE_GITBRANCH = 'InvalidParameterValue.GitBranch'
# GitCommitId取值与规范不符,请修正后再试。可参考:https://tencentcs.com/5jXKFnBW。
INVALIDPARAMETERVALUE_GITCOMMITID = 'InvalidParameterValue.GitCommitId'
# GitDirectory不符合规范。
INVALIDPARAMETERVALUE_GITDIRECTORY = 'InvalidParameterValue.GitDirectory'
# GitPassword不符合规范。
INVALIDPARAMETERVALUE_GITPASSWORD = 'InvalidParameterValue.GitPassword'
# GitUrl不符合规范。
INVALIDPARAMETERVALUE_GITURL = 'InvalidParameterValue.GitUrl'
# GitUserName不符合规范。
INVALIDPARAMETERVALUE_GITUSERNAME = 'InvalidParameterValue.GitUserName'
# Handler传入错误。
INVALIDPARAMETERVALUE_HANDLER = 'InvalidParameterValue.Handler'
# IdleTimeOut参数传入错误。
INVALIDPARAMETERVALUE_IDLETIMEOUT = 'InvalidParameterValue.IdleTimeOut'
# imageUri 传入有误。
INVALIDPARAMETERVALUE_IMAGEURI = 'InvalidParameterValue.ImageUri'
# InlineZipFile非法。
INVALIDPARAMETERVALUE_INLINEZIPFILE = 'InvalidParameterValue.InlineZipFile'
# InvokeType取值与规范不符,请修正后再试。
INVALIDPARAMETERVALUE_INVOKETYPE = 'InvalidParameterValue.InvokeType'
# L5Enable取值与规范不符,请修正后再试。
INVALIDPARAMETERVALUE_L5ENABLE = 'InvalidParameterValue.L5Enable'
# LayerName参数传入错误。
INVALIDPARAMETERVALUE_LAYERNAME = 'InvalidParameterValue.LayerName'
# Layers参数传入错误。
INVALIDPARAMETERVALUE_LAYERS = 'InvalidParameterValue.Layers'
# Limit传入错误。
INVALIDPARAMETERVALUE_LIMIT = 'InvalidParameterValue.Limit'
# 参数超出长度限制。
INVALIDPARAMETERVALUE_LIMITEXCEEDED = 'InvalidParameterValue.LimitExceeded'
# Memory取值与规范不符,请修正后再试。可参考:https://tencentcs.com/5jXKFnBW。
INVALIDPARAMETERVALUE_MEMORY = 'InvalidParameterValue.Memory'
# MemorySize错误。
INVALIDPARAMETERVALUE_MEMORYSIZE = 'InvalidParameterValue.MemorySize'
# MinCapacity 参数传入错误。
INVALIDPARAMETERVALUE_MINCAPACITY = 'InvalidParameterValue.MinCapacity'
# Name参数传入错误。
INVALIDPARAMETERVALUE_NAME = 'InvalidParameterValue.Name'
# Namespace参数传入错误。
INVALIDPARAMETERVALUE_NAMESPACE = 'InvalidParameterValue.Namespace'
# 规则不正确,Namespace为英文字母、数字、-_ 符号组成,长度30。
INVALIDPARAMETERVALUE_NAMESPACEINVALID = 'InvalidParameterValue.NamespaceInvalid'
# NodeSpec 参数传入错误。
INVALIDPARAMETERVALUE_NODESPEC = 'InvalidParameterValue.NodeSpec'
# NodeType 参数传入错误。
INVALIDPARAMETERVALUE_NODETYPE = 'InvalidParameterValue.NodeType'
# 偏移量不合法。
INVALIDPARAMETERVALUE_OFFSET = 'InvalidParameterValue.Offset'
# Order传入错误。
INVALIDPARAMETERVALUE_ORDER = 'InvalidParameterValue.Order'
# OrderBy取值与规范不符,请修正后再试。可参考:https://tencentcs.com/5jXKFnBW。
INVALIDPARAMETERVALUE_ORDERBY = 'InvalidParameterValue.OrderBy'
# 入参不是标准的json。
INVALIDPARAMETERVALUE_PARAM = 'InvalidParameterValue.Param'
# ProtocolType参数传入错误。
INVALIDPARAMETERVALUE_PROTOCOLTYPE = 'InvalidParameterValue.ProtocolType'
# 定时预置的cron配置重复。
INVALIDPARAMETERVALUE_PROVISIONTRIGGERCRONCONFIGDUPLICATE = 'InvalidParameterValue.ProvisionTriggerCronConfigDuplicate'
# TriggerName参数传入错误。
INVALIDPARAMETERVALUE_PROVISIONTRIGGERNAME = 'InvalidParameterValue.ProvisionTriggerName'
# TriggerName重复。
INVALIDPARAMETERVALUE_PROVISIONTRIGGERNAMEDUPLICATE = 'InvalidParameterValue.ProvisionTriggerNameDuplicate'
# ProvisionType 参数传入错误。
INVALIDPARAMETERVALUE_PROVISIONTYPE = 'InvalidParameterValue.ProvisionType'
# PublicNetConfig参数错误。
INVALIDPARAMETERVALUE_PUBLICNETCONFIG = 'InvalidParameterValue.PublicNetConfig'
# 不支持的函数版本。
INVALIDPARAMETERVALUE_QUALIFIER = 'InvalidParameterValue.Qualifier'
# 企业版镜像实例ID[RegistryId]传值错误。
INVALIDPARAMETERVALUE_REGISTRYID = 'InvalidParameterValue.RegistryId'
# RetCode不合法。
INVALIDPARAMETERVALUE_RETCODE = 'InvalidParameterValue.RetCode'
# RoutingConfig取值与规范不符,请修正后再试。可参考:https://tencentcs.com/5jXKFnBW。
INVALIDPARAMETERVALUE_ROUTINGCONFIG = 'InvalidParameterValue.RoutingConfig'
# Runtime传入错误。
INVALIDPARAMETERVALUE_RUNTIME = 'InvalidParameterValue.Runtime'
# searchkey 不是 Keyword,Tag 或者 Runtime。
INVALIDPARAMETERVALUE_SEARCHKEY = 'InvalidParameterValue.SearchKey'
# SecretInfo错误。
INVALIDPARAMETERVALUE_SECRETINFO = 'InvalidParameterValue.SecretInfo'
# ServiceName命名不规范。
INVALIDPARAMETERVALUE_SERVICENAME = 'InvalidParameterValue.ServiceName'
# Stamp取值与规范不符,请修正后再试。
INVALIDPARAMETERVALUE_STAMP = 'InvalidParameterValue.Stamp'
# 起始时间传入错误。
INVALIDPARAMETERVALUE_STARTTIME = 'InvalidParameterValue.StartTime'
# 需要同时指定开始日期与结束日期。
INVALIDPARAMETERVALUE_STARTTIMEORENDTIME = 'InvalidParameterValue.StartTimeOrEndTime'
# Status取值与规范不符,请修正后再试。
INVALIDPARAMETERVALUE_STATUS = 'InvalidParameterValue.Status'
# 系统环境变量错误。
INVALIDPARAMETERVALUE_SYSTEMENVIRONMENT = 'InvalidParameterValue.SystemEnvironment'
# 非法的TempCosObjectName。
INVALIDPARAMETERVALUE_TEMPCOSOBJECTNAME = 'InvalidParameterValue.TempCosObjectName'
# TraceEnable取值与规范不符,请修正后再试。
INVALIDPARAMETERVALUE_TRACEENABLE = 'InvalidParameterValue.TraceEnable'
# TrackingTarget 参数输入错误。
INVALIDPARAMETERVALUE_TRACKINGTARGET = 'InvalidParameterValue.TrackingTarget'
# TriggerCronConfig参数传入错误。
INVALIDPARAMETERVALUE_TRIGGERCRONCONFIG = 'InvalidParameterValue.TriggerCronConfig'
# TriggerCronConfig参数定时触发间隔小于指定值。
INVALIDPARAMETERVALUE_TRIGGERCRONCONFIGTIMEINTERVAL = 'InvalidParameterValue.TriggerCronConfigTimeInterval'
# TriggerDesc传入参数错误。
INVALIDPARAMETERVALUE_TRIGGERDESC = 'InvalidParameterValue.TriggerDesc'
# TriggerName传入错误。
INVALIDPARAMETERVALUE_TRIGGERNAME = 'InvalidParameterValue.TriggerName'
# TriggerProvisionedConcurrencyNum参数传入错误。
INVALIDPARAMETERVALUE_TRIGGERPROVISIONEDCONCURRENCYNUM = 'InvalidParameterValue.TriggerProvisionedConcurrencyNum'
# Type传入错误。
INVALIDPARAMETERVALUE_TYPE = 'InvalidParameterValue.Type'
# 开启cfs配置的同时必须开启vpc。
INVALIDPARAMETERVALUE_VPCNOTSETWHENOPENCFS = 'InvalidParameterValue.VpcNotSetWhenOpenCfs'
# WebSocketsParams参数传入错误。
INVALIDPARAMETERVALUE_WEBSOCKETSPARAMS = 'InvalidParameterValue.WebSocketsParams'
# 检测到不是标准的zip文件,请重新压缩后再试。
INVALIDPARAMETERVALUE_ZIPFILE = 'InvalidParameterValue.ZipFile'
# 压缩文件base64解码失败: `Incorrect padding`,请修正后再试。
INVALIDPARAMETERVALUE_ZIPFILEBASE64BINASCIIERROR = 'InvalidParameterValue.ZipFileBase64BinasciiError'
# 别名个数超过最大限制。
LIMITEXCEEDED_ALIAS = 'LimitExceeded.Alias'
# Cdn使用超过最大限制。
LIMITEXCEEDED_CDN = 'LimitExceeded.Cdn'
# eip资源超限。
LIMITEXCEEDED_EIP = 'LimitExceeded.Eip'
# 函数数量超出最大限制 ,可通过[提交工单](https://cloud.tencent.com/act/event/Online_service?from=scf%7Cindex)申请提升限制。
LIMITEXCEEDED_FUNCTION = 'LimitExceeded.Function'
# 同一个主题下的函数超过最大限制。
LIMITEXCEEDED_FUNCTIONONTOPIC = 'LimitExceeded.FunctionOnTopic'
# FunctionProvisionedConcurrencyMemory数量达到限制,可提交工单申请提升限制:https://tencentcs.com/7Fixwt63。
LIMITEXCEEDED_FUNCTIONPROVISIONEDCONCURRENCYMEMORY = 'LimitExceeded.FunctionProvisionedConcurrencyMemory'
# 函数保留并发内存超限。
LIMITEXCEEDED_FUNCTIONRESERVEDCONCURRENCYMEMORY = 'LimitExceeded.FunctionReservedConcurrencyMemory'
# FunctionTotalProvisionedConcurrencyMemory达到限制,可提交工单申请提升限制:https://tencentcs.com/7Fixwt63。
LIMITEXCEEDED_FUNCTIONTOTALPROVISIONEDCONCURRENCYMEMORY = 'LimitExceeded.FunctionTotalProvisionedConcurrencyMemory'
# 函数预置并发总数达到限制。
LIMITEXCEEDED_FUNCTIONTOTALPROVISIONEDCONCURRENCYNUM = 'LimitExceeded.FunctionTotalProvisionedConcurrencyNum'
# InitTimeout达到限制,可提交工单申请提升限制:https://tencentcs.com/7Fixwt63。
LIMITEXCEEDED_INITTIMEOUT = 'LimitExceeded.InitTimeout'
# layer版本数量超出最大限制。
LIMITEXCEEDED_LAYERVERSIONS = 'LimitExceeded.LayerVersions'
# layer数量超出最大限制。
LIMITEXCEEDED_LAYERS = 'LimitExceeded.Layers'
# 内存超出最大限制。
LIMITEXCEEDED_MEMORY = 'LimitExceeded.Memory'
# 函数异步重试配置消息保留时间超过限制。
LIMITEXCEEDED_MSGTTL = 'LimitExceeded.MsgTTL'
# 命名空间数量超过最大限制,可通过[提交工单](https://cloud.tencent.com/act/event/Online_service?from=scf%7Cindex)申请提升限制。
LIMITEXCEEDED_NAMESPACE = 'LimitExceeded.Namespace'
# Offset超出限制。
LIMITEXCEEDED_OFFSET = 'LimitExceeded.Offset'
# 定时预置数量超过最大限制。
LIMITEXCEEDED_PROVISIONTRIGGERACTION = 'LimitExceeded.ProvisionTriggerAction'
# 定时触发间隔小于最大限制。
LIMITEXCEEDED_PROVISIONTRIGGERINTERVAL = 'LimitExceeded.ProvisionTriggerInterval'
# 配额超限。
LIMITEXCEEDED_QUOTA = 'LimitExceeded.Quota'
# 函数异步重试配置异步重试次数超过限制。
LIMITEXCEEDED_RETRYNUM = 'LimitExceeded.RetryNum'
# Timeout超出最大限制。
LIMITEXCEEDED_TIMEOUT = 'LimitExceeded.Timeout'
# 用户并发内存配额超限。
LIMITEXCEEDED_TOTALCONCURRENCYMEMORY = 'LimitExceeded.TotalConcurrencyMemory'
# 触发器数量超出最大限制,可通过[提交工单](https://cloud.tencent.com/act/event/Online_service?from=scf%7Cindex)申请提升限制。
LIMITEXCEEDED_TRIGGER = 'LimitExceeded.Trigger'
# UserTotalConcurrencyMemory达到限制,可提交工单申请提升限制:https://tencentcs.com/7Fixwt63。
LIMITEXCEEDED_USERTOTALCONCURRENCYMEMORY = 'LimitExceeded.UserTotalConcurrencyMemory'
# 缺少参数错误。
MISSINGPARAMETER = 'MissingParameter'
# Code没有传入。
MISSINGPARAMETER_CODE = 'MissingParameter.Code'
# 缺失 Runtime 字段。
MISSINGPARAMETER_RUNTIME = 'MissingParameter.Runtime'
# 资源被占用。
RESOURCEINUSE = 'ResourceInUse'
# Alias已被占用。
RESOURCEINUSE_ALIAS = 'ResourceInUse.Alias'
# Cdn已被占用。
RESOURCEINUSE_CDN = 'ResourceInUse.Cdn'
# Cmq已被占用。
RESOURCEINUSE_CMQ = 'ResourceInUse.Cmq'
# Cos已被占用。
RESOURCEINUSE_COS = 'ResourceInUse.Cos'
# 函数已存在。
RESOURCEINUSE_FUNCTION = 'ResourceInUse.Function'
# FunctionName已存在。
RESOURCEINUSE_FUNCTIONNAME = 'ResourceInUse.FunctionName'
# Layer版本正在使用中。
RESOURCEINUSE_LAYERVERSION = 'ResourceInUse.LayerVersion'
# Namespace已存在。
RESOURCEINUSE_NAMESPACE = 'ResourceInUse.Namespace'
# TriggerName已存在。
RESOURCEINUSE_TRIGGER = 'ResourceInUse.Trigger'
# TriggerName已存在。
RESOURCEINUSE_TRIGGERNAME = 'ResourceInUse.TriggerName'
# COS资源不足。
RESOURCEINSUFFICIENT_COS = 'ResourceInsufficient.COS'
# 资源不存在。
RESOURCENOTFOUND = 'ResourceNotFound'
# 别名不存在。
RESOURCENOTFOUND_ALIAS = 'ResourceNotFound.Alias'
# 未找到指定的AsyncEvent,请创建后再试。
RESOURCENOTFOUND_ASYNCEVENT = 'ResourceNotFound.AsyncEvent'
# Cdn不存在。
RESOURCENOTFOUND_CDN = 'ResourceNotFound.Cdn'
# 指定的cfs下未找到您所指定的挂载点。
RESOURCENOTFOUND_CFSMOUNTINSNOTMATCH = 'ResourceNotFound.CfsMountInsNotMatch'
# 检测cfs状态为不可用。
RESOURCENOTFOUND_CFSSTATUSERROR = 'ResourceNotFound.CfsStatusError'
# cfs与云函数所处vpc不一致。
RESOURCENOTFOUND_CFSVPCNOTMATCH = 'ResourceNotFound.CfsVpcNotMatch'
# Ckafka不存在。
RESOURCENOTFOUND_CKAFKA = 'ResourceNotFound.Ckafka'
# Cmq不存在。
RESOURCENOTFOUND_CMQ = 'ResourceNotFound.Cmq'
# Cos不存在。
RESOURCENOTFOUND_COS = 'ResourceNotFound.Cos'
# 不存在的Demo。
RESOURCENOTFOUND_DEMO = 'ResourceNotFound.Demo'
# 函数不存在。
RESOURCENOTFOUND_FUNCTION = 'ResourceNotFound.Function'
# 函数不存在。
RESOURCENOTFOUND_FUNCTIONNAME = 'ResourceNotFound.FunctionName'
# 函数版本不存在。
RESOURCENOTFOUND_FUNCTIONVERSION = 'ResourceNotFound.FunctionVersion'
# 获取cfs挂载点信息错误。
RESOURCENOTFOUND_GETCFSMOUNTINSERROR = 'ResourceNotFound.GetCfsMountInsError'
# 获取cfs信息错误。
RESOURCENOTFOUND_GETCFSNOTMATCH = 'ResourceNotFound.GetCfsNotMatch'
# 未找到指定的ImageConfig,请创建后再试。
RESOURCENOTFOUND_IMAGECONFIG = 'ResourceNotFound.ImageConfig'
# layer不存在。
RESOURCENOTFOUND_LAYER = 'ResourceNotFound.Layer'
# Layer版本不存在。
RESOURCENOTFOUND_LAYERVERSION = 'ResourceNotFound.LayerVersion'
# Namespace不存在。
RESOURCENOTFOUND_NAMESPACE = 'ResourceNotFound.Namespace'
# 版本不存在。
RESOURCENOTFOUND_QUALIFIER = 'ResourceNotFound.Qualifier'
# 角色不存在。
RESOURCENOTFOUND_ROLE = 'ResourceNotFound.Role'
# Role不存在。
RESOURCENOTFOUND_ROLECHECK = 'ResourceNotFound.RoleCheck'
# Timer不存在。
RESOURCENOTFOUND_TIMER = 'ResourceNotFound.Timer'
# 并发内存配额资源未找到。
RESOURCENOTFOUND_TOTALCONCURRENCYMEMORY = 'ResourceNotFound.TotalConcurrencyMemory'
# 触发器不存在。
RESOURCENOTFOUND_TRIGGER = 'ResourceNotFound.Trigger'
# 版本不存在。
RESOURCENOTFOUND_VERSION = 'ResourceNotFound.Version'
# VPC或子网不存在。
RESOURCENOTFOUND_VPC = 'ResourceNotFound.Vpc'
# 余额不足,请先充值。
RESOURCEUNAVAILABLE_INSUFFICIENTBALANCE = 'ResourceUnavailable.InsufficientBalance'
# Namespace不可用。
RESOURCEUNAVAILABLE_NAMESPACE = 'ResourceUnavailable.Namespace'
# 未授权操作。
UNAUTHORIZEDOPERATION = 'UnauthorizedOperation'
# CAM鉴权失败。
UNAUTHORIZEDOPERATION_CAM = 'UnauthorizedOperation.CAM'
# 无访问代码权限。
UNAUTHORIZEDOPERATION_CODESECRET = 'UnauthorizedOperation.CodeSecret'
# 没有权限。
UNAUTHORIZEDOPERATION_CREATETRIGGER = 'UnauthorizedOperation.CreateTrigger'
# 没有权限的操作。
UNAUTHORIZEDOPERATION_DELETEFUNCTION = 'UnauthorizedOperation.DeleteFunction'
# 没有权限。
UNAUTHORIZEDOPERATION_DELETETRIGGER = 'UnauthorizedOperation.DeleteTrigger'
# 不是从控制台调用的该接口。
UNAUTHORIZEDOPERATION_NOTMC = 'UnauthorizedOperation.NotMC'
# Region错误。
UNAUTHORIZEDOPERATION_REGION = 'UnauthorizedOperation.Region'
# 没有权限访问您的Cos资源。
UNAUTHORIZEDOPERATION_ROLE = 'UnauthorizedOperation.Role'
# TempCos的Appid和请求账户的APPID不一致。
UNAUTHORIZEDOPERATION_TEMPCOSAPPID = 'UnauthorizedOperation.TempCosAppid'
# 无法进行此操作。
UNAUTHORIZEDOPERATION_UPDATEFUNCTIONCODE = 'UnauthorizedOperation.UpdateFunctionCode'
# 操作不支持。
UNSUPPORTEDOPERATION = 'UnsupportedOperation'
# 资源还有别名绑定,不支持当前操作,请解绑别名后重试。
UNSUPPORTEDOPERATION_ALIASBIND = 'UnsupportedOperation.AliasBind'
# 指定的配置AsyncRunEnable暂不支持,请修正后再试。
UNSUPPORTEDOPERATION_ASYNCRUNENABLE = 'UnsupportedOperation.AsyncRunEnable'
# Cdn不支持。
UNSUPPORTEDOPERATION_CDN = 'UnsupportedOperation.Cdn'
# Cos操作不支持。
UNSUPPORTEDOPERATION_COS = 'UnsupportedOperation.Cos'
# 指定的配置EipFixed暂不支持。
UNSUPPORTEDOPERATION_EIPFIXED = 'UnsupportedOperation.EipFixed'
# 不支持此地域。
UNSUPPORTEDOPERATION_REGION = 'UnsupportedOperation.Region'
# Trigger操作不支持。
UNSUPPORTEDOPERATION_TRIGGER = 'UnsupportedOperation.Trigger'
# 指定的配置暂不支持,请修正后再试。
UNSUPPORTEDOPERATION_UPDATEFUNCTIONEVENTINVOKECONFIG = 'UnsupportedOperation.UpdateFunctionEventInvokeConfig'
# 指定的配置VpcConfig暂不支持。
UNSUPPORTEDOPERATION_VPCCONFIG = 'UnsupportedOperation.VpcConfig'
|
<?php
if (empty($content)) {
return;
}
$title = 'Bank Emulator Authorization Center';
?>
<html lang="ru">
<?=
View::make('ff-bank-em::layouts.head', array(
'title' => $title,
)); ?>
<body>
<div class="navbar navbar-default">
<?=
View::make('ff-bank-em::layouts.navbar-header', array(
'title' => $title,
)); ?>
</div>
<?= $content ?>
<?php require(__DIR__ . '/js.php') ?>
</body>
</html>
|
b'Calculate -36 + -15 + 31 + 5.\n'
|
b'(12 - 2) + (94 - 111)\n'
|
b'What is (9 - 10) + -7 - (-9 - 3)?\n'
|
var scroungejs = require('scroungejs'),
startutils = require('./startutil');
startutils.createFileIfNotExist({
pathSrc : './test/indexSrc.html',
pathFin : './test/index.html'
}, function (err, res) {
if (err) return console.log(err);
scroungejs.build({
inputPath : [
'./test/testbuildSrc',
'./node_modules',
'./bttnsys.js'
],
outputPath : './test/testbuildFin',
isRecursive : true,
isSourcePathUnique : true,
isCompressed : false,
isConcatenated : false,
basepage : './test/index.html'
}, function (err, res) {
return (err) ? console.log(err) : console.log('finished!');
});
});
|
// rd_route.c
// Copyright (c) 2014-2015 Dmitry Rodionov
//
// This software may be modified and distributed under the terms
// of the MIT license. See the LICENSE file for details.
#include <stdlib.h> // realloc()
#include <libgen.h> // basename()
#include <assert.h> // assert()
#include <stdio.h> // fprintf()
#include <dlfcn.h> // dladdr()
#include "TargetConditionals.h"
#if defined(__i386__) || defined(__x86_64__)
#if !(TARGET_IPHONE_SIMULATOR)
#include <mach/mach_vm.h> // mach_vm_*
#else
#include <mach/vm_map.h> // vm_*
#define mach_vm_address_t vm_address_t
#define mach_vm_size_t vm_size_t
#define mach_vm_allocate vm_allocate
#define mach_vm_deallocate vm_deallocate
#define mach_vm_write vm_write
#define mach_vm_remap vm_remap
#define mach_vm_protect vm_protect
#define NSLookupSymbolInImage(...) ((void)0)
#define NSAddressOfSymbol(...) ((void)0)
#endif
#else
#endif
#include <mach-o/dyld.h> // _dyld_*
#include <mach-o/nlist.h> // nlist/nlist_64
#include <mach/mach_init.h> // mach_task_self()
#include "rd_route.h"
#define RDErrorLog(format, ...) fprintf(stderr, "%s:%d:\n\terror: "format"\n", \
__FILE__, __LINE__, ##__VA_ARGS__)
#if defined(__x86_64__)
typedef struct mach_header_64 mach_header_t;
typedef struct segment_command_64 segment_command_t;
#define LC_SEGMENT_ARCH_INDEPENDENT LC_SEGMENT_64
typedef struct nlist_64 nlist_t;
#else
typedef struct mach_header mach_header_t;
typedef struct segment_command segment_command_t;
#define LC_SEGMENT_ARCH_INDEPENDENT LC_SEGMENT
typedef struct nlist nlist_t;
#endif
typedef struct rd_injection {
mach_vm_address_t injected_mach_header;
mach_vm_address_t target_address;
} rd_injection_t;
static void* _function_ptr_within_image(const char *function_name, void *macho_image_header, uintptr_t vm_image_slide);
void* function_ptr_from_name(const char *function_name)
{
assert(function_name);
for (uint32_t i = 0; i < _dyld_image_count(); i++) {
void *header = (void *)_dyld_get_image_header(i);
uintptr_t vmaddr_slide = _dyld_get_image_vmaddr_slide(i);
void *ptr = _function_ptr_within_image(function_name, header, vmaddr_slide);
if (ptr) { return ptr; }
}
RDErrorLog("Failed to find symbol `%s` in the current address space.", function_name);
return NULL;
}
static void* _function_ptr_within_image(const char *function_name, void *macho_image_header, uintptr_t vmaddr_slide)
{
assert(function_name);
assert(macho_image_header);
/**
* Try the system NSLookup API to find out the function's pointer withing the specifed header.
*/
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
void *pointer_via_NSLookup = ({
NSSymbol symbol = NSLookupSymbolInImage(macho_image_header, function_name,
NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
NSAddressOfSymbol(symbol);
});
#pragma clang diagnostic pop
if (pointer_via_NSLookup) return pointer_via_NSLookup;
return NULL;
}
|
b'What is the value of 25 - (22 + -8 + -4)?\n'
|
b'What is the value of 19 - -5 - 50 - -30?\n'
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="blog,python,django,developer">
<meta name="author" content="Derek Stegelman">
<title>Derek.Stegelman.Com | Tags</title>
<link rel="stylesheet" href='http://derek.stegelman.com/assets/bootstrap/css/bootstrap.min.css'>
<link rel="stylesheet" href='http://derek.stegelman.com/assets/css/main.min.css'>
<link href='https://fonts.googleapis.com/css?family=Raleway:200italic,200' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href='http://derek.stegelman.com/assets/font-awesome/css/font-awesome.min.css'>
<link href='assets/css/prisim.min.css' rel='stylesheet' />
<link href="http://derek.stegelman.com/tags/index.xml" rel="alternate" type="application/rss+xml" title="Derek.Stegelman.Com" />
<link href="http://derek.stegelman.com/tags/index.xml" rel="feed" type="application/rss+xml" title="Derek.Stegelman.Com" />
<meta property="og:title" content="Tags" />
<meta property="og:description" content="" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://derek.stegelman.com/tags/" />
<meta itemprop="name" content="Tags">
<meta itemprop="description" content="">
<meta name="twitter:card" content="summary"/><meta name="twitter:title" content="Tags"/>
<meta name="twitter:description" content=""/>
</head>
<body>
<header class="">
<div class='color-overlay'>
</div>
<h1><a href="/">Derek Stegelman</a></h1>
<nav>
<ul>
<li>
<a href="/posts/">Writing</a>
</li>
<li>
<a href="/tech/">Technical Writing</a>
</li>
<li>
<a href="/thoughts/">Thoughts</a>
</li>
<li>
<a href="/about/">About</a>
</li>
</ul>
</nav>
</header>
<div class="container-fluid">
<article class="cf pa3 pa4-m pa4-l">
<div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links nested-img mid-gray">
</div>
</article>
<div class="mw8 center">
<section class="ph4">
</section>
</div>
</div>
<footer>
<div class='container-fluid'>
<div class='row'>
<div class='col-md-8 col-md-offset-2'>
<nav>
<ul>
<li>
<a href="/colophon/">Colophon</a>
</li>
<li>
<a href="/talks/">Talks</a>
</li>
<li>
<a href="/hire/">Hire</a>
</li>
<li>
<a href="/rocketry/">Rocketry</a>
</li>
<li>
<a href="/essays/">Essays</a>
</li>
<li>
<a href="mailto:[email protected]">Contact</a>
</li>
</ul>
</nav>
<nav class='pull-right'>
<ul>
<li>
<a href="https://github.com/dstegelman/" target="_blank"><i class="fa fa-github fa-inverse" aria-hidden="true"></i></a>
</li>
<li>
<a href="https://twitter.com/dstegelman" target="_blank"><i class="fa fa-twitter fa-inverse" aria-hidden="true"></i></a>
</li>
<li>
<a href="https://www.instagram.com/dstegelman/" target="_blank"><i class="fa fa-instagram fa-inverse" aria-hidden="true"></i></a>
</li>
<li>
<a href="https://www.linkedin.com/in/derek-stegelman-22570813/" target="_blank"><i class="fa fa-linkedin fa-inverse" aria-hidden="true"></i></a>
</li>
<li>
<a href="mailto:[email protected]"><i class="fa fa-envelope fa-inverse" aria-hidden="true"></i></a>
</li>
<li>
<a href="/atom.xml"><i class="fa fa-rss fa-inverse" aria-hidden="true"></i></a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</footer>
<script src='http://derek.stegelman.com/assets/js/prisim.js'></script>
<script src='http://derek.stegelman.com/assets/js/jquery.min.js'></script>
<script src='http://derek.stegelman.com/assets/bootstrap/js/bootstrap.min.js'></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-4439935-7', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using IdentityServer3.Core.Events;
using IdentityServer3.ElasticSearchEventService.Extensions;
using IdentityServer3.ElasticSearchEventService.Mapping;
using IdentityServer3.ElasticSearchEventService.Mapping.Configuration;
using Serilog.Events;
using Unittests.Extensions;
using Unittests.Proofs;
using Unittests.TestData;
using Xunit;
namespace Unittests
{
public class DefaultLogEventMapperTests
{
[Fact]
public void SpecifiedProperties_AreMapped()
{
var mapper = CreateMapper(b => b
.DetailMaps(c => c
.For<TestDetails>(m => m
.Map(d => d.String)
)
));
var details = new TestDetails
{
String = "Polse"
};
var logEvent = mapper.Map(CreateEvent(details));
logEvent.Properties.DoesContain(LogEventValueWith("Details.String", Quote("Polse")));
}
[Fact]
public void AlwaysAddedValues_AreAlwaysAdded()
{
var mapper = CreateMapper(b => b.AlwaysAdd("some", "value"));
var logEvent = mapper.Map(CreateEvent(new object()));
logEvent.Properties.DoesContain(LogEventValueWith("some", Quote("value")));
}
[Fact]
public void MapToSpecifiedName_MapsToSpecifiedName()
{
var mapper = CreateMapper(b => b
.DetailMaps(m => m
.For<TestDetails>(o => o
.Map("specificName", d => d.String)
)
));
var logEvent = mapper.Map(CreateEvent(new TestDetails {String = Some.String}));
logEvent.Properties.DoesContain(LogEventValueWith("Details.specificName", Quote(Some.String)));
}
[Fact]
public void PropertiesThatThrowsException_AreMappedAsException()
{
var mapper = CreateMapper(b => b
.DetailMaps(m => m
.For<TestDetails>(o => o
.Map(d => d.ThrowsException)
)
));
var logEvent = mapper.Map(CreateEvent(new TestDetails()));
logEvent.Properties.DoesContain(LogEventValueWith("Details.ThrowsException", s => s.StartsWith("\"threw")));
}
[Fact]
public void DefaultMapAllMembers_MapsAllPropertiesAndFieldsForDetails()
{
var mapper = CreateMapper(b => b
.DetailMaps(m => m
.DefaultMapAllMembers()
));
var logEvent = mapper.Map(CreateEvent(new TestDetails()));
var members = typeof (TestDetails).GetPublicPropertiesAndFields().Select(m => string.Format("Details.{0}", m.Name));
logEvent.Properties.DoesContainKeys(members);
}
[Fact]
public void ComplexMembers_AreMappedToJson()
{
var mapper = CreateMapper(b => b
.DetailMaps(m => m
.DefaultMapAllMembers()
));
var details = new TestDetails();
var logEvent = mapper.Map(CreateEvent(details));
var logProperty = logEvent.GetProperty<ScalarValue>("Details.Inner");
logProperty.Value.IsEqualTo(details.Inner.ToJsonSuppressErrors());
}
private static string Quote(string value)
{
return string.Format("\"{0}\"", value);
}
private static Expression<Func<KeyValuePair<string, LogEventPropertyValue>, bool>> LogEventValueWith(string key, Func<string,bool> satisfies)
{
return p => p.Key == key && satisfies(p.Value.ToString());
}
private static Expression<Func<KeyValuePair<string, LogEventPropertyValue>, bool>> LogEventValueWith(string key, string value)
{
return p => p.Key == key && p.Value.ToString() == value;
}
private static Event<T> CreateEvent<T>(T details)
{
return new Event<T>("category", "name", EventTypes.Information, 42, details);
}
private static DefaultLogEventMapper CreateMapper(Action<MappingConfigurationBuilder> setup)
{
var builder = new MappingConfigurationBuilder();
setup(builder);
return new DefaultLogEventMapper(builder.GetConfiguration());
}
}
}
|
b'Evaluate -16 + 11 - -10 - (-6 - 2).\n'
|
b'Evaluate 30 - (3 + (31 - 15)).\n'
|
b'Calculate (-10 - 0) + (-1 + 1 - (26 + -41)).\n'
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root.
/*
* Copyright 2000-2010 JetBrains s.r.o.
*
* 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.microsoft.alm.plugin.idea.tfvc.ui;
import com.google.common.annotations.VisibleForTesting;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.util.ui.AbstractTableCellEditor;
import com.intellij.util.ui.CellEditorComponentWithBrowseButton;
import com.microsoft.alm.plugin.context.ServerContext;
import com.microsoft.alm.plugin.idea.common.resources.TfPluginBundle;
import com.microsoft.alm.plugin.idea.common.utils.VcsHelper;
import com.microsoft.alm.plugin.idea.tfvc.ui.servertree.ServerBrowserDialog;
import org.apache.commons.lang.StringUtils;
import javax.swing.JTable;
import javax.swing.JTextField;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ServerPathCellEditor extends AbstractTableCellEditor {
private final String title;
private final Project project;
private final ServerContext serverContext;
private CellEditorComponentWithBrowseButton<JTextField> component;
public ServerPathCellEditor(final String title, final Project project, final ServerContext serverContext) {
this.title = title;
this.project = project;
this.serverContext = serverContext;
}
public Object getCellEditorValue() {
return component.getChildComponent().getText();
}
public Component getTableCellEditorComponent(final JTable table, final Object value, final boolean isSelected, final int row, final int column) {
final ActionListener listener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
createBrowserDialog();
}
};
component = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(listener), this);
component.getChildComponent().setText((String) value);
return component;
}
/**
* Creates the browser dialog for file selection
*/
@VisibleForTesting
protected void createBrowserDialog() {
final String serverPath = getServerPath();
if (StringUtils.isNotEmpty(serverPath)) {
final ServerBrowserDialog dialog = new ServerBrowserDialog(title, project, serverContext, serverPath, true, false);
if (dialog.showAndGet()) {
component.getChildComponent().setText(dialog.getSelectedPath());
}
} else {
Messages.showErrorDialog(project, TfPluginBundle.message(TfPluginBundle.KEY_ACTIONS_TFVC_SERVER_TREE_NO_ROOT_MSG),
TfPluginBundle.message(TfPluginBundle.KEY_ACTIONS_TFVC_SERVER_TREE_NO_ROOT_TITLE));
}
}
/**
* Get a server path to pass into the dialog
*
* @return
*/
@VisibleForTesting
protected String getServerPath() {
String serverPath = (String) getCellEditorValue();
// if there is no entry in the cell to find the root server path with then find it from the server context
if (StringUtils.isEmpty(serverPath) && serverContext != null && serverContext.getTeamProjectReference() != null) {
serverPath = VcsHelper.TFVC_ROOT.concat(serverContext.getTeamProjectReference().getName());
}
return serverPath;
}
}
|
b'Calculate 3 - ((-27 - -49) + -33).\n'
|
b'What is (11 + -6 - -5) + (-10 + 5 - -6)?\n'
|
package org.liquidizer.snippet
import scala.xml._
import scala.xml.parsing._
import net.liftweb.util._
import net.liftweb.http._
import net.liftweb.http.js._
import net.liftweb.http.js.JsCmds._
import net.liftweb.common._
import org.liquidizer.model._
object Markup {
val URL1= "(https?:/[^\\s\"]*[^\\s!?&.<>])"
val URL2= "\\["+URL1+" ([^]]*)\\]"
val URL_R= (URL1+"|"+URL2).r
def renderComment(in : String) : NodeSeq = {
if (in==null || in.length==0)
NodeSeq.Empty
else
toXHTML(in)
}
def toXHTML(input : String) : NodeSeq = {
try {
val src= scala.io.Source.fromString("<span>"+input+"</span>")
tidy(XhtmlParser(src).first.child, false)
} catch {
case e:FatalError => <p>{input}</p>
}
}
def tidy(seq : NodeSeq, isLink : Boolean) : NodeSeq =
seq.flatMap { tidy(_, isLink) }
def tidy(node : Node, isLink : Boolean) : NodeSeq = node match {
case Elem(ns, tag, attr, scope, ch @ _*) =>
tag match {
case "img" | "em" | "i" =>
val allowed= Set("src", "width", "height")
val fAttr= attr.filter { n=> allowed.contains(n.key) }
Elem(ns, tag, fAttr, scope, tidy(ch, true) :_*)
case _ => Text(node.toString)
}
case Text(text) if !isLink => renderBlock(text.split("\n").toList)
case _ => Text(node.toString)
}
def renderBlock(in : List[String]) : List[Node] = {
def tail= renderBlock(in.tail)
in match {
case Nil => Nil
case List(line, _*) if line.matches(" *[*-] .*") => {
val li = <li>{ renderLine(line.replaceAll("^ *[*-]","")) }</li>
tail match {
case <ul>{ c @ _* }</ul> :: t => <ul>{ li ++ c }</ul> :: t
case t => <ul>{ li }</ul> :: t
}
}
case List(line, _*) => <p>{ renderLine(line) }</p> :: tail
}
}
def renderLine(in : String) = renderHeader(in, x=>x, x=>x)
def renderTagList(in:List[String]) : Node = {
<span class="keys">{
var isFirst= true
in.map { key =>
val suff= if (isFirst) NodeSeq.Empty else Text(", ")
isFirst= false
suff ++ <a class="tag" href={Helpers.appendParams("/queries.html",("search",key) :: Nil)}>{key}</a>
}}</span>
}
def renderHeader(in : String, link : String) : NodeSeq =
renderHeader(in, { node => <a href={link}>{node}</a> })
def renderHeader(in : String, link : Node=>Node) : NodeSeq = {
var c=0
renderHeader(in, link, x=> {c=c+1; "["+c+"]"})
}
/** render a header replacing links with a generic short cut */
def renderHeader(in : String, link : Node=>Node, short : String=>String) : NodeSeq = {
URL_R.findFirstMatchIn(in) match {
case Some(m) =>
link(Text(m.before.toString)) ++ {
if (m.group(1)==null) {
eLink(m.group(2), "["+m.group(3)+"]")
} else {
eLink(m.matched, short(m.matched))
}
} ++
renderHeader(m.after.toString, link, short)
case _ =>
link(Text(in))
}
}
/** make an external link */
def eLink(url : String, display : String) =
<a href={url} title={url} target="_blank" class="extern">{display}</a>
}
class CategoryView(val keys : List[String], rootLink:String) {
def this(keyStr : String, rootLink : String) =
this(keyStr.toLowerCase.split(",| ").distinct.toList, rootLink)
def isActive(tag : String) = keys.contains(tag.toLowerCase)
def link(node : Node, keys : List[String]) = {
val sort= S.param("sort").map { v => List(("sort", v)) }.getOrElse(Nil)
val uri= Helpers.appendParams(rootLink, ("search" -> keys.mkString(" ")) :: sort)
<a href={uri}>{node}</a>
}
def getStyle(isactive : Boolean) = if (isactive) "active" else "inactive"
def getKeysWith(tag : String) = tag :: keys
def getKeysWithout(tag : String) = keys.filter{ _ != tag.toLowerCase }
def renderTag(tag : String) : Node = {
if (isActive(tag)) {
link(<div class={getStyle(true)}>{tag}</div>, getKeysWithout(tag))
} else {
link(<div class={getStyle(false)}>{tag}</div>, getKeysWith(tag))
}
}
def renderTagList(in:List[String]) : NodeSeq = {
renderTagList(in, in.size+1)
}
def renderTagList(in : List[String], len : Int) : NodeSeq = {
renderTagList(in, len, "tagList")
}
def renderTagList(in : List[String], len : Int, id: String) : NodeSeq = {
<span>{in.slice(0, len).map { tag => renderTag(tag) }}</span>
<span id={id}>{
if (len < in.size)
SHtml.a(() => SetHtml(id,
renderTagList(in.drop(len).toList, len, id+"x")),
<div class="inactive">...</div>)
else
NodeSeq.Empty
}</span>
}
}
/** The Localizer provides localization for Text nodes
* and attributes starting with $ */
object Localizer {
def loc(in : NodeSeq) : NodeSeq = in.flatMap(loc(_))
def loc(in : Node) : NodeSeq = in match {
case Text(str) if (str.startsWith("$")) => Text(loc(str))
case _ => in
}
def loc(in : String) = if (in.startsWith("$")) S.?(in.substring(1)) else in
/** localize a number of attributes */
def loc(attr : MetaData) : MetaData =
if (attr==Null) Null else attr match {
case UnprefixedAttribute(key, value, next) =>
new UnprefixedAttribute(key, loc(value.text), loc(next))
case _ => throw new Exception("Unknown attribute type : "+attr)
}
}
/** Create menu item elements with links and automatic styles */
class MenuMarker extends InRoom {
val user= User.currentUser.map { _.id.is }.getOrElse(0L)
var isFirst= true
def toUrl(url : Option[Seq[Node]]) =
uri(url.map { _.text }.getOrElse(S.uri))
def bind(in :NodeSeq) : NodeSeq = in.flatMap(bind(_))
def bind(in :Node) : NodeSeq = {
in match {
case Elem("menu", "a", attribs, scope, children @ _*) =>
// determine target and current link
var href= toUrl(attribs.get("href"))
var active=
if (href.startsWith("/"))
S.uri.replaceAll("^/room/[^/]*","") == href.replaceAll("^/room/[^/]+","")
else
S.uri.replaceAll(".*/","") == href
// set up parameters
attribs.get("action").foreach { action =>
val value= attribs.get("value").get.text
val field= action.text
// set the default order if action is sorting
if (isFirst && field=="sort")
S.set("defaultOrder", value)
// Link leads to the currently viewed page
active &&= S.param(field).map { value == _ }.getOrElse(isFirst)
val search= S.param("search").map { v => List(("search",v))}.getOrElse(Nil)
href = Helpers.appendParams(href, (field, value) :: search)
isFirst= false
}
// make menu entry
val entry= attribs.get("icon").map { url =>
<img src={"/images/menu/"+url.text+".png"} alt="" class="menu"/>
}.getOrElse(NodeSeq.Empty) ++ Localizer.loc(children)
// format link as either active (currently visited) or inaktive
val style= if (active) "active" else "inactive"
val title= attribs.get("title").map( Localizer.loc(_) )
<li><a href={href} title={title} alt={title}><div class={style}>{entry}</div></a></li>
case Elem("local", "a", attribs, scope, children @ _*) =>
// keep a number of current request attributes in the target url
val keep= attribs.get("keep").map{_.text}.getOrElse("")
val para= S.param(keep).map { v => List((keep,v))}.getOrElse(Nil)
val url= Helpers.appendParams(toUrl(attribs.get("href")), para )
val title= attribs.get("title").map( Localizer.loc(_) )
<a href={url} alt={title} title={title}>{ children }</a>
case Elem(prefix, label, attribs, scope, children @ _*) =>
Elem(prefix, label, Localizer.loc(attribs), scope, bind(children) : _*)
case _ => in
}
}
def render(in : NodeSeq) : NodeSeq = {
bind(in)
}
}
|
b'What is (1 - (13 + (8 - 9))) + -2?\n'
|
import axios from 'axios';
export default axios.create({
baseURL: 'http://localhost:9000/v1/'
});
|
package me.breidenbach.asyncmailer
/**
* Copyright © Kevin E. Breidenbach, 5/26/15.
*/
case class MailerException(message: String, cause: Throwable = null) extends Error(message, cause)
|
```js
var PlistUtils = (function() {
function readTextFile(strPath) {
var error;
var str = ObjC.unwrap(
$.NSString.stringWithContentsOfFileEncodingError(
$(strPath).stringByStandardizingPath,
$.NSUTF8StringEncoding,
error
)
);
if (error)
throw Error('Could not read file "' + strPath + '"');
return str;
}
return {
convertPlistPartToString: function(plistPart) {
var data = $.NSPropertyListSerialization.dataWithPropertyListFormatOptionsError(
$(plistPart), $.NSPropertyListXMLFormat_v1_0, 0, null);
var nsstring = $.NSString.alloc.initWithDataEncoding(data, $.NSUTF8StringEncoding);
return $(nsstring).js;
},
convertStringToPlist: function(str) {
return ObjC.deepUnwrap(
$.NSPropertyListSerialization.propertyListWithDataOptionsFormatError(
$(str).dataUsingEncoding($.NSUTF8StringEncoding), 0, 0, null));
},
createEmptyGroupAction: function(actionName) {
return this.convertStringToPlist(
"<plist version='1.0'> \n" +
"<dict> \n" +
" <key>" + (actionName || "") + "</key> \n" +
" <string>Installer</string> \n" +
" <key>Actions</key> \n" +
" <array/> \n" +
" <key>MacroActionType</key> \n" +
" <string>Group</string> \n" +
" <key>TimeOutAbortsMacro</key> \n" +
" <true/> \n" +
"</dict> \n" +
"</plist>");
},
getInitialCommentFromMacro: function(macro) {
var results = [];
if (!macro.Actions || macro.Actions.length === 0)
return null;
var action = macro.Actions[0];
if (action.MacroActionType !== "Comment")
return null;
return {
name: action.ActionName || action.Title || "",
title: action.Title || "",
text: action.Text || ""
};
},
// File must contain one macro only, or exception is thrown.
getMacroFromKMMacrosFile: function(path) {
var plist = this.readPlistArrayTextFile(path);
if (!plist)
throw Error("Could not read file '" + path + "'");
if (plist.length === 0)
throw Error("No macros were found in '" + path + "'");
if (plist.length > 1)
throw Error("Multiple macros were found in '" + path + "'");
var group = plist[0];
if (!group.Macros || group.Macros.count === 0)
throw Error("No macros were found in '" + path + "'");
if (group.Macros.length > 1)
throw Error("Multiple macros were found in '" + path + "'");
return group.Macros[0];
},
readPlistArrayTextFile: function(strPath) {
// var str = readTextFile(strPath);
// return this.convertStringToPlist(str);
var strFullPath = $(strPath).stringByStandardizingPath;
return ObjC.deepUnwrap($.NSArray.arrayWithContentsOfFile(strFullPath));
},
readPlistBinaryFile: function(path) {
var data = $.NSData.dataWithContentsOfFile(path);
return ObjC.deepUnwrap(
$.NSPropertyListSerialization.propertyListWithDataOptionsFormatError(
data, $.NSPropertyListBinaryFormat_v1_0, 0, null));
},
readPlistDictionaryTextFile: function(strPath) {
var strFullPath = $(strPath).stringByStandardizingPath;
return ObjC.deepUnwrap($.NSDictionary.dictionaryWithContentsOfFile(strFullPath));
},
writePlistTextFile: function(plist, strPath) {
var str = this.convertPlistPartToString(plist);
$(str).writeToFileAtomically($(strPath).stringByStandardizingPath, true);
}
};
})();
```
|
b'What is 26 + -12 - 15 - (-2 + -4)?\n'
|
b'What is -11 - (-2 + (3 - (-1 + 1)) - -1)?\n'
|
b'What is (8 - 53) + 5 + 32?\n'
|
b'What is the value of 15 + 4 - (6 + -8 - 6 - 0)?\n'
|
b'What is the value of (-2 - 5) + (18 - 1) + -22?\n'
|
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from copy import deepcopy
from typing import Any, Awaitable, Optional, TYPE_CHECKING
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer
from .. import models
from ._configuration import SqlVirtualMachineManagementClientConfiguration
from .operations import AvailabilityGroupListenersOperations, Operations, SqlVirtualMachineGroupsOperations, SqlVirtualMachinesOperations
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class SqlVirtualMachineManagementClient:
"""The SQL virtual machine management API provides a RESTful set of web APIs that interact with Azure Compute, Network & Storage services to manage your SQL Server virtual machine. The API enables users to create, delete and retrieve a SQL virtual machine, SQL virtual machine group or availability group listener.
:ivar availability_group_listeners: AvailabilityGroupListenersOperations operations
:vartype availability_group_listeners:
azure.mgmt.sqlvirtualmachine.aio.operations.AvailabilityGroupListenersOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.sqlvirtualmachine.aio.operations.Operations
:ivar sql_virtual_machine_groups: SqlVirtualMachineGroupsOperations operations
:vartype sql_virtual_machine_groups:
azure.mgmt.sqlvirtualmachine.aio.operations.SqlVirtualMachineGroupsOperations
:ivar sql_virtual_machines: SqlVirtualMachinesOperations operations
:vartype sql_virtual_machines:
azure.mgmt.sqlvirtualmachine.aio.operations.SqlVirtualMachinesOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Subscription ID that identifies an Azure subscription.
:type subscription_id: str
:param base_url: Service URL. Default value is 'https://management.azure.com'.
:type base_url: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = SqlVirtualMachineManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.availability_group_listeners = AvailabilityGroupListenersOperations(self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.sql_virtual_machine_groups = SqlVirtualMachineGroupsOperations(self._client, self._config, self._serialize, self._deserialize)
self.sql_virtual_machines = SqlVirtualMachinesOperations(self._client, self._config, self._serialize, self._deserialize)
def _send_request(
self,
request: HttpRequest,
**kwargs: Any
) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client._send_request(request)
<AsyncHttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.AsyncHttpResponse
"""
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
async def close(self) -> None:
await self._client.close()
async def __aenter__(self) -> "SqlVirtualMachineManagementClient":
await self._client.__aenter__()
return self
async def __aexit__(self, *exc_details) -> None:
await self._client.__aexit__(*exc_details)
|
b'Calculate 44 - 47 - (-3 + (7 - (4 + 24))).\n'
|
/*
* The MIT License
* Copyright (c) 2012 Matias Meno <[email protected]>
*/
@-webkit-keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30%,
70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px);
}
}
@-moz-keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30%,
70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px);
}
}
@keyframes passing-through {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30%,
70% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
100% {
opacity: 0;
-webkit-transform: translateY(-40px);
-moz-transform: translateY(-40px);
-ms-transform: translateY(-40px);
-o-transform: translateY(-40px);
transform: translateY(-40px);
}
}
@-webkit-keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
}
@-moz-keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
}
@keyframes slide-in {
0% {
opacity: 0;
-webkit-transform: translateY(40px);
-moz-transform: translateY(40px);
-ms-transform: translateY(40px);
-o-transform: translateY(40px);
transform: translateY(40px);
}
30% {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
-ms-transform: translateY(0px);
-o-transform: translateY(0px);
transform: translateY(0px);
}
}
@-webkit-keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1);
}
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
}
@-moz-keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1);
}
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
}
@keyframes pulse {
0% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
10% {
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-ms-transform: scale(1.1);
-o-transform: scale(1.1);
transform: scale(1.1);
}
20% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
}
.dropzone,
.dropzone * {
box-sizing: border-box;
}
.dropzone {
min-height: 150px;
height: 100%;
border: 2px dashed #0087F7;
border-radius: 5px;
background: white;
padding: 20px 20px;
}
.dropzone.dz-clickable {
cursor: pointer;
}
.dropzone.dz-clickable * {
cursor: default;
}
.dropzone.dz-clickable .dz-message,
.dropzone.dz-clickable .dz-message * {
cursor: pointer;
}
.dropzone.dz-started .dz-message {
display: none;
}
.dropzone.dz-drag-hover {
border-style: solid;
}
.dropzone.dz-drag-hover .dz-message {
opacity: 0.5;
}
.dropzone .dz-message {
text-align: center;
margin: 2em 0;
}
.dropzone .dz-preview {
position: relative;
display: inline-block;
vertical-align: top;
margin: 16px;
min-height: 100px;
}
.dropzone .dz-preview:hover {
z-index: 1000;
}
.dropzone .dz-preview:hover .dz-details {
opacity: 1;
}
.dropzone .dz-preview.dz-file-preview .dz-image {
border-radius: 20px;
background: #999;
background: linear-gradient(to bottom, #eee, #ddd);
}
.dropzone .dz-preview.dz-file-preview .dz-details {
opacity: 1;
}
.dropzone .dz-preview.dz-image-preview {
background: white;
}
.dropzone .dz-preview.dz-image-preview .dz-details {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-ms-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
transition: opacity 0.2s linear;
}
.dropzone .dz-preview .dz-remove {
font-size: 14px;
text-align: center;
display: block;
cursor: pointer;
border: none;
}
.dropzone .dz-preview .dz-remove:hover {
text-decoration: underline;
}
.dropzone .dz-preview:hover .dz-details {
opacity: 1;
}
.dropzone .dz-preview .dz-details {
z-index: 20;
position: absolute;
top: 0;
left: 0;
opacity: 0;
font-size: 13px;
min-width: 100%;
max-width: 100%;
padding: 2em 1em;
text-align: center;
color: rgba(0, 0, 0, 0.9);
line-height: 150%;
}
.dropzone .dz-preview .dz-details .dz-size {
margin-bottom: 1em;
font-size: 16px;
}
.dropzone .dz-preview .dz-details .dz-filename {
white-space: nowrap;
}
.dropzone .dz-preview .dz-details .dz-filename:hover span {
border: 1px solid rgba(200, 200, 200, 0.8);
background-color: rgba(255, 255, 255, 0.8);
}
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) {
overflow: hidden;
text-overflow: ellipsis;
}
.dropzone .dz-preview .dz-details .dz-filename:not(:hover) span {
border: 1px solid transparent;
}
.dropzone .dz-preview .dz-details .dz-filename span,
.dropzone .dz-preview .dz-details .dz-size span {
background-color: rgba(255, 255, 255, 0.4);
padding: 0 0.4em;
border-radius: 3px;
}
.dropzone .dz-preview:hover .dz-image img {
-webkit-transform: scale(1.05, 1.05);
-moz-transform: scale(1.05, 1.05);
-ms-transform: scale(1.05, 1.05);
-o-transform: scale(1.05, 1.05);
transform: scale(1.05, 1.05);
-webkit-filter: blur(8px);
filter: blur(8px);
}
.dropzone .dz-preview .dz-image {
border-radius: 20px;
overflow: hidden;
width: 120px;
height: 120px;
position: relative;
display: block;
z-index: 10;
}
.dropzone .dz-preview .dz-image img {
display: block;
}
.dropzone .dz-preview.dz-success .dz-success-mark {
-webkit-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-moz-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-ms-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
-o-animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
animation: passing-through 3s cubic-bezier(0.77, 0, 0.175, 1);
}
.dropzone .dz-preview.dz-error .dz-error-mark {
opacity: 1;
-webkit-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-moz-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-ms-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
-o-animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
animation: slide-in 3s cubic-bezier(0.77, 0, 0.175, 1);
}
.dropzone .dz-preview .dz-success-mark,
.dropzone .dz-preview .dz-error-mark {
pointer-events: none;
opacity: 0;
z-index: 500;
position: absolute;
display: block;
top: 50%;
left: 50%;
margin-left: -27px;
margin-top: -27px;
}
.dropzone .dz-preview .dz-success-mark svg,
.dropzone .dz-preview .dz-error-mark svg {
display: block;
width: 54px;
height: 54px;
}
.dropzone .dz-preview.dz-processing .dz-progress {
opacity: 1;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
transition: all 0.2s linear;
}
.dropzone .dz-preview.dz-complete .dz-progress {
opacity: 0;
-webkit-transition: opacity 0.4s ease-in;
-moz-transition: opacity 0.4s ease-in;
-ms-transition: opacity 0.4s ease-in;
-o-transition: opacity 0.4s ease-in;
transition: opacity 0.4s ease-in;
}
.dropzone .dz-preview:not(.dz-processing) .dz-progress {
-webkit-animation: pulse 6s ease infinite;
-moz-animation: pulse 6s ease infinite;
-ms-animation: pulse 6s ease infinite;
-o-animation: pulse 6s ease infinite;
animation: pulse 6s ease infinite;
}
.dropzone .dz-preview .dz-progress {
opacity: 1;
z-index: 1000;
pointer-events: none;
position: absolute;
height: 16px;
left: 50%;
top: 50%;
margin-top: -8px;
width: 80px;
margin-left: -40px;
background: rgba(255, 255, 255, 0.9);
-webkit-transform: scale(1);
border-radius: 8px;
overflow: hidden;
}
.dropzone .dz-preview .dz-progress .dz-upload {
background: #333;
background: linear-gradient(to bottom, #666, #444);
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 0;
-webkit-transition: width 300ms ease-in-out;
-moz-transition: width 300ms ease-in-out;
-ms-transition: width 300ms ease-in-out;
-o-transition: width 300ms ease-in-out;
transition: width 300ms ease-in-out;
}
.dropzone .dz-preview.dz-error .dz-error-message {
display: block;
}
.dropzone .dz-preview.dz-error:hover .dz-error-message {
opacity: 1;
pointer-events: auto;
}
.dropzone .dz-preview .dz-error-message {
pointer-events: none;
z-index: 1000;
position: absolute;
display: block;
display: none;
opacity: 0;
-webkit-transition: opacity 0.3s ease;
-moz-transition: opacity 0.3s ease;
-ms-transition: opacity 0.3s ease;
-o-transition: opacity 0.3s ease;
transition: opacity 0.3s ease;
border-radius: 8px;
font-size: 13px;
top: 130px;
left: -10px;
width: 140px;
background: #be2626;
background: linear-gradient(to bottom, #be2626, #a92222);
padding: 0.5em 1.2em;
color: white;
}
.dropzone .dz-preview .dz-error-message:after {
content: '';
position: absolute;
top: -6px;
left: 64px;
width: 0;
height: 0;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #be2626;
}
|
/* Copyright (c) 2019, 2022 Dennis Wölfing
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* libc/src/stdio/__file_write.c
* Write data to a file. (called from C89)
*/
#define write __write
#include <unistd.h>
#include "FILE.h"
size_t __file_write(FILE* file, const unsigned char* p, size_t size) {
size_t written = 0;
while (written < size) {
ssize_t result = write(file->fd, p, size - written);
if (result < 0) {
file->flags |= FILE_FLAG_ERROR;
return written;
}
written += result;
p += result;
}
return written;
}
|
b'Calculate 9 + (0 - 9 - 8) - (5 + 3).\n'
|
b'Evaluate 0 + (-2 - -2 - (-23 - -20)) + -17.\n'
|
#include <stdarg.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <sys/endian.h>
#include <sysexits.h>
#include <mpg123.h>
#include "audio.h"
#include "mp3.h"
struct mp3 {
mpg123_handle *h;
int fd;
int first;
int rate;
int channels;
int endian;
int octets;
int sign;
};
struct mp3 *
mp3_open(const char *file) {
struct mp3 *m = NULL;
char magic[3];
long rate;
int chan;
int enc;
if ((m = malloc(sizeof(struct mp3))) == NULL)
goto err;
m->h = NULL;
if ((m->fd = open(file, O_RDONLY)) < 0)
goto err;
if (read(m->fd, magic, 3) != 3)
goto err;
if (strncmp(magic, "\xFF\xFB", 2) != 0 &&
strncmp(magic, "ID3", 3) != 0)
goto err;
if (lseek(m->fd, -3, SEEK_CUR) == -1)
goto err;
if (mpg123_init() != MPG123_OK)
return NULL;
if ((m->h = mpg123_new(NULL, NULL)) == NULL ||
mpg123_param(m->h, MPG123_ADD_FLAGS, MPG123_QUIET, 0)
!= MPG123_OK || mpg123_open_fd(m->h, m->fd) != MPG123_OK)
goto err;
if (mpg123_getformat(m->h, &rate, &chan, &enc)
!= MPG123_OK || rate > (int)(~0U >> 1)) {
mpg123_close(m->h);
goto err;
}
m->first = 1;
/* Does mpg123 always output in host byte-order? */
m->endian = BYTE_ORDER == LITTLE_ENDIAN;
m->rate = rate;
m->sign = !!(enc & MPG123_ENC_SIGNED);
if (chan & MPG123_STEREO)
m->channels = 2;
else /* MPG123_MONO */
m->channels = 1;
if (enc & MPG123_ENC_FLOAT) {
mpg123_close(m->h);
goto err;
}
if (enc & MPG123_ENC_32)
m->octets = 4;
else if (enc & MPG123_ENC_24)
m->octets = 3;
else if (enc & MPG123_ENC_16)
m->octets = 2;
else /* MPG123_ENC_8 */
m->octets = 1;
return m;
err:
if (m != NULL) {
if (m->h != NULL)
mpg123_delete(m->h);
if (m->fd >= 0)
close(m->fd);
free(m);
}
mpg123_exit();
return NULL;
}
int
mp3_copy(struct mp3 *m, void *buf, size_t size, struct audio *out) {
size_t r;
if (m == NULL || buf == NULL || size == 0 || out == NULL)
return EX_USAGE;
if (m->first) { /* setup audio output */
m->first = 0;
a_setrate(out, m->rate);
a_setchan(out, m->channels);
a_setend(out, m->endian);
a_setbits(out, m->octets << 3);
a_setsign(out, m->sign);
}
if (mpg123_read(m->h, buf, size, &r) != MPG123_OK)
return EX_SOFTWARE;
if (r == 0)
return 1;
if (a_write(out, buf, r) != r && errno != EINTR
&& errno != EAGAIN)
return EX_IOERR;
return EX_OK;
}
void
mp3_close(struct mp3 *m) {
if (m == NULL)
return;
if (m->fd >= 0)
close(m->fd);
if (m->h != NULL) {
mpg123_close(m->h);
mpg123_delete(m->h);
}
mpg123_exit();
free(m);
}
|
b'Evaluate 10 - (-1 - 4 - -16) - 11.\n'
|
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
packer build -var-file="${DIR}/packer-vars.json" "${DIR}/packer.json"
|
class SessionsController < ApplicationController
before_filter :authenticate_user, :only => [:home, :profile, :setting]
before_filter :save_login_state, :only => [:login, :login_attempt]
def login
end
def login_attempt
authorized_user = User.authenticate(params[:username_or_email],params[:login_password])
if authorized_user
session[:user_id] = authorized_user.id
flash[:notice] = "Wow Welcome again, you logged in as #{authorized_user.username}"
redirect_to(:action => 'home')
else
flash.keep[:notice] = "Invalid Username or Password"
flash.keep[:color]= "invalid"
redirect_to(:action => 'index',error_message: "Invalid Username or Password",:locals => {:errorMessage => "yes"})
end
end
def home
end
def profile
@user = User.find(session[:user_id])
end
def setting
end
def passreset
end
def contactus
end
def passreset_attempt
if params[:submit_button]
# render plain: "returned from the password reset form"
render "home"
else
# render plain: "cancel pressed"
render "home"
end
end
def logout
session[:user_id] = nil
redirect_to :action => 'index'
end
end
|
/*=============================================================================
Copyright (c) 2001-2011 Joel de Guzman
Copyright (c) 2001-2011 Hartmut Kaiser
http://spirit.sourceforge.net/
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.lslboost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef BOOST_SPIRIT_INCLUDE_SUPPORT_STANDARD
#define BOOST_SPIRIT_INCLUDE_SUPPORT_STANDARD
#if defined(_MSC_VER)
#pragma once
#endif
#include <lslboost/spirit/home/support/char_encoding/standard.hpp>
#endif
|
<?php
$news = array(
array(
'created_at' => '2015-04-29 00:00:00',
'image' => 'http://fakeimg.pl/768x370/3c3c3c/',
'thumb' => 'http://fakeimg.pl/200x200/3c3c3c/',
'title' => 'Blimps to Defend Washington, D.C. Airspace',
'content' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque in pulvinar neque. Duis in pharetra purus. Mauris varius porttitor augue in iaculis. Phasellus tincidunt justo magna, eget porta est sagittis quis. Quisque at ante nec dolor euismod elementum sit amet hendrerit nibh. Etiam ut odio tortor. Mauris blandit purus et mauris gravida, eget gravida nulla convallis.</p><p>Vivamus vehicula dignissim malesuada. Donec cursus luctus mi, ac sagittis arcu scelerisque a. Nullam et metus quis sem mollis accumsan. Aenean in sapien pretium, pretium leo eu, ullamcorper sapien. Nulla tempus, metus eu iaculis posuere, ipsum ex faucibus velit, cursus condimentum ligula ex non enim. Aliquam iaculis pellentesque erat molestie feugiat. Morbi ornare maximus rutrum. Pellentesque id euismod erat, eget aliquam massa.</p>'
),
array(
'created_at' => '2015-04-26 00:00:00',
'image' => 'http://fakeimg.pl/768x370/3c3c3c/',
'thumb' => 'http://fakeimg.pl/200x200/3c3c3c/',
'title' => 'Eye Receptor Transplants May Restore Eyesight to the Blind',
'content' => '<p>Praesent cursus lobortis dui eu congue. Phasellus pellentesque posuere commodo. Curabitur dignissim placerat sapien, nec egestas ante. Mauris nec commodo est, ac faucibus massa. Nam et dolor at est dignissim condimentum. Quisque consequat tempus aliquam. Mauris consectetur rutrum efficitur.</p><p>Quisque vulputate massa velit, at facilisis turpis euismod id. Pellentesque molestie lectus ut nisl dignissim sagittis. Sed vitae rutrum turpis. Aenean ex est, sagittis vel lectus nec, suscipit condimentum ligula. Ut vitae vehicula lectus. Morbi sit amet cursus arcu. Curabitur quis nunc ultrices, suscipit erat vel, faucibus diam. Sed odio turpis, consequat eu feugiat a, porttitor eget nisl.</p>'
),
array(
'created_at' => '2015-04-27 00:00:00',
'image' => 'http://fakeimg.pl/768x370/3c3c3c/',
'thumb' => 'http://fakeimg.pl/200x200/3c3c3c/',
'title' => 'Researchers Look to Tattoos to Monitor Your Sweat',
'content' => '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ultricies malesuada risus, at pretium elit scelerisque in. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum vel risus sed leo suscipit tempus vel vel eros. Suspendisse augue elit, tempor a leo tempus, egestas hendrerit leo. Fusce mattis quam magna, ut mattis nulla ultrices at. Etiam sollicitudin tempus placerat. Nulla facilisi. Praesent non porttitor diam, imperdiet volutpat dolor. Pellentesque viverra consectetur auctor. Etiam metus purus, accumsan ac efficitur et, laoreet ut orci. Phasellus rutrum rhoncus lacus a imperdiet. Nam ac scelerisque quam. Donec vitae est pharetra, consequat risus et, maximus odio.</p>'
),
);
?>
<?php if ( isset( $news ) ) : ?>
<div class="widget widget-featured-news">
<div class="widget-header">
<h3 class="widget-title">
<i class="glyphicon glyphicon-star"></i>
Featured News
</h3>
<!-- /.widget-title -->
</div>
<!-- /.widget-header -->
<div class="widget-content">
<ul class="list-unstyled">
<?php foreach ( $news as $new ) : ?>
<li data-title="<?php echo $new['title']; ?>">
<a href="#">
<img alt="<?php echo $new['title']; ?>" class="img-responsive" height="370" src="<?php echo $new['image']; ?>" width="768">
</a>
<h2><a href="#"><?php echo $new['title']; ?></a></h2>
<div class="article hidden">
<button class="btn btn-close" type="button"><i class="glyphicon glyphicon-remove"></i></button>
<p class="h2"><?php echo $new['title']; ?></p>
<!-- /.h2 -->
<?php echo $new['content']; ?>
</div>
<!-- /.article hidden -->
</li>
<?php endforeach; ?>
</ul>
<!-- /.list-unstyled -->
</div>
<!-- /.widget-content -->
</div>
<!-- /.widget widget-featured-news -->
<?php endif; ?>
|
b'-14 - (-13 - (0 - -4))\n'
|
# VisMod
While the ultimate goal of VisMod is to assist in groundwater flow model visualization,
the current classes support the export of files that can be used in visualization software
such as [http://wci.llnl.gov/codes/visit/].
[]
(http://www.youtube.com/watch?v=v12i04psF2c)
## Dependencies
VisMod expects binary head output from modflow [http://water.usgs.gov/ogw/modflow/],
and writes BOV (Brick of Values) files for visualization in VisIt
[https://wci.llnl.gov/codes/visit/]
Currently VisMod supports only uniform grid models (x and y dimensions can differ,
but they cannot be variably spaced).
## Input requirements
1. Model layer to be exported for visualization
2. Model precision (single or double)
3. Model cell dimensions in the x and y directions
4. Origin of bottom left of the model grid (if unknown, any values will work)
5. Path and name of binary head output file from MODFLOW
6. Output path for BOV files
## Outputs
1. BOV file for each timestep or stress period specifed as
'SAVE HEAD' in the MODFLOW OC (output control) file.
2. .visit file for use in VisIt, which contains the name of each BOV
file produced by VisMod - useful for time series animations
## Workflow
1. Ensure that visMod.py and runVisMod.py exist in the same directory
2. Modify user variables in runVisMod.py
3. Ensure output path exists
Example call to class to format MODFLOW heads for VisIt--
```
origin=[0.0,0.0] #origin of bottom left corner
xdim=2000 #cell dimension in the x direction
ydim=1000 #cell dimension in the y direction
layer=1 #layer to be exported
precision='single' #single or double
headsfile='MF2005.1_11/test-run/tr2k_s3.hed'
outpath='MF2005.1_11/MF2005.1_11/test-run/visit/'
v=vm.visMod(layer,precision,xdim,ydim,origin,headsfile,outpath)
v.BOVheads()
```
#visGIS
visGIS utility tools to visualize GIS files in visualization.
Currently one class is included to convert a shapefile of contours
into a continous grid in ASCII DEM format.
## Dependencies
VisGIS expects a line shapefile with an attribute of values (normally to represent
altitude of water table or land surface)
and writes a .dem file (ASCII DEM format) files for visualization in VisIt
[https://wci.llnl.gov/codes/visit/]
VisGIS has been tested with python (x,y) with GDAL installed.
required modules are osgeo, numpy, and scipy
## Input requirements
1. Line shapefile with attribute of elevations
2. Output grid cell size
3. Path and name of dem output file
## Outputs
1. ASCII DEM file
## Workflow
Example data from
[http://www.swfwmd.state.fl.us/data/gis/layer_library/category/potmaps]
Example call to class to interpolate shapefile of contours
```
import visGIS as vg
c2g=vg.shpTools('may75fl_line.shp',
'may75fl.dem','M75FLEL',500)
c2g.getVerts() #required for interp2dem
c2g.interp2dem()
```
|
#
# Cookbook Name:: stow
# Spec:: default
#
# Copyright (c) 2015 Steven Haddox
require 'spec_helper'
describe 'stow::default' do
context 'When all attributes are default, on an unspecified platform' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new
runner.converge(described_recipe)
end
it 'converges successfully' do
chef_run # This should not raise an error
end
it 'creates stow src directory' do
expect(chef_run).to run_execute('create_stow_source_dir')
end
it 'adds stow bin to $PATH' do
expect(chef_run).to create_template('/etc/profile.d/stow.sh')
end
end
context 'When running on CentOS 6' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.5')
runner.converge(described_recipe)
end
it 'installs stow' do
expect(chef_run).to install_package 'stow'
end
end
context 'When running on Fedora 20' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'fedora', version: '20')
runner.converge(described_recipe)
end
it 'installs stow' do
expect(chef_run).to install_package 'stow'
end
end
context 'When running on Ubuntu 14' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '14.04')
runner.converge(described_recipe)
end
it 'installs stow' do
expect(chef_run).to install_package 'stow'
end
end
context 'When running on Debian 7' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'debian', version: '7.0')
runner.converge(described_recipe)
end
it 'installs stow' do
expect(chef_run).to install_package 'stow'
end
end
context 'When installing from source' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'opensuse', version: '12.3')
runner.converge(described_recipe)
end
it 'gets the latest stow' do
expect(chef_run).to create_remote_file("/usr/local/stow/src/stow-2.2.0.tar.gz")
end
it 'installs stow from source' do
expect(chef_run).to install_tar_package("file:////usr/local/stow/src/stow-2.2.0.tar.gz")
end
describe '.stow_stow' do
it 'runs on a clean install' do
expect(chef_run).to run_execute('stow_stow')
end
it 'is skipped if stow is up to date' do
# Stub package_stowed? to return true
allow_any_instance_of(Chef::Resource::Execute).to receive(:package_stowed?).and_return(true)
expect(chef_run).to_not run_execute('stow_stow')
end
end
describe '.destow_stow' do
it 'is skipped if stow is up to date' do
# Stub package_stowed? to return true
allow_any_instance_of(Chef::Resource::Execute).to receive(:package_stowed?).and_return(true)
expect(chef_run).to_not run_execute('destow_stow')
end
it 'is skipped if old_stow_packages is blank' do
# Stub package_stowed? to return false
allow_any_instance_of(Chef::Resource::Execute).to receive(:package_stowed?).and_return(true)
# Stub the directory glob to return no package matches
allow_any_instance_of(Chef::Resource::Execute).to receive(:old_stow_packages).and_return([])
expect(chef_run).to_not run_execute('destow_stow')
end
it 'should destow existing stow packages' do
# Return array of stow packages that exist in stow's path
allow_any_instance_of(Chef::Resource::Execute).to receive(:old_stow_packages).and_return(['/usr/local/stow/stow-+-2.1.3'])
# Ensure the directory glob returns the proper package
allow(::File).to receive(:exist?).and_call_original
allow(::File).to receive(:exist?).with('/usr/local/stow/stow-+-2.1.3').and_return(true)
# Ensure the correct files are present
# Ensure the symlink is detected
expect(chef_run).to run_execute('destow_stow')
expect(chef_run).to run_execute('stow_stow')
end
end
end
end
|
b'Evaluate (14 - (27 - (-8 - -19))) + (0 - -22).\n'
|
b'What is the value of -5 - (-1 + (-3 - -6)) - (2 + -26)?\n'
|
b'What is the value of -1 - (48 + -46 + 2 + -3) - 7?\n'
|
b'(0 + 13 - -8) + -9\n'
|
b'Calculate 22 - (-5 + 17 - 0).\n'
|
b'What is the value of -8 + 18 + -1 + -21?\n'
|
b'What is the value of (-2 - (-1 + -5 + 11)) + 31?\n'
|
b'Calculate (-1 - (0 + 18)) + -1 + -2.\n'
|
b'What is the value of (3 - -2) + (33 - 39) + -17 + 16?\n'
|
b'5 - (7 + 6 + (0 - -1)) - -4\n'
|
export default {
hello : "hello"
};
|
/*!
* DASSL solver library description
*/
#include "libinfo.h"
extern void _start()
{
_library_ident("DAE solver library");
_library_task("interfaces to generic IVP solver");
_library_task("operations on data for included solvers");
_library_task("DASSL solver backend");
_library_task("RADAU solver backend");
_library_task("MEBDFI solver backend");
_exit(0);
}
|
b'Calculate (5 - ((-1 - -1) + -3)) + (-27 - -7).\n'
|
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Pdf
* @subpackage Annotation
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: FileAttachment.php 24594 2012-01-05 21:27:01Z matthew $
*/
/** Internally used classes */
// require_once 'Zend/Pdf/Element.php';
// require_once 'Zend/Pdf/Element/Array.php';
// require_once 'Zend/Pdf/Element/Dictionary.php';
// require_once 'Zend/Pdf/Element/Name.php';
// require_once 'Zend/Pdf/Element/Numeric.php';
// require_once 'Zend/Pdf/Element/String.php';
/** Zend_Pdf_Annotation */
// require_once 'Zend/Pdf/Annotation.php';
/**
* A file attachment annotation contains a reference to a file,
* which typically is embedded in the PDF file.
*
* @package Zend_Pdf
* @subpackage Annotation
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Pdf_Annotation_FileAttachment extends Zend_Pdf_Annotation
{
/**
* Annotation object constructor
*
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $annotationDictionary)
{
if ($annotationDictionary->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
// require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Annotation dictionary resource has to be a dictionary.');
}
if ($annotationDictionary->Subtype === null ||
$annotationDictionary->Subtype->getType() != Zend_Pdf_Element::TYPE_NAME ||
$annotationDictionary->Subtype->value != 'FileAttachment') {
// require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Subtype => FileAttachment entry is requires');
}
parent::__construct($annotationDictionary);
}
/**
* Create link annotation object
*
* @param float $x1
* @param float $y1
* @param float $x2
* @param float $y2
* @param string $fileSpecification
* @return Zend_Pdf_Annotation_FileAttachment
*/
public static function create($x1, $y1, $x2, $y2, $fileSpecification)
{
$annotationDictionary = new Zend_Pdf_Element_Dictionary();
$annotationDictionary->Type = new Zend_Pdf_Element_Name('Annot');
$annotationDictionary->Subtype = new Zend_Pdf_Element_Name('FileAttachment');
$rectangle = new Zend_Pdf_Element_Array();
$rectangle->items[] = new Zend_Pdf_Element_Numeric($x1);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($y1);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($x2);
$rectangle->items[] = new Zend_Pdf_Element_Numeric($y2);
$annotationDictionary->Rect = $rectangle;
$fsDictionary = new Zend_Pdf_Element_Dictionary();
$fsDictionary->Type = new Zend_Pdf_Element_Name('Filespec');
$fsDictionary->F = new Zend_Pdf_Element_String($fileSpecification);
$annotationDictionary->FS = $fsDictionary;
return new Zend_Pdf_Annotation_FileAttachment($annotationDictionary);
}
}
|
get '/user' do
if logged_in?
redirect '/'
end
erb :create_account
end
post '/user' do
user = User.create(params[:user])
redirect '/'
end
post '/login' do
if user = User.login(params[:user])
session[:permissions] = '3'
end
redirect '/'
end
get '/logout' do
session.clear
session[:permissions] = '0'
redirect '/'
end
|
b'Evaluate 90 + -59 - (-3 - -17).\n'
|
const defaults = {
base_css: true, // the base dark theme css
inline_youtube: true, // makes youtube videos play inline the chat
collapse_onebox: true, // can collapse
collapse_onebox_default: false, // default option for collapse
pause_youtube_on_collapse: true, // default option for pausing youtube on collapse
user_color_bars: true, // show colored bars above users message blocks
fish_spinner: true, // fish spinner is best spinner
inline_imgur: true, // inlines webm,gifv,mp4 content from imgur
visualize_hex: true, // underlines hex codes with their colour values
syntax_highlight_code: true, // guess at language and highlight the code blocks
emoji_translator: true, // emoji translator for INPUT area
code_mode_editor: true, // uses CodeMirror for your code inputs
better_image_uploads: true // use the drag & drop and paste api for image uploads
};
const fileLocations = {
inline_youtube: ['js/inline_youtube.js'],
collapse_onebox: ['js/collapse_onebox.js'],
user_color_bars: ['js/user_color_bars.js'],
fish_spinner: ['js/fish_spinner.js'],
inline_imgur: ['js/inline_imgur.js'],
visualize_hex: ['js/visualize_hex.js'],
better_image_uploads: ['js/better_image_uploads.js'],
syntax_highlight_code: ['js/highlight.js', 'js/syntax_highlight_code.js'],
emoji_translator: ['js/emojidata.js', 'js/emoji_translator.js'],
code_mode_editor: ['CodeMirror/js/codemirror.js',
'CodeMirror/mode/cmake/cmake.js',
'CodeMirror/mode/cobol/cobol.js',
'CodeMirror/mode/coffeescript/coffeescript.js',
'CodeMirror/mode/commonlisp/commonlisp.js',
'CodeMirror/mode/css/css.js',
'CodeMirror/mode/dart/dart.js',
'CodeMirror/mode/go/go.js',
'CodeMirror/mode/groovy/groovy.js',
'CodeMirror/mode/haml/haml.js',
'CodeMirror/mode/haskell/haskell.js',
'CodeMirror/mode/htmlembedded/htmlembedded.js',
'CodeMirror/mode/htmlmixed/htmlmixed.js',
'CodeMirror/mode/jade/jade.js',
'CodeMirror/mode/javascript/javascript.js',
'CodeMirror/mode/lua/lua.js',
'CodeMirror/mode/markdown/markdown.js',
'CodeMirror/mode/mathematica/mathematica.js',
'CodeMirror/mode/nginx/nginx.js',
'CodeMirror/mode/pascal/pascal.js',
'CodeMirror/mode/perl/perl.js',
'CodeMirror/mode/php/php.js',
'CodeMirror/mode/puppet/puppet.js',
'CodeMirror/mode/python/python.js',
'CodeMirror/mode/ruby/ruby.js',
'CodeMirror/mode/sass/sass.js',
'CodeMirror/mode/scheme/scheme.js',
'CodeMirror/mode/shell/shell.js' ,
'CodeMirror/mode/sql/sql.js',
'CodeMirror/mode/swift/swift.js',
'CodeMirror/mode/twig/twig.js',
'CodeMirror/mode/vb/vb.js',
'CodeMirror/mode/vbscript/vbscript.js',
'CodeMirror/mode/vhdl/vhdl.js',
'CodeMirror/mode/vue/vue.js',
'CodeMirror/mode/xml/xml.js',
'CodeMirror/mode/xquery/xquery.js',
'CodeMirror/mode/yaml/yaml.js',
'js/code_mode_editor.js']
};
// right now I assume order is correct because I'm a terrible person. make an order array or base it on File Locations and make that an array
// inject the observer and the utils always. then initialize the options.
injector([{type: 'js', location: 'js/observer.js'},{type: 'js', location: 'js/utils.js'}], _ => chrome.storage.sync.get(defaults, init));
function init(options) {
// inject the options for the plugins themselves.
const opts = document.createElement('script');
opts.textContent = `
const options = ${JSON.stringify(options)};
`;
document.body.appendChild(opts);
// now load the plugins.
const loading = [];
if( !options.base_css ) {
document.documentElement.classList.add('nocss');
}
delete options.base_css;
for( const key of Object.keys(options) ) {
if( !options[key] || !( key in fileLocations)) continue;
for( const location of fileLocations[key] ) {
const [,type] = location.split('.');
loading.push({location, type});
}
}
injector(loading, _ => {
const drai = document.createElement('script');
drai.textContent = `
if( document.readyState === 'complete' ) {
DOMObserver.drain();
} else {
window.onload = _ => DOMObserver.drain();
}
`;
document.body.appendChild(drai);
});
}
function injector([first, ...rest], cb) {
if( !first ) return cb();
if( first.type === 'js' ) {
injectJS(first.location, _ => injector(rest, cb));
} else {
injectCSS(first.location, _ => injector(rest, cb));
}
}
function injectCSS(file, cb) {
const elm = document.createElement('link');
elm.rel = 'stylesheet';
elm.type = 'text/css';
elm.href = chrome.extension.getURL(file);
elm.onload = cb;
document.head.appendChild(elm);
}
function injectJS(file, cb) {
const elm = document.createElement('script');
elm.type = 'text/javascript';
elm.src = chrome.extension.getURL(file);
elm.onload = cb;
document.body.appendChild(elm);
}
|
b'8 - (-1 - 0) - (64 + (-1 - 39))\n'
|
b'Calculate 6 - -7 - 34 - (2 + (-9 - 0)).\n'
|
b'What is the value of 7 + 11 + (24 - 58)?\n'
|
function collectWithWildcard(test) {
test.expect(4);
var api_server = new Test_ApiServer(function handler(request, callback) {
var url = request.url;
switch (url) {
case '/accounts?username=chariz*':
let account = new Model_Account({
username: 'charizard'
});
return void callback(null, [
account.redact()
]);
default:
let error = new Error('Invalid url: ' + url);
return void callback(error);
}
});
var parameters = {
username: 'chariz*'
};
function handler(error, results) {
test.equals(error, null);
test.equals(results.length, 1);
var account = results[0];
test.equals(account.get('username'), 'charizard');
test.equals(account.get('type'), Enum_AccountTypes.MEMBER);
api_server.destroy();
test.done();
}
Resource_Accounts.collect(parameters, handler);
}
module.exports = {
collectWithWildcard
};
|
b'What is the value of 3 + 22 + -44 + (9 - 2)?\n'
|
b'What is the value of -3 - (2 - 24 - (-19 + 12)) - 4?\n'
|
b'(-4 - 4) + 75 + -50\n'
|
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 21