hexsha
stringlengths 40
40
| size
int64 5
1.05M
| ext
stringclasses 98
values | lang
stringclasses 21
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
118
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
sequencelengths 1
10
| max_stars_count
int64 1
368k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
118
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
sequencelengths 1
10
| max_issues_count
int64 1
134k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
135
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
sequencelengths 1
10
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 5
1.05M
| avg_line_length
float64 1
1.03M
| max_line_length
int64 2
1.03M
| alphanum_fraction
float64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
07e449867842570ba6b7f7ae2b3f15763d7186bd | 163 | sql | SQL | internal/post/comment/sql/get/postTotalDepth.sql | Allocamelus/Allocamelus | 337956b33afa9a851214a2c4bef90c8ca07a2703 | [
"Apache-2.0"
] | 3 | 2021-09-22T12:30:48.000Z | 2022-03-01T17:14:23.000Z | internal/post/comment/sql/get/postTotalDepth.sql | Allocamelus/Allocamelus | 337956b33afa9a851214a2c4bef90c8ca07a2703 | [
"Apache-2.0"
] | null | null | null | internal/post/comment/sql/get/postTotalDepth.sql | Allocamelus/Allocamelus | 337956b33afa9a851214a2c4bef90c8ca07a2703 | [
"Apache-2.0"
] | null | null | null | SELECT COUNT(*)
FROM PostComments PC
JOIN PostCommentClosures PCC ON (PC.postCommentId = PCC.parent)
WHERE PC.postId = ?
AND PCC.depth <= ?
AND PC.parent = 0 | 27.166667 | 65 | 0.717791 |
643b6b320d6dcee16060090daaeb32870d38900b | 2,905 | rs | Rust | src/lib.rs | KJ002/anagram_solver | 5c8c86fb19211d414acf9593fb4ceb6e2c2d9930 | [
"MIT"
] | null | null | null | src/lib.rs | KJ002/anagram_solver | 5c8c86fb19211d414acf9593fb4ceb6e2c2d9930 | [
"MIT"
] | null | null | null | src/lib.rs | KJ002/anagram_solver | 5c8c86fb19211d414acf9593fb4ceb6e2c2d9930 | [
"MIT"
] | null | null | null | use itertools::Itertools;
use std::cmp::{Ordering, Reverse};
use std::fs;
use std::thread;
use pyo3::prelude::*;
fn contains_any_characters(word: &str, characters: Vec<char>) -> bool {
for character in characters {
if word
.to_lowercase()
.contains(&character.to_lowercase().to_string())
{
return true;
}
}
false
}
fn binary_search(word: &str, words: &[String]) -> bool {
if words.len() <= 20 {
return words.iter().any(|x| x == word);
}
let centre_index = (words.len() - 1) / 2;
if word == words[centre_index] {
return true;
}
match word.cmp(&words[centre_index]) {
Ordering::Greater => binary_search(word, &words[centre_index..]),
Ordering::Less => binary_search(word, &words[..centre_index]),
_ => panic!(),
}
}
fn all_lengths(anagram: &str, max: &usize, min: &usize) -> Vec<Vec<char>> {
if *max <= *min {
return anagram.chars().permutations(*max).unique().collect_vec();
}
let mut result: Vec<Vec<char>> = Vec::new();
result.append(&mut anagram.chars().permutations(*max).unique().collect_vec());
result.append(&mut all_lengths(anagram, &(max - 1), &min));
result
}
fn threader(anagram: &str, max: usize, min: usize) -> Vec<Vec<char>> {
let mut handles = vec![];
{
let max = if max > 6 {
6
} else {
max.clone()
};
let anagram = anagram.to_string();
let handle = thread::spawn(move || {
all_lengths(&anagram, &max, &min)
});
handles.push(handle);
}
for n in 7..max+1 {
let anagram = anagram.to_string();
let handle = thread::spawn(move || {
all_lengths(&anagram, &n, &n)
});
handles.push(handle);
}
let mut result = vec![];
for handle in handles {
result.append(&mut handle.join().unwrap());
}
result
}
#[pyfunction]
fn solve_anagram(anagram: &str, max: usize, min: usize) -> PyResult<Vec<String>>{
let letters: Vec<Vec<char>> = threader(&anagram, max, min);
let words: Vec<String> = fs::read_to_string("words.txt")
.expect("Couldn't open words.txt. Does it exist?")
.split('\n')
.map(String::from)
.collect();
let mut solved: Vec<String> = Vec::new();
for perm in letters {
let result = perm.into_iter().collect::<String>();
if contains_any_characters(&result, vec!['a', 'e', 'i', 'o', 'y'])
&& !solved.iter().any(|x| x == &result)
&& binary_search(&result, &words)
{
solved.push(result);
}
}
solved.sort_by_key(|a| Reverse(a.len()));
Ok(solved)
}
#[pymodule]
fn anagram_solver(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(solve_anagram, m)?)?;
Ok(())
}
| 24.008264 | 82 | 0.549053 |
e725ca8b93021d84822bf6d286bdba3a6bcfd6e6 | 3,120 | js | JavaScript | app/components/Player/PlayerComponent.js | popcorn-official/popcorn-time-desktop | 2dcdc61d0d22ecc6f46d85bd61b6f0c55b6b0d32 | [
"MIT"
] | 9 | 2020-03-28T14:21:31.000Z | 2021-07-30T22:22:00.000Z | app/components/Player/PlayerComponent.js | TriPSs/popcorn-time-desktop | 2dcdc61d0d22ecc6f46d85bd61b6f0c55b6b0d32 | [
"MIT"
] | 21 | 2017-07-10T08:12:09.000Z | 2017-08-18T12:22:47.000Z | app/components/Player/PlayerComponent.js | popcorn-official/popcorn-time-desktop | 2dcdc61d0d22ecc6f46d85bd61b6f0c55b6b0d32 | [
"MIT"
] | 10 | 2020-05-06T07:43:32.000Z | 2022-01-14T16:49:49.000Z | // @flow
import React from 'react'
import classNames from 'classnames'
import Player from 'api/Player'
import * as PlayerConstants from 'api/Player/PlayerConstants'
import * as TorrentConstants from 'api/Torrent/TorrentConstants'
import type { Props } from './PlayerTypes'
import classes from './Player.scss'
import Stats from './Stats'
import Controls from './Controls'
import Progress from './Progress'
export default class extends React.Component {
props: Props
componentWillUnmount() {
Player.destroy()
}
isHidden = () => {
const { torrentStatus } = this.props
if (this.shouldShowPlayer()) {
return false
}
return torrentStatus === TorrentConstants.STATUS_NONE
}
shouldShowPlayer = () => {
const { playerStatus, playerAction } = this.props
return playerStatus !== PlayerConstants.STATUS_NONE
&& playerStatus !== PlayerConstants.STATUS_ENDED
&& playerAction !== PlayerConstants.ACTION_STOP
}
shouldShowControls = () => {
const { playerProvider, playerStatus } = this.props
if (playerProvider === PlayerConstants.PROVIDER_PLYR) {
return false
}
return playerStatus === PlayerConstants.STATUS_PLAYING || playerStatus === PlayerConstants.STATUS_PAUSED
}
renderVideo = () => {
const { uri, stop, playerStatus } = this.props
return (
<div
style={{
position : this.shouldShowPlayer() ? 'fixed' : 'inherit',
visibility: this.shouldShowPlayer() ? 'inherit' : 'hidden',
display : uri ? 'inherit' : 'none',
}}
className={classNames(classes.plyr, {
[classes['plyr--playing']]: playerStatus === PlayerConstants.STATUS_PLAYING,
[classes['plyr--paused']] : playerStatus === PlayerConstants.STATUS_PAUSED,
})}>
<button
className={classNames(
classes.player__close,
'pct-btn pct-btn-trans pct-btn-outline pct-btn-round')}
onClick={stop}>
<i className={'ion-ios-arrow-back'} />
Close
</button>
<video controls>
<track kind={'captions'} />
</video>
</div>
)
}
render() {
const { playerProvider, playerStatus } = this.props
const { stop, torrentStatus } = this.props
return (
<div
className={classNames({
'animated fadeIn' : !this.isHidden(),
[classes['player--hidden']]: this.isHidden(),
}, classes.player)}>
{torrentStatus !== TorrentConstants.STATUS_NONE && (
<Stats {...{
playerProvider,
playerStatus,
torrentStatus,
stop,
}} />
)}
<div className={classNames(classes.player__controls, {
'animated fadeIn': !this.isHidden(),
})}>
{this.shouldShowControls() && (
<Controls />
)}
{this.shouldShowControls() && (
<Progress />
)}
</div>
{playerProvider === PlayerConstants.PROVIDER_PLYR && this.renderVideo()}
</div>
)
}
}
| 26.218487 | 108 | 0.583333 |
e7487d72aa592d298641a0dc11a9b25974f77293 | 3,531 | js | JavaScript | kp-portfolio/src/Components/Home.js | javontaymcelroy/kerrymcphearson-portfolio | b08774dc76465f3898ac8a62f8d6157b00f4fc32 | [
"MIT"
] | null | null | null | kp-portfolio/src/Components/Home.js | javontaymcelroy/kerrymcphearson-portfolio | b08774dc76465f3898ac8a62f8d6157b00f4fc32 | [
"MIT"
] | 3 | 2021-03-10T04:49:48.000Z | 2022-02-26T22:34:23.000Z | kp-portfolio/src/Components/Home.js | javontaymcelroy/kerrymcphearson-portfolio | b08774dc76465f3898ac8a62f8d6157b00f4fc32 | [
"MIT"
] | null | null | null | import React from "react";
import { Link } from "react-router-dom";
import triangle from "../Assets/blue_triangle.svg";
import bang from "../Assets/bang.svg";
import chameleon from "../Assets/chameleon.svg";
import wave from "../Assets/wave.svg";
import chevron from "../Assets/chevron.svg";
import cloutcharts from "../Assets/CloutCharts.png";
import revitalize from "../Assets/Revitalize.png";
import Q4TB from "../Assets/Q4TB.png";
import SE from "../Assets/SE.png";
import "../SCSS/Home.scss";
const Home = () => {
return (
<>
<div className="Home">
<div className="hero-section">
<h1>
Hi, my name is Kerry McPhearson & I'm a Product Designer Hailing
From Atlanta, GA
</h1>
</div>
<img src={triangle} className="hero-triangle" alt="blue triangle" />
<img src={bang} className="hero-bang" alt="yellow bang" />
<img src={chameleon} className="hero-chameleon" alt="chameleon" />
<img src={wave} className="hero-wave" alt="blue wave" />
</div>
<div className="scroll-down-container">
<p className="scroll-down">Scroll Down to View My Projects</p>
<img src={chevron} alt="scroll down" className="chevron" />
</div>
<div className="home-grid-container">
<div className="cloutcharts">
<Link to="/cloutcharts">
<img
src={cloutcharts}
alt="Clout Charts"
className="square-image"
/>
<div className="project-info">
<h1 className="project-title">Clout Charts</h1>
<p className="project-desc">
CC is a streaming aggregator service that lets listeners explore
music from all over the world.{" "}
</p>
</div>
</Link>
</div>
<div className="q4tb">
<Link to="/questforthebest">
<img
src={Q4TB}
alt="Quest for the Best"
className="verticle-image"
/>
<div className="project-info">
<h1>Quest For The Best</h1>
<p className="project-desc">
Quest For The Best is a social challenge platform that
encourages members of a community to seek out the best available
experiences in their area.
</p>
</div>
</Link>
</div>
<div className="revitalize">
<Link to="/revitalize">
<img src={revitalize} alt="Revitalize" className="square-image" />
<div className="project-info">
<h1 className="project-title">Revitalize</h1>
<p className="project-desc">
Revitalize is a crowdfunding/CRM platform for trade
apprenticeships and small business owners. .
</p>
</div>
</Link>
</div>
<div className="se">
<Link to="/solve-employment">
<img src={SE} alt="Solve Employment" className="banner-image" />
<div className="project-info">
<h1 className="project-title">Solve Employment</h1>
<p className="project-desc">
Solve Employment is a socially responsible freelancing platform
that helps you grow your business and make a difference.
</p>
</div>
</Link>
</div>
</div>
</>
);
};
export default Home;
| 35.31 | 80 | 0.542339 |
74cde69693e6901e362741b0beae7bd43f88c587 | 79,566 | js | JavaScript | TYLC/erp-web/target/erpweb/static-resources/public/control.js | zljxh/TYLC | 9497175053d3e7454e9b5128cd31cda608343450 | [
"Apache-2.0"
] | null | null | null | TYLC/erp-web/target/erpweb/static-resources/public/control.js | zljxh/TYLC | 9497175053d3e7454e9b5128cd31cda608343450 | [
"Apache-2.0"
] | null | null | null | TYLC/erp-web/target/erpweb/static-resources/public/control.js | zljxh/TYLC | 9497175053d3e7454e9b5128cd31cda608343450 | [
"Apache-2.0"
] | null | null | null | function getCaiNiaoPrint(t,e){var i,l="<br><font color='#FF00FF'>打印组件未安装!<a href='http://www.taobao.com/market/cainiao/eleprint.php' target='_self'>请点击这里</a>,下载32位安装程序,安装后请刷新页面或重新进入。</font>",n="<br><font color='#FF00FF'>打印组件需要升级!点击这里<a href=' http://www.taobao.com/market/cainiao/eleprint.php' target='_self'>请点击这里</a>,下载32位安装程序,安装升级后请重新进入。</font>",r="<br><font color='#FF00FF'>打印组件未安装!点击这里<a href=' http://www.taobao.com/market/cainiao/eleprint.php' target='_self'>请点击这里</a>,下载64位安装程序,安装后请刷新页面或重新进入。</font>";try{var o=navigator.userAgent.indexOf("MSIE")>=0||navigator.userAgent.indexOf("Trident")>=0,a=o&&navigator.userAgent.indexOf("x64")>=0;return void 0!=t||void 0!=e?i=o?t:e:null==CreatedOKCNPrint7766?(i=document.createElement("object"),i.setAttribute("width",0),i.setAttribute("height",0),i.setAttribute("style","position:absolute;left:0px;top:-100px;width:0px;height:0px;"),o?i.setAttribute("classid","clsid:09896DB8-1189-44B5-BADC-D6DB5286AC57"):i.setAttribute("type","application/x-cainiaoprint"),document.body.appendChild(i),CreatedOKCNPrint7766=i):i=CreatedOKCNPrint7766,null==i||void 0===i.VERSION?(navigator.userAgent.indexOf("Chrome")>=0&&(document.documentElement.innerHTML=""+document.documentElement.innerHTML),navigator.userAgent.indexOf("Firefox")>=0&&(document.documentElement.innerHTML=""+document.documentElement.innerHTML),a?document.write(r):o?document.write(l):document.documentElement.innerHTML=l+document.documentElement.innerHTML,i):i.VERSION<"1.0.0.0"?(a?document.write("<br><font color='#FF00FF'>打印组件需要升级!点击这里<a href=' http://www.taobao.com/market/cainiao/eleprint.php' target='_self'>请点击这里</a>,下载64位安装程序,安装升级后请重新进入。</font>"):o?document.write(n):document.documentElement.innerHTML=n+document.documentElement.innerHTML,i):i}catch(t){return document.documentElement.innerHTML=a?"Error:"+r+document.documentElement.innerHTML:"Error:"+l+document.documentElement.innerHTML,i}}vm.Control=vm.Control||{},vm.Control.MultiSelectProductModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/MultiSelectProduct",this.OperatorGroupRowId=null;var e=this;this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageMultiSelectProductByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountMultiSelectProductByPQP",this.griddataParameter.toolbar=".tbMultiSelectProduct";var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbMultiSelectProductMenu")),e.gridModel.c8GetElementsBySelector("#tbMultiSelectProductMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbMultiSelectProductMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addProductClose()},this.griddataParameter.dataoptions={remoteSort:!1,columns:[[{title:"选择",field:"ck",checkbox:!0,sortable:!0},{title:"商品简称",field:"ProductShortName",width:120,align:"left",sortable:!0},{title:"商品代码",field:"ProductCode",width:120,align:"left",sortable:!0},{title:"商品名称",field:"ProductName",width:120,align:"left",sortable:!0},{title:"规格代码",field:"ProductSkuCode",width:120,align:"left",sortable:!0},{title:"规格名称",field:"ProductSkuName",width:120,align:"left",sortable:!0},{title:"库存",field:"InventoryQuantity",width:120,align:"left",sortable:!0},{title:"可用库存",field:"KYQuantity",width:120,align:"left",sortable:!0},{title:"是否赠品",field:"IsGift",width:100,align:"right",hidden:!0},{title:"图片",field:"PicturePath1",width:50,align:"right",hidden:!0},{title:"组合",field:"IsCombin",width:60,align:"left",sortable:!0,formatter:function(t,e,i){return"1"==e.IsCombin?"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' checked='true' value='true'/>":"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' value='false'/>"}}]],singleSelect:!1,onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){if(null!=o){var t=o();if(void 0==t)return;t.ProductCategoryRowId=n,e.gridModel.pSearch(t)}else e.gridModel.pSearch({ProductCategoryRowId:n})};var n=null;this.treeoption={url:"BusinessControl/GetComboTreeProductCategory",onClick:function(t){n=t.id,e.searchClick()}};var r=null,o=null;this.setParameter=function(t){r=t.callback,o=t.getData},this.addProduct=function(){if(null!=r){var t=e.gridModel.datagrid("getSelections");r(t),e.gridModel.datagrid("clearChecked")}l()},this.addProductClose=function(){e.addProduct(),ko.c8showMessage("success","添加成功!")}},vm.Control=vm.Control||{},vm.Control.SelectDistributorModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectDistributorModel",this.OperatorGroupRowId=null,this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/Distributor/getpage",this.griddataParameter.countUrl="/Distributor/getcount",this.griddataParameter.toolbar=".tbSelectVip",this.f_DblClickRow=function(t,i){e.addVipClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"代码",field:"Code",width:120,align:"right"},{title:"名称",field:"Name",width:120,align:"right"},{title:"手机",field:"Mobile",width:120,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback};var i=null;this.addProduct=function(){if(null!=i){var t=e.gridModel.datagrid("getSelected");i(t)}},this.addVipClose=function(){e.addProduct(),e.c8win&&e.c8win.c8CloseWin()},this.setFormValidate=function(){$(".easyui-textbox").each(function(t,i){$(i).textbox("textbox").keydown(function(t){13==t.keyCode&&e.searchClick()})})}},vm.Control=vm.Control||{},vm.Control.Supplier=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=SelectSupplier",this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/getSupplierList",this.griddataParameter.countUrl="/BusinessControl/getSupplierCount",this.griddataParameter.toolbar=".tbSelectSupplier",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addDataSupplierClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"供应商名称",field:"Name",width:120,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var i=null;this.addDataSupplier=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=i&&i(t)},this.addDataSupplierClose=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&(null!=i&&i(t),e.c8win&&e.c8win.c8CloseWin())}},vm.Control=vm.Control||{},vm.Control.SelectSupplierTextModel=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=MultiSelectSupplier",this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageMultiSelectSupplierByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountMultiSelectSupplierByPQP",this.griddataParameter.toolbar=".tbMultiSelectSupplier",this.griddataParameter.IsFormLayout=!1;var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbMultiSelectSupplierMenu")),e.gridModel.c8GetElementsBySelector("#tbMultiSelectSupplierMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbMultiSelectSupplierMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addPurchaseOrderClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"供应商代码",field:"Code",width:160,align:"right"},{title:"供应商名称",field:"Name",width:80,align:"right"},{title:"公司名称",field:"CompanyName",width:80,align:"right"},{title:"联系人",field:"Contact",width:80,align:"right"},{title:"手机",field:"Mobile",width:80,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){n=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var n=null;this.addSupplier=function(){if(null!=n){var t=e.gridModel.datagrid("getSelections");n(t)}l()},this.addSupplierClose=function(){e.addSupplier(),e.c8win&&(e.c8win.c8CloseWin(),l())}},vm.Control=vm.Control||{},vm.Control.MultiSelectProductBatchModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/MultiSelectProductBatch",this.OperatorGroupRowId=null;var e=this;this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageMultiSelectProductBatchByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountMultiSelectProductBatchByPQP",this.griddataParameter.toolbar=".tbMultiSelectProduct",this.griddataParameter.IsFormLayout=!1;var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbMultiSelectProductMenu")),e.gridModel.c8GetElementsBySelector("#tbMultiSelectProductMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbMultiSelectProductMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addProductClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"商品代码",field:"ProductCode",width:120,align:"left"},{title:"商品名称",field:"ProductName",width:120,align:"left"},{title:"规格代码",field:"ProductSkuCode",width:120,align:"left"},{title:"规格名称",field:"ProductSkuName",width:120,align:"left"}]],singleSelect:!1,onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch({ProductCategoryRowId:n})};var n=null;this.treeoption={url:"BusinessControl/GetComboTreeProductCategory",onClick:function(t){n=t.id,e.searchClick()}},this.setParameter=function(t){r=t.callback};var r=null;this.addProduct=function(){if(null!=r){var t=e.gridModel.datagrid("getSelections");r(t),e.gridModel.datagrid("clearChecked")}l()},this.addProductClose=function(){e.addProduct(),e.c8win&&(e.c8win.c8CloseWin(),l())}},vm.Control=vm.Control||{},vm.Control.MultiSelectProductBatchInventoryModel=function(t){function e(){return void 0==n||!!l.gridModel.datagrid("validateRow",n)&&(l.gridModel.datagrid("endEdit",n),n=void 0,!0)}function i(t){n!=t&&(e()?(l.gridModel.datagrid("selectRow",t).datagrid("beginEdit",t),n=t):l.gridModel.datagrid("selectRow",n))}var l=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,l.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=MultiSelectProductBatchInventory&433234",this.OperatorGroupRowId=null;var l=this;this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageInventoryBatchProductInfo",this.griddataParameter.countUrl="/BusinessControl/GetCountByPageQueryParameters",this.griddataParameter.toolbar=".tbMultiSelectProductBatchnventory";var n=void 0;this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"仓库名称",field:"WarehouseName",width:120,align:"left"},{title:"库位代码",field:"KWCode",width:100,align:"left"},{title:"数量",field:"Quantity",width:80,align:"right",editor:{type:"numberbox",options:{min:0,precision:0}},formatter:function(t,e){return e.Quantity=e.Quantity||1,e.Quantity}},{title:"锁定数",field:"LockedQuantity",width:80,align:"right"},{title:"库存数",field:"InventoryQuantity",width:80,align:"right"},{title:"商品代码",field:"ProductCode",width:120,align:"left"},{title:"商品名称",field:"ProductName",width:120,align:"left"},{title:"规格代码",field:"ProductSkuCode",width:120,align:"left"},{title:"规格名称",field:"ProductSkuName",width:120,align:"left"},{title:"生产日期",field:"ProductionDate",width:120,align:"left"},{title:"保质期",field:"SafeDate",width:120,align:"left"},{title:"有效期",field:"ValidDate",width:120,align:"left"},{title:"批次号",field:"BatchNo",width:120,align:"left"}]],singleSelect:!1,onClickRow:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){l.gridModel.pSearch(this.callBackParameter.data)},this.callBackParameter=null,this.setParameter=function(t){this.callBackParameter=t,r=t.callback,null!=t.singleSelect&&(l.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var r=null;this.addItem=function(){if(null!=r){e();var t=l.gridModel.datagrid("getSelections");r(t),l.gridModel.datagrid("clearChecked")}},this.addItemClose=function(){l.addItem(),l.c8win&&l.c8win.c8CloseWin()}},vm.Control=vm.Control||{},vm.Control.MultiSelectShopModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/MultiSelectShop",this.OperatorGroupRowId=null;var e=this;this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageMultiSelectShopByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountMultiSelectShopByPQP",this.griddataParameter.toolbar=".tbMultiSelectShop",this.griddataParameter.IsFormLayout=!1;var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbMultiSelectShopMenu")),e.gridModel.c8GetElementsBySelector("#tbMultiSelectShopMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbMultiSelectShopMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addShopClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"名称",field:"Name",width:120,align:"right"},{title:"代码",field:"Code",width:120,align:"right"}]],singleSelect:!1,onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch({ShopCategoryRowId:n})};var n=null;this.treeoption={url:"BusinessControl/GetComboTreeShopCategory",onClick:function(t){n=t.id,e.searchClick()}},this.setParameter=function(t){r=t.callback};var r=null;this.addShop=function(){if(null!=r){var t=e.gridModel.datagrid("getSelections");r(t)}l()},this.addShopClose=function(){e.addShop(),e.c8win&&(e.c8win.c8CloseWin(),l())}},vm.Control=vm.Control||{},vm.Control.MultiSelectPurchaseOrderModel=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=MultiSelectPurchaseOrder",this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageMultiSelectPurchaseOrderByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountMultiSelectPurchaseOrderByPQP",this.griddataParameter.toolbar=".tbMultiSelectPurchaseOrder",this.griddataParameter.IsFormLayout=!1;var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbMultiSelectPurchaseOrderMenu")),e.gridModel.c8GetElementsBySelector("#tbMultiSelectPurchaseOrderMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbMultiSelectPurchaseOrderMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addPurchaseOrderClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"单据编号",field:"Code",width:160,align:"right"},{title:"采购进货类型",field:"PurchaseInTypeName",width:80,align:"right"},{title:"供应商",field:"SupplierName",width:80,align:"right"},{title:"外部编号",field:"OutCode",width:80,align:"right"},{title:"业务员",field:"BusinessEmployeeName",width:80,align:"right"},{title:"仓库",field:"WarehouseName",width:80,align:"right"},{title:"计划到货日期",field:"PlanDeliveryDate",width:80,align:"right"},{title:"付款期限",field:"PayTermDate",width:80,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){n=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var n=null;this.addPurchaseOrder=function(){if(null!=n){var t=e.gridModel.datagrid("getSelections");n(t)}l()},this.addPurchaseOrderClose=function(){e.addPurchaseOrder(),e.c8win&&(e.c8win.c8CloseWin(),l())}},vm.Control=vm.Control||{},vm.Control.MultiSelectPurchaseReturnOrderModel=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=MultiSelectPurchaseReturnOrder",this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageMultiSelectPurchaseReturnOrderByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountMultiSelectPurchaseReturnOrderByPQP",this.griddataParameter.toolbar=".tbMultiSelectPurchaseReturnOrder",this.griddataParameter.IsFormLayout=!1;var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbMultiSelectPurchaseReturnOrderMenu")),e.gridModel.c8GetElementsBySelector("#tbMultiSelectPurchaseReturnOrderMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbMultiSelectPurchaseReturnOrderMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addPurchaseReturnOrderClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"单据编号",field:"Code",width:160,align:"right"},{title:"采购进货类型",field:"PurchaseInTypeName",width:80,align:"right"},{title:"供应商",field:"SupplierName",width:80,align:"right"},{title:"外部编号",field:"OutCode",width:80,align:"right"},{title:"业务员",field:"BusinessEmployeeName",width:80,align:"right"},{title:"仓库",field:"WarehouseName",width:80,align:"right"},{title:"计划到货日期",field:"PlanDeliveryDate",width:80,align:"right"},{title:"付款期限",field:"PayTermDate",width:80,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){n=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var n=null;this.addPurchaseReturnOrder=function(){if(null!=n){var t=e.gridModel.datagrid("getSelections");n(t)}l()},this.addPurchaseReturnOrderClose=function(){e.addPurchaseReturnOrder(),e.c8win&&(e.c8win.c8CloseWin(),l())}},vm.Control=vm.Control||{},vm.Control.MultiSelectWarehousePositionModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=MultiSelectWarehousePosition";var e=this;this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageWarehouserPositionByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountWarehouserPositionByPQP",this.griddataParameter.toolbar=".tbMultiSelectWarehousePosition",this.griddataParameter.IsFormLayout=!1;var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbMultiSelectWarehousePositionMenu")),e.gridModel.c8GetElementsBySelector("#tbMultiSelectWarehousePositionMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbMultiSelectWarehousePositionMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addWarehousePositionClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"库位代码",field:"Code",width:120,align:"left"},{title:"库位名称",field:"Name",width:120,align:"left"},{title:"仓库名称",field:"WarehouseRowId",width:120,align:"left"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch(this.callBackParameter.data)},this.callBackParameter=null,this.setParameter=function(t){this.callBackParameter=t,n=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var n=null;this.addWarehousePosition=function(){if(null!=n)if(void 0==this.callBackParameter.singleSelect||this.callBackParameter.singleSelect){var t=e.gridModel.datagrid("getSelected");n(t,this.callBackParameter)}else{var t=e.gridModel.datagrid("getSelections");n(t,this.callBackParameter)}l()},this.addWarehousePositionClose=function(){e.addWarehousePosition(),e.c8win&&(e.c8win.c8CloseWin(),l())}},vm.Control=vm.Control||{},vm.Control.MultiSelectWarehouseModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/MultiSelectWarehouse",this.OperatorGroupRowId=null;var e=this;this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageMultiSelectWarehouseByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountMultiSelectWarehouseByPQP",this.griddataParameter.toolbar=".tbMultiSelectWarehouse",this.griddataParameter.IsFormLayout=!1;var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbMultiSelectWarehouseMenu")),e.gridModel.c8GetElementsBySelector("#tbMultiSelectWarehouseMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbMultiSelectWarehouseMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addWarehouseClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"名称",field:"Name",width:120,align:"right"},{title:"代码",field:"Code",width:120,align:"right"}]],singleSelect:!1,onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){n=t.callback};var n=null;this.addWarehouse=function(){if(null!=n){var t=e.gridModel.datagrid("getSelections");n(t)}l()},this.addWarehouseClose=function(){e.addWarehouse(),e.c8win&&(e.c8win.c8CloseWin(),l())}},vm.Control=vm.Control||{},vm.Control.MultiSelectVopOutWarehouseModel=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=MultiSelectVopOutWarehouse",this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageMultiSelectVopOutWarehouseByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountMultiSelectVopOutWarehouseByPQP",this.griddataParameter.toolbar=".tbMultiSelectVopOutWarehouse",this.griddataParameter.IsFormLayout=!1;var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbMultiSelectVopOutWarehouseMenu")),e.gridModel.c8GetElementsBySelector("#tbMultiSelectVopOutWarehouseMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbMultiSelectVopOutWarehouseMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addVopOutWarehouseClose()},this.griddataParameter.dataoptions={columns:[[{field:"ck",checkbox:!0,sortable:!0},{title:"出库单号",field:"Code",width:150,align:"center"},{title:"审核",field:"IsAudit",width:40,align:"center",formatter:$.c8formatter.checkbox},{title:"仓库名称",field:"WarehouseName",width:80,align:"center"},{title:"通知数",field:"TotalNoticeQuantity",width:55,align:"center"},{title:"出库数",field:"TotalQuantity",width:55,align:"center"},{title:"唯品会仓库",field:"VopWarehouseName",width:80,align:"center"},{title:"出库时间",field:"WarehouseDeliveryTime",width:140,align:"center"},{title:"备注",field:"Remark",width:100,align:"center"}]],singleSelect:!1,idFiled:"Code",onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){n=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var n=null;this.addVopOutWarehouse=function(){if(null!=n){var t=e.gridModel.datagrid("getSelections");n(t)}l()},this.addVopOutWarehouseClose=function(){e.addVopOutWarehouse(),e.c8win&&(e.c8win.c8CloseWin(),l())}},$(function(){}),vm.Control=vm.Control||{},vm.Control.MultiSelectRegionModel=function(t){this.winUrl="/BusinessControl/MultiSelectRegion",this.OperatorGroupRowId=null;var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.f_DblClickRow=function(t,i){e.addRegionClose()},this.griddataParameter=t||{},this.griddataParameter.IsFormLayout=!1,this.griddataParameter.dataoptions={singleSelect:!1,iconCls:"icon-ok",rownumbers:!0,animate:!0,collapsible:!0,fitColumns:!0,url:"/Region/GetGridTreeObjectList",method:"get",idField:"RowId",treeField:"Name",columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"名称",field:"Name",width:80},{title:"代码",field:"Code",width:80}]]},this.gridModel=new c8TreeGrid(this.griddataParameter),this.searchClick=function(){},this.setParameter=function(t){i=t.callback};var i=null;this.addRegion=function(){if(null!=i){var t=e.gridModel.datagrid("getSelections");i(t)}},this.addRegionClose=function(){e.addRegion(),e.c8win&&e.c8win.c8CloseWin()}},vm.Control=vm.Control||{},vm.Control.MultiSelectOrderTypeModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/MultiSelectOrderType",this.OperatorGroupRowId=null;var e=this;this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageMultiSelectOrderTypeByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountMultiSelectOrderTypeByPQP",this.griddataParameter.toolbar=".tbMultiSelectOrderType",this.griddataParameter.IsFormLayout=!1;var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbMultiSelectOrderTypeMenu")),e.gridModel.c8GetElementsBySelector("#tbMultiSelectOrderTypeMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbMultiSelectOrderTypeMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addOrderTypeClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"名称",field:"Name",width:120,align:"right"}]],singleSelect:!1,onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){n=t.callback};var n=null;this.addOrderType=function(){if(null!=n){var t=e.gridModel.datagrid("getSelections");n(t)}l()},this.addOrderTypeClose=function(){e.addOrderType(),e.c8win&&(e.c8win.c8CloseWin(),l())}},vm.Control=vm.Control||{},vm.Control.SelectWarehousePositionModel=function(t){var e=this;this.winUrl="/BusinessControl/SelectWarehouserPosition",this.OperatorGroupRowId=null,this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageWarehouserPositionByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountWarehouserPositionByPQP",this.griddataParameter.toolbar=".tbSelectWarehousePosition",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addProductClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"库位代码",field:"Code",width:80,align:"right"},{title:"库位名称",field:"Name",width:80,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch({WarehouseRowId:i})};var i=null;this.treeoption={url:"BusinessControl/GetComboWarehouse",onClick:function(t){i=t.id,e.searchClick()}},this.setParameter=function(t){l=t.callback};var l=null;this.addProduct=function(){if(null!=l){var t=e.gridModel.datagrid("getSelected");l(t)}},this.addProductClose=function(){e.addProduct(),e.c8win&&e.c8win.c8CloseWin()}},vm.Control=vm.Control||{},vm.Control.SelectActiveLockModel=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=SelectActiveLock",this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageSelectActiveLockByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountSelectActiveLockByPQP",this.griddataParameter.toolbar=".tbSelectActiveLock",this.griddataParameter.IsFormLayout=!1;var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbSelectActiveLockMenu")),e.gridModel.c8GetElementsBySelector("#tbSelectActiveLockMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbSelectActiveLockMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addPurchaseOrderClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"编号",field:"Code",width:160,align:"right"},{title:"名称",field:"Name",width:160,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){n=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var n=null;this.addPurchaseOrder=function(){if(null!=n){var t=e.gridModel.datagrid("getSelections");n(t)}l()},this.addPurchaseOrderClose=function(){e.addPurchaseOrder(),e.c8win&&(e.c8win.c8CloseWin(),l())}},vm.Control=vm.Control||{},vm.Control.SelectUnApprovedSellOrder=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=MultiSelectUnArrivalSellOrder",this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageUnApprovedSellOrder",this.griddataParameter.countUrl="/BusinessControl/GetCountUnApprovedSellOrder",this.griddataParameter.toolbar=".tbSelectUnArrivalSellOrder",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.UnApprovedSellOrderClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"订单编号",
field:"Code",width:100,align:"right"},{title:"平台单号",field:"Tid",width:100,align:"right"},{title:"店铺名称",field:"ShopName",width:100,align:"right"},{title:"平台名称",field:"PlatTypeRowId",width:100,align:"right"},{title:"未核销金额",field:"UnApprovedAmount",width:80,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var i=null;this.addUnApprovedSellOrder=function(){if(null!=i){var t=e.gridModel.datagrid("getSelections");i(t)}},this.UnApprovedSellOrderClose=function(){e.addUnApprovedSellOrder(),e.c8win&&e.c8win.c8CloseWin()}},vm.Control=vm.Control||{},vm.Control.SelectAccountModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectAccountModel",this.OperatorGroupRowId=null,this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageAccountByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountAccountByPQP",this.griddataParameter.toolbar=".tbSelectAccount",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addProductClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"费用科目名称",field:"AccountName",width:120,align:"right"},{title:"费用科目编码",field:"AccountCode",width:120,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback};var i=null;this.addProduct=function(){if(null!=i){var t=e.gridModel.datagrid("getSelected");i(t)}},this.addProductClose=function(){e.addProduct(),e.c8win&&e.c8win.c8CloseWin()}},vm.Control=vm.Control||{},vm.Control.SelectVipModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectVipModel",this.OperatorGroupRowId=null,this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageVipByPQP",this.griddataParameter.countUrl="/BusinessControl/GetCountVipByPQP",this.griddataParameter.toolbar=".tbSelectVip",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addVipClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"会员代码",field:"Code",width:100,align:"right"},{title:"会员名称",field:"Name",width:100,align:"right"},{title:"手机",field:"Mobile",width:100,align:"right"},{title:"平台名称",field:"PlatTypeName",width:100,align:"right"},{title:"店铺",field:"ShopName",width:100,align:"right"},{title:"会员级别",field:"LevelName",width:100,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback};var i=null;this.addProduct=function(){if(null!=i){var t=e.gridModel.datagrid("getSelected");if(null==t)return void $.customerAlert("请选择会员!");i(t),e.c8win&&e.c8win.c8CloseWin()}},this.addVipClose=function(){e.addProduct()}},vm.Control=vm.Control||{},vm.Control.SelectExpress=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectExpress",this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/getExpressList",this.griddataParameter.countUrl="/BusinessControl/getExpressCount",this.griddataParameter.toolbar=".tbSelectExpress",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addDataExpressClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"快递名称",field:"Name",width:120,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter);var i=null;this.OpenWin=function(){i=new c8.c8Window({url:e.winUrl,isShowParent:!0}),i.c8BindingWin(e),i.openWin()},this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){l=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var l=null;this.addDataExpress=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=l&&l(t)},this.addDataExpressClose=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&(null!=l?l(t):e.ParentModel.modifyExpressSingle(e.ParentRow.RowId,t[0].RowId,t[0].Name,e.ParentRow),e.c8win&&e.c8win.c8CloseWin())}},vm.Control=vm.Control||{},vm.Control.SelectReturnChangedOrder=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=SelectReturnChangedOrder",this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/PinBackStorage/getByMobileAndRowId",this.griddataParameter.toolbar=".tbSelectReturnChangedOrder",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addDataExpressClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"退换货单代码",field:"Code",width:200,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter);var i=null;this.OpenWin=function(t){i=new c8.c8Window({url:e.winUrl,isShowParent:!0}),i.c8BindingWin(e),e.gridModel.pSearch({Mobile:t}),i.openWin()},this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){l=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var l=null;this.addDataExpress=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=l&&l(t)},this.addDataExpressClose=function(){var t=e.gridModel.datagrid("getSelections");if(null==t||0==t.length)return void ko.c8showMessage("warn","请选择单据");null!=l?l(t):e.ParentModel.modifyExpressSingle(t[0]),e.c8win&&e.c8win.c8CloseWin()}};var SelectReturnChangedOrder=new vm.Control.SelectReturnChangedOrder;vm.Control=vm.Control||{},vm.Control.SelectWarehouse=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=SelectWarehouse",this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/getWarehouseList",this.griddataParameter.countUrl="/BusinessControl/getWarehouseCount",this.griddataParameter.toolbar=".tbSelectExpress",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.Close()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"仓库代码",field:"Code",width:120,align:"right"},{title:"仓库名称",field:"Name",width:120,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var i=null;this.addDataWarehouse=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=i&&i(t)},this.addDataWarehouseClose=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&(null!=i&&i(t),e.c8win&&e.c8win.c8CloseWin())}},vm.Control=vm.Control||{},vm.Control.SelectPositionModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectPosition",this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/getPositionList",this.griddataParameter.countUrl="/BusinessControl/getPositionCount",this.griddataParameter.toolbar=".tbSelectVip",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addDataExpressClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"库位代码",field:"Code",width:120,align:"right"},{title:"库位名称",field:"Name",width:120,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8GridPaginationModel(this.griddataParameter);var i=null,l=null;this.OpenWin=function(t){i=new c8.c8Window({url:e.winUrl,isShowParent:!0}),l=t,e.modelInfo={},e.modelInfo.WarehouseRowId=t,e.modelInfo.Code="",e.modelInfo.Name="",ko.c8SetFormQueryModel({model:e.modelInfo}),i.c8BindingWin(e),i.openWin()},this.searchClick=function(){""!=$("#Code").val()&&$("#Code").val(),""!=$("#Name").val()&&$("#Name").val();var t=i.c8GetFormModel();t.WarehouseRowId=l,e.gridModel.pSearch(t)},this.setParameter=function(t){n=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var n=null;this.addDataExpress=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=n&&n(t)},this.addDataExpressClose=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&(null!=n?n(t):e.ParentModel.modifyWarehousePosition(t[0],t[0].Name,e.ParentRow),e.c8win&&e.c8win.c8CloseWin())}},vm.Control=vm.Control||{},vm.Control.SelectFlag=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectFlag",this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/getFlagList",this.griddataParameter.countUrl="/BusinessControl/getFlagCount",this.griddataParameter.toolbar=".tbSelectExpress",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addDataFlagClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"旗帜代码",field:"Code",width:100,align:"right"},{title:"旗帜名称",field:"Name",width:100,align:"right"},{title:"淘宝旗帜",field:"RowId",width:100,align:"center",formatter:function(t,e,i){return 0==e.RowId?null:'<img src="/Content/images/taobaoflag/'+e.RowId+'.png" />'}}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var i=null;this.addDataFlag=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=i&&i(t)},this.addDataFlagClose=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&(null!=i&&i(t),e.c8win&&e.c8win.c8CloseWin())}},vm.Control=vm.Control||{},vm.Control.SelectEmployee=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectEmployee",this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/getPageEmployeeList",this.griddataParameter.countUrl="/BusinessControl/getPageEmployeeCount",this.griddataParameter.toolbar=".tbSelectExpress",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.Close()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"客服代码",field:"Code",width:120,align:"right"},{title:"客服名称",field:"Name",width:120,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var i=null;this.addDataEmployee=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=i&&i(t)},this.addDataEmployeeClose=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&(null!=i&&i(t),e.c8win&&e.c8win.c8CloseWin())}},vm.Control=vm.Control||{},vm.Control.SelectPayTypeModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectPayType",this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageSelectPayTypeByPQP",this.griddataParameter.toolbar=".tbSelectPayType",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addWarehouseClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"名称",field:"Name",width:120,align:"right"}]],singleSelect:!1,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback};var i=null;this.addWarehouse=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=i&&i(t)},this.addWarehouseClose=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&(null!=i&&i(t),e.c8win&&e.c8win.c8CloseWin())}},vm.Control=vm.Control||{},vm.Control.SellOrderModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SellOrder",this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/getSellOrderSelectPage",this.griddataParameter.countUrl="/BusinessControl/getSellOrderSelectCount",this.griddataParameter.toolbar=".tbSelectUnArrivalSellOrder",this.griddataParameter.dataoptions={remoteSort:!1,singleSelect:!0,checkOnSelect:!1,selectOnCheck:!1,columns:[[{title:"店铺",field:"EditShopName",width:100,align:"right",sortable:!0},{title:"平台单号",field:"Tid",width:130,align:"right",sortable:!0},{title:"付款时间",field:"PayTime",width:130,align:"right",sortable:!0},{title:"收货人",field:"Consignee",width:80,align:"right",sortable:!0},{title:"手机",field:"Mobile",width:110,align:"right",sortable:!0},{title:"会员名称",field:"VipName",width:80,align:"right",sortable:!0},{title:"货到付款",field:"IsCod",width:70,align:"right",sortable:!0,formatter:function(t,e,i){return"1"==e.IsCod?"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' checked='true' value='true'/>":"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' value='false'/>"}},{title:"支付金额",field:"PayAmount",width:70,align:"right",sortable:!0},{title:"运单号",field:"ExpressNumber",width:100,align:"right",sortable:!0},{title:"数量",field:"TotalQuantity",width:50,align:"right",sortable:!0},{title:"平台类型",field:"EditPlatTypeName",width:100,align:"right",sortable:!0},{title:"订单类型",field:"EditOrderTypeName",width:100,align:"right",sortable:!0},{title:"让利金额",field:"BenefitAmount",width:100,align:"right",sortable:!0},{title:"退款状态",field:"EditRefundStatusName",width:100,align:"right",sortable:!0},{title:"发货单号",field:"DeliveryOrderCode",width:150,align:"right",sortable:!0},{title:"订单单号",field:"Code",width:130,align:"right",sortable:!0},{title:"快递费用",field:"ExpressFee",width:80,align:"right",sortable:!0},{title:"电话",field:"Telephone",width:80,align:"right",sortable:!0},{title:"会员代码",field:"VipCode",width:80,align:"right",sortable:!0},{title:"拍单时间",field:"PlatCreated",width:130,align:"right",sortable:!0},{title:"地址",field:"Address",width:200,align:"right",sortable:!0}]],singleSelect:!0,onSelect:function(t,i){var l=$(e.gridModel.grid).datagrid("getSelected");l?e.inSkuDetailGridPaginationModel.pSearch({SellOrderRowId:l.RowId}):e.inSkuDetailGridPaginationModel.pLoadData([])}},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.save=function(){},this.SkuDetailGridDataParameter={},this.SkuDetailGridDataParameter.pageUrl="/BusinessControl/getReturnChangedSellOrderDetailList",this.SkuDetailGridDataParameter.form={},this.SkuDetailGridDataParameter.toolbar=".toolbarProductSku",this.SkuDetailGridDataParameter.dataoptions={remoteSort:!1,singleSelect:!0,checkOnSelect:!1,selectOnCheck:!1,columns:[[{field:"ck",checkbox:!0},{title:"终结",field:"IsStop",width:70,align:"right",sortable:!0,formatter:function(t,e,i){return"1"==e.IsStop?"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' checked='true' value='true'/>":"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' value='false'/>"}},{title:"平台退款",field:"IsRefund",width:70,align:"right",sortable:!0,formatter:function(t,e,i){return"1"==e.IsRefund?"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' checked='true' value='true'/>":"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' value='false'/>"}},{title:"发货状态",field:"EditStatusName",width:70,align:"right",sortable:!0},{title:"虚拟商品",field:"IsVirtual",width:70,align:"right",sortable:!0,formatter:function(t,e,i){return"1"==e.IsVirtual?"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' checked='true' value='true'/>":"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' value='false'/>"}},{title:"赠品",field:"IsGift",width:45,align:"right",sortable:!0,formatter:function(t,e,i){return"1"==e.IsGift?"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' checked='true' value='true'/>":"<input type='checkbox' onchange='this.checked=!this.checked;' readonly='readonly' value='false'/>"}},{title:"商品简称",field:"ProductShortName",width:100,align:"right",sortable:!0},{title:"商品名称",field:"ProductName",width:100,align:"right",sortable:!0},{title:"商品代码",field:"ProductCode",width:100,align:"right",sortable:!0},{title:"规格名称",field:"ProductSkuName",width:100,align:"right",sortable:!0},{title:"规格代码",field:"ProductSkuCode",width:100,align:"right",sortable:!0},{title:"数量",field:"Quantity",width:45,align:"right",sortable:!0},{title:"商品单位",field:"ProductUnitName",width:70,align:"right",sortable:!0},{title:"让利金额",field:"BenefitAmount",width:70,align:"right",sortable:!0},{title:"折扣",field:"Discount",width:45,align:"right",sortable:!0},{title:"标准售价",field:"StandardPrice",width:70,align:"right",sortable:!0},{title:"销售单价",field:"SalePrice",width:70,align:"right",sortable:!0},{title:"销售金额",field:"SaleAmount",width:70,align:"right",sortable:!0},{title:"实付单价",field:"PaymentPrice",width:70,align:"right",sortable:!0},{title:"实付金额",field:"Payment",width:70,align:"right",sortable:!0},{title:"物流费用",field:"ExpressFee",width:70,align:"right",sortable:!0},{title:"发货单号",field:"DeliveryOrderCode",width:140,align:"right",sortable:!0},{title:"发货仓库",field:"EditWarehouseName",width:100,align:"right",sortable:!0},{title:"物流公司",field:"EditExpressName",width:100,align:"right",sortable:!0},{title:"运单号",field:"ExpressNumber",width:100,align:"right",sortable:!0},{title:"成本价",field:"CostPrice",width:100,align:"right",sortable:!0}]]},this.inSkuDetailGridPaginationModel=new c8Grid(this.SkuDetailGridDataParameter),this.setParameter=function(t){i=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var i=null;this.SellOrder=function(){if(null!=i){var t={},l=$(this.gridModel.grid).datagrid("getSelected");if(!l)return void $.messager.alert("提示","请选择主表");var n=$(e.inSkuDetailGridPaginationModel.grid).datagrid("getChecked");t.Order=l,t.SkuDetailList=n,i(t)}},this.SelectSellOrder=function(){if(!$(this.gridModel.grid).datagrid("getSelected"))return void ko.c8showMessage("error","请选择主表");var t=$(e.inSkuDetailGridPaginationModel.grid).datagrid("getChecked");if(!t||0==t.length)return void ko.c8showMessage("error","请选择明细");e.SellOrder(),e.c8win&&e.c8win.c8CloseWin()},this.Close=function(){e.c8win&&e.c8win.c8CloseWin()}},vm.Control=vm.Control||{},vm.Control.SelectCostTypeModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectCostTypeModel",this.OperatorGroupRowId=null,this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/getCostTypeList",this.griddataParameter.countUrl="/BusinessControl/GetCountCostType",this.griddataParameter.toolbar=".tbSelectCostType",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addProductClose()},this.griddataParameter.dataoptions={singleSelect:!0,columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"名称",field:"Name",width:120,align:"right"}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback};var i=null;this.addProduct=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=i&&i(t)},this.addProductClose=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&(null!=i&&i(t),e.c8win&&e.c8win.c8CloseWin())}},vm.Control=vm.Control||{},vm.Control.SelectProductSkuModel=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=SelectProductSku",this.OperatorGroupRowId=null,this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageSelectProductSkuByPQP",this.griddataParameter.toolbar=".tbSelectProductSku",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addProductClose()},this.griddataParameter.dataoptions={remoteSort:!1,columns:[[{title:"选择",field:"ck",checkbox:!0,sortable:!0},{title:"规格代码",field:"Code",width:120,align:"left",sortable:!0},{title:"规格名称",field:"Name",width:300,align:"left",sortable:!0}]],singleSelect:!0,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch({ProductRowId:e.ProductRowId})},this.ProductRowId=null,this.setParameter=function(t){i=t.callback};var i=null;this.addProduct=function(){if(null!=i){var t=e.gridModel.datagrid("getSelections");i(t),e.gridModel.datagrid("clearChecked")}},this.addProductClose=function(){e.addProduct(),e.c8win&&e.c8win.c8CloseWin()}},vm.Control=vm.Control||{},vm.Control.SelectVopPick=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=SelectVopPick",this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetVopPickList",this.griddataParameter.countUrl="/BusinessControl/GetVopPickCount",this.griddataParameter.toolbar=".tbSelectVopPick",this.griddataParameter.IsFormLayout=!1;var i=function(t,i,l){t.preventDefault(),e.gridModel.datagrid("selectRow",i),e.gridModel.getWindowContext().ko.c8BindingViewModel(e,e.gridModel.c8GetElementsBySelector("#tbMultiSelectVopPickMenu")),e.gridModel.c8GetElementsBySelector("#tbSelectVopPickMenu").menu("show",{left:t.pageX,top:t.pageY})},l=function(){e.gridModel.c8GetElementsBySelector("#tbSelectVopPickMenu").menu("hide")};this.f_DblClickRow=function(t,i){e.addVopPickClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"拣货单号",field:"PickNo",width:80,align:"right"},{title:"PO单号",field:"PoNo",width:160,align:"right"},{title:"RowId",field:"RowId",width:80,align:"right",hidden:"true"},{title:"供应商名称",field:"VopVendorName",width:80,align:"right"},{title:"唯品会仓库",field:"SellSite",width:80,align:"right"},{title:"平台数量",field:"Stock",width:80,align:"right"},{title:"通知数",field:"NoticeQuantity",width:80,align:"right"},{title:"出库数",field:"OutQuantity",width:80,align:"right"}]],singleSelect:!1,onDblClickRow:this.f_DblClickRow,onRowContextMenu:i},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){n=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var n=null;this.addVopPick=function(){if(null==n)return!1;var t=e.gridModel.datagrid("getSelections");if(t.length<=0)return!0;for(var i=t[0].PoNo,r=t[0].SellSite,o=0;o<t.length;o++)if(i!=t[o].PoNo||r!=t[o].SellSite)return!1;return n(t),l(),!0},this.addVopPickClose=function(){if(!e.addVopPick())return void $.customerAlert("请选择同一个唯品会仓库及PO单号下的拣货单!");e.c8win&&(e.c8win.c8CloseWin(),l())}},vm.Control=vm.Control||{},vm.Control.SelectSeparateBoxWaveModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectSeparateBoxWave",this.baseModel=null;var i=null;this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageSelectSeparateBoxWaveByPQP",this.griddataParameter.toolbar=".tbSelectSeparateBoxWave",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addSeparateBoxWaveClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"波次号",field:"WaveCode",width:150,align:"right"},{title:"数量",field:"TotalBillQuantity",width:120,align:"right"},{title:"扫描数量",field:"TotalBoxQuantity",width:190,align:"center"}]],singleSelect:!1,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter),this.searchClick=function(){null==i?(e.gridModel.pSearch(),e.gridModel.datagrid("hideColumn","TotalBoxQuantity")):e.gridModel.pSearch(i())},this.setParameter=function(t){l=t.callback,i=t.getData};var l=null;this.addSeparateBoxWave=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=l&&l(t)},this.addSeparateBoxWaveClose=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&(null!=l&&l(t),e.c8win&&e.c8win.c8CloseWin())}},vm.Control=vm.Control||{},vm.Control.MultiSelectProvinceModel=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/MultiSelectProvince",this.OperatorGroupRowId=null;var e=this;this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetMultiSelectProvince",this.griddataParameter.toolbar=".tbMultiSelectProvince",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addProvinceClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"名称",field:"Name",width:120,align:"right"}]],singleSelect:!1},this.gridModel=new c8Grid(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback};var i=null;this.addProvince=function(){if(null!=i){var t=e.gridModel.datagrid("getSelections");i(t)}},this.addProvinceClose=function(){e.addProvince(),e.c8win&&e.c8win.c8CloseWin()}},vm.Control=vm.Control||{},vm.Control.SelectPostPrintOrderWaveModel=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=SelectPostPrintOrderWave",this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageSelectPostPrintOrderWaveByPQP",this.griddataParameter.toolbar=".tbSelectPostPrintOrderWave",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addPostPrintOrderWaveClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"波次号",field:"WaveCode",width:150,align:"right"},{title:"单据数量",field:"TotalBillQuantity",width:90,align:"center"},{title:"未打印数量",field:"noPrintCount",width:90,align:"center"},{title:"后置打单锁定人",field:"lockUserName",width:150,align:"center"}]],singleSelect:!1,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback};var i=null;this.addPostPrintOrderWave=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=i&&i(t)},this.addPostPrintOrderWaveClose=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&(null!=i&&i(t),e.c8win&&e.c8win.c8CloseWin())}},vm.Control=vm.Control||{},vm.Control.SelectPostPrintOrder2WaveModel=function(t){var e=this;this.winUrl="/BusinessControl/getControlView?ControlName=SelectPostPrintOrder2Wave",this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/GetPageSelectPostPrintOrder2WaveByPQP",this.griddataParameter.toolbar=".tbSelectPostPrintOrder2Wave",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addPostPrintOrderWaveClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"波次号",field:"WaveCode",width:150,align:"right"},{title:"一单一货",field:"IsLonely",width:90,align:"center",formatter:function(t,e,i){return 1==t?"是":"否"}},{title:"仓库",field:"WarehouseName",width:100,sortable:!0,align:"right"},{title:"快递公司",field:"ExpressName",width:120,sortable:!0,align:"right"},{title:"单据数量",field:"TotalBillQuantity",width:80,align:"center"},{title:"作废数量",field:"CancelBillQuantity",width:80,align:"center"},{title:"未打印数量",field:"noPrintCount",width:80,align:"center"},{title:"后置打单锁定人",field:"lockUserName",width:120,align:"center"}]],singleSelect:!1,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8Grid(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback};var i=null;this.addPostPrintOrderWave=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=i&&i(t)},this.addPostPrintOrderWaveClose=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&(null!=i&&i(t),e.c8win&&e.c8win.c8CloseWin())}},vm.Control=vm.Control||{},vm.Control.SelectExpectDeliveryDate=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectExpectDeliveryDate",this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.toolbar=".tbSelectExpectDeliveryDate",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addDataFlagClose()},this.gridModel=new c8Grid(this.griddataParameter),this.setParameter=function(t){i=t.callback,null!=t.singleSelect&&(e.griddataParameter.dataoptions.singleSelect=t.singleSelect)};var i=null;this.addExpectDeliveryDateClose=function(){var t=$("#dd").parent().find("span > input:last").val();null!=t&&""!=t&&(null!=i&&i(t),e.c8win&&e.c8win.c8CloseWin())}},vm.PostPrintOrder2=vm.PostPrintOrder2||{},vm.PostPrintOrder2.PickProductsPrint=function(t){this.parentModel=null;var e=this,i=null,l=null,n="",r="",o="",a=null;this.WaveRowId=null,this.excete=function(t,d){if(l=d,n="",r="",o="",null==(i=e.getDefaultPrintTemplate())||""==i)return void ko.c8showMessage("warn","未设置打印模板");l.PRINT_INITA(i.Top,i.LLeft,886,480,"千胜后置打单拣货单打印"),l.SET_PRINT_PAGESIZE(1,i.Width,i.Height,""),a=i.PrintName,l.SET_PRINTER_INDEX(a);var c=t;c.OrderInfo={},c.OrderInfo.WaveCode=c[0].WaveCode,c.OrderInfo.ShopRowID=c[0].ShopRowId,e.setcainiaoprint(c),"0"==a||void 0!=a&&null!=a&&""!=a||(a=l.SELECT_PRINTER()),l.SET_LICENSES("","61A8E196CFE2FC08C91049FE374A647031","",""),l.PRINT()?ko.c8showMessage("打印完成"):ko.c8showMessage("打印错误")},this.setcainiaoprint=function(t){l.ADD_PRINT_DATA("ProgramData",i.ParamStr);var a=JSON.parse(i.ParamJson);for(var d in a)if(1==a[d]){if("TotalProductCount"==d)continue
;"WaveCode"==d?l.SET_PRINT_STYLEA(d,"CONTENT",t.OrderInfo[d]):l.SET_PRINT_CONTENT(d,t.OrderInfo[d])}var c="";if(""==r){var s=l.GET_VALUE("ItemContent","productinfo"),h=s.indexOf("<thead>");h+=7,n=s.substr(0,h);var u=s.indexOf("</thead>");o=s.substr(u+8),r=s.substr(h,u-h)}c=c+n+r+"</thead>";var g=JSON.parse(a.productinfo),w=t;$.each(w,function(t,i){var l=$.c8help.c8CloneObject(r);for(var n in g)1==g[n]&&(l="No"==n?l.replace("序号",t+1):l.replace(e.transferToCn(n),null==i[n]?"":i[n]));c+="<tbody>"+l+"</tbody>"}),c+=o,l.SET_PRINT_CONTENT("productinfo",c)},this.transferToCn=function(t){var e="";return"ProductCode"==t?e="商品代码":"ProductName"==t?e="商品名称":"ProductSkuCode"==t?e="规格代码":"ProductSkuName"==t?e="规格名称":"KwCode"==t?e="库位名称":"WarehouseName"==t?e="仓库名称":"RemainQuantity"==t?e="数量":"WaveCode"==t?e="波次条码":"ShopRowID"==t&&(e="店铺"),e},this.getDefaultPrintTemplate=function(){var t=null;return ko.c8Ajax({type:"GET",url:"/PrintTemplateCaiNiao/getPostPrintOrder2FenJian",async:!1,datatype:"json",contentType:"application/json",success:function(e){t=e},error:function(t){alert(t.responseText)},beforeSend:function(){},complete:function(){}}),t}},vm.Control=vm.Control||{},vm.Control.ShowPostPrintOrder2RemainProducts=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){e.c8winId=t,e.gridModel3.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=ShowPostPrintOrder2RemainProducts",this.baseModel=null,this.griddataParameter3=t||{},this.griddataParameter3.pageUrl="/PostPrintOrder2/GetPostPrintOrder2AllNoScanProducts",this.griddataParameter3.toolbar=".tbSelectPostPrintOrder2AllNoScanProducts",this.griddataParameter3.IsFormLayout=!1,this.griddataParameter3.dataoptions={remoteSort:!1,columns:[[{title:"商品名称",field:"ProductName",width:130,align:"center",sortable:!0},{title:"商品代码",field:"ProductCode",width:130,align:"center",sortable:!0},{title:"商品规格名称",field:"ProductSkuName",width:130,align:"center",sortable:!0},{title:"商品规格代码",field:"ProductSkuCode",width:130,align:"center",sortable:!0},{title:"仓库名称",field:"WarehouseName",width:120,align:"center",sortable:!0},{title:"库位名称",field:"KwCode",width:120,align:"center",sortable:!0},{title:"数量",field:"RemainQuantity",width:80,align:"center",sortable:!0}]],onDblClickRow:function(t,i){e.addProductClose()}},this.gridModel3=new c8Grid(this.griddataParameter3),this.searchClick=function(){e.gridModel3.pSearch()};var i,l=new vm.PostPrintOrder2.PickProductsPrint;this.remainAllNoScanProductsPrint=function(){void 0==i&&(i=getCaiNiaoPrint(null,null)),l.parentModel=e,l.excete(e.gridModel3.datagrid("getRows"),i)};var n=null,r=null;this.setParameter=function(t){n=t.callback,r=t.getData},this.addProductClose=function(){e.addProduct(),e.c8win&&e.c8win.c8CloseWin()},this.addProduct=function(){if(null!=n){var t=e.gridModel3.datagrid("getSelections");n(t),e.gridModel3.datagrid("clearChecked")}},this.remainAllNoScanProductsExport=function(){var t=e.gridModel3.datagrid("getRows");if(null==t||t.length<=0)return void ko.c8showMessage("warn","请选择单据");var i={};i.Parameters=ko.toJSON(t),$.ajaxFileDownload({url:"/PostPrintOrder2/remainAllNoScanProductsExport",data:i,method:"POST"})}},vm.Control=vm.Control||{},vm.Control.SelectInvoiceOrder=function(t){var e=this;this.c8winId=null,this.setWinId=function(t){this.c8winId=t,e.gridModel.c8winId=this.c8winId},this.winUrl="/BusinessControl/getControlView?ControlName=SelectInvoiceOrder",this.baseModel=null,this.griddataParameter=t||{},this.griddataParameter.pageUrl="/BusinessControl/SelectInvoiceOrderByPQP",this.griddataParameter.countUrl="/BusinessControl/SelectInvoiceOrderCountByPQP",this.griddataParameter.toolbar=".tbSelectPayType",this.griddataParameter.IsFormLayout=!1,this.f_DblClickRow=function(t,i){e.addWarehouseClose()},this.griddataParameter.dataoptions={columns:[[{title:"选择",field:"ck",checkbox:!0},{title:"采购发票号码",field:"SupplierInvoiceCode",width:120,align:"right"},{title:"发票代码",field:"SupplierInvoiceCode",width:120,align:"right"},{title:"发票号码",field:"InvoiceNumber",width:120,align:"right"},{title:"发票金额",field:"Amount",width:120,align:"right"}]],singleSelect:!1,onDblClickRow:this.f_DblClickRow},this.gridModel=new c8GridPaginationModel(this.griddataParameter),this.searchClick=function(){e.gridModel.pSearch()},this.setParameter=function(t){i=t.callback};var i=null;this.addWarehouse=function(){var t=e.gridModel.datagrid("getSelections");null!=t&&0!=t.length&&null!=i&&i(t)},this.addWarehouseClose=function(){e.addWarehouse(),e.c8win&&e.c8win.c8CloseWin()}},function(t){t.fn.c8MultiSelectProduct=function(e,i){t(this).unbind("click");var l=new vm.Control.MultiSelectProductModel;e.windowId=e.windowId||i.c8WindowId;var n=new c8.c8Window({url:l.winUrl,windowId:e.windowId,isShowParent:!0,model:l});e||alert("c8MultiSelectProduct参数不存在"),l.setParameter(e),l.setWinId(n.c8GetWinId()),t(this).click(function(){n.c8OpenWin(),ko.c8BindEnter(t(".SearchConditions input"),function(){l.searchClick()})})},t.fn.c8MultiSelectProductBatchInventory=function(e,i){t(this).unbind("click");var l=new vm.Control.MultiSelectProductBatchInventoryModel;e.windowId=e.windowId||i.c8WindowId;var n=new c8.c8Window({url:l.winUrl,windowId:e.windowId,isShowParent:!0,model:l});e||alert("c8MultiSelectProductBatchInventory参数不存在"),l.setParameter(e),l.setWinId(n.c8GetWinId()),t(this).click(function(){n.c8OpenWin()})},t.fn.c8MultiSelectProductBatch=function(e,i){t(this).unbind("click");var l=new vm.Control.MultiSelectProductBatchModel;e.windowId=e.windowId||i.c8WindowId;var n=new c8.c8Window({url:l.winUrl,windowId:e.windowId,isShowParent:!0,model:l});e||alert("c8MultiSelectProductBatch参数不存在"),l.setParameter(e),l.setWinId(n.c8GetWinId()),t(this).click(function(){n.c8OpenWin()})},t.fn.c8MultiSelectShop=function(e){t(this).unbind("click");var i=new vm.Control.MultiSelectShopModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin()})},t.fn.c8MultiSelectExpress=function(e){t(this).unbind("click");var i=new vm.Control.MultiSelectExpressModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin()})},t.fn.c8MultiSelectWarehousePositionText=function(e,i){var l=new vm.Control.MultiSelectWarehousePositionModel;l.setParameter(e),l.searchClick(),e.windowId=e.windowId||i.c8WindowId;var n=new c8.c8Window({url:l.winUrl,windowId:e.windowId,isShowParent:!0,model:l});l.setWinId(n.c8GetWinId());var r={prompt:"请输入采购订单",iconWidth:18,icons:[{iconCls:"icon-line_edit",handler:function(t){n.c8OpenWin()}}]};t(this).textbox(r)},t.fn.c8SelectPurchaseOrderText=function(e,i){var l=new vm.Control.MultiSelectPurchaseOrderModel;l.setParameter(e),e.windowId=e.windowId||i.c8WindowId;var n=new c8.c8Window({url:l.winUrl,windowId:e.windowId,isShowParent:!0,model:l});l.setWinId(n.c8GetWinId());var r={prompt:"请输入采购订单",iconWidth:18,icons:[{iconCls:"icon-line_edit",handler:function(t){n.c8OpenWin()}}]};t(this).textbox(r)},t.fn.c8SelectSupplierText=function(e,i){var l=new vm.Control.SelectSupplierTextModel;l.setParameter(e),e.windowId=e.windowId||i.c8WindowId;var n=new c8.c8Window({url:l.winUrl,windowId:e.windowId,isShowParent:!0,model:l}),r={prompt:"请输入供应商名称",iconWidth:18,icons:[{iconCls:"icon-line_edit",handler:function(t){n.c8OpenWin()}}]};l.setWinId(n.c8GetWinId()),t(this).textbox(r)},t.fn.c8SelectVopoutWarehouseText=function(e,i){var l=new vm.Control.MultiSelectVopOutWarehouseModel;l.setParameter(e),e.windowId=e.windowId||i.c8WindowId;var n=new c8.c8Window({url:l.winUrl,windowId:e.windowId,isShowParent:!0,model:l});l.setWinId(n.c8GetWinId());var r={prompt:"请输入出库单",iconWidth:18,icons:[{iconCls:"icon-line_edit",handler:function(t){n.c8OpenWin()}}]};t(this).textbox(r)},t.fn.c8SelectVopPickText=function(e,i){var l=new vm.Control.SelectVopPick;l.setParameter(e),e.windowId=e.windowId||i.c8WindowId;var n=new c8.c8Window({url:l.winUrl,windowId:e.windowId,isShowParent:!0,model:l});l.setWinId(n.c8GetWinId());var r={prompt:"请选择拣货单",iconWidth:18,icons:[{iconCls:"icon-line_edit",handler:function(t){n.c8OpenWin()}}]};t(this).textbox(r)},t.fn.c8MultiSelectOrderType=function(e){t(this).unbind("click");var i=new vm.Control.MultiSelectOrderTypeModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin()})},t.fn.c8SelectPurchaseReturnOrderText=function(e){var i=new vm.Control.MultiSelectPurchaseReturnOrderModel;i.setParameter(e);var l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setWinId(l.c8GetWinId());var n={prompt:"请输入采购退货订单",iconWidth:18,icons:[{iconCls:"icon-line_edit",handler:function(t){l.c8OpenWin()}}]};t(this).textbox(n)},t.fn.c8MultiSelectEnumInfo=function(e){t(this).unbind("click");var i=new vm.Control.MultiSelectOrderTypeModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin()})},t.fn.c8MultiSelectWarehouse=function(e){t(this).unbind("click");var i=new vm.Control.MultiSelectWarehouseModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin()})},t.fn.c8MultiSelectRegion=function(e){t(this).unbind("click");var i=new vm.Control.MultiSelectRegionModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin()})},t.fn.c8SelectWarehousPosition=function(e){t(this).unbind("click");var i=new vm.Control.SelectWarehousePositionModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin()})},t.fn.c8SelectActiveLock=function(e){t(this).unbind("click");var i=new vm.Control.SelectActiveLockModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin()})},t.fn.SelectUnApprovedSellOrderClick=function(e){t(this).unbind("click");var i=new vm.Control.SelectUnApprovedSellOrder,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin()})},t.fn.SellOrderClick=function(e){var i=new vm.Control.SellOrderModel;i.setParameter(e);var l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setWinId(l.c8GetWinId());var n={prompt:"请选择订单",iconWidth:18,icons:[{iconCls:"icon-line_edit",handler:function(e){l.c8OpenWin(),l.c8GetElementListBySelector(".easyui-textbox").each(function(e,l){t(l).textbox("textbox").keydown(function(t){13==t.keyCode&&i.searchClick()})})}}]};t(this).textbox(n)},t.fn.SelectExpressClick=function(e){t(this).unbind("click");var i=new vm.Control.SelectExpress,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.searchClick()})},t.fn.SelectSupplierClick=function(e){t(this).unbind("click");var i=new vm.Control.Supplier,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.searchClick()})},t.fn.SelectWarehouseClick=function(e){t(this).unbind("click");var i=new vm.Control.SelectWarehouse,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.searchClick()})},t.fn.SelectFlagClick=function(e){t(this).unbind("click");var i=new vm.Control.SelectFlag,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.searchClick()})},t.fn.SelectExpectDeliveryDate=function(e){t(this).unbind("click");var i=new vm.Control.SelectExpectDeliveryDate,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin()})},t.fn.SelectEmployeeClick=function(e){t(this).unbind("click");var i=new vm.Control.SelectEmployee,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.searchClick()})},t.fn.SelectAccountModelClick=function(e){t(this).unbind("click");var i=new vm.Control.SelectUnApprovedSellOrder,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.searchClick()})},t.fn.c8SelectPayTypeModelClick=function(e){t(this).unbind("click");var i=new vm.Control.SelectPayTypeModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.searchClick()})},t.fn.c8SelectVipText=function(e){var i=new vm.Control.SelectVipModel;i.setParameter(e);var l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setWinId(l.c8GetWinId());var n={prompt:"请选择会员",iconWidth:18,icons:[{iconCls:"icon-line_edit",handler:function(e){l.c8OpenWin(),ko.c8BindEnter(t(".SearchConditions input"),function(){i.searchClick()})}}]};t(this).textbox(n)},t.fn.c8SelectDistributorText=function(e){var i=new vm.Control.SelectDistributorModel;i.setParameter(e);var l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setWinId(l.c8GetWinId());var n={prompt:"请选择分销商",iconWidth:18,icons:[{iconCls:"icon-line_edit",handler:function(t){l.c8OpenWin(),i.setFormValidate()}}]};t(this).textbox(n)},t.fn.GridLayoutClick=function(e){t(this).unbind("click");var i=new vm.Control.GridLayout,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.InitData(l.c8GetWinId())})},t.fn.c8SelectSeparateBoxWaveModelClick=function(e){t(this).unbind("click");var i=new vm.Control.SelectSeparateBoxWaveModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.searchClick()})},t.fn.c8MultiSelectProvince=function(e){t(this).unbind("click");var i=new vm.Control.MultiSelectProvinceModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.searchClick()})},t.fn.c8SelectPostPrintOrderWaveModelClick=function(e){t(this).unbind("click");var i=new vm.Control.SelectPostPrintOrderWaveModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.searchClick()})},t.fn.c8SelectPostPrintOrder2WaveModelClick=function(e){t(this).unbind("click");var i=new vm.Control.SelectPostPrintOrder2WaveModel,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),t(".default-checkbox").threeStateCheckbox(),ko.c8BindEnter(t(".SearchConditions input"),function(){i.searchClick()}),i.searchClick()})},t.fn.c8ShowPostPrintOrder2RemainProductsClick=function(e){t(this).unbind("click");var i=new vm.Control.ShowPostPrintOrder2RemainProducts,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin(),i.searchClick()})},t.fn.c8SelectInvoiceOrderClick=function(e){t(this).unbind("click");var i=new vm.Control.SelectInvoiceOrder,l=new c8.c8Window({url:i.winUrl,isShowParent:!0,model:i});i.setParameter(e),i.setWinId(l.c8GetWinId()),t(this).click(function(){l.c8OpenWin()})}}(jQuery);var CreatedOKCNPrint7766=null;
//# sourceMappingURL=control.js.map | 19,891.5 | 31,988 | 0.786228 |
3c82a08839ee50b014e95e3a5bd6b835a35d1aad | 3,087 | rs | Rust | ssz-rs/examples/another_container.rs | Snowfork/ssz_rs | 8d497a949c320577aa1f741eb9f2958191df905b | [
"MIT"
] | null | null | null | ssz-rs/examples/another_container.rs | Snowfork/ssz_rs | 8d497a949c320577aa1f741eb9f2958191df905b | [
"MIT"
] | 1 | 2022-03-17T07:44:32.000Z | 2022-03-17T07:44:32.000Z | ssz-rs/examples/another_container.rs | Snowfork/ssz_rs | 8d497a949c320577aa1f741eb9f2958191df905b | [
"MIT"
] | null | null | null | use hex;
use ssz_rs::prelude::*;
use ssz_rs::std::{FromIterator, vec};
#[derive(PartialEq, Eq, Debug, Default, SimpleSerialize)]
struct SingleFieldTestStruct {
a: u8,
}
#[derive(PartialEq, Eq, Debug, Default, SimpleSerialize)]
struct SmallTestStruct {
a: u16,
b: u16,
}
#[derive(PartialEq, Eq, Debug, Default, Clone, SimpleSerialize)]
struct FixedTestStruct {
a: u8,
b: u64,
c: u32,
}
#[derive(PartialEq, Eq, Debug, Default, Clone, SimpleSerialize)]
struct VarTestStruct {
a: u16,
b: List<u16, 1024>,
c: u8,
}
#[derive(PartialEq, Eq, Debug, Default, SimpleSerialize)]
struct ComplexTestStruct {
a: u16,
b: List<u16, 128>,
c: u8,
d: List<u8, 256>,
e: VarTestStruct,
f: Vector<FixedTestStruct, 4>,
g: Vector<VarTestStruct, 2>,
}
fn main() {
let mut value = ComplexTestStruct {
a: 51972,
b: List::<u16, 128>::from_iter([48645]),
c: 46,
d: List::<u8, 256>::from_iter([105]),
e: VarTestStruct {
a: 1558,
b: List::<u16, 1024>::from_iter([39947]),
c: 65,
},
f: Vector::<FixedTestStruct, 4>::from_iter([
FixedTestStruct {
a: 70,
b: 905948488145107787,
c: 2675781419,
},
FixedTestStruct {
a: 3,
b: 12539792087931462647,
c: 4719259,
},
FixedTestStruct {
a: 73,
b: 13544872847030609257,
c: 2819826618,
},
FixedTestStruct {
a: 159,
b: 16328658841145598323,
c: 2375225558,
},
]),
g: Vector::<VarTestStruct, 2>::from_iter([
VarTestStruct {
a: 30336,
b: List::<u16, 1024>::from_iter([30909]),
c: 240,
},
VarTestStruct {
a: 64263,
b: List::<u16, 1024>::from_iter([38121]),
c: 100,
},
]),
};
let encoding = serialize(&value).expect("can serialize");
let expected_encoding = vec![
4, 203, 71, 0, 0, 0, 46, 73, 0, 0, 0, 74, 0, 0, 0, 70, 75, 251, 176, 156, 89, 147, 146, 12,
43, 47, 125, 159, 3, 247, 163, 104, 30, 119, 74, 6, 174, 155, 2, 72, 0, 73, 105, 229, 23,
47, 23, 14, 249, 187, 186, 35, 19, 168, 159, 115, 97, 6, 253, 179, 12, 155, 226, 214, 16,
147, 141, 83, 0, 0, 0, 5, 190, 105, 22, 6, 7, 0, 0, 0, 65, 11, 156, 8, 0, 0, 0, 17, 0, 0,
0, 128, 118, 7, 0, 0, 0, 240, 189, 120, 7, 251, 7, 0, 0, 0, 100, 233, 148,
];
assert_eq!(encoding, expected_encoding);
let recovered_value: ComplexTestStruct =
deserialize(&expected_encoding).expect("can deserialize");
assert_eq!(recovered_value, value);
let root = value.hash_tree_root().expect("can find root");
let expected_root = "69b0ce69dfbc8abb8ae4fba564dcb813f5cc5b93c76d2b3d0689687c35821036";
assert_eq!(hex::encode(root), expected_root);
}
| 29.4 | 99 | 0.517979 |
a3d9f3b154a2419092578916f94761158d392f17 | 6,373 | kt | Kotlin | gradle-plugin/src/main/kotlin/ws/osiris/gradle/DeployPlugin.kt | AlexRogalskiy/osiris | b71d8e0c0ef325640db7b4d833e7771ec4317464 | [
"Apache-2.0"
] | 43 | 2017-06-05T07:51:52.000Z | 2022-02-23T06:24:20.000Z | gradle-plugin/src/main/kotlin/ws/osiris/gradle/DeployPlugin.kt | cjkent/osiris | 409e4cbdf4e64a1f9cb25e640744c99a14c7a4c7 | [
"Apache-2.0"
] | 683 | 2017-06-30T21:38:10.000Z | 2022-03-02T12:02:38.000Z | gradle-plugin/src/main/kotlin/ws/osiris/gradle/DeployPlugin.kt | AlexRogalskiy/osiris | b71d8e0c0ef325640db7b4d833e7771ec4317464 | [
"Apache-2.0"
] | 2 | 2020-09-27T14:43:02.000Z | 2022-01-05T12:50:36.000Z | package ws.osiris.gradle
import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.TaskExecutionException
import org.gradle.api.tasks.bundling.Zip
import ws.osiris.aws.validateName
import ws.osiris.awsdeploy.DeployableProject
import java.nio.file.Path
import kotlin.reflect.KClass
/** The version Gradle gives to a project if no version is specified. */
private const val NO_VERSION: String = "unspecified"
/**
* Gradle plugin that handles building and deploying Osiris projects.
*
* Adds tasks to:
* * Build a jar containing the application and all its dependencies
* * Generate a CloudFormation template that defines the API and lambda
* * Deploy the application to AWS
* * Open an endpoint from a deployed stage in the system default browser
*/
class OsirisDeployPlugin : Plugin<Project> {
override fun apply(project: Project) {
val extension = project.extensions.create("osiris", OsirisDeployPluginExtension::class.java)
val deployableProject = GradleDeployableProject(project, extension)
val zipTask = project.tasks.create("zip", Zip::class.java)
val deployTask = createTask(project, deployableProject, extension, "deploy", OsirisDeployTask::class)
val generateTemplateTask = createTask(
project,
deployableProject,
extension,
"generateCloudFormation",
OsirisGenerateCloudFormationTask::class
)
createTask(project, deployableProject, extension, "open", OsirisOpenTask::class)
project.afterEvaluate {
for (task in project.getTasksByName("assemble", false)) zipTask.dependsOn(task)
generateTemplateTask.dependsOn(zipTask)
deployTask.dependsOn(generateTemplateTask)
val jarPaths = mutableListOf<Path>()
jarPaths.addAll(deployableProject.runtimeClasspath)
jarPaths.add(deployableProject.projectJar)
zipTask.from(jarPaths)
zipTask.into("lib")
val versionStr = if (project.version == NO_VERSION) "" else "-${project.version}"
zipTask.archiveName = "${project.name}$versionStr-dist.zip"
}
}
private fun <T : OsirisTask> createTask(
project: Project,
deployableProject: DeployableProject,
extension: OsirisDeployPluginExtension,
name: String,
type: KClass<T>
): T = project.tasks.create(name, type.java).apply {
this.deployableProject = deployableProject
this.extension = extension
}
}
/**
* Allows the plugins to be configured using the Gradle DSL.
*
* osiris {
* rootPackage = "com.example.application"
* staticFilesDirectory = "/some/directory"
* environmentName = "dev"
* awsProfile = "dev-account"
* }
*/
open class OsirisDeployPluginExtension(
var rootPackage: String? = null,
var staticFilesDirectory: String? = null,
var environmentName: String? = null,
var awsProfile: String? = null,
var stackName: String? = null
)
/**
* Base class for tasks.
*/
abstract class OsirisTask : DefaultTask() {
internal lateinit var deployableProject: DeployableProject
internal lateinit var extension: OsirisDeployPluginExtension
}
/**
* Task to generate the CloudFormation template.
*/
open class OsirisGenerateCloudFormationTask : OsirisTask() {
@TaskAction
fun generate() {
try {
deployableProject.generateCloudFormation()
} catch (e: Exception) {
throw TaskExecutionException(this, e)
}
}
}
/**
* Task to upload the static files to S3, the jar to the S3 code bucket and then deploy the CloudFormation stack.
*/
open class OsirisDeployTask : OsirisTask() {
@TaskAction
fun deploy() {
try {
val stageUrls = deployableProject.deploy()
for ((stage, url) in stageUrls) {
logger.lifecycle("Deployed to stage '$stage' at $url")
}
} catch (e: Exception) {
throw TaskExecutionException(this, e)
}
}
}
/**
* Task to open an endpoint from a stage in the system default browser.
*/
open class OsirisOpenTask : OsirisTask() {
@TaskAction
fun deploy() {
try {
if (!project.hasProperty("stage")) {
throw IllegalStateException("Please specify the stage using '-P=...', for example: '-Pstage=dev'")
}
if (!project.hasProperty("endpoint")) {
throw IllegalStateException("Please specify the endpoint using '-P=...', for example: '-Pendpoint=/foo/bar'")
}
val stage = project.property("stage") as String
val endpoint = project.property("endpoint") as String
deployableProject.openBrowser(stage, endpoint)
} catch (e: Exception) {
throw TaskExecutionException(this, e)
}
}
}
/**
* Integrates with the deployment logic in the AWS deployment module.
*/
private class GradleDeployableProject(
private val project: Project,
private val extension: OsirisDeployPluginExtension
) : DeployableProject {
override val sourceDir: Path = project.projectDir.toPath().resolve("src/main")
override val name: String = project.name
override val buildDir: Path = project.buildDir.toPath()
override val zipBuildDir: Path = buildDir.resolve("distributions")
override val rootPackage: String get() = extension.rootPackage ?: throw IllegalStateException("rootPackage required")
override val version: String? = if (project.version == NO_VERSION) null else project.version.toString()
override val environmentName: String? get() = extension.environmentName
override val staticFilesDirectory: String? get() = extension.staticFilesDirectory
override val awsProfile: String? get() = validateName(extension.awsProfile)
override val stackName: String? get() = validateName(extension.stackName)
override val projectJar: Path
get() = project.configurations.getByName("runtime").allArtifacts.files.singleFile.toPath()
override val runtimeClasspath: List<Path>
get() = project.configurations.getByName("runtimeClasspath").resolvedConfiguration.resolvedArtifacts.map { it.file.toPath() }
}
| 36.626437 | 133 | 0.67786 |
012c90e69a0113de2d3db32365ba3d75e8dc1556 | 977 | rs | Rust | ascod-comm-data/src/driver_messages/driver_output_card5.rs | avs-simulator/ascod-comm | 57cee57d963781d66e11f77c4ebf50e0eb70e2b9 | [
"MIT"
] | null | null | null | ascod-comm-data/src/driver_messages/driver_output_card5.rs | avs-simulator/ascod-comm | 57cee57d963781d66e11f77c4ebf50e0eb70e2b9 | [
"MIT"
] | null | null | null | ascod-comm-data/src/driver_messages/driver_output_card5.rs | avs-simulator/ascod-comm | 57cee57d963781d66e11f77c4ebf50e0eb70e2b9 | [
"MIT"
] | null | null | null | use c2rust_bitfields::BitfieldStruct;
use static_assertions::assert_eq_size;
pub const SIZE_DRIVER_OUTPUT_CARD5: usize = 3;
#[repr(C, packed)]
#[derive(BitfieldStruct, Clone, Debug)]
pub struct DriverOutputCard5 {
#[bitfield(name = "button_hazard_lamp", ty = "libc::uint8_t", bits = "0..=0")]
#[bitfield(name = "spark_lamp", ty = "libc::uint8_t", bits = "1..=1")]
#[bitfield(name = "backlight_button_thermal_monitor", ty = "libc::uint8_t", bits = "2..=2")]
#[bitfield(name = "warning_lamp", ty = "libc::uint8_t", bits = "3..=3")]
#[bitfield(name = "interior_light_red", ty = "libc::uint8_t", bits = "8..=15")]
#[bitfield(name = "interior_light_white", ty = "libc::uint8_t", bits = "16..=23")]
raw: [u8; SIZE_DRIVER_OUTPUT_CARD5],
}
assert_eq_size!(DriverOutputCard5, [u8; SIZE_DRIVER_OUTPUT_CARD5]);
impl Default for DriverOutputCard5 {
fn default() -> Self {
Self {
raw: [0; SIZE_DRIVER_OUTPUT_CARD5],
}
}
}
| 36.185185 | 96 | 0.647902 |
dd2ce3fef41d57f831a2d5335e441ab5e751ead5 | 621 | go | Go | sealeye-example/versionHidden.go | gholt/sealeye | d7ed141bc5732d242ff85e8cb967ed8d432db0fa | [
"MIT"
] | null | null | null | sealeye-example/versionHidden.go | gholt/sealeye | d7ed141bc5732d242ff85e8cb967ed8d432db0fa | [
"MIT"
] | 1 | 2021-01-08T02:44:22.000Z | 2021-01-08T02:44:22.000Z | sealeye-example/versionHidden.go | gholt/sealeye | d7ed141bc5732d242ff85e8cb967ed8d432db0fa | [
"MIT"
] | null | null | null | package main
import "fmt"
func init() {
version.HiddenSubcommands["hidden"] = versionHidden
}
type versionHiddenCLI struct {
commonOptions
Help string
QuickHelp string
Func func(cli *versionHiddenCLI) int
Args []string
HelpOption bool `option:"?,h,help" help:"Outputs this help text."`
}
var versionHidden = &versionHiddenCLI{
Help: `
Usage: {{.Command}}
Mostly just an example of a hidden subcommand.
`,
QuickHelp: "Mostly just an example of a hidden subcommand.",
Func: func(cli *versionHiddenCLI) int {
if len(cli.Args) > 0 {
return 1
}
fmt.Println("1.2.3")
return 0
},
}
| 18.818182 | 67 | 0.68599 |
c3dfda3fd9302489e3607feef4f356f8a71fa4c0 | 12,508 | go | Go | session_handshake.go | moroen/dtls | 8868b17f6698d0759906307ebf0cb0aca15ff499 | [
"MIT"
] | null | null | null | session_handshake.go | moroen/dtls | 8868b17f6698d0759906307ebf0cb0aca15ff499 | [
"MIT"
] | null | null | null | session_handshake.go | moroen/dtls | 8868b17f6698d0759906307ebf0cb0aca15ff499 | [
"MIT"
] | null | null | null | package dtls
import (
"bytes"
"encoding/hex"
"errors"
"reflect"
"time"
)
func (s *session) parseRecord(data []byte) (*record, []byte, error) {
rec, rem, err := parseRecord(data)
if err != nil {
logWarn(s.peer.String(), "dtls: parse record: %s", err.Error())
return nil, nil, err
}
if s.decrypt {
if s.KeyBlock == nil {
logWarn(s.peer.String(), "dtls: tried to decrypt but KeyBlock not initialized.")
return nil, nil, errors.New("dtls: key block not initialized")
}
if len(rec.Data) < 8 {
if rec.IsAlert() {
// we were expecting encryption, but received an unencrypted alert message.
logDebug(s.peer.String(), "dtls: read %s (rem:%d) (decrypted:not-applicable-alert)", rec.Print(), len(rem))
return rec, rem, nil
} else {
logWarn(s.peer.String(), "dtls: data underflow, expected at least 8 bytes, but received %d.", len(rec.Data))
return nil, nil, errors.New("dtls: data underflow, expected at least 8 bytes")
}
}
var iv []byte
var key []byte
if s.Type == SessionType_Client {
iv = s.KeyBlock.ServerIV
key = s.KeyBlock.ServerWriteKey
} else {
iv = s.KeyBlock.ClientIV
key = s.KeyBlock.ClientWriteKey
}
nonce := newNonceFromBytes(iv, rec.Data[:8])
aad := newAad(rec.Epoch, rec.Sequence, uint8(rec.ContentType), uint16(len(rec.Data)-16))
clearText, err := dataDecrypt(rec.Data[8:], nonce, key, aad, s.peer.String())
if err != nil {
if s.handshake.firstDecrypt {
//callback that psk is invalid
logWarn(s.peer.String(), "dtls: PSK is most likely invalid for identity: %s%s", s.Server.Identity, s.Client.Identity)
s.handshake.firstDecrypt = false
}
if rec.IsHandshake() {
logDebug(s.peer.String(), "dtls: read %s (rem:%d) (decrypted:not-applicable): %s", rec.Print(), len(rem), err.Error())
return rec, rem, nil
} else {
logWarn(s.peer.String(), "dtls: read decryption error: %s", err.Error())
return nil, nil, err
}
}
if s.handshake.firstDecrypt {
s.handshake.firstDecrypt = false
}
rec.SetData(clearText)
}
logDebug(s.peer.String(), "dtls: read %s (rem:%d) (decrypted:%t)", rec.Print(), len(rem), s.decrypt)
return rec, rem, nil
}
func (s *session) parseHandshake(data []byte) (*handshake, error) {
hs, err := parseHandshake(data)
s.updateHash(data)
if err != nil {
return nil, err
}
logDebug(s.peer.String(), "dtls: read %s", hs.Print())
return hs, err
}
func (s *session) writeHandshake(hs *handshake) error {
hs.Header.Sequence = s.handshake.seq
s.handshake.seq += 1
rec := newRecord(ContentType_Handshake, s.getEpoch(), s.getNextSequence(), hs.Bytes())
s.updateHash(rec.Data)
logDebug(s.peer.String(), "dtls: write (handshake) %s", hs.Print())
return s.writeRecord(rec)
}
func (s *session) writeHandshakes(hss []*handshake) error {
recs := make([]*record, len(hss))
for idx, hs := range hss {
hs.Header.Sequence = s.handshake.seq
s.handshake.seq += 1
rec := newRecord(ContentType_Handshake, s.getEpoch(), s.getNextSequence(), hs.Bytes())
s.updateHash(rec.Data)
logDebug(s.peer.String(), "dtls: write (handshake) %s", hs.Print())
recs[idx] = rec
}
return s.writeRecords(recs)
}
func (s *session) writeRecord(rec *record) error {
if s.encrypt {
var iv []byte
var key []byte
if s.Type == SessionType_Client {
iv = s.KeyBlock.ClientIV
key = s.KeyBlock.ClientWriteKey
} else {
iv = s.KeyBlock.ServerIV
key = s.KeyBlock.ServerWriteKey
}
nonce := newNonce(iv, rec.Epoch, rec.Sequence)
aad := newAad(rec.Epoch, rec.Sequence, uint8(rec.ContentType), uint16(len(rec.Data)))
cipherText, err := dataEncrypt(rec.Data, nonce, key, aad, s.peer.String())
if err != nil {
return err
}
w := newByteWriter()
w.PutUint16(rec.Epoch)
w.PutUint48(rec.Sequence)
w.PutBytes(cipherText)
rec.SetData(w.Bytes())
logDebug(s.peer.String(), "dtls: write (encrptyed) %s", rec.Print())
return s.peer.WritePacket(rec.Bytes())
} else {
logDebug(s.peer.String(), "dtls: write (unencrypted) %s", rec.Print())
return s.peer.WritePacket(rec.Bytes())
}
}
func (s *session) writeRecords(recs []*record) error {
if s.encrypt {
return errors.New("dtls: can't write multiple encrypted records.")
} else {
buf := bytes.Buffer{}
for _, rec := range recs {
logDebug(s.peer.String(), "dtls: write (unencrypted) %s", rec.Print())
buf.Write(rec.Bytes())
}
return s.peer.WritePacket(buf.Bytes())
}
}
func (s *session) generateCookie() {
s.handshake.cookie = randomBytes(16)
}
func (s *session) startHandshake() error {
reqHs := newHandshake(handshakeType_ClientHello)
reqHs.ClientHello.Init(s.Id, s.Client.Random, nil, s.cipherSuites, s.compressionMethods)
err := s.writeHandshake(reqHs)
if err != nil {
return err
}
return nil
}
func (s *session) waitForHandshake(timeout time.Duration) error {
if s.handshake.done == nil {
return errors.New("dtls: handshake not in-progress")
}
select {
case err := <-s.handshake.done:
if s.handshake.state == "finished" {
return nil
} else {
return err
}
case <-time.After(timeout):
return errors.New("dtls: timed out waiting for handshake to complete")
}
return errors.New("dtls: unknown wait error")
}
func (s *session) processHandshakePacket(rspRec *record) error {
var reqHs, rspHs *handshake
var err error
switch rspRec.ContentType {
case ContentType_Handshake:
rspHs, err = s.parseHandshake(rspRec.Data)
if err != nil {
return err
}
if s.isHandshakeDone() && rspHs.Header.HandshakeType != handshakeType_ClientHello {
return errors.New("dtls: handshake packet received after handshake is complete")
}
switch rspHs.Header.HandshakeType {
case handshakeType_ClientHello:
cookie := rspHs.ClientHello.GetCookie()
if len(cookie) == 0 {
s.reset()
s.generateCookie()
s.sequenceNumber = uint64(rspHs.Header.Sequence)
s.handshake.seq = rspHs.Header.Sequence
s.handshake.state = "recv-clienthello-initial"
s.started = time.Now()
} else {
if !reflect.DeepEqual(cookie, s.handshake.cookie) {
s.handshake.state = "failed"
err = errors.New("dtls: cookie in clienthello does not match")
break
}
s.Client.RandomTime, s.Client.Random = rspHs.ClientHello.GetRandom()
if rspHs.ClientHello.HasSessionId() {
//resuming a session
s.Client.Identity = getIdentityFromCache(rspHs.ClientHello.GetSessionIdStr())
if len(s.Client.Identity) > 0 {
s.Id = rspHs.ClientHello.GetSessionId()
logDebug(s.peer.String(), "dtls: resuming previously established session, set identity: %s", s.Client.Identity)
s.resumed = true
psk := GetPskFromKeystore(s.Client.Identity, s.peer.String())
if psk == nil {
err = errors.New("dtls: no valid psk for identity")
break
}
s.Psk = psk
s.initKeyBlock()
} else {
logDebug(s.peer.String(), "dtls: tried to resume session, but it was not found")
s.resumed = false
}
} else {
s.resumed = false
}
s.handshake.state = "recv-clienthello"
}
case handshakeType_HelloVerifyRequest:
if len(s.handshake.cookie) == 0 {
s.handshake.cookie = rspHs.HelloVerifyRequest.GetCookie()
s.resetHash()
s.handshake.state = "recv-helloverifyrequest"
} else {
s.handshake.state = "failed"
err = errors.New("dtls: received hello verify request, but already have cookie")
break
}
s.handshake.state = "recv-helloverifyrequest"
case handshakeType_ServerHello:
s.Server.RandomTime, s.Server.Random = rspHs.ServerHello.GetRandom()
if reflect.DeepEqual(s.Id, rspHs.ServerHello.GetSessionId()) {
//resuming session
s.resumed = true
} else {
s.Id = rspHs.ServerHello.GetSessionId()
}
s.handshake.state = "recv-serverhello"
case handshakeType_ClientKeyExchange:
s.Client.Identity = string(rspHs.ClientKeyExchange.GetIdentity())
psk := GetPskFromKeystore(s.Client.Identity, s.peer.String())
if psk == nil {
err = errors.New("dtls: no valid psk for identity")
break
}
s.Psk = psk
s.initKeyBlock()
s.handshake.state = "recv-clientkeyexchange"
//TODO fail here if identity isn't found
case handshakeType_ServerKeyExchange:
s.Server.Identity = string(rspHs.ServerKeyExchange.GetIdentity())
s.handshake.state = "recv-serverkeyexchange"
case handshakeType_ServerHelloDone:
s.handshake.state = "recv-serverhellodone"
case handshakeType_Finished:
var label string
if s.Type == SessionType_Client {
label = "server"
} else {
label = "client"
}
if rspHs.Finished.Match(s.KeyBlock.MasterSecret, s.handshake.savedHash, label) {
if s.Type == SessionType_Server {
setIdentityToCache(hex.EncodeToString(s.Id), s.Client.Identity)
}
logDebug(s.peer.String(), "dtls: encryption matches, handshake complete")
} else {
s.handshake.state = "failed"
err = errors.New("dtls: crypto verification failed")
break
}
s.handshake.state = "finished"
break
default:
logWarn(s.peer.String(), "dtls: invalid handshake type [%v] received", rspRec.ContentType)
err = errors.New("dtls: bad handshake type")
break
}
case ContentType_ChangeCipherSpec:
s.decrypt = true
s.handshake.firstDecrypt = true
s.handshake.savedHash = s.getHash()
s.handshake.state = "cipherchangespec"
}
if err == nil {
switch s.handshake.state {
case "recv-clienthello-initial":
reqHs = newHandshake(handshakeType_HelloVerifyRequest)
reqHs.HelloVerifyRequest.Init(s.handshake.cookie)
err = s.writeHandshake(reqHs)
if err != nil {
break
}
s.resetHash()
case "recv-clienthello":
//TODO consider adding serverkeyexchange, not sure what to recommend as a server identity
reqHs = newHandshake(handshakeType_ServerHello)
reqHs.ServerHello.Init(s.Server.Random, s.Id)
reqHs2 := newHandshake(handshakeType_ServerHelloDone)
reqHs2.ServerHelloDone.Init()
err = s.writeHandshakes([]*handshake{reqHs, reqHs2})
if err != nil {
break
}
case "recv-helloverifyrequest":
reqHs = newHandshake(handshakeType_ClientHello)
err = reqHs.ClientHello.Init(s.Id, s.Client.Random, s.handshake.cookie, s.cipherSuites, s.compressionMethods)
if err != nil {
break
}
err = s.writeHandshake(reqHs)
if err != nil {
break
}
case "recv-serverhellodone":
if len(s.Server.Identity) > 0 {
psk := GetPskFromKeystore(s.Server.Identity, s.peer.String())
if len(psk) > 0 {
s.Client.Identity = s.Server.Identity
s.Psk = psk
}
}
if len(s.Psk) == 0 {
psk := GetPskFromKeystore(s.Client.Identity, s.peer.String())
if len(psk) > 0 {
s.Psk = psk
} else {
err = errors.New("dtls: no psk could be found")
break
}
}
if !s.resumed {
reqHs = newHandshake(handshakeType_ClientKeyExchange)
reqHs.ClientKeyExchange.Init([]byte(s.Client.Identity))
err = s.writeHandshake(reqHs)
if err != nil {
break
}
}
s.initKeyBlock()
rec := newRecord(ContentType_ChangeCipherSpec, s.getEpoch(), s.getNextSequence(), []byte{0x01})
s.incEpoch()
err = s.writeRecord(rec)
if err != nil {
break
}
s.encrypt = true
reqHs = newHandshake(handshakeType_Finished)
reqHs.Finished.Init(s.KeyBlock.MasterSecret, s.getHash(), "client")
err = s.writeHandshake(reqHs)
if err != nil {
break
}
case "finished":
if s.Type == SessionType_Server {
rec := newRecord(ContentType_ChangeCipherSpec, s.getEpoch(), s.getNextSequence(), []byte{0x01})
s.incEpoch()
err = s.writeRecord(rec)
if err != nil {
break
}
s.encrypt = true
reqHs = newHandshake(handshakeType_Finished)
reqHs.Finished.Init(s.KeyBlock.MasterSecret, s.getHash(), "server")
err = s.writeHandshake(reqHs)
if err != nil {
break
}
}
}
}
if err != nil {
s.handshake.state = "failed"
s.handshake.err = err
if HandshakeCompleteCallback != nil {
HandshakeCompleteCallback(s.peer.String(), s.Client.Identity, time.Now().Sub(s.started), err)
}
FORERR:
for {
select {
case s.handshake.done <- err:
continue
default:
break FORERR
}
}
return err
} else {
s.handshake.err = nil
}
if s.handshake.state == "finished" {
if HandshakeCompleteCallback != nil {
HandshakeCompleteCallback(s.peer.String(), s.Client.Identity, time.Now().Sub(s.started), nil)
}
FORFIN:
for {
select {
case s.handshake.done <- nil:
continue
default:
break FORFIN
}
}
}
return nil
}
| 28.107865 | 122 | 0.669012 |
751a89d0a39d0abb263a57f4dcd3124976d4f773 | 5,157 | h | C | runa/base/dumper.h | walkinsky8/nana-runner | 103992e07e7e644d349437fdf959364ffe9cb653 | [
"BSL-1.0"
] | 5 | 2017-12-28T08:22:20.000Z | 2022-03-30T01:26:17.000Z | runa/base/dumper.h | walkinsky8/nana-runner | 103992e07e7e644d349437fdf959364ffe9cb653 | [
"BSL-1.0"
] | null | null | null | runa/base/dumper.h | walkinsky8/nana-runner | 103992e07e7e644d349437fdf959364ffe9cb653 | [
"BSL-1.0"
] | null | null | null | /**
* Runa C++ Library
* Copyright (c) 2017-2019 walkinsky:lyh6188(at)hotmail(dot)com
*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*/
// Created on 2017/01/15
#pragma once
#include <runa/base/_config.h>
#include <runa/base/base_types.h>
namespace runa
{
class dumper
{
string oss_;
bool compact_;
int level_;
bool hideEmpty_;
public:
dumper(bool _compact = false, int _level = 0, bool _hideEmpty = false)
: compact_{ _compact }, level_{ _level }, hideEmpty_{ _hideEmpty }
{}
string const& str() const
{
return oss_;
}
bool compact() const
{
return compact_;
}
bool compact(bool _c)
{
bool old = compact_;
compact_ = _c;
return old;
}
template<class T>
dumper& write(const T& _v)
{
oss_ << _v;
return *this;
}
dumper& operator<<(bool _v)
{
return write(_v);
}
dumper& operator<<(char _v)
{
return write(_v);
}
dumper& operator<<(uchar _v)
{
return write(_v);
}
dumper& operator<<(short _v)
{
return write(_v);
}
dumper& operator<<(ushort _v)
{
return write(_v);
}
dumper& operator<<(int _v)
{
return write(_v);
}
dumper& operator<<(uint _v)
{
return write(_v);
}
dumper& operator<<(long _v)
{
return write(_v);
}
dumper& operator<<(ulong _v)
{
return write(_v);
}
dumper& operator<<(int64 _v)
{
return write(_v);
}
dumper& operator<<(uint64 _v)
{
return write(_v);
}
//dumper& operator<<(size_t _v)
//{
// return writeValue(_v);
//}
dumper& operator<<(float _v)
{
return write(_v);
}
dumper& operator<<(double _v)
{
return write(_v);
}
dumper& operator<<(long double _v)
{
return write(_v);
}
dumper& writeString(const istr& _v);
dumper& operator<<(const string& _v)
{
return writeString(_v);
}
dumper& operator<<(const wstring& _v)
{
return writeString(to_string(_v));
}
dumper& operator<<(const char* _v)
{
return writeString(_v);
}
dumper& operator<<(const wchar_t* _v)
{
return writeString(to_string(_v));
}
dumper& operator<<(const bytes& _v)
{
return write(_v);
}
dumper& operator<<(const datetime& _v)
{
return write(_v);
}
dumper& operator<<(const id& _v)
{
return write(_v);
}
template<class T>
dumper& operator<<(const T& _v)
{
return codec(*this, const_cast<T&>(_v));
}
template<class T>
dumper& operator<<(const number<T>& _v)
{
return write(_v);
}
template<class T>
dumper& operator<<(const optional<T>& _v)
{
if (!_v.empty())
*this << _v.value();
return *this;
}
template<class T, T _Def>
dumper& operator<<(const enum_<T, _Def>& _v)
{
return write(_v.str());
}
template<class T>
dumper& operator<<(const ptr<T>& _v)
{
if (!_v)
return write("null");
else
return (*this) << *_v;
}
template<class T>
dumper& operator<<(const std::vector<T>& _v)
{
enter({});
unnamed(_v);
leave();
return *this;
}
dumper& indent();
dumper& writeName(string _name);
dumper& writeBegin();
dumper& writeEnd();
dumper& enter(const string& _type);
dumper& leave();
template<class T>
dumper& operator()(string _name, const T& _v)
{
if (!hideEmpty_ || !is_empty(_v))
return indent().writeName(_name) << _v;
return *this;
}
template<class T>
dumper& unnamed(const std::vector<T>& _v)
{
for (const auto& i : _v)
{
indent() << i;
}
return *this;
}
};
inline std::ostream& operator<<(std::ostream& _os, const dumper& _v)
{
return _os << _v.str();
}
template<class T>
inline string dump(const T& _v, bool _compact=true, int _level=0, bool _hideEmpty=true)
{
dumper d{ _compact, _level, _hideEmpty };
d << _v;
return d.str();
}
}
| 22.133047 | 91 | 0.453752 |
a4dd3e87d364285ee3ff78901ef235bbe44bfc2a | 334 | sql | SQL | haogrgr-boot-web/src/test/resources/schema/test.sql | haogrgr/haogrgr-boot | c444b07c7302fa205d8b64005fca6b5f397560fa | [
"Apache-2.0"
] | null | null | null | haogrgr-boot-web/src/test/resources/schema/test.sql | haogrgr/haogrgr-boot | c444b07c7302fa205d8b64005fca6b5f397560fa | [
"Apache-2.0"
] | null | null | null | haogrgr-boot-web/src/test/resources/schema/test.sql | haogrgr/haogrgr-boot | c444b07c7302fa205d8b64005fca6b5f397560fa | [
"Apache-2.0"
] | null | null | null | CREATE TABLE `test_model`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`age` int(11) DEFAULT NULL,
`modify_time` datetime DEFAULT NULL,
`create_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8; | 30.363636 | 48 | 0.628743 |
d3d44f047924582c139b8c7bb1ed3144586cd73e | 1,315 | lua | Lua | application/controller/live_redis_cache.lua | Tinywan/openresty-project-v0.01 | 8b8c6b2f6a7afe2a5f86e36d8e3ed612031cd6ca | [
"MIT"
] | 37 | 2017-09-22T03:05:34.000Z | 2022-02-09T16:34:37.000Z | application/controller/live_redis_cache.lua | Tinywan/openresty-project-v0.01 | 8b8c6b2f6a7afe2a5f86e36d8e3ed612031cd6ca | [
"MIT"
] | null | null | null | application/controller/live_redis_cache.lua | Tinywan/openresty-project-v0.01 | 8b8c6b2f6a7afe2a5f86e36d8e3ed612031cd6ca | [
"MIT"
] | 12 | 2017-12-11T23:38:44.000Z | 2021-11-16T01:28:13.000Z | --[[-----------------------------------------------------------------------
* | Copyright (C) Shaobo Wan (Tinywan)
* | Github: https://github.com/Tinywan
* | Blog: http://www.cnblogs.com/Tinywan
* |------------------------------------------------------------------------
* | Date: 2017/5/19 23:25
* | Function: local_live_test.
* | TestInfo: port = 63700 auth = tinywan123456
* | log [n] 这样子的log日志是可以删除的()
* |------------------------------------------------------------------------
--]]
local template = require "resty.template"
local helper = require "vendor.helper"
local live_common = require "live.common"
local read_content = live_common.read_content
local test = live_common.test
local exit = ngx.exit
local ngx_var = ngx.var
local print = ngx.print
-- get var id
local id = ngx_var.id
local content = read_content(id)
-- 在控制条件中除了false和nil 为假,其他值都为真,所以lua认为0和空字符串也是真
if not content or content == nil then
-- backup data
template.render("404.html", {
title = "404 界面",
})
exit(200)
end
-- backup data
members = { Tom = 10, Jake = 11, Dodo = 12, Jhon = 16 }
template.caching(true)
template.render("index.html", {
live_id = id,
title = "Openresty 渲染 html 界面",
ws_title = "Openresty 渲染 websocket",
content = helper.cjson_decode(content),
members = members
})
| 29.886364 | 75 | 0.563498 |
0b28b47566a0388433df755a312dddf760b4c430 | 1,250 | py | Python | onebarangay_psql/users/tests/test_admin.py | PrynsTag/oneBarangay-PostgreSQL | 11d7b97b57603f4c88948905560a22a5314409ce | [
"Apache-2.0"
] | null | null | null | onebarangay_psql/users/tests/test_admin.py | PrynsTag/oneBarangay-PostgreSQL | 11d7b97b57603f4c88948905560a22a5314409ce | [
"Apache-2.0"
] | 43 | 2022-02-07T00:18:35.000Z | 2022-03-21T04:42:48.000Z | onebarangay_psql/users/tests/test_admin.py | PrynsTag/oneBarangay-PostgreSQL | 11d7b97b57603f4c88948905560a22a5314409ce | [
"Apache-2.0"
] | null | null | null | """Create your tests for the admin app here."""
import pytest
from django.contrib.auth import get_user_model
from django.urls import reverse
pytestmark = pytest.mark.django_db
User = get_user_model()
class TestUserAdmin:
"""Test the admin interface."""
def test_changelist(self, admin_client):
"""Test the changelist view."""
url = reverse("admin:users_user_changelist")
response = admin_client.get(url)
assert response.status_code == 200
def test_search(self, admin_client):
"""Test the search functionality."""
url = reverse("admin:users_user_changelist")
response = admin_client.get(url, data={"q": "test"})
assert response.status_code == 200
def test_add(self, admin_client):
"""Test the add user functionality."""
url = reverse("admin:users_user_add")
response = admin_client.get(url)
assert response.status_code == 200
def test_view_user(self, admin_client):
"""Test the view user functionality."""
user = User.objects.get(username="admin")
url = reverse("admin:users_user_change", kwargs={"object_id": user.pk})
response = admin_client.get(url)
assert response.status_code == 200
| 33.783784 | 79 | 0.668 |
308a4a5ea4ddf912aafbecbe540215deacd15acd | 7,458 | html | HTML | docs/vim.fault.InvalidName.html | cleeistaken/python_vsan_sdk_monitoring | 520cfaddc086b6f8c9a00c2b296649fadaa4f3c6 | [
"MIT"
] | 1 | 2020-03-23T05:20:45.000Z | 2020-03-23T05:20:45.000Z | docs/vim.fault.InvalidName.html | cleeistaken/python_vsan_sdk_monitoring | 520cfaddc086b6f8c9a00c2b296649fadaa4f3c6 | [
"MIT"
] | null | null | null | docs/vim.fault.InvalidName.html | cleeistaken/python_vsan_sdk_monitoring | 520cfaddc086b6f8c9a00c2b296649fadaa4f3c6 | [
"MIT"
] | null | null | null | <html xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:vim2="urn:vim2" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<script src="./commonRes.js" language="JavaScript"> type="text/javascript"></script>
<link href="doc-style.css" type="text/css" rel="StyleSheet">
</head>
<script src="dynamic-content.js" type="text/javascript"></script>
<body>
<table cellspacing="0" class="header-footer" id="top">
<tr>
<td>
<br>
</td><td></td><td><a href="#field_detail">Local Properties</a></td><td></td>
</tr>
<tr>
<td><a href="index-mo_types.html">Managed Object Types</a></td><td><a href="index-do_types.html">Data Object Types</a></td><td><a href="index-properties.html">All Properties</a></td><td><a href="index-methods.html">All Methods</a></td>
</tr>
</table>
<br>
<a id="vim.fault.InvalidName" name="vim.fault.InvalidName"></a>
<h1>Fault - InvalidName(vim.fault.InvalidName)</h1>
<dl>
<dt>Thrown by</dt>
<dd>
<a href="vim.AuthorizationManager.html#addRole">AddAuthorizationRole</a>, <a href="vim.DistributedVirtualSwitch.html#addPortgroups">AddDVPortgroup_Task</a>, <a href="vim.DistributedVirtualSwitch.html#addNetworkResourcePool">AddNetworkResourcePool</a>, <a href="vim.alarm.AlarmManager.html#create">CreateAlarm</a>, <a href="vim.ResourcePool.html#createVm">CreateChildVM_Task</a>, <a href="vim.Folder.html#createCluster">CreateCluster</a>, <a href="vim.Folder.html#createClusterEx">CreateClusterEx</a>, <a href="vim.Folder.html#createDatacenter">CreateDatacenter</a>, <a href="vim.DistributedVirtualSwitch.html#addPortgroup">CreateDVPortgroup_Task</a>, <a href="vim.Folder.html#createDistributedVirtualSwitch">CreateDVS_Task</a>, <a href="vim.Folder.html#createFolder">CreateFolder</a>, <a href="vim.host.DatastoreSystem.html#createLocalDatastore">CreateLocalDatastore</a>, <a href="vim.scheduler.ScheduledTaskManager.html#createObjectScheduledTask">CreateObjectScheduledTask</a>, <a href="vim.ResourcePool.html#createResourcePool">CreateResourcePool</a>, <a href="vim.scheduler.ScheduledTaskManager.html#create">CreateScheduledTask</a>, <a href="vim.VirtualMachine.html#createSnapshot">CreateSnapshot_Task</a>, <a href="vim.VirtualMachine.html#createSnapshotEx">CreateSnapshotEx_Task</a>, <a href="vim.Folder.html#createStoragePod">CreateStoragePod</a>, <a href="vim.ResourcePool.html#createVApp">CreateVApp</a>, <a href="vim.Folder.html#createVm">CreateVM_Task</a>, <a href="vim.host.DatastoreSystem.html#createVvolDatastore">CreateVvolDatastore</a>, <a href="vim.DistributedVirtualSwitch.html#reconfigureVmVnicNetworkResourcePool">DvsReconfigureVmVnicNetworkResourcePool_Task</a>, <a href="vim.ResourcePool.html#importVApp">ImportVApp</a>, <a href="vim.option.OptionManager.html#queryView">QueryOptions</a>, <a href="vim.alarm.Alarm.html#reconfigure">ReconfigureAlarm</a>, <a href="vim.dvs.DistributedVirtualPortgroup.html#reconfigure">ReconfigureDVPortgroup_Task</a>, <a href="vim.DistributedVirtualSwitch.html#reconfigure">ReconfigureDvs_Task</a>, <a href="vim.scheduler.ScheduledTask.html#reconfigure">ReconfigureScheduledTask</a>, <a href="vim.VirtualMachine.html#reconfigure">ReconfigVM_Task</a>, <a href="vim.HostSystem.html#reconnect">ReconnectHost_Task</a>, <a href="vim.ResourcePool.html#registerVm">RegisterChildVM_Task</a>, <a href="vim.Folder.html#registerVm">RegisterVM_Task</a>, <a href="vim.DistributedVirtualSwitch.html#removeNetworkResourcePool">RemoveNetworkResourcePool</a>, <a href="vim.ManagedEntity.html#rename">Rename_Task</a>, <a href="vim.Datastore.html#renameDatastore">RenameDatastore</a>, <a href="vim.vm.Snapshot.html#rename">RenameSnapshot</a>, <a href="vim.VirtualMachine.html#startRecording">StartRecording_Task</a>, <a href="vim.AuthorizationManager.html#updateRole">UpdateAuthorizationRole</a>, <a href="vim.ResourcePool.html#updateConfig">UpdateConfig</a>, <a href="vim.DistributedVirtualSwitch.html#updateNetworkResourcePool">UpdateNetworkResourcePool</a>, <a href="vim.option.OptionManager.html#updateValues">UpdateOptions</a>, <a href="vim.host.StorageSystem.html#updateScsiLunDisplayName">UpdateScsiLunDisplayName</a>, <a href="vim.VirtualApp.html#updateVAppConfig">UpdateVAppConfig</a>
</dd>
<dt>Extends</dt>
<dd>
<a href="vim.fault.VimFault.html">VimFault</a>
</dd>
<dt>See also</dt>
<dd>
<a href="vim.ManagedEntity.html">ManagedEntity</a>
</dd>
<p></p>
</dl>
<H2>Fault
Description</H2>
<p></p>
A InvalidName fault is thrown when the name
contains an invalid character or format.
<p></p>
<a id="field_detail" name="field_detail"></a>
<p class="table-title">Properties</p>
<table cellspacing="0">
<tr>
<th>
Name
</th><th>
Type
</th><th>
Description
</th>
</tr>
<tr class="r1">
<td nowrap="1"><a id="entity" name="entity"></a><strong>entity</strong><span title="May not be present" class="footnote-ref">*</span></td><td><a href="vmodl.ManagedObjectReference.html">ManagedObjectReference</a>
<br> to a
<a href="vim.ManagedEntity.html">ManagedEntity</a></td><td>
<p></p>
Entity, if any, that has an invalid name.
<br>
</td>
</tr>
<tr class="r0">
<td nowrap="1"><a id="name" name="name"></a><strong>name</strong></td><td>xsd:string</td><td>
<p></p>
The invalid name.
<br>
</td>
</tr>
<tr class="r1">
<td colspan="3">
Properties inherited from <a href="vim.fault.VimFault.html">VimFault</a></td>
</tr>
<tr class="r0">
<td colspan="3">None</td>
</tr>
<tr class="r1">
<td colspan="3">
Properties inherited from <a href="vmodl.MethodFault.html">MethodFault</a></td>
</tr>
<tr class="r0">
<td colspan="3"><a href="vmodl.MethodFault.html#faultCause">faultCause</a>, <a href="vmodl.MethodFault.html#faultMessage">faultMessage</a></td>
</tr>
</table>
<span class="footnote-ref">*</span><span class="footnote">May not be present</span>
<br>
<a style="margin-bottom:10px; margin-top:10px; cursor:hand; cursor:pointer" onclick="resize_textarea('wsdl-textarea');expandcontent(this, 'wsdl-div')">Show WSDL type definition</a>
<div class="switchcontent" id="wsdl-div">
<textarea cols="20" rows="10" name="wsdl-textarea" wrap="off" readonly="1" id="wsdl-textarea"> <complexType xmlns="http://www.w3.org/2001/XMLSchema" xmlns:vsan="urn:vsan" name="InvalidName">
<complexContent>
<extension base="vsan:VimFault">
<sequence>
<element name="name" type="xsd:string"/>
<element name="entity" type="vsan:ManagedObjectReference" minOccurs="0"/>
</sequence>
</extension>
</complexContent>
</complexType></textarea>
</div>
<br>
<br>
<table cellspacing="0" class="header-footer" id="bottom">
<tr>
<td><a href="#top">Top of page</a></td><td></td><td><a href="#field_detail">Local Properties</a></td><td></td>
</tr>
<tr>
<td><a href="index-mo_types.html">Managed Object Types</a></td><td><a href="index-do_types.html">Data Object Types</a></td><td><a href="index-properties.html">All Properties</a></td><td><a href="index-methods.html">All Methods</a></td>
</tr>
</table>
<br>
<script language="javascript">document.write(ID_Copyright);</script>
<br>
<script language="javascript">document.write(ID_VersionInformation);</script>
</body>
</html>
| 63.20339 | 3,226 | 0.712926 |
650d0ad17e404144a026ce3f06aafc17ea1fda8f | 1,962 | py | Python | sparse gamma def/gamma_def_score.py | blei-lab/ars-reparameterization | b20a84c28537d85e0aaf62cbbaacb6de9370f0a3 | [
"MIT"
] | 33 | 2017-03-11T10:00:32.000Z | 2022-03-08T14:23:45.000Z | ars-reparameterization/sparse gamma def/gamma_def_score.py | astirn/neural-inverse-cdf-sampling | 80eb2eb7cf396a4e53df62bc126e9a1828f55ca9 | [
"MIT"
] | 2 | 2018-02-05T17:14:00.000Z | 2019-08-02T14:37:25.000Z | ars-reparameterization/sparse gamma def/gamma_def_score.py | astirn/neural-inverse-cdf-sampling | 80eb2eb7cf396a4e53df62bc126e9a1828f55ca9 | [
"MIT"
] | 10 | 2017-03-05T13:31:01.000Z | 2020-03-29T01:09:01.000Z | from autograd import grad
import autograd.numpy as np
import autograd.numpy.random as npr
import autograd.scipy.special as sp
from gamma_def import *
# Define helper functions for score fnc estimator
def logQ(sample, alpha, m):
"""
Evaluates log of variational approximation, vectorized.
"""
temp = alpha*(np.log(alpha)-np.log(m))
temp += (alpha-1.)*np.log(sample)
temp -= alpha*sample/m
temp -= np.log(sp.gamma(alpha))
return temp
def grad_logQ(sample,alpha,m):
"""
Evaluates the gradient of the log of variational approximation, vectorized.
"""
gradient = np.zeros((alpha.shape[0],2))
gradient[:,0] = np.log(alpha) - np.log(m) + 1. + np.log(sample) - sample/m
gradient[:,0] -= sp.digamma(alpha)
gradient[:,1] = -alpha/m + alpha*sample/m**2
return gradient
# Define score function estimator
def score_estimator(alpha,m,x,K,alphaz,S=100):
"""
Form score function estimator based on samples lmbda.
"""
N = x.shape[0]
if x.ndim == 1:
D = 1
else:
D = x.shape[1]
num_z = N*np.sum(K)
L = K.shape[0]
gradient = np.zeros((alpha.shape[0],2))
f = np.zeros((2*S,alpha.shape[0],2))
h = np.zeros((2*S,alpha.shape[0],2))
for s in range(2*S):
lmbda = npr.gamma(alpha,1.)
lmbda[lmbda < 1e-300] = 1e-300
zw = m*lmbda/alpha
lQ = logQ(zw,alpha,m)
gradLQ = grad_logQ(zw,alpha,m)
lP = logp(zw, K, x, alphaz)
temp = lP - np.sum(lQ)
f[s,:,:] = temp*gradLQ
h[s,:,:] = gradLQ
# CV
covFH = np.zeros((alpha.shape[0],2))
covFH[:,0] = np.diagonal(np.cov(f[S:,:,0],h[S:,:,0],rowvar=False)[:alpha.shape[0],alpha.shape[0]:])
covFH[:,1] = np.diagonal(np.cov(f[S:,:,1],h[S:,:,1],rowvar=False)[:alpha.shape[0],alpha.shape[0]:])
a = covFH / np.var(h[S:,:,:],axis=0)
return np.mean(f[:S,:,:],axis=0) - a*np.mean(h[:S,:,:],axis=0)
| 29.727273 | 104 | 0.574414 |
3590c07c413ceb5ce35b81b4a4ffbcc37aa29cf1 | 2,197 | sql | SQL | master2021/company_secProc.sql | MoDELSVGU/SQLSI | 54e8039cad17f69bb9c20847db69c7ac22875405 | [
"MIT"
] | null | null | null | master2021/company_secProc.sql | MoDELSVGU/SQLSI | 54e8039cad17f69bb9c20847db69c7ac22875405 | [
"MIT"
] | null | null | null | master2021/company_secProc.sql | MoDELSVGU/SQLSI | 54e8039cad17f69bb9c20847db69c7ac22875405 | [
"MIT"
] | null | null | null | DROP PROCEDURE IF EXISTS Query1;
/* SELECT email FROM Employee */
DELIMITER //
CREATE PROCEDURE Query1(in kcaller varchar(250), in krole varchar(250))
BEGIN
DECLARE _rollback int DEFAULT 0;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
SET _rollback = 1;
GET STACKED DIAGNOSTICS CONDITION 1 @p1 = RETURNED_SQLSTATE, @p2 = MESSAGE_TEXT;
SELECT @p1, @p2;
ROLLBACK;
END;
START TRANSACTION;
DROP TEMPORARY TABLE IF EXISTS TEMP1;
CREATE TEMPORARY TABLE TEMP1 AS (
SELECT CASE auth_READ_Employee_email(kcaller, krole, Employee_id) WHEN TRUE THEN email ELSE throw_error() END AS email FROM Employee
);
IF _rollback = 0
THEN SELECT * from TEMP1;
END IF;
END //
DELIMITER ;
DROP PROCEDURE IF EXISTS Query2;
/* SELECT salary FROM Employee JOIN (SELECT * FROM Supervision WHERE supervisors = 'B') ON supervisees = Employeee */
DELIMITER //
CREATE PROCEDURE Query2(in kcaller varchar(250), in krole varchar(250))
BEGIN
DECLARE _rollback int DEFAULT 0;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
SET _rollback = 1;
GET STACKED DIAGNOSTICS CONDITION 1 @p1 = RETURNED_SQLSTATE, @p2 = MESSAGE_TEXT;
SELECT @p1, @p2;
ROLLBACK;
END;
START TRANSACTION;
DROP TEMPORARY TABLE IF EXISTS TEMP1;
CREATE TEMPORARY TABLE TEMP1 AS (
SELECT Employee_id AS supervisees, Employee_id AS supervisors FROM Employee, Employee WHERE Employee_id = 'B'
);
DROP TEMPORARY TABLE IF EXISTS TEMP2;
CREATE TEMPORARY TABLE TEMP2 AS (
SELECT CASE auth_READ_Supervision(kcaller, krole, supervisees, supervisors) WHEN TRUE THEN supervisees ELSE throw_error() END AS supervisees FROM TEMP1
);
DROP TEMPORARY TABLE IF EXISTS TEMP3;
CREATE TEMPORARY TABLE TEMP3 AS (
SELECT * FROM Supervision WHERE supervisors = 'B'
);
DROP TEMPORARY TABLE IF EXISTS TEMP4;
CREATE TEMPORARY TABLE TEMP4 AS (
SELECT * FROM Employee JOIN TEMP3 ON supervisees = Employeee
);
DROP TEMPORARY TABLE IF EXISTS TEMP5;
CREATE TEMPORARY TABLE TEMP5 AS (
SELECT * FROM TEMP4
);
DROP TEMPORARY TABLE IF EXISTS TEMP6;
CREATE TEMPORARY TABLE TEMP6 AS (
SELECT CASE auth_READ_Employee_salary(kcaller, krole, Employee_id) WHEN TRUE THEN salary ELSE throw_error() END AS salary FROM TEMP5
);
IF _rollback = 0
THEN SELECT * from TEMP6;
END IF;
END //
DELIMITER ;
| 31.84058 | 151 | 0.778334 |
24dd812c61da2358f917e8ca237702104107d23f | 2,931 | go | Go | backend/go/infrastructure/storage/psql.go | webtech-fmi/phonebook | 9841d3653abf4df514737b228a6d0553bb284d94 | [
"MIT"
] | null | null | null | backend/go/infrastructure/storage/psql.go | webtech-fmi/phonebook | 9841d3653abf4df514737b228a6d0553bb284d94 | [
"MIT"
] | null | null | null | backend/go/infrastructure/storage/psql.go | webtech-fmi/phonebook | 9841d3653abf4df514737b228a6d0553bb284d94 | [
"MIT"
] | null | null | null | package storage
import (
"context"
"errors"
"fmt"
db "github.com/go-ozzo/ozzo-dbx"
_ "github.com/lib/pq"
"github.com/webtech-fmi/phonebook/backend/go/infrastructure/log"
)
// psqlConfiguration for creating a database storage
type psqlConfiguration struct {
Host string
Port int
DBName string `mapsstructure:"dbname"`
Username string
Password string
Schema string
MaxIdle int `mapstructure:"max_idle"`
MaxOpen int `mapstructure:"max_open"`
SSLmode string `mapstructure:"sslmode"`
Debug bool
}
func loadDBConfiguration(options map[string]interface{}) (*psqlConfiguration, error) {
host, ok := options["host"].(string)
if !ok {
return nil, errors.New("invalid type for DB host")
}
port, ok := options["port"].(int)
if !ok {
return nil, errors.New("invalid type for DB port")
}
dbName, ok := options["dbname"].(string)
if !ok {
return nil, errors.New("invalid type for DB name")
}
username, ok := options["username"].(string)
if !ok {
return nil, errors.New("invalid type for DB username")
}
password, ok := options["password"].(string)
if !ok {
return nil, errors.New("invalid type for DB password")
}
maxIdle, ok := options["max_idle"].(int)
if !ok {
return nil, errors.New("invalid type for DB max_idle")
}
maxOpen, ok := options["max_open"].(int)
if !ok {
return nil, errors.New("invalid type for DB max_open")
}
debug, ok := options["debug"].(bool)
if !ok {
return nil, errors.New("invalid type for DB debug")
}
ssl, ok := options["sslmode"].(string)
if !ok {
return nil, errors.New("invalid type for DB sslmode")
}
return &psqlConfiguration{
Host: host,
Port: port,
DBName: dbName,
Username: username,
Password: password,
MaxIdle: maxIdle,
MaxOpen: maxOpen,
Debug: debug,
SSLmode: ssl,
}, nil
}
// Connection pool + logger
type PSQL struct {
DB *db.DB
Logger *log.Logger
}
func NewPSQL(ctx context.Context, options map[string]interface{}, logger *log.Logger) (*PSQL, error) {
dbConfig, err := loadDBConfiguration(options)
if err != nil {
return nil, fmt.Errorf("could not initialize DB storage with error: [%s]", err)
}
settings := fmt.Sprintf(
"user=%s password=%s host=%s port=%d dbname=%s sslmode=%s",
dbConfig.Username,
dbConfig.Password,
dbConfig.Host,
dbConfig.Port,
dbConfig.DBName,
dbConfig.SSLmode,
)
cp, err := db.Open("postgres", settings)
if err != nil {
logger.Fatal().Err(err).Msg("Could not instantiate the database connection pool")
}
err = cp.DB().Ping()
if err != nil {
logger.Fatal().Err(err).Msg("Database unreachable")
}
go func() error {
logger.Info().Msg("[PSQL] Starting cleanup database hook...")
<-ctx.Done()
logger.Info().Msg("[PSQL] Cleaning up the database...")
return cp.Close()
}()
cp.DB().SetMaxOpenConns(dbConfig.MaxOpen)
cp.DB().SetMaxIdleConns(dbConfig.MaxIdle)
return &PSQL{DB: cp, Logger: logger}, nil
}
| 22.204545 | 102 | 0.671784 |
0bafe8e2d71b4a839f7f69c774b8f4b694cdaef6 | 2,892 | js | JavaScript | frontend/web/themes/default/js/charging.js | bactv/study.edu | ea22d101081d256b5782408216f9f4191e93d10f | [
"BSD-3-Clause"
] | null | null | null | frontend/web/themes/default/js/charging.js | bactv/study.edu | ea22d101081d256b5782408216f9f4191e93d10f | [
"BSD-3-Clause"
] | null | null | null | frontend/web/themes/default/js/charging.js | bactv/study.edu | ea22d101081d256b5782408216f9f4191e93d10f | [
"BSD-3-Clause"
] | null | null | null | /**
* Created by bactv on 07/05/2017.
*/
$(document).ready(function() {
// tab
$(".btn-pref .btn").click(function () {
$(".btn-pref .btn").removeClass("btn-primary").addClass("btn-default");
// $(".tab").addClass("active"); // instead of this do the below
$(this).removeClass("btn-default").addClass("btn-primary");
});
// click telco image
$("a.telco").on('click', function () {
$("a.telco").removeClass('telco_active');
$("a.telco").parent().removeClass('telco_active');
$(".table > thead > tr > th").removeClass('th_error')
$(this).addClass('telco_active');
$(this).parent().addClass('telco_active');
});
});
function charging() {
var telco_type = $("a.telco_active").attr('id');
var serial_number = $("#serial_number").val();
var code_number = $("#code_number").val();
var _csrf = $("meta[name='csrf-token']").attr('content');
var check = true;
if (telco_type == '' || telco_type == undefined) {
$(".table > thead > tr > th").addClass('th_error');
check = false;
} else {
$(".table > thead > tr > th").removeClass('th_error');
}
if (serial_number == '') {
$("label#lb_serial_number").css({'color' : 'red'});
$('#serial_number').addClass('th_error');
check = false;
} else {
$("label#lb_serial_number").css({'color' : 'green'});
$('#serial_number').removeClass('th_error')
}
if (code_number == '') {
$("label#lb_code_number").css({'color' : 'red'});
$('#code_number').addClass('th_error');
check = false;
} else {
$("label#lb_code_number").css({'color' : 'green'});
$('#code_number').removeClass('th_error')
}
if (!check) {
return false;
} else {
$.ajax({
method: 'POST',
url: '/charging/process-charge.io',
data: {'telco_type' : telco_type, 'serial_number' : serial_number, 'code_number' : code_number, _csrf : _csrf},
success: function (data) {
var res = JSON.parse(data);
var title = '';
if (res.status != 200) {
title = 'Thông báo';
} else {
title = 'Thông báo';
}
BootstrapDialog.show({
title: title,
message: res.message
});
if (res.status == 200) {
setTimeout(function() {
location.reload();
}, 3000);
}
// nạp sai quá 5 lần
if (res.status == 222) {
setTimeout(function() {
window.location = '/dang-xuat.io';
}, 3000);
}
}
});
}
} | 33.241379 | 123 | 0.469917 |
8549db51054909d4e42d25231c4f6e7795d64d77 | 182 | rs | Rust | examples/opb-contract-call-service-provider/contract-service/opb/contracts/target-core/src/state.rs | chenxifun/bsnhub-service-demo | f950066fc24b47b795b28b4ff6bdaa9e0206843a | [
"Apache-2.0"
] | 2 | 2021-04-08T06:15:14.000Z | 2021-07-05T07:49:40.000Z | examples/opb-contract-call-service-provider/contract-service/opb/contracts/target-core/src/state.rs | chenxifun/bsnhub-service-demo | f950066fc24b47b795b28b4ff6bdaa9e0206843a | [
"Apache-2.0"
] | null | null | null | examples/opb-contract-call-service-provider/contract-service/opb/contracts/target-core/src/state.rs | chenxifun/bsnhub-service-demo | f950066fc24b47b795b28b4ff6bdaa9e0206843a | [
"Apache-2.0"
] | 6 | 2020-10-14T07:43:08.000Z | 2022-01-20T01:53:33.000Z | use cw_storage_plus::Map;
// REQUESTS stores the requests whether the response has been executed: <request_id, responded>
pub const REQUESTS: Map<&str, bool> = Map::new("requests"); | 45.5 | 95 | 0.758242 |
8591fd45e7857fc0b8a4444fa86654f5398f24b6 | 1,968 | js | JavaScript | en/doxygen/html/class_appearance_widget.js | dash-docs/dash-docs.github.io | e47f3e97d12464d6cf724c7eb4a22497585c12be | [
"MIT-0",
"MIT"
] | 2 | 2017-12-06T15:58:00.000Z | 2020-02-13T18:01:58.000Z | en/doxygen/html/class_appearance_widget.js | dash-docs/dash-docs.github.io | e47f3e97d12464d6cf724c7eb4a22497585c12be | [
"MIT-0",
"MIT"
] | 1 | 2018-01-17T16:05:18.000Z | 2018-01-24T21:12:03.000Z | en/doxygen/html/class_appearance_widget.js | dash-docs/dash-docs.github.io | e47f3e97d12464d6cf724c7eb4a22497585c12be | [
"MIT-0",
"MIT"
] | 2 | 2018-01-28T20:04:14.000Z | 2019-11-05T00:23:18.000Z | var class_appearance_widget =
[
[ "AppearanceWidget", "class_appearance_widget.html#a0baa4e423f9275af6213eb2a5e088bcb", null ],
[ "~AppearanceWidget", "class_appearance_widget.html#a5a15e9de3c630faa60ac4f5eeed06408", null ],
[ "accept", "class_appearance_widget.html#abbe5467d80f5ec52ac262b6f6113aead", null ],
[ "appearanceChanged", "class_appearance_widget.html#ae87a960829514ec601926fd9408b7845", null ],
[ "setModel", "class_appearance_widget.html#a36ac35039c62e5390c0d3a5024ecffb8", null ],
[ "updateFontFamily", "class_appearance_widget.html#aa8c01c05dcbeb29fad5b304fef8c5bd9", null ],
[ "updateFontScale", "class_appearance_widget.html#a26f8519c21ca04f630b94026320508d6", null ],
[ "updateFontWeightBold", "class_appearance_widget.html#a57f65f10a85f6530a1f136ead2ae2d97", null ],
[ "updateFontWeightNormal", "class_appearance_widget.html#a196e9868fd3fcd437248ea716da6e1d5", null ],
[ "updateTheme", "class_appearance_widget.html#a6873100e023124ad7d4a41f990fea635", null ],
[ "updateWeightSlider", "class_appearance_widget.html#a99775cd79e188d979519fc2ccfcd1495", null ],
[ "fAcceptChanges", "class_appearance_widget.html#a261518495992c2278c6a96ddb37fdd06", null ],
[ "mapper", "class_appearance_widget.html#a5672ef7845daca581cbc6e13daa35e36", null ],
[ "model", "class_appearance_widget.html#af168272b4f019db49d59b185dee9b9d5", null ],
[ "prevFontFamily", "class_appearance_widget.html#a10077aedab6bc9f3cfbda63a7561bcb7", null ],
[ "prevScale", "class_appearance_widget.html#a25bbcf2d04612e7c56309c9eb817827f", null ],
[ "prevTheme", "class_appearance_widget.html#a8bdb61a1a557967bccff7eb54f919179", null ],
[ "prevWeightBold", "class_appearance_widget.html#a5a71ad66d2facc56bb7eff2e47ec36bf", null ],
[ "prevWeightNormal", "class_appearance_widget.html#a4560e30279ca2aca302225467daead79", null ],
[ "ui", "class_appearance_widget.html#a6ed06bc1375f47001feb6b35653a836f", null ]
]; | 85.565217 | 105 | 0.792683 |
bef033be39bedf3b56564a1af2324334eb4122a6 | 3,132 | html | HTML | forget/app/components/forgettingCalculator/forgettingCalculator.html | isaacdomini/branches_front_end_private | 601c8448d5ba15c55aa9e90af44528ee089c656f | [
"Unlicense",
"MIT"
] | 3 | 2018-09-27T17:49:58.000Z | 2020-09-22T08:29:55.000Z | forget/app/components/forgettingCalculator/forgettingCalculator.html | isaacdomini/branches_front_end_private | 601c8448d5ba15c55aa9e90af44528ee089c656f | [
"Unlicense",
"MIT"
] | 2 | 2020-05-07T16:17:20.000Z | 2021-01-05T03:08:53.000Z | forget/app/components/forgettingCalculator/forgettingCalculator.html | isaacdomini/branches_front_end_private | 601c8448d5ba15c55aa9e90af44528ee089c656f | [
"Unlicense",
"MIT"
] | 4 | 2018-09-27T17:50:00.000Z | 2020-06-06T16:20:19.000Z | <div>
<h2>Forgetting Curve Calculator</h2>
<div class="calculators">
<div v-bind:class="{highlight: strengthHighlighted}" v-on:click="setStrengthHighlight">
<div>
<h3>Strength Calculator</h3>
<br>
<div>
If you want to have a <input v-model="r" type="number">% chance of remembering a fact after
</div>
<div><input v-model="years" type="text"> years,</div>
<div><input v-model="months" type="text"> months,</div>
<div><input v-model="weeks" type="text"> weeks,</div>
<div><input v-model="days" type="text"> days,</div>
<div><input v-model="hours" type="text"> hours,</div>
<div><input v-model="minutes" type="text"> minutes,</div>
and <div><input v-model="seconds" type="text"> seconds</div>
<br>
. . . then that fact will need to be encoded as
<span style="font-weight: bold">{{sComputed | truncateToHundredths}}</span> dbE memory in your brain.
</div>
</div>
<div v-bind:class="{highlight: recallHighlighted}" v-on:click="setRecallHighlight">
<h3>Recall Calculator</h3>
If you learned something
<div><input v-model="years" type="text"> years,</div>
<div><input v-model="months" type="text"> months,</div>
<div><input v-model="weeks" type="text"> weeks,</div>
<div><input v-model="days" type="text"> days,</div>
<div><input v-model="hours" type="text"> hours,</div>
<div><input v-model="minutes" type="text"> minutes,</div>
and <div><input v-model="seconds" type="text"> seconds</div>
ago,
and it was encoded as a
<br>
<div>
<input v-model="s" type="number"> dBE
</div>
memory in your brain,
<br>
. . . then today, you would have a
<br>
<span style="font-weight: bold">{{rComputed | times100 | truncateToHundredths}}</span>% chance of remembering that fact
</span>
</div>
<div v-bind:class="{highlight: timeHighlighted}" v-on:click="setTimeHighlight">
<h3>Time Calculator</h3>
You will have a
<div>
<input v-model="r" type="number">% Chance Remembering
</div>
<br>
<div> a
<input v-model="s" type="number"> dBE fact
</div>
<br>
<div style="font-weight: bold">
<div> {{yearsComputed}} years</div>
<div> {{monthsComputed}} months</div>
<div> {{weeksComputed}} weeks</div>
<div> {{daysComputed}} days</div>
<div> {{hoursComputed}} hours</div>
<div> {{minutesComputed}} minutes</div>
<div> {{secondsComputed}} seconds</div>
from now
</div>
</div>
</div>
</div> | 40.153846 | 135 | 0.492656 |
0552f5e8e06e37ddfe49b5f93e3260d16009f8b3 | 992 | rb | Ruby | spec/lib/changed_by_spec.rb | BravoTran/auditable | c309fa345864719718045e9b4f13a0e87a8597a2 | [
"MIT"
] | 13 | 2015-02-26T19:35:43.000Z | 2021-07-18T03:33:17.000Z | spec/lib/changed_by_spec.rb | BravoTran/auditable | c309fa345864719718045e9b4f13a0e87a8597a2 | [
"MIT"
] | null | null | null | spec/lib/changed_by_spec.rb | BravoTran/auditable | c309fa345864719718045e9b4f13a0e87a8597a2 | [
"MIT"
] | 6 | 2015-07-05T10:56:06.000Z | 2022-02-24T22:35:46.000Z | require 'spec_helper'
describe 'Auditable#changed_By' do
describe Survey do
let(:survey) { Survey.create :title => 'Survey', changed_by: User.create( name: 'Surveyor') }
it 'should set changed_by using default' do
survey.audits.last.changed_by.name.should eql 'Surveyor'
end
end
describe Plant do
let(:plant) { Plant.create :name => 'an odd fungus', tastey: false }
it 'should set changed_by from symbol' do
plant.audits.last.changed_by.name.should eql 'Bob'
end
end
describe Tree do
let(:tree) { Tree.create :name => 'a tall pine', tastey: false }
it 'should set changed_by from symbol inherited from parent' do
tree.audits.last.changed_by.name.should eql 'Sue'
end
end
describe Kale do
let(:kale) { Kale.create :name => 'a bunch of leafy kale', tastey: true }
it 'should set changed_by from proc' do
kale.audits.last.changed_by.name.should eql 'bob loves a bunch of leafy kale'
end
end
end
| 24.8 | 97 | 0.677419 |
1638ba286cc1eec20dbd55822cdc91d64552cc05 | 3,157 | h | C | common/melissa_utils.h | melissa-sa/melissa | d07c43a396267d26f52b7b152a385f8a600ac2e8 | [
"BSD-3-Clause"
] | 7 | 2019-09-19T07:16:25.000Z | 2021-05-18T08:27:11.000Z | common/melissa_utils.h | melissa-sa/melissa | d07c43a396267d26f52b7b152a385f8a600ac2e8 | [
"BSD-3-Clause"
] | 4 | 2017-08-09T16:34:41.000Z | 2020-03-12T20:23:46.000Z | common/melissa_utils.h | melissa-sa/melissa | d07c43a396267d26f52b7b152a385f8a600ac2e8 | [
"BSD-3-Clause"
] | 4 | 2019-05-20T10:38:13.000Z | 2020-04-19T08:46:51.000Z | /******************************************************************
* Melissa *
*-----------------------------------------------------------------*
* COPYRIGHT (C) 2017 by INRIA and EDF. ALL RIGHTS RESERVED. *
* *
* This source is covered by the BSD 3-Clause License. *
* Refer to the LICENCE file for further information. *
* *
*-----------------------------------------------------------------*
* Original Contributors: *
* Theophile Terraz, *
* Bruno Raffin, *
* Alejandro Ribes, *
* Bertrand Iooss, *
******************************************************************/
/**
*
* @file melissa_utils.h
* @author Terraz Théophile
* @date 2016-15-02
*
**/
#ifndef MELISSA_UTILS_H
#define MELISSA_UTILS_H
#ifdef __cplusplus
extern "C" {
#endif
#if BUILD_WITH_MPI == 0
#undef BUILD_WITH_MPI
#endif // BUILD_WITH_MPI
#ifdef BUILD_WITH_MPI
#include <mpi.h>
#endif // BUILD_WITH_MPI
#include <stdio.h>
#include <stdint.h>
#ifndef MPI_MAX_PROCESSOR_NAME
#define MPI_MAX_PROCESSOR_NAME 256 /**< Define the macro if mpi.h not present */
#endif
#ifndef MAX_FIELD_NAME
#define MAX_FIELD_NAME 128 /**< Define name size if not defined */
#endif
#define MELISSA_ERROR 0 /**< display only errors */
#define MELISSA_WARNING 1 /**< display errors and warnings */
#define MELISSA_INFO 2 /**< display usefull messages */
#define MELISSA_DEBUG 3 /**< display all messages */
#define VERBOSE_ERROR MELISSA_ERROR, __func__ /**< display only errors */
#define VERBOSE_WARNING MELISSA_WARNING, __func__ /**< display errors and warnings */
#define VERBOSE_INFO MELISSA_INFO, __func__ /**< display usefull messages */
#define VERBOSE_DEBUG MELISSA_DEBUG, __func__ /**< display all messages */
extern int MELISSA_MESSAGE_LEN;
int melissa_get_message_len();
void melissa_logo ();
void* melissa_malloc (size_t size);
void* melissa_calloc (size_t num,
size_t size);
void* melissa_realloc (void *ptr,
size_t size);
void melissa_free (void *ptr);
void melissa_bind (void *socket,
const char *port_name);
void melissa_connect (void *socket,
char *port_name);
double melissa_get_time ();
void melissa_get_node_name (char *node_name, size_t buf_len);
void init_verbose_lvl(int verbose_level);
void melissa_print (int msg_type,
const char* func_name,
const char* format, ...);
void set_bit (uint32_t *vect, int pos);
void clear_bit (uint32_t *vect, int pos);
int test_bit (uint32_t *vect, int pos);
#ifdef __cplusplus
}
#endif
#endif // MELISSA_UTILS_H
| 30.95098 | 86 | 0.510611 |
f05136d88821cb5ba7ae7358c44d2b30837eb2b2 | 938 | py | Python | src/ychaos/cli/exceptions/__init__.py | vanderh0ff/ychaos | 5148c889912b744ee73907e4dd30c9ddb851aeb3 | [
"Apache-2.0"
] | 8 | 2021-07-21T15:37:48.000Z | 2022-03-03T14:43:09.000Z | src/ychaos/cli/exceptions/__init__.py | vanderh0ff/ychaos | 5148c889912b744ee73907e4dd30c9ddb851aeb3 | [
"Apache-2.0"
] | 102 | 2021-07-20T16:08:29.000Z | 2022-03-25T07:28:37.000Z | src/ychaos/cli/exceptions/__init__.py | vanderh0ff/ychaos | 5148c889912b744ee73907e4dd30c9ddb851aeb3 | [
"Apache-2.0"
] | 8 | 2021-07-20T13:37:46.000Z | 2022-02-18T01:44:52.000Z | # Copyright 2021, Yahoo
# Licensed under the terms of the Apache 2.0 license. See the LICENSE file in the project root for terms
from abc import abstractmethod
from typing import Any, Dict
class YChaosCLIError(Exception):
exitcode = 1
def __init__(self, app, message, **kwargs):
self.app = app
self.message: str = message
self.attrs: Dict[str, Any] = kwargs
@abstractmethod
def handle(self) -> None:
"""
Handle is the method that is called during teardown to handle a particular type of error
Any subcommand can raise a sub class of YChaosCLIError and forget about the exception.
The main teardown module takes responsibility of calling the handle method
This can be used to print message of exception or handle the panic in a suitable way
"""
if self.app.is_debug_mode():
self.app.console.print_exception(extra_lines=2)
| 33.5 | 105 | 0.687633 |
16050092ac6044d4356de0dc5cb5a2733358e7e6 | 515 | h | C | src/Leds.h | Fberbari/AAQuad-Evolution | f814018da1e38333389a09ace3ae72fe93b4eaa8 | [
"MIT"
] | 5 | 2020-02-01T20:11:28.000Z | 2021-09-29T19:57:06.000Z | src/Leds.h | Fberbari/AAQuad-Evolution | f814018da1e38333389a09ace3ae72fe93b4eaa8 | [
"MIT"
] | null | null | null | src/Leds.h | Fberbari/AAQuad-Evolution | f814018da1e38333389a09ace3ae72fe93b4eaa8 | [
"MIT"
] | null | null | null | #ifndef _LEDS_H
#define _LEDS_H
#include "Common.h"
/***********************************************************************************************************************
* Prototypes
**********************************************************************************************************************/
void Leds_Init(void);
void Leds_SetLed0(void);
void Leds_ClearLed0(void);
void Leds_ToggleLed0(void);
void Leds_SetLed1(void);
void Leds_ClearLed1(void);
void Leds_ToggleLed1(void);
#endif // _LEDS_H
| 23.409091 | 120 | 0.405825 |
29e5c756a84a0fef8328e338fe3aa591f9b3fbf3 | 7,032 | lua | Lua | scripts/claim-ground-items.lua | ajs/dfhack-scripts | 6aaf1727614559d5a91a5f5cccc9bcd8a437d768 | [
"MIT"
] | null | null | null | scripts/claim-ground-items.lua | ajs/dfhack-scripts | 6aaf1727614559d5a91a5f5cccc9bcd8a437d768 | [
"MIT"
] | null | null | null | scripts/claim-ground-items.lua | ajs/dfhack-scripts | 6aaf1727614559d5a91a5f5cccc9bcd8a437d768 | [
"MIT"
] | null | null | null | -----
-- Find any unattended items that have flags that prevent being picked up
-- OTHER THAN explicitly being forbidden and make them accessible.
local item_count = 0
for _,item in ipairs(df.global.world.items.all) do
if item.flags.on_ground and not item.flags.forbid then
local name = dfhack.items.getDescription(item, item:getType())
local item_is = 0
if item.flags.trader then
print("Trader item: "..name)
item_count = item_count + 1
item.flags.trader = false
else if item.flags.hostile then
print("Hostile owned item: "..name)
item_count = item_count + 1
item.flags.hostile = false
else if item.flags.hidden then
print("Hidden item: "..name)
item_count = item_count + 1
item.flags.hidden = false
else if item.flags.removed then
print("Removed item: "..name)
item_count = item_count + 1
item.flags.removed = false
end end end end
end
end
if item_count > 0 then
print("Total reclaimed items: "..item_count)
end
-- What follows is a script by PatrikLundell on the Dwarf Fortress forums.
local enemy_civs = {}
for i, diplomacy in ipairs (df.global.world.entities.all [df.global.ui.civ_id].relations.diplomacy) do
if df.global.world.entities.all [diplomacy.group_id].type == df.historical_entity_type.Civilization and
diplomacy.relation == 1 then -- 1 seems to be war, while 0 is peace for civs. Sites seem to use a different encoding.
table.insert (enemy_civs, dfhack.TranslateName (df.global.world.entities.all [diplomacy.group_id].name, true))
end
end
---------------------------
function Is_Enemy_Civ (civ)
for i, enemy in ipairs (enemy_civs) do
if dfhack.TranslateName (civ.name, true) == enemy then
return true
end
end
return false
end
---------------------------
function y ()
local dumped = 0
local dump_forbidden = 0
local dump_foreign = 0
local dump_trader = 0
local melt = 0
local trader_ground = 0
for i, item in ipairs (df.global.world.items.all) do
if item.flags.dump then
dumped = dumped + 1
if item.flags.forbid then
dump_forbidden = dump_forbidden + 1
end
if item.flags.foreign then
dump_foreign = dump_foreign + 1
end
if item.flags.trader then
dump_trader = dump_trader + 1
end
end
if item.flags.melt then
melt = melt + 1
end
if item.flags.on_ground and
item.flags.trader then
trader_ground = trader_ground + 1
if item.subtype.id == "ITEM_TOOL_SCROLL" then
item.flags.trader = false
dfhack.println ("Claiming scroll")
else
printall (item.subtype)
end
end
end
dfhack.println ("Dump designated: " .. tostring (dumped) .. ", Foreign: " .. tostring (dump_foreign) .. ", Trader: " .. tostring (dump_trader) .. ", Trader on the ground: " .. tostring (trader_ground) .. ", Melt designated: " .. tostring (melt))
---------------------------
for i, unit in ipairs (df.global.world.units.all) do
if (dfhack.TranslateName(dfhack.units.getVisibleName(unit), true) ~= dfhack.TranslateName (unit.name, true) or
#unit.status.souls > 1) and
not unit.flags2.killed then
dfhack.println (dfhack.TranslateName(dfhack.units.getVisibleName(unit), true), dfhack.TranslateName (unit.name, true))
end
local hf = df.historical_figure.find (unit.hist_figure_id)
if not unit.flags2.killed and
hf and
hf.info.reputation then
if #hf.info.reputation.all_identities > 0 then
dfhack.color (COLOR_LIGHTRED)
dfhack.println ("Has false identities:", dfhack.TranslateName (unit.name, true), dfhack.TranslateName (unit.name, false), #hf.info.reputation.all_identities, hf.id)
for k, identity_id in ipairs (hf.info.reputation.all_identities) do
local identity = df.identity.find (identity_id)
dfhack.println ("", dfhack.TranslateName (identity.name, true), dfhack.TranslateName (identity.name, false), identity.histfig_id, df.identity_type [identity.type])
end
dfhack.color (COLOR_RESET)
end
end
end
local trap_count = 0
local spied_trap_count = 0
local civ_observed_count = {}
for i, building in ipairs (df.global.world.buildings.all) do
if building._type == df.building_trapst and
building.trap_type == df.trap_type.CageTrap then
trap_count = trap_count + 1
for k, observer in ipairs (building.observed_by_civs) do
if civ_observed_count [observer] then
civ_observed_count [observer] = civ_observed_count [observer] + 1
else
civ_observed_count [observer] = 1
end
end
end
end
dfhack.println ("Trap Count: " .. tostring (trap_count))
---------------------------
for i, count in pairs (civ_observed_count) do
local civ = df.historical_entity.find (i)
if civ.race == -1 then
-- dfhack.println (" Traps observed by the " .. df.historical_entity_type [civ.type] .. " " .. dfhack.TranslateName (civ.name, true) .. ": " .. tostring (count))
else
if df.global.world.raws.creatures.all [civ.race].name [0] == "goblin" or
Is_Enemy_Civ (civ) then
dfhack.color (COLOR_LIGHTRED)
dfhack.println (" Traps observed by the " .. df.global.world.raws.creatures.all [civ.race].name [0] .. " " ..
df.historical_entity_type [civ.type] .. " " .. dfhack.TranslateName (civ.name, true) .. ": " .. tostring (count))
end
-- dfhack.println (" Traps observed by the " .. df.global.world.raws.creatures.all [civ.race].name [0] .. " " ..
-- df.historical_entity_type [civ.type] .. " " .. dfhack.TranslateName (civ.name, true) .. ": " .. tostring (count))
dfhack.color (COLOR_RESET)
end
end
local goblin_found = false
for i, unit in ipairs (df.global.world.units.active) do
local civ = df.historical_entity.find (unit.civ_id)
if civ and
civ.race ~= -1 and
(df.global.world.raws.creatures.all [civ.race].name [0] == "goblin" or
Is_Enemy_Civ (civ)) and
not unit.flags1.marauder and
unit.flags2.visitor and
dfhack.units.isAlive (unit) then
-- not unit.flags1.invader_origin and
-- not unit.flags1.invades and
-- not unit.flags2.visitor_uninvited
if not goblin_found then
goblin_found = true
dfhack.println ()
dfhack.println ("Enemy civ members present:")
end
dfhack.color (COLOR_LIGHTRED)
dfhack.println (dfhack.TranslateName (unit.name, true), dfhack.TranslateName (unit.name, false), dfhack.TranslateName (civ.name, true))
dfhack.color (COLOR_RESET)
end
end
end
y () | 35.877551 | 248 | 0.621729 |
121daa4d779fb360ebf7a587538e7944d10e34ea | 7,029 | h | C | include/defs.h | tengcm2015/xv6_rpi2_port | a4247ff6cfd3ba5e5f37134f68959a82e77f4ba8 | [
"MIT"
] | 2 | 2019-08-02T02:40:30.000Z | 2019-08-02T02:43:37.000Z | include/defs.h | tengcm2015/xv6_rpi2_port | a4247ff6cfd3ba5e5f37134f68959a82e77f4ba8 | [
"MIT"
] | null | null | null | include/defs.h | tengcm2015/xv6_rpi2_port | a4247ff6cfd3ba5e5f37134f68959a82e77f4ba8 | [
"MIT"
] | null | null | null | #ifndef DEFS_H
#define DEFS_H
struct buf;
struct context;
struct file;
struct inode;
struct pipe;
struct proc;
struct spinlock;
struct stat;
struct superblock;
struct trapframe;
void OkLoop(void);
void NotOkLoop(void);
// arm.c
uint inw(uint addr);
void outw(uint addr, uint data);
void cli (void);
void sti (void);
uint readcpsr(void);
uint cpsr_usr(void);
int int_enabled();
void pushcli(void);
void popcli(void);
void getcallerpcs(void *, uint*);
void show_callstk(char *);
// asm.S
void set_stk(uint mode, uint addr);
void* get_fp(void);
void* get_sp(void);
uint get_cpunum(void);
void enable_interrupts(void);
void invalidate_dcache_all(void);
void clean_inval_dcache_all(void);
// bio.c
void binit(void);
struct buf* bread(uint, uint);
void brelse(struct buf*);
void bwrite(struct buf*);
// buddy.c
void kmem_init (void);
void kmem_init2(void *vstart, void *vend);
void* kmalloc (int order);
void kfree (void *mem, int order);
void free_page(void *v);
void* alloc_page (void);
void kmem_test_b (void);
int get_order (uint32 v);
// cache.c
void flush_dcache_all(void);
void invalidate_icache_all(void);
void invalidate_tlb (void);
// console.c
void consoleinit(void);
void cprintf(char*, ...);
void consoleintr(int(*)(void));
void panic(char*) __attribute__((noreturn));
void drawcharacter(uint8, uint, uint);
void gpuputc(uint);
// memide.c
void ideinit(void);
void ideintr(void);
void iderw(struct buf*);
// exec.c
int exec(char*, char**);
// file.c
struct file* filealloc(void);
void fileclose(struct file*);
struct file* filedup(struct file*);
void fileinit(void);
int fileread(struct file*, char*, int n);
int filestat(struct file*, struct stat*);
int filewrite(struct file*, char*, int n);
// fs.c
void readsb(int dev, struct superblock *sb);
int dirlink(struct inode*, char*, uint);
struct inode* dirlookup(struct inode*, char*, uint*);
struct inode* ialloc(uint, short);
struct inode* idup(struct inode*);
void iinit(void);
void ilock(struct inode*);
void iput(struct inode*);
void iunlock(struct inode*);
void iunlockput(struct inode*);
void iupdate(struct inode*);
int namecmp(const char*, const char*);
struct inode* namei(char*);
struct inode* nameiparent(char*, char*);
int readi(struct inode*, char*, uint, uint);
void stati(struct inode*, struct stat*);
int writei(struct inode*, char*, uint, uint);
// kalloc.c
// char* kalloc(void);
// void kfree(char*);
// void kinit1(void*, void*);
// void kinit2(void*, void*);
// void kmem_init (void);
// log.c
void initlog(void);
void log_write(struct buf*);
void begin_trans();
void commit_trans();
// main.c
int cpuutil(int, int, int);
// pipe.c
int pipealloc(struct file**, struct file**);
void pipeclose(struct pipe*, int);
int piperead(struct pipe*, char*, int);
int pipewrite(struct pipe*, char*, int);
//PAGEBREAK: 16
// proc.c
struct proc* copyproc(struct proc*);
void exit(void);
int fork(void);
int growproc(int);
int kill(int);
void pinit(void);
void procdump(void);
void scheduler(void) __attribute__((noreturn));
void sched(void);
void sleep(void*, struct spinlock*);
void userinit(void);
int wait(void);
void wakeup(void*);
void yield(void);
void dump_context (struct context *c);
void procdump(void);
// swtch.S
void swtch(struct context**, struct context*);
// keyboard.S
int UsbInitialise(void);
void KeyboardUpdate(void);
char KeyboardGetChar(void);
uint KeyboardCount(void);
uint KeyboardGetAddress(uint);
struct KeyboardLeds KeyboardGetLedSupport(uint);
// spinlock.c
void acquire(struct spinlock*);
int holding(struct spinlock*);
void initlock(struct spinlock*, char*);
void release(struct spinlock*);
// string.c
int memcmp(const void*, const void*, uint);
void* memmove(void*, const void*, uint);
void* memset(void*, int, uint);
void* memcpy(void *dst, const void *src, uint n);
char* safestrcpy(char*, const char*, int);
int strlen(const char*);
int strncmp(const char*, const char*, uint);
char* strncpy(char*, const char*, int);
uint div(uint n, uint d);
// syscall.c
int argint(int, int*);
int argptr(int, char**, int);
int argstr(int, char**);
int fetchint(uint, int*);
int fetchstr(uint, char**);
void syscall(void);
// timer.c
void timer3init(void);
void timer3intr(void);
void delay(uint);
extern struct spinlock tickslock;
extern uint ticks;
// trap.c
void trap_init(void);
void stack_init(void);
void dump_trapframe (struct trapframe *tf);
// trap_asm.S
void trap_reset(void);
void trap_und(void);
void trap_swi(void);
void trap_iabort(void);
void trap_dabort(void);
void trap_na(void);
void trap_irq(void);
void trap_fiq(void);
// uart.c
void uartinit(int);
void miniuartintr(void);
void uartputc(uint);
void setgpiofunc(uint, uint);
void setgpioval(uint, uint);
void led_flash(int, int);
void led_flash_no_map(int, int);
// vm.c
int allocuvm(pde_t*, uint, uint);
int deallocuvm(pde_t*, uint, uint);
void freevm(pde_t*);
void inituvm(pde_t*, char*, uint);
int loaduvm(pde_t*, char*, struct inode*, uint, uint);
pde_t* copyuvm(pde_t*, uint);
void switchuvm(struct proc*);
int copyout(pde_t*, uint, void*, uint);
void clearpteu(pde_t *pgdir, char *uva);
void* kpt_alloc(void);
void init_vmm (void);
void kpt_freerange (uint32 low, uint32 hi);
void paging_init (uint phy_low, uint phy_hi);
void map_vectors (uint vector_start);
// number of elements in fixed-size array
#define NELEM(x) (sizeof(x)/sizeof((x)[0]))
#endif
| 30.038462 | 66 | 0.550007 |
7fd3b2d2bf1b371d0081780ffac85d0eab4453e0 | 1,731 | go | Go | service/UserService.go | watter08/NotitiaGolang | cef8ba1c6d92e3700fafc17f9c3d062738c467ad | [
"MIT"
] | 5 | 2017-11-20T17:38:41.000Z | 2021-11-25T09:11:06.000Z | service/UserService.go | watter08/NotitiaGolang | cef8ba1c6d92e3700fafc17f9c3d062738c467ad | [
"MIT"
] | null | null | null | service/UserService.go | watter08/NotitiaGolang | cef8ba1c6d92e3700fafc17f9c3d062738c467ad | [
"MIT"
] | 5 | 2018-09-07T13:27:50.000Z | 2021-03-12T09:54:36.000Z | package service
import (
"go-restful-mvc/model"
)
func NewUser(user *model.User) (int, interface{}) {
// Your db call service implementation instead of resSuccess:=
resSuccess := model.BaseResponse{
Status: 200,
Message: "Success create new user, email: " + user.Email,
}
return 200, resSuccess
}
func FindUserByEmail(email string) (int, interface{}) {
// Your db call service implementation instead of user:=
user := model.UserDetailDtoResponse{
Email: email,
FullName: "mczal",
Role: "user",
}
result := model.BaseSingleResponse{
Status: 200,
Message: "Success",
Value: user,
}
return 200, result
}
func ScanUser() (int, interface{}) {
// Your db call service implementation instead of users:=
users := []model.UserSimpleDtoResponse{
{
Email: "[email protected]",
FullName: "mczal1",
Role: "user",
},
{
Email: "[email protected]",
FullName: "mczal",
Role: "user",
},
{
Email: "[email protected]",
FullName: "mczal3",
Role: "user",
},
}
userInts := make([]interface{}, len(users))
for i, v := range users {
userInts[i] = interface{}(v)
}
result := model.BaseListResponse{
Status: 200,
Message: "Success",
Content: userInts,
}
return 200, result
}
func FindUserByID(userID string) (int, interface{}) {
// Your db call service implementation instead of user:=
user := model.UserDetailDtoResponse{
Email: "[email protected]",
FullName: "mczal fullname",
Address: "Mczal Street 313",
Role: "user",
PhoneNumber: "1111111",
}
succRes := model.BaseSingleResponse{
Status: 200,
Message: "Success get user by id: " + userID,
Value: user,
}
return 200, succRes
}
| 20.127907 | 63 | 0.641248 |
5810b8eb3ad46fd383f291d1b5a362d6b0b688b6 | 45 | h | C | KiraraScreen/KiraraScreen/_Main.h | stackprobe/Kirara2 | 9f26878aca05ba7257e0cef15489d60e9427ee77 | [
"MIT"
] | null | null | null | KiraraScreen/KiraraScreen/_Main.h | stackprobe/Kirara2 | 9f26878aca05ba7257e0cef15489d60e9427ee77 | [
"MIT"
] | null | null | null | KiraraScreen/KiraraScreen/_Main.h | stackprobe/Kirara2 | 9f26878aca05ba7257e0cef15489d60e9427ee77 | [
"MIT"
] | null | null | null | void Pub_AddInstantMessage_x(char *message);
| 22.5 | 44 | 0.844444 |
38e61b4b282051f06e91701514a13798774af8c3 | 181 | lua | Lua | scripts/UnmuteNotes.lua | StephenWeatherford/dorico-scripts | 1ebb0ee22a1c30c846ffcf6405cff69059ff14c5 | [
"MIT"
] | 1 | 2021-04-01T17:27:49.000Z | 2021-04-01T17:27:49.000Z | scripts/UnmuteNotes.lua | StephenWeatherford/dorico-scripts | 1ebb0ee22a1c30c846ffcf6405cff69059ff14c5 | [
"MIT"
] | null | null | null | scripts/UnmuteNotes.lua | StephenWeatherford/dorico-scripts | 1ebb0ee22a1c30c846ffcf6405cff69059ff14c5 | [
"MIT"
] | null | null | null | local app=DoApp.DoApp()
app:doCommand([[UI.InvokePropertyEnableSwitch?Type=kEventColour&Value=false]])
app:doCommand([[UI.InvokePropertyEnableSwitch?Type=kEventMuted&Value=false]])
| 45.25 | 78 | 0.823204 |
e03d30a72b1a70a57e509e2999282a922a23af53 | 567 | asm | Assembly | oeis/248/A248179.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/248/A248179.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/248/A248179.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A248179: Decimal expansion of (2/27)*(9 + 2*sqrt(3)*Pi).
; Submitted by Jon Maiga
; 1,4,7,2,7,9,9,7,1,7,4,3,7,4,3,0,1,5,5,8,1,9,5,9,0,3,3,6,7,2,9,8,4,6,9,9,2,1,2,6,2,5,1,6,6,5,8,1,8,9,9,5,8,1,1,3,6,4,3,9,3,3,0,4,6,1,6,9,4,3,6,3,6,0,5,6,1,5,7,2,8,1,6,3,7,3,8,8,8,8,3,6,4,9,8,0,4,5,1,9
mov $2,1
mov $3,$0
mul $3,5
lpb $3
mul $1,$3
mov $5,$3
sub $5,1
mul $5,2
add $5,1
mul $2,$5
add $1,$2
cmp $4,0
mov $5,$0
add $5,$4
div $1,$5
div $2,$5
mul $2,2
sub $3,1
lpe
mul $1,4
mov $6,10
pow $6,$0
div $2,$6
div $1,$2
add $1,$6
mov $0,$1
mod $0,10
| 17.71875 | 201 | 0.511464 |
4789381907565dda62e37d95ef8e6c541fa056c7 | 1,330 | html | HTML | public/index.html | gabrielbarragan/workshop1-fetch | a6ebcd16f77d5540e2f5ad0cd9a2b20aa2710d6d | [
"MIT"
] | null | null | null | public/index.html | gabrielbarragan/workshop1-fetch | a6ebcd16f77d5540e2f5ad0cd9a2b20aa2710d6d | [
"MIT"
] | null | null | null | public/index.html | gabrielbarragan/workshop1-fetch | a6ebcd16f77d5540e2f5ad0cd9a2b20aa2710d6d | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="description"
content="Web site created using create-snowpack-app"
/>
<link
rel="stylesheet"
type="text/css"
href="%PUBLIC_URL%/_dist_/index.css"
/>
<title>Gabriel aprende</title>
</head>
<body>
<div class="py-10 max-w-screen-xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="text-center">
<p
class="text-base leading-6 text-yellow-100 font-semibold tracking-wide uppercase"
>
Aprendiendo - La tienda de aguacates-
</p>
<h3
class="mt-2 text-3xl leading-8 font-extrabold tracking-tight text-green-200 sm:text-4xl sm:leading-10"
>
Aguacates- Gabo
</h3>
<p class="mt-4 max-w-2xl text-xl leading-7 text-gray-50 mx-auto">
Este es un proyecto de clase, donde aprendo a manejar el DOM usando Javascript
</p>
<div id="app"></div> <!-- se suele usar un div con id app, mount o container-->
</div>
</div>
<!-- Add more scripts here -->
<script type="module" src="%PUBLIC_URL%/_dist_/index.js"></script>
</body>
</html>
| 30.227273 | 112 | 0.583459 |
0bb51dc78ddd2967ca706bd880e3869f1feac056 | 4,633 | py | Python | lib/taurus/qt/qtgui/panel/report/basicreport.py | MikeFalowski/taurus | ef041bf35dd847caf08a7efbe072f4020d35522e | [
"CC-BY-3.0"
] | 1 | 2016-10-19T13:54:08.000Z | 2016-10-19T13:54:08.000Z | lib/taurus/qt/qtgui/panel/report/basicreport.py | MikeFalowski/taurus | ef041bf35dd847caf08a7efbe072f4020d35522e | [
"CC-BY-3.0"
] | 27 | 2016-05-25T08:56:58.000Z | 2019-01-21T09:18:08.000Z | lib/taurus/qt/qtgui/panel/report/basicreport.py | MikeFalowski/taurus | ef041bf35dd847caf08a7efbe072f4020d35522e | [
"CC-BY-3.0"
] | 8 | 2015-07-24T09:16:50.000Z | 2018-06-12T12:33:59.000Z | #!/usr/bin/env python
#############################################################################
##
# This file is part of Taurus
##
# http://taurus-scada.org
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Taurus is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
##
# Taurus is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
##
# You should have received a copy of the GNU Lesser General Public License
# along with Taurus. If not, see <http://www.gnu.org/licenses/>.
##
#############################################################################
"""This module provides a panel to display taurus messages"""
__all__ = ["ClipboardReportHandler", "SMTPReportHandler"]
__docformat__ = 'restructuredtext'
from taurus.core.util.report import TaurusMessageReportHandler
from taurus.external.qt import Qt
from taurus.qt.qtgui.util.ui import UILoadable
class ClipboardReportHandler(TaurusMessageReportHandler):
"""Report a message by copying it to the clipboard"""
Label = "Copy to Clipboard"
def report(self, message):
app = Qt.QApplication.instance()
clipboard = app.clipboard()
clipboard.setText(message)
Qt.QMessageBox.information(None, "Done!",
"Message Copied to clipboard")
@UILoadable(with_ui='ui')
class SendMailDialog(Qt.QDialog):
def __init__(self, parent=None):
Qt.QDialog.__init__(self, parent)
self.loadUi(filename="SendMailForm.ui")
self.ui.buttonBox.accepted.connect(self.accept)
self.ui.buttonBox.rejected.connect(self.reject)
self.ui.editMessage.setFont(Qt.QFont("Monospace"))
def setFrom(self, efrom):
self.ui.lineEditFrom.setText(efrom)
def setTo(self, eto):
self.ui.editTo.setText(eto)
def setSubject(self, subject):
self.ui.editSubject.setText(subject)
def setMessage(self, message):
self.ui.editMessage.setPlainText(message)
def getFrom(self):
return str(self.ui.editFrom.text())
def getTo(self):
return str(self.ui.editTo.text())
def getSubject(self):
return str(self.ui.editSubject.text())
def getMessage(self):
return str(self.ui.editMessage.toPlainText())
def getMailInfo(self):
return self.getFrom(), self.getTo(), self.getSubject(), \
self.getMessage()
class SMTPReportHandler(TaurusMessageReportHandler):
"""Report a message by sending an email"""
Label = "Send email"
def report(self, message):
app = Qt.QApplication.instance()
subject = "Error in " + app.applicationName()
dialog = self.createDialog(subject=subject, message=message)
if not dialog.exec_():
return
mail_info = dialog.getMailInfo()
try:
self.sendMail(*mail_info)
Qt.QMessageBox.information(None, "Done!",
"Email has been sent!")
except:
import sys
import traceback
einfo = sys.exc_info()[:2]
msg = "".join(traceback.format_exception_only(*einfo))
Qt.QMessageBox.warning(None, "Failed to send email",
"Failed to send email. Reason:\n\n" + msg)
def sendMail(self, efrom, eto, subject, message):
import smtplib
import email.mime.text
msg = email.mime.text.MIMEText(message)
msg['From'] = efrom
msg['To'] = eto
msg['Subject'] = subject
s = smtplib.SMTP('localhost')
s.sendmail(efrom, eto, msg.as_string())
s.quit()
def getDialogClass(self):
return SendMailDialog
def createDialog(self, efrom=None, eto=None, subject=None, message=None):
dialog = self.getDialogClass()()
dialog.setWindowTitle("Compose message")
if efrom is not None:
dialog.setFrom(efrom)
if eto is not None:
dialog.setFrom(eto)
if subject is not None:
dialog.setSubject(subject)
if message is not None:
dialog.setMessage(message)
return dialog
def main():
app = Qt.QApplication([])
w = SendMailDialog()
w.exec_()
if __name__ == "__main__":
main()
| 29.890323 | 77 | 0.618821 |
9c68062a58c52bec86735b0eb7c560dfe7a5284a | 2,096 | js | JavaScript | waltz-ng/client/common/svelte/calendar-heatmap/calendar-heatmap-utils.js | G-Research/waltz | 512049af0fd117af68f16bf6dd10c12207e8623f | [
"Apache-2.0"
] | 77 | 2016-06-17T11:01:16.000Z | 2020-02-28T04:00:31.000Z | waltz-ng/client/common/svelte/calendar-heatmap/calendar-heatmap-utils.js | khartec/waltz | fdfa6f386b70f2308b9abeecf804be350707b398 | [
"Apache-2.0"
] | 2,778 | 2016-01-21T20:44:52.000Z | 2020-03-09T13:27:07.000Z | waltz-ng/client/common/svelte/calendar-heatmap/calendar-heatmap-utils.js | G-Research/waltz | 512049af0fd117af68f16bf6dd10c12207e8623f | [
"Apache-2.0"
] | 42 | 2016-01-21T21:54:58.000Z | 2020-03-05T21:06:46.000Z | import _ from "lodash";
export function prepareMonthData(data = [], startDate, endDate) {
let months = [];
const startMonth = startDate.getMonth();
const startYear = startDate.getFullYear();
let initialCalendarDate = new Date(startYear, startMonth, 1);
while (initialCalendarDate < endDate) {
const date = new Date(initialCalendarDate);
const month = {
startDate: date,
days: mkDaysForMonth(data, date)
}
months.push(month);
initialCalendarDate = new Date(initialCalendarDate.setMonth(initialCalendarDate.getMonth() + 1))
}
return months
}
function mkDateKeyFromDateStr(dateStr) {
const date = new Date(dateStr);
return mkDateKeyFromComponents(date.getMonth() + 1, date.getDate(), date.getFullYear());
}
function mkDateKeyFromComponents(month, day, year) {
return year * 10000 + month * 100 + day;
}
function toDateFromDateKey(dateKey) {
let year = Math.floor(dateKey / 10000);
let month = Math.floor(dateKey % 10000 / 100);
let date = Math.floor(dateKey % 100);
return new Date(year, month - 1, date);
}
function mkDaysForMonth(data, date) {
let month = date.getMonth() + 1;
let year = date.getFullYear();
let dayCount = daysInMonth(month, year);
let dataByDate = _.keyBy(data, d => mkDateKeyFromDateStr(d.date));
return _.map(_.range(dayCount), x => {
let day = x + 1;
let dateKey = mkDateKeyFromComponents(month, day, year);
let value = _.get(dataByDate, [dateKey, "count"], 0);
return {date: toDateFromDateKey(dateKey), value}
});
}
export function daysInMonth(month, year) {
return new Date(year, month, 0).getDate();
}
export const monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
export const dimensions = {
diagram: {
width: 2400,
height: 800
},
day: {
width: 20
},
month: {
width: 150,
height: 160
},
circleRadius: 8,
weekPadding: 10,
monthsPerLine: 6
} | 23.288889 | 111 | 0.619275 |
168b54e73d5a4d57fae827d58cdc591a06aa87c1 | 1,455 | h | C | include/FrameBuffer.h | danielabbott/Painting-Application-prototype | 96de14a184f8649b609d618c6b24ea6b0c580c68 | [
"MIT"
] | null | null | null | include/FrameBuffer.h | danielabbott/Painting-Application-prototype | 96de14a184f8649b609d618c6b24ea6b0c580c68 | [
"MIT"
] | 1 | 2018-11-04T08:12:43.000Z | 2019-02-10T14:18:23.000Z | include/FrameBuffer.h | danielabbott/Painting-Application-prototype | 96de14a184f8649b609d618c6b24ea6b0c580c68 | [
"MIT"
] | null | null | null | #pragma once
#include <ArrayTexture.h>
// Use glBindFragDataLocation to bind fragment shader outputs to a colour attachment
class ArrayTextureFrameBuffer
{
GLuint frameBufferName = 0;
unsigned int size = 0;
ArrayTexture * arrayTexture;
public:
ArrayTextureFrameBuffer(ArrayTexture & arrayTexture, unsigned int arrayTextureIndex);
ArrayTextureFrameBuffer(ArrayTextureFrameBuffer const&) = delete;
ArrayTextureFrameBuffer(ArrayTextureFrameBuffer &&) = delete;
ArrayTextureFrameBuffer& operator=(const ArrayTextureFrameBuffer&&) = delete;
~ArrayTextureFrameBuffer();
// For drawing on the framebuffer
void bindFrameBuffer() const;
};
class FrameBuffer
{
GLuint frameBufferName = 0;
GLuint backingTextureId;
ImageFormat type;
unsigned int width = 0;
unsigned int height = 0;
void create();
public:
FrameBuffer(ImageFormat type, unsigned int width, unsigned int height, bool createWhenNeeded = false);
FrameBuffer(FrameBuffer const&) = delete;
FrameBuffer(FrameBuffer &&) = default;
FrameBuffer& operator=(const FrameBuffer&&) = delete;
~FrameBuffer();
// uses GL_ARB_clear_texture if available, otherwise will bind the framebuffer
void clear();
// For drawing on the framebuffer
void bindFrameBuffer();
// For using this framebuffer as a texture to draw with
void bindTexture();
// The texture MUST be bound when this function is called
void getTexureData(void * outputBuffer);
};
void bind_default_framebuffer();
| 25.982143 | 103 | 0.77457 |
59452a77e1114367768125aa4e3d4d08a8301a28 | 4,957 | lua | Lua | projects/tutorials/tutscripts/T009-udp_network.lua | pixeljetstream/luxinia1 | 5d69b2d47d5ed4501dc155cfef999475f2fdfe2a | [
"Unlicense",
"MIT"
] | 31 | 2015-01-05T18:22:15.000Z | 2020-12-07T03:21:50.000Z | projects/tutorials/tutscripts/T009-udp_network.lua | pixeljetstream/luxinia1 | 5d69b2d47d5ed4501dc155cfef999475f2fdfe2a | [
"Unlicense",
"MIT"
] | null | null | null | projects/tutorials/tutscripts/T009-udp_network.lua | pixeljetstream/luxinia1 | 5d69b2d47d5ed4501dc155cfef999475f2fdfe2a | [
"Unlicense",
"MIT"
] | 12 | 2015-01-05T19:17:44.000Z | 2021-01-15T08:56:06.000Z | -- UDP Server/Client application
view = UtilFunctions.simplerenderqueue()
view.rClear:colorvalue(0.0,0.0,0.0,0)
dofile "T009/udp.lua"
mainframe = TitleFrame:new(0,0,180,80,nil,"Main Menu")
mainframe.startserver = mainframe:add(
Button:new(5,25,170,25,"Start server"))
mainframe.startclient = mainframe:add(
Button:new(5,50,170,25,"Start client"))
--------- logging component
function createLogLabel (...)
local label = Label:new(...)
label:setAlignment(
Label.LABEL_ALIGNLEFT,Label.LABEL_ALIGNTOP)
function label:reset() self.loglines = {} end
function label:log(fmt,...)
local line = select('#',...)==0 and tostring(fmt)
or fmt:format(...)
local str = self:wrapLine(line)
for nl,line in str:gmatch("(\n?)([^\n]*)") do
if #nl+#line>0 then
table.insert(self.loglines,line)
end
end
self:scrollto()
end
function label:scrollto(line)
line = line or #self.loglines
local lines = {}
for i=math.max(1,line-self:getMaxLines()+1),line do
lines[#lines+1] = self.loglines[i]
end
self:setText(table.concat(lines,"\n"))
end
label:reset()
return label
end
mainframe.serverlog = mainframe:add(
createLogLabel(10,28,160,0))
------- moving the frame
local function window_mousePressed(self,me,contains)
if not contains then return end
self:getParent():moveZ(self,1) -- move to front
if me.y<25 then
self:lockMouse()
self.mouselockpos = {me.x,me.y}
end
end
function window_mouseReleased(self,me)
if self:isMouseLocker() then self:unlockMouse() end
end
function window_mouseMoved(self,me)
if self:isMouseLocker() then
local x,y = self:getLocation()
local dx,dy =
me.x-self.mouselockpos[1],
me.y-self.mouselockpos[2]
self:setLocation(x+dx,y+dy)
end
end
mainframe.mousePressed = window_mousePressed
mainframe.mouseReleased = window_mouseReleased
mainframe.mouseMoved = window_mouseMoved
-------- runing the server
function startserver ()
mainframe.serverruns = true
local function logger(...)
mainframe.serverlog:log(...)
end
local function closed ()
return not mainframe.serverruns
end
local function broadcast ()
end
server (logger,closed,broadcast)
Timer.remove("Server")
mainframe.serverruns = nil
end
------- start / stop the server
function mainframe.startserver:onClicked()
if mainframe.serverruns==nil then
mainframe:setSize(180,300)
mainframe.startserver:setText("Stop Server")
mainframe.startserver:setLocation(5,245)
mainframe.startclient:setLocation(5,270)
mainframe.serverlog:setSize(160,210)
mainframe.serverlog:scrollto()
Timer.set("Server",startserver,50)
else
mainframe:setSize(180,80)
mainframe.serverruns = false
mainframe.startserver:setText("Start Server")
mainframe.startserver:setLocation(5,25)
mainframe.startclient:setLocation(5,50)
mainframe.serverlog:setSize(160,0)
end
end
------- start a client
function mainframe.startclient:onClicked()
local window = TitleFrame:new(
mainframe:getX()+mainframe:getWidth(),mainframe:getY(),
200,150,nil,"Client")
Container.getRootContainer():add(window,1)
window.mousePressed = window_mousePressed
window.mouseReleased = window_mouseReleased
window.mouseMoved = window_mouseMoved
local close = window:add(Button:new(168,4,30,20,"exit"))
local running
local conpanel = window:add(GroupFrame:new(10,40,180,80))
conpanel:add(Label:new(10,10,160,16,"Server adress:"))
local serveradr = conpanel:add(TextField:new(10,26,160,20))
local connect = conpanel:add(Button:new(100,48,70,20,
"connect"))
serveradr:setText("localhost")
local chatpanel = GroupFrame:new(4,24,194,124)
local log = chatpanel:add(createLogLabel(5,5,170,90))
local sendtx = chatpanel:add(TextField:new(5,95,120,20))
local send = chatpanel:add(Button:new(122,95,40,20,"Send"))
local bye = chatpanel:add(Button:new(160,95,30,20,"Bye"))
local sendqueue = {}
function send:onClicked()
table.insert(sendqueue,sendtx:getText())
sendtx:setText("")
end
sendtx.onAction = send.onClicked
function bye:onClicked()
running = false
end
function close:onClicked()
running = false
window:remove()
end
function connect:onClicked()
if running~=nil then return end
running = true
conpanel:remove()
window:add(chatpanel)
local function closeit () return not running end
local function receiver (...) log:log(...) end
local function sender ()
return table.remove(sendqueue,1)
end
TimerTask.new(
function ()
client(serveradr:getText(),receiver,sender,closeit)
running = nil
chatpanel:remove()
window:add(conpanel)
end,50)
end
end
Container.getRootContainer():add(mainframe)
MouseCursor.showMouse(true)
-- cleanup for tutorial framework
return function() Timer.remove("Server") end | 26.089474 | 61 | 0.692556 |
1e080f39f9bbb7da23ac802ecb0ec0ceb4e572b4 | 271 | kt | Kotlin | api/src/main/java/com/w3bshark/infinitescroll/api/data/IUser.kt | TylerMcCraw/android-infinite-scroll | 798c178d0c7b14386cd8bccef4257fba71a0dc18 | [
"Apache-2.0"
] | null | null | null | api/src/main/java/com/w3bshark/infinitescroll/api/data/IUser.kt | TylerMcCraw/android-infinite-scroll | 798c178d0c7b14386cd8bccef4257fba71a0dc18 | [
"Apache-2.0"
] | null | null | null | api/src/main/java/com/w3bshark/infinitescroll/api/data/IUser.kt | TylerMcCraw/android-infinite-scroll | 798c178d0c7b14386cd8bccef4257fba71a0dc18 | [
"Apache-2.0"
] | null | null | null | package com.w3bshark.infinitescroll.api.data
/**
* Contract for User data model
*
* Created by Tyler McCraw on 12/12/17.
*/
interface IUser {
var id: Int
var emailAddr: String?
var firstName: String?
var lastName: String?
var photoUrl: String?
}
| 18.066667 | 44 | 0.675277 |
0500b5fed4ac6b499034df8ea3a59ff9f1a083f8 | 349 | lua | Lua | schema/items/ammo/sh_50ammo.lua | VindoesCompooter/Metro-2033 | 792225f9a998eb2e7c249cab2bdcb3c6f582c89c | [
"MIT"
] | 3 | 2019-04-09T09:57:13.000Z | 2019-07-23T22:15:02.000Z | schema/items/ammo/sh_50ammo.lua | VindoesCompooter/Metro-2033 | 792225f9a998eb2e7c249cab2bdcb3c6f582c89c | [
"MIT"
] | 1 | 2021-01-11T22:46:13.000Z | 2021-01-11T22:46:13.000Z | schema/items/ammo/sh_50ammo.lua | VindoesCompooter/Metro-2033 | 792225f9a998eb2e7c249cab2bdcb3c6f582c89c | [
"MIT"
] | 1 | 2021-01-05T13:09:18.000Z | 2021-01-05T13:09:18.000Z | ITEM.name = "Box of .50 AE"
ITEM.model = "models/stalker/ammo/magnum.mdl"
ITEM.exRender = true
ITEM.iconCam = {
pos = Vector(184.46412658691, 155.1947479248, 113.36277008057),
ang = Angle(25, 220, 0),
fov = 2.3932799161492,
}
ITEM.ammo = "z_stalker_deagle"
ITEM.maxQuantity = 24
ITEM.desc = "A Box that contains 24 .50 AE Rounds"
ITEM.price = 70 | 26.846154 | 64 | 0.710602 |
4dacb58cc3ab45a68650158ee2d7cd1496eb4815 | 30,028 | html | HTML | open-post.html | rashmiFartode/adminphp | 1beadb9c3f74b6b8f60a27c209d1132612c84435 | [
"MIT"
] | null | null | null | open-post.html | rashmiFartode/adminphp | 1beadb9c3f74b6b8f60a27c209d1132612c84435 | [
"MIT"
] | null | null | null | open-post.html | rashmiFartode/adminphp | 1beadb9c3f74b6b8f60a27c209d1132612c84435 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<!--[if IE 8]>
<html class="ie ie8" lang="en-US">
<![endif]-->
<!--[if !(IE 8)]><!-->
<html lang="en-US" class="cmsms_html">
<!--<![endif]-->
<!-- Mirrored from eco-nature-html.cmsmasters.net/open-post.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 20 Oct 2018 13:11:42 GMT -->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<link rel="shortcut icon" href="img/favicon-2.jpg" type="image/x-icon" />
<title>Open Post | Eco Nature</title>
<link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Lato:100,300,regular,700,900%7COpen+Sans:300%7CIndie+Flower:regular%7COswald:300,regular,700&subset=latin,latin-ext' type='text/css' media='all' />
<link rel='stylesheet' href='css/revslider.html' type='text/css' media='all' />
<link rel="stylesheet" type="text/css" href="css/settings.css" media="screen" />
<link rel='stylesheet' href='css/style.css' />
<link rel='stylesheet' href='css/adaptive.css' />
<link rel='stylesheet' href='css/retina.css' />
<link rel='stylesheet' href='css/ilightbox.css' />
<link rel='stylesheet' href='css/ilightbox-skins/dark-skin.css' />
<link rel='stylesheet' href='css/cmsms-events-style.css' />
<link rel='stylesheet' href='css/cmsms-events-adaptive.css' />
<link rel='stylesheet' href='css/fontello.css' />
<link rel='stylesheet' href='css/animate.css' />
<link rel='stylesheet' href='css/jquery.isotope.css' type='text/css' media='screen' />
<!--[if lte IE 9]>
<link rel='stylesheet' href='css/ie.css' type='text/css' media='screen' />
<link rel='stylesheet' href='css/econature_fonts.css' type='text/css' media='screen' />
<link rel='stylesheet' href='css/econature_colors_primary.css' type='text/css' media='screen' />
<link rel='stylesheet' href='css/econature_colors_secondary.css' type='text/css' media='screen' />
<![endif]-->
<link rel='stylesheet' href='css/econature.css' />
<link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Oxygen%3A300%2C400%2C700&ver=4.2' type='text/css' media='all' />
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/jquery-migrate.min.js'></script>
<script type='text/javascript' src='js/jsLibraries.min.js'></script>
<script type='text/javascript' src='js/jquery.iLightBox.min.js'></script>
<style type="text/css">
.header_top,
.header_top_outer,
.header_top_inner,
.header_top_aligner {
height : 35px;
}
.header_mid,
.header_mid_outer,
.header_mid .header_mid_inner .search_wrap_inner,
.header_mid .header_mid_inner .slogan_wrap_inner,
.header_mid .header_mid_inner .social_wrap_inner,
.header_mid .header_mid_inner nav > div > ul,
.header_mid .header_mid_inner nav > div > ul > li,
.header_mid .header_mid_inner nav > div > ul > li > a,
.header_mid .header_mid_inner nav > div > ul > li > a > span.nav_bg_clr,
.header_mid .header_mid_inner .logo,
.header_mid .header_mid_inner .resp_nav_wrap_inner {
height : 95px;
}
.header_bot,
.header_bot_outer,
.header_bot .header_bot_inner nav > div > ul,
.header_bot .header_bot_inner nav > div > ul > li,
.header_bot .header_bot_inner nav > div > ul > li > a {
height : 45px;
}
#page.fixed_header #middle {
padding-top : 95px;
}
#page.fixed_header.enable_header_top #middle {
padding-top : 130px;
}
#page.fixed_header.enable_header_bottom #middle {
padding-top : 140px;
}
#page.fixed_header.enable_header_top.enable_header_bottom #middle {
padding-top : 175px;
}
@media only screen and (max-width: 1024px) {
.header_top,
.header_top_outer,
.header_top_inner,
.header_top_aligner,
.header_mid,
.header_mid_outer,
.header_mid .header_mid_inner nav > div > ul,
.header_mid .header_mid_inner nav > div > ul > li,
.header_mid .header_mid_inner nav > div > ul > li > a,
.header_mid .header_mid_inner nav > div > ul > li > a > span.nav_bg_clr,
.header_bot,
.header_bot_outer,
.header_bot .header_bot_inner nav > div > ul,
.header_bot .header_bot_inner nav > div > ul > li,
.header_bot .header_bot_inner nav > div > ul > li > a {
height : auto;
}
#page.fixed_header #middle,
#page.fixed_header.enable_header_top #middle,
#page.fixed_header.enable_header_bottom #middle,
#page.fixed_header.enable_header_top.enable_header_bottom #middle {
padding-top : 0px !important;
}
}
.cmsms_dynamic_cart .widget_shopping_cart_content .cart_list {
overflow-y:auto;
}
.header_mid_inner .logo {
position:static;
}
#footer.cmsms_footer_default .footer_inner {
min-height:450px;
}
.fixed_footer #main {
margin-bottom:450px;
}
.header_mid_inner .logo .logo_retina {
width : 179px;
}
.header_mid .header_mid_inner .logo_wrap {
width : 179px;
}
#cmsms_row_554b576c54360 .cmsms_row_outer_parent {
padding-top: 0px;
}
#cmsms_row_554b576c54360 .cmsms_row_outer_parent {
padding-bottom: 50px;
}
#cmsms_paypal .button{
color: rgba(255, 255, 255, 1);
border-color: rgba(88, 207, 144, 1);
background-color: rgba(88, 207, 144, 1);
font-size: 12px;
}
#cmsms_paypal .button:hover {
color: rgba(151, 156, 164, 1);
border-color: rgba(229, 232, 236, 1);
background-color: rgba(255, 255, 255, 1);
}
</style>
</head>
<body>
<!-- _________________________ Start Page _________________________ -->
<div id="page" class="csstransition cmsms_liquid fixed_header hfeed site">
<!-- _________________________ Start Main _________________________ -->
<div id="main">
<!-- _________________________ Start Header _________________________ -->
<header id="header">
<div class="header_mid" data-height="95">
<div class="header_mid_outer">
<div class="header_mid_inner">
<div class="logo_wrap">
<a href="index-2.html" title="Eco Nature" class="logo">
<img src="img/logo.png" alt="Eco Nature" />
<img class="logo_retina" src="img/logo.png" alt="Eco Nature" width="179" height="44" />
</a>
</div>
<div class="resp_nav_wrap">
<div class="resp_nav_wrap_inner">
<div class="resp_nav_content">
<a class="responsive_nav cmsms-icon-menu-2" href="javascript:void(0);"></a>
</div>
</div>
</div>
<!-- _________________________ Start Navigation _________________________ -->
<nav role="navigation">
<div class="menu-main-container">
<ul id="navigation" class="navigation">
<li>
<a href="#">
<span class="nav_bg_clr"></span>
<span>Home</span>
</a>
<ul class="sub-menu">
<li><a href="index-2.html"><span>Home</span></a></li>
<li><a href="onepage-index.html"><span>Home 2</span></a></li>
<li><a href="boxed-index.html"><span>Home 3</span></a></li>
</ul>
</li>
<li class="current-menu-item">
<a href="#">
<span class="nav_bg_clr"></span>
<span>Layouts</span>
</a>
<ul class="sub-menu">
<li><a href="about-us.html"><span>About Us</span></a></li>
<li><a href="widgets.html"><span>Widgets & Sidebars</span></a></li>
<li><a href="sitemap.html"><span>Sitemap</span></a></li>
<li><a href="404.html"><span>Error Page</span></a></li>
<li class="current_page_item"><a href="open-post.html"><span>Open Post</span></a></li>
<li><a href="open-project.html"><span>Open Project</span></a></li>
<li><a href="open-profile.html"><span>Open Profile</span></a></li>
</ul>
</li>
<li>
<a href="blog.html">
<span class="nav_bg_clr"></span>
<span>Blog</span>
</a>
<ul class="sub-menu">
<li><a href="blog-standard.html"><span>Standard</span></a></li>
<li><a href="blog-masonry.html"><span>Masonry</span></a></li>
<li><a href="blog-timeline.html"><span>Timeline</span></a></li>
</ul>
</li>
<li>
<a href="portfolio.html">
<span class="nav_bg_clr"></span>
<span>Portfolio</span>
</a>
<ul class="sub-menu">
<li><a href="puzzle.html"><span>Puzzle</span></a></li>
<li><a href="grid.html"><span>Grid</span></a></li>
</ul>
</li>
<li>
<a href="#">
<span class="nav_bg_clr"></span>
<span>Profiles</span>
</a>
<ul class="sub-menu">
<li><a href="profiles-vertical.html"><span>Vertical</span></a></li>
<li><a href="profiles-horisontal.html"><span>Horisontal</span></a></li>
</ul>
</li>
<li>
<a href="#">
<span class="nav_bg_clr"></span>
<span>Elements</span>
</a>
<ul class="sub-menu">
<li><a href="typography.html"><span>Typography</span></a></li>
<li>
<a href="#"><span>Shortcodes</span></a>
<ul class="sub-menu cmsms_left">
<li><a href="shortcodes-1.html"><span>Shortcodes #1</span></a></li>
<li><a href="shortcodes-2.html"><span>Shortcodes #2</span></a></li>
<li><a href="shortcodes-3.html"><span>Shortcodes #3</span></a></li>
<li><a href="shortcodes-4.html"><span>Shortcodes #4</span></a></li>
<li><a href="shortcodes-5.html"><span>Shortcodes #5</span></a></li>
</ul>
</li>
<li><a href="forms.html"><span>Forms</span></a></li>
</ul>
</li>
<li>
<a href="contacts.html">
<span class="nav_bg_clr"></span>
<span>Contacts</span>
</a>
</li>
</ul>
</div>
<div class="cl"></div>
</nav>
<!-- _________________________ Finish Navigation _________________________ -->
</div>
</div>
</div>
</header>
<!-- _________________________ Finish Header _________________________ -->
<!-- _________________________ Start Middle _________________________ -->
<div id="middle">
<div class="cmsms_breadcrumbs">
<div class="cmsms_breadcrumbs_inner align_right">
<span>You are here: </span>
<a href="index-2.html" class="cms_home">Home</a>
<span class="breadcrumbs_sep"> / </span>
<a href="#" class="cms_home">Layouts</a>
<span class="breadcrumbs_sep"> / </span>
<span>Open Post</span>
</div>
</div>
<div class="middle_inner">
<div class="content_wrap r_sidebar">
<!--_________________________ Start Content _________________________ -->
<div class="content entry" role="main">
<div class="blog opened-article">
<!--_________________________ Start Standard Article _________________________ -->
<article class="post format-standard hentry">
<header class="cmsms_post_header entry-header">
<span class="cmsms_post_format_img cmsms-icon-desktop-3"></span>
<h1 class="cmsms_post_title entry-title">Bear Population</h1>
</header>
<div class="cmsms_post_content entry-content">
<div id="cmsms_row_554b576c54360" class="cmsms_row cmsms_color_scheme_default">
<div class="cmsms_row_outer_parent">
<div class="cmsms_row_outer">
<div class="cmsms_row_inner">
<div class="cmsms_row_margin">
<div class="cmsms_column one_first">
<div class="cmsms_text">
<p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate similique.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="cl"></div>
</div>
<footer class="cmsms_post_footer entry-meta">
<div class="cmsms_post_meta_info">
<abbr class="published cmsms_post_date cmsms-icon-calendar-8" title="July 20, 2014">July 20, 2014</abbr><a href="#" onclick="return false;" id="cmsmsLike-2000" class="cmsmsLike active cmsms-icon-heart-7"><span>1</span></a><a class="cmsms_post_comments cmsms-icon-comment-6" href="#" title="Comment on Bear Population">0</a>
</div>
<div class="cmsms_post_cont_info">
<span class="cmsms_post_user_name">By <a href="#" title="Posts by backdoor" class="vcard author"><span class="fn" rel="author">backdoor</span></a></span><span class="cmsms_post_category">In <a href="#" rel="category tag">Animals</a>, <a href="#" rel="category tag">Home</a></span>
</div>
</footer>
</article>
<!--_________________________ Finish Standard Article _________________________ -->
<aside class="post_nav">
<span class="cmsms_next_post">
<a href="#" rel="next">Keep Calm & Save Nature</a>
<span class="cmsms_next_arrow">
<span></span>
</span>
</span>
<span class="cmsms_prev_post">
<a href="#" rel="prev">Quote</a>
<span class="cmsms_prev_arrow">
<span></span>
</span>
</span>
</aside>
<aside class="share_posts">
<h3 class="share_posts_title">Share this post?</h3>
<div class="fl share_posts_item">
<a href="https://twitter.com/share" class="twitter-share-button" data-lang="en">Tweet</a>
<script type="text/javascript">
!function (d, s, id) {
var js = undefined,
fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
d.getElementById(id).parentNode.removeChild(d.getElementById(id));
}
js = d.createElement(s);
js.id = id;
js.src = '../platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'twitter-wjs');
</script>
</div>
<div class="fl share_posts_item">
<div class="g-plusone" data-size="medium"></div>
<script type="text/javascript">
(function () {
var po = document.createElement('script'),
s = document.getElementsByTagName('script')[0];
po.type = 'text/javascript';
po.async = true;
po.src = '../apis.google.com/js/plusone.js';
s.parentNode.insertBefore(po, s);
} )();
</script>
</div>
<div class="fl share_posts_item">
<a href="#" class="pin-it-button">
<img src="../assets.pinterest.com/images/PinExt.png" title="Pin It" alt="" />
</a>
<script type="text/javascript">
(function (d, s, id) {
var js = undefined,
fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
d.getElementById(id).parentNode.removeChild(d.getElementById(id));
}
js = d.createElement(s);
js.id = id;
js.src = '../assets.pinterest.com/js/pinit.js';
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'pinterest-wjs'));
</script>
</div>
<div class="fl share_posts_item">
<div class="fb-like" data-send="false" data-layout="button_count" data-width="200" data-show-faces="false" data-font="arial"></div>
<script type="text/javascript">
(function (d, s, id) {
var js = undefined,
fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
d.getElementById(id).parentNode.removeChild(d.getElementById(id));
}
js = d.createElement(s);
js.id = id;
js.src = '../connect.facebook.net/en_US/all.js#xfbml=1';
fjs.parentNode.insertBefore(js, fjs);
} (document, 'script', 'facebook-jssdk'));
</script>
</div>
<div class="cl"></div>
</aside>
<aside class="about_author">
<h3 class="about_author_title">About author</h3>
<div class="about_author_inner">
<figure class="alignleft">
<img alt='' src='http://2.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8?s=100&d=mm&r=g' srcset='http://2.gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8?s=200&d=mm&r=g 2x' class='avatar avatar-100 photo' height='100' width='100' />
</figure>
<div class="ovh">
<h2 class="vcard author">
<span class="fn" rel="author">backdoor</span>
</h2>
<div class="social_wrap">
<div class="social_wrap_inner">
<ul>
<li><a href="mailto:[email protected]" class="cmsms-icon-mail-6" title="Email" target="_blank"></a></li>
</ul>
</div>
</div>
</div>
</div>
</aside>
<aside class="related_posts">
<h3>More posts</h3>
<ul>
<li><a href="#" class="current">Popular</a></li>
<li><a href="#">Latest</a></li>
</ul>
<div class="related_posts_content">
<div class="related_posts_content_tab" style="display:block;">
<div class="one_half">
<div class="rel_post_content">
<figure class="alignleft">
<a href="#" title="Sunflower Time">
<img width="100" height="100" src="img/images/Sunflower-Time-thumb.jpg" class="attachment-100x100" alt="Sunflower Time" title="Sunflower Time" style="width:100px; height:100px;" />
</a>
</figure>
<h5>
<a href="#" title="Sunflower Time">Sunflower Time</a>
</h5>
</div>
</div>
<div class="one_half last">
<div class="rel_post_content">
<figure class="alignleft">
<a href="#" title="Save Tropic Forests">
<img width="100" height="100" src="img/images/forest-thumb.jpg" class="attachment-100x100" alt="Save Tropic Forests" title="Save Tropic Forests" style="width:100px; height:100px;" />
</a>
</figure>
<h5>
<a href="#" title="Save Tropic Forests">Save Tropic Forests</a>
</h5>
</div>
</div>
<div class="cl"></div>
<div class="one_half">
<div class="rel_post_content">
<figure class="alignleft">
<a href="#" title="Quote">
<span class="img_placeholder cmsms-icon-comment-6"></span>
</a>
</figure>
<h5>
<a href="#" title="Quote">Quote</a>
</h5>
</div>
</div>
<div class="one_half last">
<div class="rel_post_content">
<figure class="alignleft">
<a href="#" title="Spring Melody">
<img width="100" height="100" src="img/images/leaves-thumb.jpg" class="attachment-100x100" alt="Spring Melody" title="Spring Melody" style="width:100px; height:100px;" />
</a>
</figure>
<h5>
<a href="#" title="Spring Melody">Spring Melody</a>
</h5>
</div>
</div>
<div class="cl"></div>
</div>
<div class="related_posts_content_tab">
<div class="one_half">
<div class="rel_post_content">
<figure class="alignleft">
<a href="#" title="The Ozone Layer">
<img width="100" height="100" src="img/images/ozon-thumb.jpg" class="attachment-100x100" alt="The Ozone Layer" title="The Ozone Layer" style="width:100px; height:100px;" />
</a>
</figure>
<h5>
<a href="#" title="The Ozone Layer">The Ozone Layer</a>
</h5>
</div>
</div>
<div class="one_half last">
<div class="rel_post_content">
<figure class="alignleft">
<a href="#" title="Spring Melody">
<img width="100" height="100" src="img/images/leaves-thumb.jpg" class="attachment-100x100" alt="Spring Melody" title="Spring Melody" style="width:100px; height:100px;" />
</a>
</figure>
<h5>
<a href="#" title="Spring Melody">Spring Melody</a>
</h5>
</div>
</div>
<div class="cl"></div>
<div class="one_half">
<div class="rel_post_content">
<figure class="alignleft">
<a href="#" title="Save Tropic Forests">
<img width="100" height="100" src="img/images/forest-thumb.jpg" class="attachment-100x100" alt="Save Tropic Forests" title="Save Tropic Forests" style="width:100px; height:100px;" />
</a>
</figure>
<h5>
<a href="#" title="Save Tropic Forests">Save Tropic Forests</a>
</h5>
</div>
</div>
<div class="one_half last">
<div class="rel_post_content">
<figure class="alignleft">
<a href="#" title="Keep Calm & Save Nature">
<span class="img_placeholder cmsms-icon-megaphone-3"></span>
</a>
</figure>
<h5>
<a href="#" title="Keep Calm & Save Nature">Keep Calm & Save Nature</a>
</h5>
</div>
</div>
<div class="cl"></div>
</div>
</div>
</aside>
<div id="respond" class="comment-respond">
<h3>Leave a Reply</h3>
<form action="#" method="post" id="commentform" class="comment-form" novalidate>
<p class="comment-notes">Your email address will not be published.</p>
<p class="comment-form-author">
<input type="text" id="author" name="author" value="" size="30" placeholder="Name (Required)" />
</p>
<p class="comment-form-email">
<input type="text" id="email" name="email" value="" size="30" placeholder="Email (Required)" />
</p>
<p class="comment-form-url">
<input type="text" id="url" name="url" value="" size="30" placeholder="Website" />
</p>
<p class="comment-form-comment">
<textarea name="comment" id="comment" cols="60" rows="10"></textarea>
</p>
<p class="form-submit">
<input name="submit" type="submit" id="submit" class="submit" value="Submit Comment" />
<input type='hidden' name='comment_post_ID' value='2000' id='comment_post_ID' />
<input type='hidden' name='comment_parent' id='comment_parent' value='0' />
</p>
<p style="display: none;">
<input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="01f6361215" />
</p>
<p style="display: none;">
<input type="hidden" id="ak_js" name="ak_js" value="51"/>
</p>
</form>
</div><!-- #respond -->
</div>
</div>
<!-- _________________________ Finish Content _________________________ -->
<!-- _________________________ Start Sidebar _________________________ -->
<div class="sidebar" role="complementary">
<aside id="search-2" class="widget widget_search">
<div class="search_bar_wrap">
<form method="get">
<p>
<input name="s" placeholder="enter keywords" value="" type="text" />
<button type="submit" class="cmsms-icon-search-7"></button>
</p>
</form>
</div>
</aside>
<aside id="custom-flickr-2" class="widget widget_custom_flickr_entries">
<div id="flickr">
<h3 class="widgettitle">Flickr</h3>
<div class="wrap">
<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=9&display=latest&size=s&layout=x&source=user&user=64867600@N03"></script>
</div>
<div class="cl"></div>
<a href="http://www.flickr.com/photos/64867600@N03" class="more_button" target="_blank">
<span>More flickr images</span>
</a>
</div>
</aside>
<aside id="cmsms_paypal" class="widget widget_custom_paypal_donations">
<div class="cmsms_paypal_donations_widget">
<h3 class="widgettitle">Donate</h3>
<p>Donec fringilla, erat et semper eleifend, justo quam sodales a vehicula ipsum libero eget mi. Integer condimentum, nibh aliquet.</p>
<a href="#" class="button">DONATE NOW!</a>
</div>
</aside>
<aside id="recent-posts-2" class="widget widget_recent_entries">
<h3 class="widgettitle">Recent Posts</h3>
<ul>
<li><a href="#">The Ozone Layer</a></li>
<li><a href="#">Spring Melody</a></li>
<li><a href="#">Save Tropic Forests</a></li>
<li><a href="#">Keep Calm & Save Nature</a></li>
<li><a href="#">Bear Population</a></li>
</ul>
</aside>
</div>
<!-- _________________________ Finish Sidebar _________________________ -->
</div>
</div>
</div>
<!-- _________________________ Finish Middle _________________________ -->
<a href="javascript:void(0);" id="slide_top" class="cmsms-icon-up-open-mini"></a>
</div>
<!-- _________________________ Finish Main _________________________ -->
<!-- _________________________ Start Footer _________________________ -->
<footer id="footer" class="cmsms_color_scheme_footer cmsms_footer_small">
<div class="footer_bg">
<div class="footer_inner">
<div class="social_wrap">
<div class="social_wrap_inner">
<ul>
<li><a href="#" class="cmsms-icon-twitter-circled" title="Twitter" target="_blank"></a></li>
<li><a href="#" class="cmsms-icon-facebook-circled" title="Facebook" target="_blank"></a></li>
<li><a href="#" class="cmsms-icon-gplus-circled" title="Google+" target="_blank"></a></li>
<li><a href="#" class="cmsms-icon-vimeo-circled" title="Vimeo" target="_blank"></a></li>
<li><a href="#" class="cmsms-icon-skype-circled" title="Skype" target="_blank"></a></li>
</ul>
</div>
</div>
<span class="copyright">EcoNature © 2015 | All Rights Reserved</span>
</div>
</div>
</footer>
<!-- _________________________ Finish Footer _________________________ -->
</div>
<!-- _________________________ Finish Page _________________________ -->
<script type='text/javascript' src='js/jqueryLibraries.min.js'></script>
<script type='text/javascript'>
/* <![CDATA[ */
var cmsms_script = {
"ilightbox_skin":"dark",
"ilightbox_path":"vertical",
"ilightbox_infinite":"0",
"ilightbox_aspect_ratio":"1",
"ilightbox_mobile_optimizer":"1",
"ilightbox_max_scale":"1",
"ilightbox_min_scale":"0.2",
"ilightbox_inner_toolbar":"0",
"ilightbox_smart_recognition":"0",
"ilightbox_fullscreen_one_slide":"0",
"ilightbox_fullscreen_viewport":"center",
"ilightbox_controls_toolbar":"1",
"ilightbox_controls_arrows":"0",
"ilightbox_controls_fullscreen":"1",
"ilightbox_controls_thumbnail":"1",
"ilightbox_controls_keyboard":"1",
"ilightbox_controls_mousewheel":"1",
"ilightbox_controls_swipe":"1",
"ilightbox_controls_slideshow":"0",
"ilightbox_close_text":"Close",
"ilightbox_enter_fullscreen_text":"Enter Fullscreen (Shift+Enter)",
"ilightbox_exit_fullscreen_text":"Exit Fullscreen (Shift+Enter)",
"ilightbox_slideshow_text":"Slideshow",
"ilightbox_next_text":"Next",
"ilightbox_previous_text":"Previous",
"ilightbox_load_image_error":"An error occurred when trying to load photo.",
"ilightbox_load_contents_error":"An error occurred when trying to load contents.",
"ilightbox_missing_plugin_error":"The content your are attempting to view requires the <a href='{pluginspage}' target='_blank'>{type} plugin<\\\/a>."
};
/* ]]> */
</script>
<script type='text/javascript' src='js/jquery.easing.min6f3e.js?ver=1.3.0'></script>
<script type='text/javascript' src='js/jquery.script.js'></script>
<script type='text/javascript' src='js/jquery.tweet.min.js'></script>
<script type='text/javascript' src='js/jquery.isotope.min.js'></script>
<script type='text/javascript' src='js/jquery.isotope.mode.js'></script>
<script type='text/javascript' src='js/widget-countdown.js'></script>
</body>
<!-- Mirrored from eco-nature-html.cmsmasters.net/open-post.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 20 Oct 2018 13:12:03 GMT -->
</html>
| 42.592908 | 335 | 0.561476 |
b6665f9dca6ea65d5c622ad75af9d93dfad7fb26 | 166 | rb | Ruby | db/migrate/20180212144913_add_index_to_add_effect_list.rb | white-mns/yojouhan_1_rails | 39a3d7ad3f0665fbcf597fd8ce099ab33819df2d | [
"MIT"
] | null | null | null | db/migrate/20180212144913_add_index_to_add_effect_list.rb | white-mns/yojouhan_1_rails | 39a3d7ad3f0665fbcf597fd8ce099ab33819df2d | [
"MIT"
] | 1 | 2022-02-26T03:38:10.000Z | 2022-02-26T03:38:10.000Z | db/migrate/20180212144913_add_index_to_add_effect_list.rb | white-mns/yojouhan_rails | 39a3d7ad3f0665fbcf597fd8ce099ab33819df2d | [
"MIT"
] | null | null | null | class AddIndexToAddEffectList < ActiveRecord::Migration
def change
add_index :add_effect_lists, :add_effect_id
add_index :add_effect_lists, :name
end
end
| 23.714286 | 55 | 0.789157 |
0cf243e0f912db385063a422e6bbf35dbe9d0972 | 3,663 | py | Python | python/iceberg/api/transforms/transforms.py | moulimukherjee/incubator-iceberg | bf7edc4b325df6dd80d86fea0149d2be0ad09468 | [
"Apache-2.0"
] | 58 | 2019-09-10T20:51:26.000Z | 2022-03-22T11:06:09.000Z | python/iceberg/api/transforms/transforms.py | moulimukherjee/incubator-iceberg | bf7edc4b325df6dd80d86fea0149d2be0ad09468 | [
"Apache-2.0"
] | 292 | 2019-07-23T04:33:18.000Z | 2021-07-26T04:28:22.000Z | python/iceberg/api/transforms/transforms.py | moulimukherjee/incubator-iceberg | bf7edc4b325df6dd80d86fea0149d2be0ad09468 | [
"Apache-2.0"
] | 26 | 2019-08-28T23:59:03.000Z | 2022-03-04T08:54:08.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import re
from .bucket import Bucket
from .dates import Dates
from .identity import Identity
from .timestamps import Timestamps
from .truncate import Truncate
from ..types import (TypeID)
"""
Factory methods for transforms.
<p>
Most users should create transforms using a
{@link PartitionSpec.Builder#builderFor(Schema)} partition spec builder}.
@see PartitionSpec#builderFor(Schema) The partition spec builder.
"""
class Transforms(object):
HAS_WIDTH = re.compile("(\\w+)\\[(\\d+)\\]")
def __init__(self):
pass
@staticmethod
def from_string(type_var, transform):
match = Transforms.HAS_WIDTH.match(transform)
if match is not None:
name = match.group(1)
w = int(match.group(2))
if name.lower() == "truncate":
return Truncate.get(type_var, w)
elif name.lower() == "bucket":
return Bucket.get(type_var, w)
if transform.lower() == "identity":
return Identity.get(type_var)
elif type_var.type_id == TypeID.TIMESTAMP:
return Timestamps(transform.lower(), transform.lower())
elif type_var.type_id == TypeID.DATE:
return Dates(transform.lower(), transform.lower())
raise RuntimeError("Unknown transform: %s" % transform)
@staticmethod
def identity(type_var):
return Identity.get(type_var)
@staticmethod
def year(type_var):
if type_var.type_id == TypeID.DATE:
return Dates("year", "year")
elif type_var.type_id == TypeID.TIMESTAMP:
return Timestamps("year", "year")
else:
raise RuntimeError("Cannot partition type %s by year" % type_var)
@staticmethod
def month(type_var):
if type_var.type_id == TypeID.DATE:
return Dates("month", "month")
elif type_var.type_id == TypeID.TIMESTAMP:
return Timestamps("month", "month")
else:
raise RuntimeError("Cannot partition type %s by month" % type_var)
@staticmethod
def day(type_var):
if type_var.type_id == TypeID.DATE:
return Dates("day", "day")
elif type_var.type_id == TypeID.TIMESTAMP:
return Timestamps("day", "day")
else:
raise RuntimeError("Cannot partition type %s by day" % type_var)
@staticmethod
def hour(type_var):
if type_var.type_id == TypeID.DATE:
return Dates("hour", "hour")
elif type_var.type_id == TypeID.TIMESTAMP:
return Timestamps("hour", "hour")
else:
raise RuntimeError("Cannot partition type %s by hour" % type_var)
@staticmethod
def bucket(type_var, num_buckets):
return Bucket.get(type_var, num_buckets)
@staticmethod
def truncate(type_var, width):
return Truncate.get(type_var, width)
| 32.705357 | 78 | 0.65329 |
5f9a6689d5faa88f0c447a73ab24d76a0af2d5cc | 401 | h | C | drivers/marvell/ddr_phy_access.h | sohumango/arm-trusted-firmware | 7fe3a5f49da673a0e958fd6f26d2d492930b8d58 | [
"MIT"
] | 1,408 | 2015-01-26T17:15:15.000Z | 2022-03-31T12:54:11.000Z | drivers/marvell/ddr_phy_access.h | sohumango/arm-trusted-firmware | 7fe3a5f49da673a0e958fd6f26d2d492930b8d58 | [
"MIT"
] | 1,177 | 2015-01-07T12:55:46.000Z | 2022-01-19T10:49:12.000Z | drivers/marvell/ddr_phy_access.h | sohumango/arm-trusted-firmware | 7fe3a5f49da673a0e958fd6f26d2d492930b8d58 | [
"MIT"
] | 959 | 2015-01-08T09:12:45.000Z | 2022-03-28T03:07:50.000Z | /*
* Copyright (C) 2021 Marvell International Ltd.
*
* SPDX-License-Identifier: BSD-3-Clause
* https://spdx.org/licenses
*/
#include <plat_marvell.h>
#define DEVICE_BASE 0xF0000000
#define DDR_PHY_OFFSET 0x1000000
#define DDR_PHY_BASE_ADDR (DEVICE_BASE + DDR_PHY_OFFSET)
int mvebu_ddr_phy_write(uintptr_t offset, uint16_t data);
int mvebu_ddr_phy_read(uintptr_t offset, uint16_t *read);
| 25.0625 | 57 | 0.770574 |
d04294208307b11d9d1b6587851d8815b0f5d0f8 | 1,293 | css | CSS | estilo01.css | AdegaxX/Projetos | 2b91b0d4efad6b8b157df0695d9f2a1774e7b681 | [
"MIT"
] | null | null | null | estilo01.css | AdegaxX/Projetos | 2b91b0d4efad6b8b157df0695d9f2a1774e7b681 | [
"MIT"
] | null | null | null | estilo01.css | AdegaxX/Projetos | 2b91b0d4efad6b8b157df0695d9f2a1774e7b681 | [
"MIT"
] | null | null | null | body {
background: black;
font-family: 'Courier New', Courier, monospace;
font-size: 25px;
background-image: url(background1.png);
background-position: center;
background-size: cover;
}
p {
font:normal 25px Verdana;
}
p2 {
font: normal 20px Arial;
}
.cx {
border:0px solid rgb(252, 252, 252);
margin: 0px;
display: inline-block;
padding:6px 10px;
font-size:13px;
text-decoration: none;
font-weight: bold;
background-color: rgba(220, 224, 224, 0.5);
}
.bt {
border:1px solid #000000;
border-radius: 25px;
display:inline-block;
cursor:pointer;
font-family:Verdana;
font-weight:bold;
font-size:13px;
padding:6px 10px;
text-decoration:none;
box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.445);
color:white;
background-color: rgb(228, 6, 6);
}
header {
color: white;
text-align: center;
}
input {
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
}
section {
background: white;
border-radius: 10px;
padding: 15px;
width: 80%;
margin: auto;
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.404);
margin-bottom: 20px;
}
footer {
color: rgba(255, 255, 255, 0.459);
text-align: center;
font-style: italic;
}
| 18.211268 | 75 | 0.613302 |
b2df89e53c0696d724b6e84ea61023d0f33bec67 | 597 | py | Python | Pokemon Identifier/app.py | sethuiyer/mlhub | 6be271c0070a0c0bb90dd92aceb344e7415bb1db | [
"MIT"
] | 22 | 2016-12-28T16:14:18.000Z | 2019-09-22T16:39:29.000Z | Pokemon Identifier/app.py | sethuiyer/mlhub | 6be271c0070a0c0bb90dd92aceb344e7415bb1db | [
"MIT"
] | 6 | 2020-03-24T17:48:55.000Z | 2022-03-12T00:04:58.000Z | Pokemon Identifier/app.py | sethuiyer/mlhub | 6be271c0070a0c0bb90dd92aceb344e7415bb1db | [
"MIT"
] | 17 | 2017-01-17T09:45:14.000Z | 2020-04-21T07:19:39.000Z | from poketype import PokemonTypeIdentifier
from flask import Flask, request, make_response,jsonify
import os
id = PokemonTypeIdentifier()
app = Flask(__name__,static_url_path='/static')
@app.route('/findtype',methods=['GET'])
def classify():
poke_name=request.args.get('pokename')
results = id.predict_type(poke_name)
return jsonify({'results':results})
@app.route('/',methods=['GET'])
def root():
return app.send_static_file('index.html')
if __name__ == '__main__':
port = int(os.environ.get('PORT', 8001))
app.run(debug=True,host='0.0.0.0',port=port,use_reloader=False)
| 33.166667 | 67 | 0.721943 |
accef4e20a9e1d977954ca858b7b5096eb1f323e | 449 | kt | Kotlin | app/src/sharedTest/java/com/artf/chatapp/util/MockitoExt.kt | Yunzehahaha/Android-chat-app-demo | e9bce6a21956b1898da7643b8efff2f594b32b6b | [
"Apache-2.0"
] | null | null | null | app/src/sharedTest/java/com/artf/chatapp/util/MockitoExt.kt | Yunzehahaha/Android-chat-app-demo | e9bce6a21956b1898da7643b8efff2f594b32b6b | [
"Apache-2.0"
] | null | null | null | app/src/sharedTest/java/com/artf/chatapp/util/MockitoExt.kt | Yunzehahaha/Android-chat-app-demo | e9bce6a21956b1898da7643b8efff2f594b32b6b | [
"Apache-2.0"
] | null | null | null | package com.artf.chatapp.util
import org.mockito.ArgumentCaptor
import org.mockito.ArgumentMatchers
import org.mockito.Mockito
inline fun <reified T> any(): T = Mockito.any(T::class.java)
inline fun <reified T> mock(): T = Mockito.mock(T::class.java)
inline fun <reified T> nullable(): T = ArgumentMatchers.nullable(T::class.java)
inline fun <reified T> argumentCaptor(): ArgumentCaptor<T> = ArgumentCaptor.forClass(T::class.java)
| 32.071429 | 100 | 0.739421 |
476b3f3847b6a68a731ca927a38545dab63e167e | 485 | sql | SQL | kata-files/lesson2/postgresql/expected/MYLARGESCHEMA/function/func655.sql | goldmansachs/obevo-kata | 5596ff44ad560d89d183ac0941b727db1a2a7346 | [
"Apache-2.0"
] | 22 | 2017-09-28T21:35:04.000Z | 2022-02-12T06:24:28.000Z | kata-files/lesson2/postgresql/expected/MYLARGESCHEMA/function/func655.sql | goldmansachs/obevo-kata | 5596ff44ad560d89d183ac0941b727db1a2a7346 | [
"Apache-2.0"
] | 6 | 2017-07-01T13:52:34.000Z | 2018-09-13T15:43:47.000Z | kata-files/lesson2/postgresql/expected/MYLARGESCHEMA/function/func655.sql | goldmansachs/obevo-kata | 5596ff44ad560d89d183ac0941b727db1a2a7346 | [
"Apache-2.0"
] | 11 | 2017-04-30T18:39:09.000Z | 2021-08-22T16:21:11.000Z | CREATE FUNCTION func655() RETURNS integer
LANGUAGE plpgsql
AS $$ DECLARE val INTEGER; BEGIN val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE166);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE329);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.TABLE115);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW60);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW52);val:=(SELECT COUNT(*)INTO MYCOUNT FROM MYLARGESCHEMA.VIEW34);END $$;
GO | 69.285714 | 416 | 0.769072 |
8fb6ba12aca6de210045354c2a7f3acc9bc1dcec | 195 | kt | Kotlin | src/main/java/com/hongwei/model/privilege/Privilege.kt | hongwei-bai/application-file-server | 8c3bf79e40d0043d453afc7c2a733c6c286bd0e8 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/hongwei/model/privilege/Privilege.kt | hongwei-bai/application-file-server | 8c3bf79e40d0043d453afc7c2a733c6c286bd0e8 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/hongwei/model/privilege/Privilege.kt | hongwei-bai/application-file-server | 8c3bf79e40d0043d453afc7c2a733c6c286bd0e8 | [
"Apache-2.0"
] | null | null | null | package com.hongwei.model.privilege
data class Privilege(
val entries: List<String>,
val photo: PhotoPrivilege? = PhotoPrivilege(),
val uploadExercise: Boolean? = false
) | 27.857143 | 54 | 0.687179 |
dc05f837144c2d7be2afc9abddb596a38fe7fcdf | 4,233 | kt | Kotlin | app/src/main/java/vsec/com/slockandroid/Presenters/RegisterLockActivity/RegisterLockPresenter.kt | mragimbo/slock-android | 5770c42e25c889b80d90240dd23b68479c28c002 | [
"MIT"
] | null | null | null | app/src/main/java/vsec/com/slockandroid/Presenters/RegisterLockActivity/RegisterLockPresenter.kt | mragimbo/slock-android | 5770c42e25c889b80d90240dd23b68479c28c002 | [
"MIT"
] | null | null | null | app/src/main/java/vsec/com/slockandroid/Presenters/RegisterLockActivity/RegisterLockPresenter.kt | mragimbo/slock-android | 5770c42e25c889b80d90240dd23b68479c28c002 | [
"MIT"
] | 1 | 2020-02-08T14:00:24.000Z | 2020-02-08T14:00:24.000Z | package vsec.com.slockandroid.Presenters.RegisterLockActivity
import android.app.Activity
import android.bluetooth.BluetoothDevice
import android.content.Context
import android.os.AsyncTask
import vsec.com.slockandroid.Controllers.ApiController
import vsec.com.slockandroid.Controllers.BluetoothController
import vsec.com.slockandroid.Controllers.Callback.BluetootLockValidate
import vsec.com.slockandroid.Controllers.Callback.BluetoothLockRegister
import vsec.com.slockandroid.Controllers.Callback.BluetoothScanCallback
import vsec.com.slockandroid.Controllers.Helpers
import vsec.com.slockandroid.Presenters.HomeActivity.HomeView
import vsec.com.slockandroid.Presenters.LoginActivity.LoginView
import vsec.com.slockandroid.generalModels.Lock
class RegisterLockPresenter (private val view: RegisterLockPresenter.View){
private val lock: Lock = Lock()
private lateinit var registerLockTask: RegisterLockTask
private lateinit var bleLock: BluetoothDevice
fun lookForRegistrableLock() {
BluetoothController.scanLeDevice(true, ::onScanDoneRegister)
}
fun registerLock() {
this.lock.setUuid(Helpers.newBase64Uuid())
this.lock.setBleAddress(bleLock.address)
this.lock.setSecret(Helpers.newBase64Token())
this.registerLockTask = RegisterLockTask(this, bleLock)
this.registerLockTask.execute(this.lock)
}
private fun lockRegisterdAtApi(lock: BluetoothDevice) {
lock.connectGatt(this.view.getContext(),false, BluetoothLockRegister(this.lock, ::onRegistrationDone), BluetoothDevice.TRANSPORT_LE)
}
fun onRegistrationDone() {
this.view.checkLock()
BluetoothController.scanLeDevice(true, ::onScanDoneValidate)
//search for the device, if found. add lock to backend
//this.view.changeActivity(HomeView::class.java as Class<Activity>)
}
fun onScanDoneRegister(){
val lock: BluetoothDevice? = BluetoothScanCallback.scannedBleDevices.filter { it.name != null }.find { it.name.contains("SLOCK") } //&& it.address == "30:AE:A4:CE:F9:0E" }//"SLOCK-ALPHA-v1") }
if(lock != null){
this.bleLock = lock
view.onRegisterableLockFound()
}else {
this.view.onNoRegisterableDeviceFound()
}
}
fun onScanDoneValidate(){
BluetoothScanCallback.scannedBleDevices.find { it.address == this.lock.getBleAddress()}
?.connectGatt(this.view.getContext(),false,
BluetootLockValidate(::onLockValidationDone)
)
}
fun onLockValidationDone(validated: Boolean){
if(validated){
this.view.changeActivity(HomeView::class.java as Class<Activity>)
}else{
println("error")
}
}
fun updateLockName(lockName: String) { this.lock.setName(lockName)}
fun updateDescription(description: String){ this.lock.setDiscription(description) }
fun updateProductKey(productKey: String) {
this.lock.setProductKey(productKey)
}
interface View {
fun changeActivity(toActivity: Class<Activity>, extras: Map<String, String> = emptyMap())
fun onRegisterableLockFound()
fun onNoRegisterableDeviceFound()
fun checkLock()
fun getContext(): Context
fun toastLong(message: String)
}
companion object{
class RegisterLockTask(
private var presenter: RegisterLockPresenter,
private var lock: BluetoothDevice
): AsyncTask<Lock,Void,String>(){
override fun doInBackground(vararg params: Lock?): String {
if(params.isEmpty())
return "500"
return ApiController.registerLock(params[0] as Lock)
}
override fun onPostExecute(result: String?) {
if(result == "200")
this.presenter.lockRegisterdAtApi(lock)
else if(result == "401"){
ApiController.clearSession()
this.presenter.view.changeActivity(LoginView::class.java as Class<Activity>)
}else{
this.presenter.view.toastLong("could not register the slock")
}
}
}
}
} | 38.834862 | 201 | 0.677297 |
f0629fcfe39cc2a9911c3a04a0f813fc81ab951d | 916 | js | JavaScript | components/button.js | j-94/chakra-graphcms | 7d63ff01834940b70395ba255ac72d3dc945c348 | [
"MIT"
] | null | null | null | components/button.js | j-94/chakra-graphcms | 7d63ff01834940b70395ba255ac72d3dc945c348 | [
"MIT"
] | null | null | null | components/button.js | j-94/chakra-graphcms | 7d63ff01834940b70395ba255ac72d3dc945c348 | [
"MIT"
] | null | null | null | import { Box, Link as ChakraLink } from '@chakra-ui/react'
import Link from 'next/link'
const linkDefaultStyles = {
width: 'full',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
px: [8, null, 10],
py: [3, null, 4],
fontSize: ['base', null, 'lg'],
fontWeight: 'medium',
borderRadius: 'md'
}
export default function Button({ href, label, theme }) {
if (!href || !label) return null
if (href.includes('http')) {
return (
<Box borderRadius="md" boxShadow="md">
<ChakraLink
isExternal
href={href}
{...linkDefaultStyles}
variant={theme}
>
{label}
</ChakraLink>
</Box>
)
}
return (
<Box borderRadius="md" boxShadow="md">
<Link href={href}>
<ChakraLink {...linkDefaultStyles} variant={theme}>
{label}
</ChakraLink>
</Link>
</Box>
)
}
| 20.818182 | 59 | 0.549127 |
da76de0ab54feb3d2c53c9eee72df659f6c31986 | 48,000 | tab | SQL | preparation/pe/cg_force_field/B-B.tab | jkrajniak/paper-generic-adaptive-resolution-method-for-reverse-mapping-of-polymers-data | 9e967fd74dcb9bca018789e0a8b50105d9fd77df | [
"Unlicense"
] | null | null | null | preparation/pe/cg_force_field/B-B.tab | jkrajniak/paper-generic-adaptive-resolution-method-for-reverse-mapping-of-polymers-data | 9e967fd74dcb9bca018789e0a8b50105d9fd77df | [
"Unlicense"
] | null | null | null | preparation/pe/cg_force_field/B-B.tab | jkrajniak/paper-generic-adaptive-resolution-method-for-reverse-mapping-of-polymers-data | 9e967fd74dcb9bca018789e0a8b50105d9fd77df | [
"Unlicense"
] | null | null | null | 0.002 12801.791 248435.29
0.004 12312.929 240183.88
0.006 11841.055 231447.24
0.008 11387.14 222225.37
0.01 10952.154 213295.88
0.012 10533.956 205467.49
0.014 10130.284 198009.24
0.016 9741.9193 190159.08
0.018 9369.6473 181916.99
0.02 9014.2514 174376.52
0.022 8672.1412 168523.67
0.024 8340.1567 163103.62
0.026 8019.7268 156969.08
0.028 7712.2804 150120.05
0.03 7419.2466 143652.53
0.032 7137.6703 138704.66
0.034 6864.4279 134243.64
0.036 6600.6957 129194.57
0.038 6347.6497 123557.42
0.04 6106.466 118234.28
0.042 5874.7126 114161.9
0.044 5649.8184 110490.23
0.046 5432.7516 106334.55
0.048 5224.4802 101694.85
0.05 5025.9722 97313.605
0.052 4835.2258 93961.798
0.054 4650.125 90939.803
0.056 4471.4666 87519.439
0.058 4300.0473 83700.705
0.06 4136.6638 80094.685
0.062 3979.6685 77335.956
0.064 3827.32 74848.681
0.066 3680.2738 72033.524
0.068 3539.1859 68890.488
0.07 3404.7119 65922.526
0.072 3275.4958 63651.933
0.074 3150.1041 61604.763
0.076 3029.0767 59287.728
0.078 2912.9532 56700.828
0.08 2802.2734 54258.025
0.082 2695.9211 52389.197
0.084 2592.7166 50704.258
0.086 2493.1041 48797.204
0.088 2397.5278 46668.037
0.09 2306.4319 44657.47
0.092 2218.8979 43119.317
0.094 2133.9547 41732.516
0.096 2051.9678 40162.902
0.098 1973.3031 38410.475
0.1 1898.3259 36755.663
0.102 1826.2804 35489.675
0.104 1756.3672 34348.257
0.106 1688.8874 33056.375
0.108 1624.1417 31614.027
0.11 1562.4313 30252.021
0.112 1503.1337 29210.04
0.114 1445.5911 28270.589
0.116 1390.0513 27207.295
0.118 1336.7619 26020.16
0.12 1285.9707 24899.151
0.122 1237.1653 24041.541
0.124 1189.8045 23268.318
0.126 1144.0921 22393.166
0.128 1100.2318 21416.086
0.13 1058.4277 20493.431
0.132 1018.2581 19787.569
0.134 979.27744 19151.162
0.136 941.65347 18430.862
0.138 905.55399 17626.669
0.14 871.14679 16867.271
0.142 838.08491 16286.306
0.144 806.00157 15762.506
0.146 775.03488 15169.658
0.148 745.32294 14507.761
0.15 717.00384 13882.733
0.152 689.79201 13404.565
0.154 663.38558 12973.448
0.156 637.89822 12485.5
0.158 613.44358 11940.72
0.16 590.13534 11426.286
0.162 567.73844 11032.727
0.164 546.00443 10677.893
0.166 525.02687 10276.283
0.168 504.8993 9827.8984
0.17 485.71528 9404.4898
0.172 467.28134 9080.5677
0.174 449.39301 8788.5188
0.176 432.12727 8457.9712
0.178 415.56112 8088.9248
0.18 399.77157 7740.4352
0.182 384.59938 7473.8287
0.184 369.87625 7233.4557
0.186 355.66556 6961.3961
0.188 342.03067 6657.6497
0.19 329.03496 6370.8227
0.192 316.54738 6151.3902
0.194 304.4294 5953.5495
0.196 292.73318 5729.6287
0.198 281.51088 5479.628
0.2 270.81467 5243.553
0.202 260.53667 5062.9474
0.204 250.56288 4900.1131
0.206 240.93622 4715.8135
0.208 231.69962 4510.0486
0.21 222.89602 4315.7452
0.212 214.43664 4167.0965
0.214 206.22764 4033.0745
0.216 198.30434 3881.3854
0.218 190.7021 3712.0289
0.22 183.45623 3552.1062
0.222 176.49367 3429.7598
0.224 169.73719 3319.452
0.226 163.21586 3194.6031
0.228 156.95878 3055.213
0.23 150.99501 2923.5873
0.232 145.26443 2822.8892
0.234 139.70346 2732.0996
0.236 134.33603 2629.3418
0.238 129.18609 2514.6158
0.24 124.27757 2406.2803
0.242 119.56097 2323.3999
0.244 114.98397 2248.6748
0.246 110.56627 2164.0993
0.248 106.32757 2069.6732
0.25 102.28757 1980.5069
0.252 98.405542 1912.2916
0.254 94.638408 1850.7886
0.256 91.002388 1781.178
0.258 87.513696 1703.4599
0.26 84.188548 1630.0709
0.262 80.993413 1573.9258
0.264 77.892845 1523.3053
0.266 74.900192 1466.0118
0.268 72.028798 1402.0453
0.27 69.29201 1341.642
0.272 66.66223 1295.4313
0.274 64.110285 1253.7677
0.276 61.647159 1206.6119
0.278 59.283837 1153.9638
0.28 57.031304 1104.2484
0.282 54.866844 1066.2144
0.284 52.766446 1031.9228
0.286 50.739152 993.11088
0.288 48.794003 949.7785
0.29 46.940038 908.85984
0.292 45.158563 877.55567
0.294 43.429816 849.33176
0.296 41.761236 817.38729
0.298 40.160267 781.72225
0.3 38.634347 748.04385
0.302 37.168091 722.27871
0.304 35.745233 699.04882
0.306 34.371896 672.75668
0.308 33.054206 643.40231
0.31 31.798287 615.68304
0.312 30.591474 594.47686
0.314 29.420379 575.35732
0.316 28.290044 553.71739
0.318 27.20551 529.55705
0.32 26.171816 506.74251
0.322 25.17854 489.2886
0.324 24.214662 473.55212
0.326 23.284331 455.74121
0.328 22.391697 435.85586
0.33 21.540908 416.11328
0.332 20.727244 399.81789
0.334 19.941636 386.38341
0.336 19.18171 374.13628
0.338 18.445091 363.0765
0.34 17.729404 346.05075
0.342 17.060888 320.95426
0.344 16.445587 302.5131
0.346 15.850836 300.40483
0.348 15.243968 314.62945
0.35 14.592318 362.28528
0.352 13.794827 435.45162
0.354 12.850511 479.50167
0.356 11.87682 464.82759
0.358 10.991201 391.42939
0.36 10.311102 299.06184
0.362 9.7949536 248.37811
0.364 9.31759 230.97102
0.366 8.8710695 217.53501
0.368 8.44745 208.07007
0.37 8.0387892 203.63218
0.372 7.6329213 202.96363
0.374 7.2269347 201.53796
0.376 6.8267694 197.14234
0.378 6.4383653 189.77677
0.38 6.0676623 180.86873
0.382 5.7148904 172.51833
0.384 5.377589 164.30706
0.386 5.0576622 155.14379
0.388 4.7570139 145.02851
0.39 4.4775482 135.76246
0.392 4.213964 129.44816
0.394 3.9597555 124.73625
0.396 3.715019 119.97613
0.398 3.479851 115.16779
0.4 3.2543479 111.18451
0.402 3.035113 108.66043
0.404 2.8197062 106.36356
0.406 2.6096587 103.30106
0.408 2.4065019 99.472927
0.41 2.211767 95.403169
0.412 2.0248892 91.726907
0.414 1.8448594 88.086826
0.416 1.6725419 84.014484
0.418 1.5088014 79.50988
0.42 1.3545024 75.206424
0.422 1.2079757 71.868758
0.424 1.0670274 69.060323
0.426 0.93173446 66.213327
0.428 0.80217408 63.32777
0.43 0.67842338 60.80504
0.432 0.55895392 58.940001
0.434 0.44266337 57.171477
0.436 0.33026801 55.044816
0.438 0.22248411 52.560018
0.44 0.12002794 50.012227
0.442 0.0224352 47.761939
0.444 -0.071019818 45.612035
0.446 -0.16001294 43.300046
0.448 -0.24422 40.82597
0.45 -0.32331682 38.478667
0.452 -0.39813467 36.560343
0.454 -0.46955819 34.80216
0.456 -0.53734331 32.921933
0.458 -0.60124592 30.919661
0.46 -0.66102195 29.057032
0.462 -0.71747405 27.590525
0.464 -0.77138406 26.250647
0.466 -0.82247664 24.773107
0.468 -0.87047648 23.157906
0.47 -0.91510827 21.595054
0.472 -0.9568567 20.268994
0.474 -0.99618424 18.981366
0.476 -1.0327822 17.539377
0.478 -1.0663418 15.943027
0.48 -1.0965543 14.38978
0.482 -1.1239009 13.103863
0.484 -1.1489697 11.927952
0.486 -1.1716127 10.677963
0.488 -1.1916816 9.353895
0.49 -1.2090283 8.1438478
0.492 -1.224257 7.215853
0.494 -1.2378917 6.35171
0.496 -1.2496638 5.3532858
0.498 -1.2593048 4.2205803
0.5 -1.2665461 3.1609325
0.502 -1.2719485 2.3752615
0.504 -1.2760472 1.646596
0.506 -1.2785349 0.76438575
0.508 -1.2791047 -0.2713685
0.51 -1.2774495 -1.1963803
0.512 -1.2743192 -1.7509378
0.514 -1.2704457 -2.2061885
0.516 -1.2654944 -2.828706
0.518 -1.2591309 -3.618491
0.52 -1.2510205 -4.319792
0.522 -1.2418517 -4.635208
0.524 -1.2324796 -4.7580165
0.526 -1.2228196 -4.9231445
0.528 -1.2127871 -5.130592
0.53 -1.2022973 -5.2944485
0.532 -1.1916093 -5.3428812
0.534 -1.1809258 -5.3829167
0.536 -1.1700776 -5.5075037
0.538 -1.1588957 -5.7166422
0.54 -1.147211 -5.947943
0.542 -1.135104 -6.0936407
0.544 -1.1228365 -6.1480612
0.546 -1.1105117 -6.1509055
0.548 -1.0982329 -6.1021743
0.55 -1.086103 -6.0088837
0.552 -1.0741973 -5.9191315
0.554 -1.0624265 -5.8875243
0.556 -1.0506472 -5.9275867
0.558 -1.0387162 -6.039319
0.56 -1.0264899 -6.168095
0.562 -1.0140438 -6.2337975
0.564 -1.0015548 -6.2528135
0.566 -0.98903252 -6.2670224
0.568 -0.97648667 -6.2764244
0.57 -0.96392682 -6.2812399
0.572 -0.95136171 -6.283102
0.574 -0.93879441 -6.2839089
0.576 -0.92622607 -6.2841466
0.578 -0.91365783 -6.283815
0.58 -0.90109081 -6.2740966
0.582 -0.88856144 -6.2535254
0.584 -0.87607671 -6.241946
0.586 -0.86359366 -6.2518516
0.588 -0.8510693 -6.2832421
0.59 -0.83846069 -6.4574536
0.592 -0.82523949 -6.8348644
0.594 -0.81112123 -7.2027022
0.596 -0.79642868 -7.4091524
0.598 -0.78148462 -7.4542148
0.6 -0.76661182 -7.4011442
0.602 -0.75188004 -7.3736908
0.604 -0.73711706 -7.3993434
0.606 -0.72228267 -7.4450954
0.608 -0.70733668 -7.5109466
0.61 -0.69223888 -7.6213216
0.612 -0.67685139 -7.7653751
0.614 -0.66117738 -7.8657778
0.616 -0.64538828 -7.8804702
0.618 -0.6296555 -7.8094523
0.62 -0.61415047 -7.6883537
0.622 -0.59890209 -7.5821878
0.624 -0.58382172 -7.4994015
0.626 -0.56890448 -7.4190575
0.628 -0.55414549 -7.3411558
0.63 -0.53953986 -7.2464642
0.632 -0.52515963 -7.1181506
0.634 -0.51106726 -6.9790487
0.636 -0.49724344 -6.8495909
0.638 -0.48366889 -6.7297774
0.64 -0.47032433 -6.6119889
0.642 -0.45722094 -6.4878357
0.644 -0.44437299 -6.3637812
0.646 -0.43176581 -6.2470593
0.648 -0.41938475 -6.1376703
0.65 -0.40721513 -6.0318287
0.652 -0.39525743 -5.9241517
0.654 -0.38351852 -5.8160277
0.656 -0.37199332 -5.7104429
0.658 -0.36067675 -5.6073973
0.66 -0.34956373 -5.5002213
0.662 -0.33867587 -5.3790768
0.664 -0.32804743 -5.2458803
0.666 -0.31769235 -5.1057169
0.668 -0.30762456 -4.9585868
0.67 -0.297858 -4.8033949
0.672 -0.28841098 -4.64806
0.674 -0.27926576 -4.5071979
0.676 -0.27038219 -4.3864104
0.678 -0.26172012 -4.2856974
0.68 -0.2532394 -4.2079347
0.682 -0.24488838 -4.1324091
0.684 -0.23670976 -4.0208619
0.686 -0.22880493 -3.8586231
0.688 -0.22127527 -3.6456926
0.69 -0.21422216 -3.4162988
0.692 -0.20761007 -3.2332001
0.694 -0.20128936 -3.104963
0.696 -0.19519022 -3.0116243
0.698 -0.18924286 -2.953184
0.7 -0.18337749 -2.9310951
0.702 -0.17751848 -2.9148696
0.704 -0.17171801 -2.8551421
0.706 -0.16609791 -2.7344888
0.708 -0.16078005 -2.5529098
0.71 -0.15588627 -2.3200127
0.712 -0.1515 -2.0834016
0.714 -0.14755267 -1.890463
0.716 -0.14393815 -1.7505873
0.718 -0.14055032 -1.6637745
0.72 -0.13728305 -1.6287055
0.722 -0.1340355 -1.6129764
0.724 -0.13083115 -1.5712788
0.726 -0.12775038 -1.4893897
0.728 -0.12487359 -1.3673089
0.73 -0.12228115 -1.2376761
0.732 -0.11992288 -1.1467077
0.734 -0.11769432 -1.0821299
0.736 -0.11559436 -1.0180917
0.738 -0.11362195 -0.95459295
0.74 -0.11177599 -0.90558057
0.742 -0.10999963 -0.88227133
0.744 -0.10824691 -0.86662313
0.746 -0.10653313 -0.84332403
0.748 -0.10487361 -0.81237408
0.75 -0.10328364 -0.78217875
0.752 -0.1017449 -0.76198363
0.754 -0.1002357 -0.74464329
0.756 -0.098766322 -0.72217228
0.758 -0.097347014 -0.69457064
0.76 -0.095988039 -0.66613829
0.762 -0.09468246 -0.64218237
0.764 -0.09341931 -0.61991361
0.766 -0.092202806 -0.59553561
0.768 -0.091037167 -0.56904839
0.77 -0.089926612 -0.53943365
0.772 -0.088879433 -0.51139561
0.774 -0.08788103 -0.49453635
0.776 -0.086901287 -0.49273543
0.778 -0.085910088 -0.50599286
0.78 -0.084877316 -0.53652654
0.782 -0.083763982 -0.5731901
0.784 -0.082584556 -0.59371919
0.786 -0.081389105 -0.58921375
0.788 -0.080227701 -0.55967379
0.79 -0.07915041 -0.50308403
0.792 -0.078215364 -0.43758698
0.794 -0.077400062 -0.3954346
0.796 -0.076633626 -0.38872105
0.798 -0.075845178 -0.41744631
0.8 -0.074963841 -0.46842272
0.802 -0.073971487 -0.51039042
0.804 -0.072922279 -0.52942879
0.806 -0.071853772 -0.52968941
0.808 -0.070803521 -0.51117229
0.81 -0.069809083 -0.46161854
0.812 -0.068957047 -0.39363118
0.814 -0.068234558 -0.35676186
0.816 -0.06753 -0.3757004
0.818 -0.066731757 -0.45044679
0.82 -0.065728213 -0.53879474
0.822 -0.064576578 -0.57886107
0.824 -0.063412768 -0.58333678
0.826 -0.06224323 -0.58458974
0.828 -0.061074409 -0.58261995
0.83 -0.059912751 -0.5776167
0.832 -0.058763943 -0.57233568
0.834 -0.057623408 -0.57043716
0.836 -0.056482194 -0.57301502
0.838 -0.055331348 -0.58006925
0.84 -0.054161917 -0.61260173
0.842 -0.052880941 -0.67768131
0.844 -0.051451192 -0.73340656
0.846 -0.049947315 -0.75180911
0.848 -0.048443955 -0.73288896
0.85 -0.047015759 -0.69644418
0.852 -0.045658179 -0.67485503
0.854 -0.044316339 -0.66719671
0.856 -0.042989392 -0.65996221
0.858 -0.04167649 -0.65315152
0.86 -0.040376786 -0.64440138
0.862 -0.039098884 -0.62846261
0.864 -0.037862935 -0.60336968
0.866 -0.036685406 -0.57004291
0.868 -0.035582764 -0.52848231
0.87 -0.034571476 -0.47867605
0.872 -0.033668059 -0.42807369
0.874 -0.032859182 -0.38787918
0.876 -0.032116543 -0.36183506
0.878 -0.031411841 -0.34994135
0.88 -0.030716777 -0.34702259
0.882 -0.030023751 -0.34056416
0.884 -0.029354521 -0.32473266
0.886 -0.02872482 -0.30103392
0.888 -0.028150385 -0.26946794
0.89 -0.027646949 -0.22047933
0.892 -0.027268468 -0.15228922
0.894 -0.027037792 -0.086117775
0.896 -0.026923997 -0.035408665
0.898 -0.026896157 -0.0001618875
0.9 -0.026923349 0.033567187
0.902 -0.027030426 0.076249602
0.904 -0.027228347 0.10873035
0.906 -0.027465347 0.115328
0.908 -0.027689659 0.09604257
0.91 -0.027849518 0.06107126
0.912 -0.027933944 0.02199706
0.914 -0.027937506 -0.02929859
0.916 -0.02781675 -0.10232003
0.918 -0.027528226 -0.19706725
0.92 -0.027028481 -0.33265507
0.922 -0.026197605 -0.50592996
0.924 -0.025004761 -0.66437458
0.926 -0.023540107 -0.77773996
0.928 -0.021893801 -0.84602609
0.93 -0.020156003 -0.88198509
0.932 -0.018365861 -0.91422209
0.934 -0.016499114 -0.95376451
0.936 -0.014550803 -0.99578674
0.938 -0.012515967 -1.0402888
0.94 -0.010389648 -1.0750827
0.942 -0.0082156367 -1.1079562
0.944 -0.0059578231 -1.1810609
0.946 -0.003491393 -1.3165727
0.948 -0.0006915325 -1.5144914
0.95 0.0025665726 -1.7129012
0.952 0.0061600721 -1.8208485
0.954 0.0098499666 -1.8566933
0.956 0.013586845 -1.8678329
0.958 0.017321298 -1.8542673
0.96 0.021003914 -1.8285545
0.962 0.024635516 -1.8106091
0.964 0.028246351 -1.798908
0.966 0.031831148 -1.7845712
0.968 0.035384636 -1.7675987
0.97 0.038901543 -1.6613743
0.972 0.042030133 -1.4059309
0.974 0.044525266 -1.1278587
0.976 0.046541568 -0.92709872
0.978 0.048233661 -0.803651
0.98 0.049756172 -0.69811085
0.982 0.051026105 -0.52764968
0.984 0.05186677 -0.31653625
0.986 0.05229225 -0.11246327
0.988 0.052316623 0.084569263
0.99 0.051953973 0.27437449
0.992 0.051219126 0.47217202
0.994 0.050065285 0.70125832
0.996 0.048414092 0.96952348
0.998 0.046187191 1.2769675
1 0.043306222 1.561671
1.002 0.039940507 1.7434355
1.004 0.03633248 1.8567612
1.006 0.032513462 1.9544278
1.008 0.028514769 2.0364354
1.01 0.02436772 2.1466599
1.012 0.019928129 2.2957462
1.014 0.015184735 2.3899712
1.016 0.010368244 2.3688432
1.018 0.0057093626 2.2323621
1.02 0.0014387961 1.9963036
1.022 -0.0022758519 1.7242125
1.024 -0.005458054 1.4719665
1.026 -0.0081637177 1.2476742
1.028 -0.010448751 1.0513357
1.03 -0.01236906 0.89526616
1.032 -0.014029815 0.77241113
1.034 -0.015458705 0.64140085
1.036 -0.016595419 0.48023527
1.038 -0.017379646 0.28891438
1.04 -0.017751076 0.08751387
1.042 -0.017729702 -0.067421207
1.044 -0.017481391 -0.14126251
1.046 -0.017164651 -0.13585103
1.048 -0.016937987 -0.051186785
1.05 -0.016959904 0.06073845
1.052 -0.017180941 0.12557613
1.054 -0.017462209 0.16178291
1.056 -0.017828073 0.21017219
1.058 -0.018302898 0.27074398
1.06 -0.018911049 0.32959919
1.062 -0.019621294 0.38034896
1.064 -0.020432444 0.44815774
1.066 -0.021413925 0.55067974
1.068 -0.022635163 0.68791495
1.07 -0.024165585 0.81128792
1.072 -0.025880315 0.86062071
1.074 -0.027608068 0.86708502
1.076 -0.029348655 0.87345507
1.078 -0.031101888 0.87973086
1.08 -0.032867579 0.88374033
1.082 -0.03463685 0.88403685
1.084 -0.036403726 0.88388061
1.086 -0.038172372 0.88580638
1.088 -0.039946952 0.88981415
1.09 -0.041731629 0.89435912
1.092 -0.043524388 0.8969212
1.094 -0.045319313 0.89758227
1.096 -0.047114717 0.89739947
1.098 -0.048908911 0.89637281
1.1 -0.050700208 0.89512813
1.102 -0.052489424 0.89458124
1.104 -0.054278533 0.89454136
1.106 -0.056067589 0.89452767
1.108 -0.057856644 0.89454017
1.11 -0.05964575 0.89465452
1.112 -0.061435262 0.89488672
1.114 -0.063225297 0.89507165
1.116 -0.065015549 0.89510381
1.118 -0.066805712 0.89498321
1.12 -0.068595481 0.88859097
1.122 -0.070360076 0.8715849
1.124 -0.072081821 0.85274889
1.126 -0.073771071 0.83909013
1.128 -0.075438182 0.83060862
1.13 -0.077093506 0.81900721
1.132 -0.07871421 0.79672856
1.134 -0.08028042 0.77317961
1.136 -0.081806929 0.75702743
1.138 -0.08330853 0.74827203
1.14 -0.084800017 0.74143338
1.142 -0.086274263 0.72455398
1.144 -0.087698233 0.69339762
1.146 -0.089047854 0.65020557
1.148 -0.090299055 0.59497784
1.15 -0.091427765 0.52748133
1.152 -0.092408981 0.45807724
1.154 -0.093260074 0.4028901
1.156 -0.094020541 0.36745015
1.158 -0.094729875 0.35175738
1.16 -0.09542757 0.34885757
1.162 -0.096125305 0.3412678
1.164 -0.096792642 0.32014933
1.166 -0.097405902 0.28719208
1.168 -0.09794141 0.24239604
1.17 -0.098375487 0.17547614
1.172 -0.098643314 0.085743865
1.174 -0.098718462 -0.00212087
1.176 -0.098634831 -0.073034703
1.178 -0.098426323 -0.12699763
1.18 -0.09812684 -0.15892645
1.182 -0.097790617 -0.17544173
1.184 -0.097425074 -0.19918238
1.186 -0.096993888 -0.24108349
1.188 -0.09646074 -0.30114506
1.19 -0.095789308 -0.35709241
1.192 -0.09503237 -0.38034157
1.194 -0.094267941 -0.38370334
1.196 -0.093497557 -0.3862978
1.198 -0.09272275 -0.38812494
1.2 -0.091945057 -0.38945861
1.202 -0.091164916 -0.39114512
1.204 -0.090380476 -0.39376936
1.206 -0.089589838 -0.39734371
1.208 -0.088791102 -0.40186818
1.21 -0.087982366 -0.43187936
1.212 -0.087063584 -0.50584755
1.214 -0.085958975 -0.59013673
1.216 -0.084703037 -0.65717715
1.218 -0.083330267 -0.70696882
1.22 -0.081875162 -0.75727998
1.222 -0.080301147 -0.8182368
1.224 -0.078602215 -0.86060792
1.226 -0.076858715 -0.86280407
1.228 -0.075150998 -0.82482525
1.23 -0.073559414 -0.76747957
1.232 -0.07208108 -0.72536114
1.234 -0.07065797 -0.69834083
1.236 -0.069287717 -0.67250352
1.238 -0.067967956 -0.64784922
1.24 -0.06669632 -0.62253717
1.242 -0.065477807 -0.58907043
1.244 -0.064340038 -0.54080548
1.246 -0.063314585 -0.47675496
1.248 -0.062433018 -0.39691887
1.25 -0.06172691 -0.30444657
1.252 -0.061215232 -0.22134488
1.254 -0.06084153 -0.1727507
1.256 -0.060524229 -0.16494342
1.258 -0.060181756 -0.19792304
1.26 -0.059732537 -0.2460078
1.262 -0.059197725 -0.27236951
1.264 -0.058643059 -0.28597026
1.266 -0.058053844 -0.3069186
1.268 -0.057415385 -0.33521452
1.27 -0.056712986 -0.37350059
1.272 -0.055921382 -0.41896418
1.274 -0.055037129 -0.46078
1.276 -0.054078262 -0.49357791
1.278 -0.053062818 -0.51735791
1.28 -0.052008831 -0.53323383
1.282 -0.050929882 -0.55134541
1.284 -0.049803449 -0.58411762
1.286 -0.048593412 -0.63494956
1.288 -0.047263651 -0.70384122
1.29 -0.045778047 -0.78155931
1.292 -0.044137414 -0.84395483
1.294 -0.042402228 -0.87788756
1.296 -0.040625863 -0.88513297
1.298 -0.038861696 -0.86569105
1.3 -0.037163099 -0.84076719
1.302 -0.035498627 -0.83326553
1.304 -0.033830037 -0.82452883
1.306 -0.032200512 -0.79420112
1.308 -0.030653233 -0.74228238
1.31 -0.029231382 -0.68020022
1.312 -0.027932432 -0.63049339
1.314 -0.026709409 -0.59840096
1.316 -0.025538828 -0.57805089
1.318 -0.024397205 -0.56944317
1.32 -0.023261055 -0.57112749
1.322 -0.022112695 -0.57433992
1.324 -0.020963696 -0.56956032
1.326 -0.019834454 -0.55458221
1.328 -0.018745367 -0.52940557
1.33 -0.017716831 -0.49535621
1.332 -0.016763942 -0.46064217
1.334 -0.015874263 -0.43426107
1.336 -0.015026898 -0.41832822
1.338 -0.01420095 -0.41284363
1.34 -0.013375523 -0.40809434
1.342 -0.012568573 -0.39451435
1.344 -0.011797466 -0.38203709
1.346 -0.011040424 -0.38044903
1.348 -0.01027567 -0.38975017
1.35 -0.0094814235 -0.45660352
1.352 -0.0084492555 -0.58594142
1.354 -0.0071376578 -0.66850489
1.356 -0.0057752359 -0.63676562
1.358 -0.0045905953 -0.4907236
1.36 -0.0038123415 -0.31071492
1.362 -0.0033477356 -0.21754678
1.364 -0.0029421544 -0.19158973
1.366 -0.0025813767 -0.17274324
1.368 -0.0022511814 -0.1610073
1.37 -0.0019373475 -0.15594733
1.372 -0.0016273921 -0.15463595
1.374 -0.0013188037 -0.15376861
1.376 -0.0010123177 -0.1525335
1.378 -0.00070866967 -0.15093062
1.38 -0.00040859519 -0.14941125
1.382 -0.00011102466 -0.14632584
1.384 0.00017670817 -0.13807186
1.386 0.00044126278 -0.12314761
1.388 0.00066929863 -0.1015531
1.39 0.00084747519 -0.046317799
1.392 0.00085456982 0.047793802
1.394 0.00065629998 0.12120863
1.396 0.00036973531 0.13608864
1.398 0.00011194543 0.092433826
1.4 0 0.027986358
1.402 0 0
1.404 0 0
1.406 0 0
1.408 0 0
1.41 0 0
1.412 0 0
1.414 0 0
1.416 0 0
1.418 0 0
1.42 0 0
1.422 0 0
1.424 0 0
1.426 0 0
1.428 0 0
1.43 0 0
1.432 0 0
1.434 0 0
1.436 0 0
1.438 0 0
1.44 0 0
1.442 0 0
1.444 0 0
1.446 0 0
1.448 0 0
1.45 0 0
1.452 0 0
1.454 0 0
1.456 0 0
1.458 0 0
1.46 0 0
1.462 0 0
1.464 0 0
1.466 0 0
1.468 0 0
1.47 0 0
1.472 0 0
1.474 0 0
1.476 0 0
1.478 0 0
1.48 0 0
1.482 0 0
1.484 0 0
1.486 0 0
1.488 0 0
1.49 0 0
1.492 0 0
1.494 0 0
1.496 0 0
1.498 0 0
1.5 0 0
1.502 0 0
1.504 0 0
1.506 0 0
1.508 0 0
1.51 0 0
1.512 0 0
1.514 0 0
1.516 0 0
1.518 0 0
1.52 0 0
1.522 0 0
1.524 0 0
1.526 0 0
1.528 0 0
1.53 0 0
1.532 0 0
1.534 0 0
1.536 0 0
1.538 0 0
1.54 0 0
1.542 0 0
1.544 0 0
1.546 0 0
1.548 0 0
1.55 0 0
1.552 0 0
1.554 0 0
1.556 0 0
1.558 0 0
1.56 0 0
1.562 0 0
1.564 0 0
1.566 0 0
1.568 0 0
1.57 0 0
1.572 0 0
1.574 0 0
1.576 0 0
1.578 0 0
1.58 0 0
1.582 0 0
1.584 0 0
1.586 0 0
1.588 0 0
1.59 0 0
1.592 0 0
1.594 0 0
1.596 0 0
1.598 0 0
1.6 0 0
1.602 0 0
1.604 0 0
1.606 0 0
1.608 0 0
1.61 0 0
1.612 0 0
1.614 0 0
1.616 0 0
1.618 0 0
1.62 0 0
1.622 0 0
1.624 0 0
1.626 0 0
1.628 0 0
1.63 0 0
1.632 0 0
1.634 0 0
1.636 0 0
1.638 0 0
1.64 0 0
1.642 0 0
1.644 0 0
1.646 0 0
1.648 0 0
1.65 0 0
1.652 0 0
1.654 0 0
1.656 0 0
1.658 0 0
1.66 0 0
1.662 0 0
1.664 0 0
1.666 0 0
1.668 0 0
1.67 0 0
1.672 0 0
1.674 0 0
1.676 0 0
1.678 0 0
1.68 0 0
1.682 0 0
1.684 0 0
1.686 0 0
1.688 0 0
1.69 0 0
1.692 0 0
1.694 0 0
1.696 0 0
1.698 0 0
1.7 0 0
1.702 0 0
1.704 0 0
1.706 0 0
1.708 0 0
1.71 0 0
1.712 0 0
1.714 0 0
1.716 0 0
1.718 0 0
1.72 0 0
1.722 0 0
1.724 0 0
1.726 0 0
1.728 0 0
1.73 0 0
1.732 0 0
1.734 0 0
1.736 0 0
1.738 0 0
1.74 0 0
1.742 0 0
1.744 0 0
1.746 0 0
1.748 0 0
1.75 0 0
1.752 0 0
1.754 0 0
1.756 0 0
1.758 0 0
1.76 0 0
1.762 0 0
1.764 0 0
1.766 0 0
1.768 0 0
1.77 0 0
1.772 0 0
1.774 0 0
1.776 0 0
1.778 0 0
1.78 0 0
1.782 0 0
1.784 0 0
1.786 0 0
1.788 0 0
1.79 0 0
1.792 0 0
1.794 0 0
1.796 0 0
1.798 0 0
1.8 0 0
1.802 0 0
1.804 0 0
1.806 0 0
1.808 0 0
1.81 0 0
1.812 0 0
1.814 0 0
1.816 0 0
1.818 0 0
1.82 0 0
1.822 0 0
1.824 0 0
1.826 0 0
1.828 0 0
1.83 0 0
1.832 0 0
1.834 0 0
1.836 0 0
1.838 0 0
1.84 0 0
1.842 0 0
1.844 0 0
1.846 0 0
1.848 0 0
1.85 0 0
1.852 0 0
1.854 0 0
1.856 0 0
1.858 0 0
1.86 0 0
1.862 0 0
1.864 0 0
1.866 0 0
1.868 0 0
1.87 0 0
1.872 0 0
1.874 0 0
1.876 0 0
1.878 0 0
1.88 0 0
1.882 0 0
1.884 0 0
1.886 0 0
1.888 0 0
1.89 0 0
1.892 0 0
1.894 0 0
1.896 0 0
1.898 0 0
1.9 0 0
1.902 0 0
1.904 0 0
1.906 0 0
1.908 0 0
1.91 0 0
1.912 0 0
1.914 0 0
1.916 0 0
1.918 0 0
1.92 0 0
1.922 0 0
1.924 0 0
1.926 0 0
1.928 0 0
1.93 0 0
1.932 0 0
1.934 0 0
1.936 0 0
1.938 0 0
1.94 0 0
1.942 0 0
1.944 0 0
1.946 0 0
1.948 0 0
1.95 0 0
1.952 0 0
1.954 0 0
1.956 0 0
1.958 0 0
1.96 0 0
1.962 0 0
1.964 0 0
1.966 0 0
1.968 0 0
1.97 0 0
1.972 0 0
1.974 0 0
1.976 0 0
1.978 0 0
1.98 0 0
1.982 0 0
1.984 0 0
1.986 0 0
1.988 0 0
1.99 0 0
1.992 0 0
1.994 0 0
1.996 0 0
1.998 0 0
2 0 0
| 47.952048 | 47 | 0.344688 |
f016bcca921752720665dbfae5ff32e58e1d8f2e | 629 | js | JavaScript | src/widget/components/SectionListLink.js | katandcompany/wistiaPlugin | 73b9b3821800fb0df191d11c1719dfb645ece0b4 | [
"MIT"
] | null | null | null | src/widget/components/SectionListLink.js | katandcompany/wistiaPlugin | 73b9b3821800fb0df191d11c1719dfb645ece0b4 | [
"MIT"
] | null | null | null | src/widget/components/SectionListLink.js | katandcompany/wistiaPlugin | 73b9b3821800fb0df191d11c1719dfb645ece0b4 | [
"MIT"
] | null | null | null | import React, { useContext } from 'react';
import { PluginContext } from '../../contexts/PluginContext';
const SectionListLink = ({ sectionId, active }) => {
const { setCurrentFilter } = useContext(PluginContext);
const linkClickEvent = (event) => {
setCurrentFilter(event.currentTarget.getAttribute('id'));
};
return (
<a
className={`btn btn-primary ${active ? 'active' : ''}`}
id={sectionId}
key={sectionId}
role="button"
onClick={linkClickEvent}
onKeyPress={linkClickEvent}
href={`#${sectionId}`}>
{sectionId}
</a>
);
};
export default SectionListLink;
| 25.16 | 61 | 0.627981 |
85e81d6c3e8dd1b1505901d4bee866c02485f58e | 314 | h | C | Breakout Clone/ball.h | GEMISIS/Breakout-Clone | b09385449f8b11d43b89d90390653d04b6ebdf9b | [
"MIT"
] | null | null | null | Breakout Clone/ball.h | GEMISIS/Breakout-Clone | b09385449f8b11d43b89d90390653d04b6ebdf9b | [
"MIT"
] | null | null | null | Breakout Clone/ball.h | GEMISIS/Breakout-Clone | b09385449f8b11d43b89d90390653d04b6ebdf9b | [
"MIT"
] | 1 | 2021-11-14T20:12:02.000Z | 2021-11-14T20:12:02.000Z | #pragma once
#include "entity.h"
#include "paddle.h"
class Ball : public Entity
{
public:
Ball()
{
}
Ball(Paddle* paddle, sf::RenderWindow* window);
void Bounce(bool bounceY);
void Reset(sf::RenderWindow* window);
bool Update(sf::RenderWindow* window);
private:
sf::Vector2f velocity;
Paddle* paddle;
}; | 16.526316 | 48 | 0.707006 |
2a284d43516ab7f430c70113eebc373740ba54d3 | 6,016 | html | HTML | index.html | Backlink-gmx/Outdoorrucksack | 6614e01e1632b2577c08831bb344dc4165d7def5 | [
"MIT"
] | null | null | null | index.html | Backlink-gmx/Outdoorrucksack | 6614e01e1632b2577c08831bb344dc4165d7def5 | [
"MIT"
] | null | null | null | index.html | Backlink-gmx/Outdoorrucksack | 6614e01e1632b2577c08831bb344dc4165d7def5 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Der passende Outdoorrucksack für die Aktivitäten beim Wandern</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom fonts for this template -->
<link href="https://fonts.googleapis.com/css?family=Catamaran:100,200,300,400,500,600,700,800,900" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lato:100,100i,300,300i,400,400i,700,700i,900,900i" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="css/one-page-wonder.min.css" rel="stylesheet">
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark navbar-custom fixed-top">
<div class="container">
<a class="navbar-brand" href="#">Informationen zum Outdoorrucksack</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="#">Sign Up</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Log In</a>
</li>
</ul>
</div>
</div>
</nav>
<header class="masthead text-center text-white">
<div class="masthead-content">
<div class="container">
<h1 class="masthead-heading mb-0">Der beste Outdoorrucksack</h1>
<h2 class="masthead-subheading mb-0">Wandern - Trekking - Outdoor</h2>
<a href="https://www.g-v.de/outdoorrucksack" class="btn btn-primary btn-xl rounded-pill mt-5">Outdoorrucksack finden</a>
</div>
</div>
<div class="bg-circle-1 bg-circle"></div>
<div class="bg-circle-2 bg-circle"></div>
<div class="bg-circle-3 bg-circle"></div>
<div class="bg-circle-4 bg-circle"></div>
</header>
<section>
<div class="container">
<div class="row align-items-center">
<div class="col-lg-6 order-lg-2">
<div class="p-5">
<img class="img-fluid rounded-circle" src="img/01.jpg" alt="">
</div>
</div>
<div class="col-lg-6 order-lg-1">
<div class="p-5">
<h2 class="display-4">Was sollte man zum Outdoorrucksack wissen?</h2>
<p>Da jeder das Gewicht, das er trägt, reduzieren möchte, ist der leichte Outdoorrucksack viel häufiger anzutreffen, zumal so viel Arbeit in ihre Designs gesteckt wurde, um sie bequemer zu machen, wobei es einfacher macht, den Outdoorrucksack beim Bewegen zu tragen. Die meisten Menschen nutzen den Outdoorrucksack für kleine bis mittlere Lasten beim Trekking und Wandern im Outdoor - Bereich, was weniger ermüdend und heutzutage im Allgemeinen sehr bequem ist. Es gibt viele Faktoren, die beim Kauf eines neuen Outdoorrucksacks berücksichtigt muss, wie z.B. das Gewicht, das Volumen und das Design. Auf dem Markt gibt es eine große Vielfalt. Diese Seite soll einigen Tipps zu geben zum Helfen, was Sie bei der Suche nach Ihrem nächsten leichten Outdoorrucksack beachten sollten.</p>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="container">
<div class="row align-items-center">
<div class="col-lg-6">
<div class="p-5">
<img class="img-fluid rounded-circle" src="img/02.jpg" alt="">
</div>
</div>
<div class="col-lg-6">
<div class="p-5">
<h2 class="display-4">Das innere des Outdoorrucksacks</h2>
<p>Da Sie einen leichteren Outdoorrucksack haben möchten, sollten Sie einen Rucksack mit weniger sperrigem Rahmen, modernen Materialien und gutem Design finden. Grundlegende Outdoorrucksäcke haben einen einfachen Rahmen und können eine Last von bis zu 20 Kg tragen. Wenn Sie vorhaben beim Wandern und beim Trekking eine schwerere Last zu tragen, sollten Sie einen Outdoorrucksack mit einem stabileren Rahmen suchen, da dies Ihr Gewicht zwangsläufig erhöht. Wenn Sie anfangen, in große Rucksäcke zu wandern, haben sie eine zusätzliche Polsterung, um sie bei großen Lasten trotzdem bequem zu tragen und sie sind aufgrund der zusätzlichen Belastung und des zusätzlichen Verschleißes im Allgemeinen aus stabileren Materialien gefertigt.</p>
</div>
</div>
</div>
</div>
</section>
<section>
<div class="container">
<div class="row align-items-center">
<div class="col-lg-6 order-lg-2">
<div class="p-5">
<img class="img-fluid rounded-circle" src="img/03.jpg" alt="">
</div>
</div>
<div class="col-lg-6 order-lg-1">
<div class="p-5">
<h2 class="display-4">Outdoorrucksack - Material</h2>
<p>Gute leichte Outdoorrucksäcke bestehen oft aus zwei unterschiedlichen Materialien. Faser, die leichter, aber viel teurer sind, und Ripstop-Nylon, das schwerer, aber günstig ist. Sie werden bei beiden Entscheidungen nichts falsch machen, da die Materialien von einem Outdoorrucksack sehr langlebig und funktional sind und einige großartige, leichte Outdoorrucksäcke daraus hergestellt werden.</p>
</div>
</div>
</div>
</div>
</section>
<!-- Footer -->
<footer class="py-5 bg-black">
<div class="container">
<p class="m-0 text-center text-white small">Alle Rechte vorbehalten © Rucksäcke 2020</p>
</div>
<!-- /.container -->
</footer>
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
</body>
</html>
| 46.276923 | 795 | 0.658743 |
5f5421cf0ee10d7fe2ac56a9d2b4ccca0b3e9675 | 332 | sql | SQL | install/migration/1_6_to_1_7/mssql.sql | ZenPlanner/BugLogHQ | cbd67e44b0c569d649dfeba4c44bb02c5813cc46 | [
"Apache-2.0"
] | null | null | null | install/migration/1_6_to_1_7/mssql.sql | ZenPlanner/BugLogHQ | cbd67e44b0c569d649dfeba4c44bb02c5813cc46 | [
"Apache-2.0"
] | null | null | null | install/migration/1_6_to_1_7/mssql.sql | ZenPlanner/BugLogHQ | cbd67e44b0c569d649dfeba4c44bb02c5813cc46 | [
"Apache-2.0"
] | null | null | null | CREATE TABLE [dbo].[bl_ExtensionLog] (
[ExtensionLogID] int IDENTITY (1,1) NOT NULL,
[extensionID] int NULL,
[createdOn] datetime NOT NULL,
[entryID] int NULL
)
ON [PRIMARY]
GO
ALTER TABLE [dbo].[bl_ExtensionLog]
ADD
CONSTRAINT [DF_bl_ExtensionLog_createdOn]
DEFAULT (getdate()) FOR [createdOn]
GO
| 22.133333 | 51 | 0.683735 |
e3c933775877e1a29db56b69abdf7df09bfbc274 | 1,185 | go | Go | packetizer_test.go | lightsofapollo/rtp | cfeee237106ea293979796c30a3a1e1fbafaa355 | [
"MIT"
] | null | null | null | packetizer_test.go | lightsofapollo/rtp | cfeee237106ea293979796c30a3a1e1fbafaa355 | [
"MIT"
] | null | null | null | packetizer_test.go | lightsofapollo/rtp | cfeee237106ea293979796c30a3a1e1fbafaa355 | [
"MIT"
] | null | null | null | package rtp
import (
"fmt"
"testing"
"time"
"github.com/pion/rtp/codecs"
"github.com/stretchr/testify/assert"
)
func TestNtpConversion(t *testing.T) {
loc := time.FixedZone("UTC-5", -5*60*60)
tests := []struct {
t time.Time
n uint64
}{
{t: time.Date(1985, time.June, 23, 4, 0, 0, 0, loc), n: 0xa0c65b1000000000},
{t: time.Date(1999, time.December, 31, 23, 59, 59, 500000, loc), n: 0xbc18084f0020c49b},
{t: time.Date(2019, time.March, 27, 13, 39, 30, 8675309, loc), n: 0xe04641e202388b88},
}
for _, in := range tests {
out := toNtpTime(in.t)
assert.Equal(t, in.n, out)
}
}
func TestPacketizer(t *testing.T) {
multiplepayload := make([]byte, 128)
//use the G722 payloader here, because it's very simple and all 0s is valid G722 data.
packetizer := NewPacketizer(100, 98, 0x1234ABCD, &codecs.G722Payloader{}, NewRandomSequencer(), 90000)
packets := packetizer.Packetize(multiplepayload, 2000)
if len(packets) != 2 {
packetlengths := ""
for i := 0; i < len(packets); i++ {
packetlengths += fmt.Sprintf("Packet %d length %d\n", i, len(packets[i].Payload))
}
t.Fatalf("Generated %d packets instead of 2\n%s", len(packets), packetlengths)
}
}
| 26.931818 | 103 | 0.662447 |
1b156cb4ea5bde552c19b3569a25db9f053abd1e | 689 | lua | Lua | src/ServerScriptService/temporary/Footsteps/Pitch.server.lua | DevArke/starstream | 79af1414f5140519951ed023883ad2144b36a198 | [
"Apache-2.0"
] | null | null | null | src/ServerScriptService/temporary/Footsteps/Pitch.server.lua | DevArke/starstream | 79af1414f5140519951ed023883ad2144b36a198 | [
"Apache-2.0"
] | null | null | null | src/ServerScriptService/temporary/Footsteps/Pitch.server.lua | DevArke/starstream | 79af1414f5140519951ed023883ad2144b36a198 | [
"Apache-2.0"
] | null | null | null | while wait(.3) do
x = script.Parent:GetChildren()
for i = 1,#x do
if x[i]:IsA("Sound") then
x[i].Pitch = x[i].Pitch - 0.1
end
end
wait(.3)
x = script.Parent:GetChildren()
for i = 1,#x do
if x[i]:IsA("Sound") then
x[i].Pitch = x[i].Pitch - 0.1
end
end
wait(.3)
x = script.Parent:GetChildren()
for i = 1,#x do
if x[i]:IsA("Sound") then
x[i].Pitch = x[i].Pitch + 0.2
end
end
wait(.3)
x = script.Parent:GetChildren()
for i = 1,#x do
if x[i]:IsA("Sound") then
x[i].Pitch = x[i].Pitch - 0.1
end
end
wait(.3)
x = script.Parent:GetChildren()
for i = 1,#x do
if x[i]:IsA("Sound") then
x[i].Pitch = x[i].Pitch + 0.1
end
end
end
| 14.978261 | 32 | 0.558781 |
da8507dcc8ce5dc0b2b66962fbf1a0eef9a4faf6 | 439 | asm | Assembly | unix-x64/printhex.asm | mazoti/adler32 | a7d27786344277a6fe589ba98c0210d96c88fc8e | [
"BSD-3-Clause"
] | null | null | null | unix-x64/printhex.asm | mazoti/adler32 | a7d27786344277a6fe589ba98c0210d96c88fc8e | [
"BSD-3-Clause"
] | null | null | null | unix-x64/printhex.asm | mazoti/adler32 | a7d27786344277a6fe589ba98c0210d96c88fc8e | [
"BSD-3-Clause"
] | null | null | null | ; void printhex(int stdout_stderr, int number);
global printhex
section .data
hex_table db '0123456789abcdef'
section .text
printhex:
mov rbx,rsp
mov rdx,1 ; write 1 character
divide:
mov rcx,rsi
and rcx,15 ; push mod 16
push rcx
shr rsi,4
jnz divide
print_stack:
mov rax,4 ; write syscall
pop rcx
lea rsi,[rel hex_table+rcx]
syscall
cmp rbx,rsp
jne print_stack
ret
| 14.633333 | 47 | 0.646925 |
74bfc79b9d5b89875ca557b0fc2ae5ce447f5fd4 | 2,102 | js | JavaScript | polymer-app/app/edit/src/d4l-logging/d4l-logging.js | coders-for-labour/dashboard-for-labour | 0d89187c6328834b3281f14fb2d07a5836694f9a | [
"MIT"
] | 5 | 2017-05-21T20:45:11.000Z | 2019-11-15T18:59:08.000Z | polymer-app/app/edit/src/d4l-logging/d4l-logging.js | coders-for-labour/dashboard-for-labour | 0d89187c6328834b3281f14fb2d07a5836694f9a | [
"MIT"
] | 26 | 2017-05-23T11:00:19.000Z | 2022-03-03T22:57:38.000Z | polymer-app/app/edit/src/d4l-logging/d4l-logging.js | coders-for-labour/dashboard-for-labour | 0d89187c6328834b3281f14fb2d07a5836694f9a | [
"MIT"
] | 5 | 2017-05-26T10:46:35.000Z | 2019-11-17T23:56:29.000Z | window.D4L = window.D4L || {};
/**
* @polymerBehavior D4L.Logging
*/
D4L.Logging = {
properties: {
LogLevel: {
type: Object,
value: function() {
return {
ERR: 0,
WARN: 1,
INFO: 2,
VERBOSE: 3,
DEBUG: 4,
SILLY: 5
};
}
},
__disableLogging: {
type: Boolean,
value: false
},
logLevel: {
type: Number,
value: 3
}
},
__assert: function() {
console.assert.apply(console, arguments);
},
__err: function() {
if (this.logLevel >= this.LogLevel.ERR) {
console.error.apply(console, arguments);
}
},
__warn: function() {
if (this.logLevel >= this.LogLevel.WARN) {
let args = Array.from(arguments);
args.splice(0, 0, `${this.is}: `);
console.warn.apply(console, args);
}
},
__info: function() {
if (this.__disableLogging === false && this.logLevel >= this.LogLevel.INFO) {
let args = Array.from(arguments);
args.splice(0, 0, `${this.is}: [info] `);
console.log.apply(console, args);
}
},
__verbose: function() {
if (this.__disableLogging === false && this.logLevel >= this.LogLevel.VERBOSE) {
let args = Array.from(arguments);
args.splice(0, 0, `${this.is}: [verbose] `);
console.log.apply(console, args);
}
},
__log: function() {
if (this.__disableLogging === false && this.logLevel >= this.LogLevel.VERBOSE) {
let args = Array.from(arguments);
args.splice(0, 0, `${this.is}: [verbose] `);
console.log.apply(console, args);
}
},
__debug: function() {
if (this.__disableLogging === false && this.logLevel >= this.LogLevel.DEBUG) {
let args = Array.from(arguments);
args.splice(0, 0, `${this.is}: [debug]`);
console.log.apply(console, args);
}
},
__silly: function() {
if (this.__disableLogging === false && this.logLevel >= this.LogLevel.SILLY) {
let args = Array.from(arguments);
args.splice(0, 0, `${this.is}: [silly]`);
console.log.apply(console, args);
}
}
} | 26.275 | 84 | 0.553758 |
2822f5e1adedf305c8fcfe5fcfed5e376745113e | 4,574 | lua | Lua | rl_env.lua | lujiaying/visual7w-qa-models | 3aaced3ca4768e0e07c6ff7c9b95d5ed71604ee9 | [
"MIT"
] | 1 | 2020-07-07T10:29:56.000Z | 2020-07-07T10:29:56.000Z | rl_env.lua | lujiaying/visual7w-qa-models | 3aaced3ca4768e0e07c6ff7c9b95d5ed71604ee9 | [
"MIT"
] | null | null | null | rl_env.lua | lujiaying/visual7w-qa-models | 3aaced3ca4768e0e07c6ff7c9b95d5ed71604ee9 | [
"MIT"
] | null | null | null | require 'torch'
require 'nn'
require 'nngraph' require 'loadcaffe'
require 'image'
require 'math'
require 'misc.QADatasetLoader'
require 'modules.QAAttentionModel'
require 'modules.QACriterion'
local utils = require 'misc.utils'
local net_utils = require 'misc.net_utils'
local rl_env = {}
local rnn = nil
local cnn = nil
local crit = nil
local seq_length = 20
local vocab_size = 3007
local word_to_ix = {}
local gpu_mode = false
function rl_env.init(gpuid)
if rnn == nil then
print(string.format('Init reinforcement learning environment, gpuid=%s', gpuid))
--[[
local loader = QADatasetLoader{h5_file='data/qa_data.h5', json_file='data/qa_data.json',dataset_file='visual7w-toolkit/datasets/visual7w-telling/dataset.json'}
seq_length = loader.seq_length
vocab_size = loader.vocab_size
print(seq_length)
print(vocab_size)
loader = nil
collectgarbage() -- free some memory
--]]
gpu_mode = gpuid >= 0
if gpu_mode then
require 'cutorch'
require 'cunn'
require 'cudnn'
cutorch.manualSeed(1234)
cutorch.setDevice(gpuid + 1) -- note +1 because lua is 1-indexed
end
local checkpoint = torch.load('checkpoints/model_visual7w_telling_gpu.t7')
local vocab = checkpoint.vocab
for i, w in pairs(vocab) do
word_to_ix[w] = i
end
local modules = checkpoint.modules
cnn = modules.cnn
rnn = modules.rnn
modules = nil
collectgarbage() -- free some memory
if gpu_mode then cnn:cuda() end
rnn:createClones()
if gpu_mode then rnn:cuda() end
cnn:evaluate()
rnn:evaluate()
crit = nn.QACriterion()
if gpu_mode then crit:cuda() end
end
print(string.format('Done init reinforcement learning environment, gpuid=%s', gpuid))
return rnn, cnn, crit
end
function rl_env.get_features(image_ids, questions, answers)
local batch_size = #image_ids
local q_lens = utils.get_sequences_token_cnt(questions)
local a_lens = utils.get_sequences_token_cnt(answers)
local MAX_Q_LEN = 14
local data = {}
data.images = torch.Tensor(batch_size, 3, 224, 224)
data.question_lengths = torch.LongTensor(batch_size)
data.labels = torch.LongTensor(batch_size, seq_length)
for i = 1, batch_size do
local image_path = string.format('images/v7w_%s.jpg', image_ids[i])
local img = image.load(image_path, 3)
img = image.scale(img, 224, 224, 'bicubic'):mul(255)
data.images[i] = img
local seq = torch.LongTensor(seq_length):zero()
local question = string.lower(questions[i]):gsub('%p', '')
--local q_len = q_lens[i]
local q_len = math.min(q_lens[i], MAX_Q_LEN)
data.question_lengths[i] = q_len + 1 -- with <START> token
local question_label = torch.LongTensor(q_len):zero()
local token_idx = 1
for token in question:gmatch('%w+') do
local word_ix = word_to_ix[token]
if word_ix == nil then word_ix = word_to_ix['UNK'] end
question_label[token_idx] = word_ix
token_idx = token_idx + 1
if token_idx > q_len then break end
end
seq[{{1,q_len}}] = question_label
seq[q_len+1] = vocab_size
local answer = string.lower(answers[i]):gsub('%p', '')
local MAX_A_LEN = seq_length - 1 - q_len
local a_len = math.min(a_lens[i], MAX_A_LEN)
local ans_label = torch.LongTensor(a_len):zero()
token_idx = 1
for token in answer:gmatch('%w+') do
local word_ix = word_to_ix[token]
if word_ix == nil then word_ix = word_to_ix['UNK'] end
ans_label[token_idx] = word_ix
token_idx = token_idx + 1
if token_idx > a_len then break end
end
seq[{{q_len+2, q_len+a_len+1}}] = ans_label
data.labels[i] = seq
end
data.images = net_utils.prepro(data.images, false, gpu_mode)
data.labels = data.labels:transpose(1,2):contiguous()
data.question_lengths = data.question_lengths:contiguous()
return data
end
--[[
images: images already preprocessed
labels: question_labels + answer_labels, (D+2)xN
returns a size N Tensor
--]]
function rl_env.produce_reward(images, labels, question_lengths)
local batch_size = labels:size(2)
--print(string.format("batch_size:%s", batch_size))
local image_encodings = cnn:forward(images)
local conv_feat_maps = cnn:get(30).output:view(batch_size, 512, -1)
local logprobs = rnn:forward{image_encodings, conv_feat_maps, labels}
local loss = crit:forward(logprobs, {labels, question_lengths})
local rewards = -1 * crit.loss_per_sample
--local w_rescale = 1000
local w_rescale = 1
rewards = w_rescale * torch.exp(rewards)
return rewards
end
return rl_env
| 30.905405 | 163 | 0.69742 |
e76b08a54c94d8717ac6fbf42faf2fa3ed0ac11b | 4,402 | js | JavaScript | src/services/spSearch.js | princeppy/angular-sharepoint-sharecoffee-wrapper | 5a716ac02b77dc11887dd94ef71659a368412a82 | [
"MIT"
] | null | null | null | src/services/spSearch.js | princeppy/angular-sharepoint-sharecoffee-wrapper | 5a716ac02b77dc11887dd94ef71659a368412a82 | [
"MIT"
] | null | null | null | src/services/spSearch.js | princeppy/angular-sharepoint-sharecoffee-wrapper | 5a716ac02b77dc11887dd94ef71659a368412a82 | [
"MIT"
] | null | null | null | (function () {
'use strict';
/**
* @ngdoc service
* @name ExpertsInside.SharePoint.Search.$spSearch
* @requires ExpertsInside.SharePoint.Core.$spRest
* @requires ExpertsInside.SharePoint.Core.$spConvert
*
* @description Query the Search via REST API
*
*/
angular.module('ExpertsInside.SharePoint.Search')
.factory('$spSearch', function ($http, $spRest, $spConvert) {
var $spSearchMinErr = angular.$$minErr('$spSearch');
var search = {
/**
* @private
* Wrap given properties in a query properties object based on search type
*/
$$createQueryProperties: function (searchType, properties) {
var queryProperties;
switch (searchType) {
case 'postquery':
queryProperties = new ShareCoffee.PostQueryProperties();
break;
case 'suggest':
queryProperties = new ShareCoffee.SuggestProperties();
break;
default:
queryProperties = new ShareCoffee.QueryProperties();
break;
}
return angular.extend(queryProperties, properties);
},
/**
* @private
* Decorate the result with $promise and $resolved
*/
$decorateResult: function (result, httpConfig) {
if (angular.isUndefined(result.$resolved)) {
result.$resolved = false;
}
result.$raw = null;
result.$promise = $http(httpConfig).then(function (response) {
var data = response.data;
if (angular.isObject(data)) {
if (angular.isDefined(data.query)) {
result.$raw = data.query;
angular.extend(result, $spConvert.searchResult(data.query));
} else if (angular.isDefined(data.suggest)) {
result.$raw = data.suggest;
angular.extend(result, $spConvert.suggestResult(data.suggest));
}
}
if (angular.isUndefined(result.$raw)) {
throw $spSearchMinErr('badresponse', 'Response does not contain a valid search result.');
}
result.$resolved = true;
return result;
});
return result;
},
/**
* @ngdoc method
* @name ExpertsInside.SharePoint.Search.$spSearch#query
* @methodOf ExpertsInside.SharePoint.Search.$spSearch
*
* @description Perform a search query based on given properties
*
* @param {Object} properties query properties
*
* @returns {Object} search query result
*/
query: function (properties) {
properties = angular.extend({}, properties);
var searchType = properties.searchType;
delete properties.searchType;
var queryProperties = search.$$createQueryProperties(searchType, properties);
var httpConfig = ShareCoffee.REST.build.read['for'].angularJS(queryProperties);
httpConfig.transformResponse = $spRest.transformResponse;
var result = {};
return search.$decorateResult(result, httpConfig);
},
/**
* @ngdoc method
* @name ExpertsInside.SharePoint.Search.$spSearch#postquery
* @methodOf ExpertsInside.SharePoint.Search.$spSearch
*
* @description Perform a search postquery based on given properties
*
* @param {Object} properties query properties
*
* @returns {Object} search query result
*/
postquery: function (properties) {
properties = angular.extend(properties, { searchType: 'postquery' });
return search.query(properties);
},
/**
* @ngdoc method
* @name ExpertsInside.SharePoint.Search.$spSearch#suggest
* @methodOf ExpertsInside.SharePoint.Search.$spSearch
*
* @description Perform a search suggest based on given properties
*
* @param {Object} properties query properties
*
* @returns {Object} search query result
*/
suggest: function (properties) {
properties = angular.extend(properties, { searchType: 'suggest' });
return search.query(properties);
}
};
return search;
});
})();
| 32.607407 | 103 | 0.570877 |
c336c306f419e04866cddb7769da546b2fe0cd6f | 135 | sql | SQL | sql/wait_chains.sql | th0x4c/coin | d70eb7effd672d66e2fe2a57c6ca7406b74e2f44 | [
"Unlicense"
] | null | null | null | sql/wait_chains.sql | th0x4c/coin | d70eb7effd672d66e2fe2a57c6ca7406b74e2f44 | [
"Unlicense"
] | null | null | null | sql/wait_chains.sql | th0x4c/coin | d70eb7effd672d66e2fe2a57c6ca7406b74e2f44 | [
"Unlicense"
] | null | null | null | select
'WAIT_CHAINS' CNAME, to_char(systimestamp, 'yyyy-mm-dd"T"hh24:mi:ss.ff') CTIMESTAMP,
v$wait_chains.*
from
v$wait_chains
/
| 19.285714 | 86 | 0.725926 |
b61ac5069b04295054cda0ddeb80e56da1902e7c | 76 | sql | SQL | src/test/resources/sql/set/b77b120e.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 66 | 2018-06-15T11:34:03.000Z | 2022-03-16T09:24:49.000Z | src/test/resources/sql/set/b77b120e.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 13 | 2019-03-19T11:56:28.000Z | 2020-08-05T04:20:50.000Z | src/test/resources/sql/set/b77b120e.sql | Shuttl-Tech/antlr_psql | fcf83192300abe723f3fd3709aff5b0c8118ad12 | [
"MIT"
] | 28 | 2019-01-05T19:59:02.000Z | 2022-03-24T11:55:50.000Z | -- file:strings.sql ln:20 expect:true
SET standard_conforming_strings TO on
| 25.333333 | 37 | 0.815789 |
bcf1fe7d405d715c6985568af6bf01b5d95200c4 | 2,253 | swift | Swift | RakutenAdvertisingAttribution/Source/Helpers/DataBuilders/ResolveLinkRequestBuilder.swift | Rakuten-Advertising-Developers/RADAttribution-SDK-iOS | 0ea8aa43c7711794bb85f43cf8f9952590411b7f | [
"MIT"
] | 1 | 2021-10-29T21:53:25.000Z | 2021-10-29T21:53:25.000Z | RakutenAdvertisingAttribution/Source/Helpers/DataBuilders/ResolveLinkRequestBuilder.swift | Rakuten-Advertising-Developers/RADAttribution-SDK-iOS | 0ea8aa43c7711794bb85f43cf8f9952590411b7f | [
"MIT"
] | 1 | 2021-08-18T11:24:54.000Z | 2021-08-18T11:24:54.000Z | RakutenAdvertisingAttribution/Source/Helpers/DataBuilders/ResolveLinkRequestBuilder.swift | Rakuten-Advertising-Developers/RADAttribution-SDK-iOS | 0ea8aa43c7711794bb85f43cf8f9952590411b7f | [
"MIT"
] | 2 | 2021-10-29T21:53:39.000Z | 2022-02-18T14:01:47.000Z | //
// ResolveLinkRequestBuilder.swift
// RakutenAdvertisingAttribution
//
// Created by Durbalo, Andrii on 21.07.2020.
//
import Foundation
typealias ResolveLinkRequestBuilderCompletion = (ResolveLinkRequest) -> Void
class ResolveLinkRequestBuilder {
var deviceDataBuilder: DeviceDataBuilder = DeviceDataBuilder()
var userDataBuilder: UserDataBuilder = UserDataBuilder()
var firstLaunchDetectorAdapter: () -> (FirstLaunchDetector) = {
return FirstLaunchDetector(userDefaults: .standard, key: .firstLaunch)
}
func buildResolveRequest(url: URL,
linkId: String?,
adSupportable: AdSupportable,
completion: @escaping ResolveLinkRequestBuilderCompletion) {
let universalLink = linkId != nil ? "" : url.absoluteString
deviceDataBuilder.buildDeviceData(adSupportable: adSupportable) { [weak self] deviceData in
guard let self = self else { return }
let request = ResolveLinkRequest(firstSession: self.firstLaunchDetectorAdapter().isFirstLaunch,
universalLinkUrl: universalLink,
userData: self.userDataBuilder.buildUserData(),
deviceData: deviceData,
linkId: linkId)
completion(request)
}
}
func buildEmptyResolveLinkRequest(adSupportable: AdSupportable,
completion: @escaping ResolveLinkRequestBuilderCompletion) {
deviceDataBuilder.buildDeviceData(adSupportable: adSupportable) { [weak self] deviceData in
guard let self = self else { return }
let link = ""
let request = ResolveLinkRequest(firstSession: self.firstLaunchDetectorAdapter().isFirstLaunch,
universalLinkUrl: link,
userData: self.userDataBuilder.buildUserData(),
deviceData: deviceData,
linkId: nil)
completion(request)
}
}
}
| 38.186441 | 107 | 0.57257 |
967516e82be9ecdb82149ef6fb8f5a617ce39ec4 | 1,738 | kt | Kotlin | retroauth-android/src/main/java/com/andretietz/retroauth/WeakActivityStack.kt | moovel/retroauth | b5334f354c5d04f8f3d39af72cbd6fb79aaa10c3 | [
"Apache-2.0"
] | 279 | 2015-06-29T08:08:16.000Z | 2015-09-24T04:02:06.000Z | retroauth-android/src/main/java/com/andretietz/retroauth/WeakActivityStack.kt | moovel/retroauth | b5334f354c5d04f8f3d39af72cbd6fb79aaa10c3 | [
"Apache-2.0"
] | 51 | 2015-10-24T21:50:13.000Z | 2020-12-22T19:52:33.000Z | retroauth-android/src/main/java/com/andretietz/retroauth/WeakActivityStack.kt | moovel/retroauth | b5334f354c5d04f8f3d39af72cbd6fb79aaa10c3 | [
"Apache-2.0"
] | 34 | 2015-10-06T17:34:48.000Z | 2021-03-19T15:50:14.000Z | /*
* Copyright (c) 2016 Andre Tietz
*
* 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.andretietz.retroauth
import android.app.Activity
import android.util.SparseArray
import java.lang.ref.WeakReference
import java.util.LinkedList
internal class WeakActivityStack {
private val map = SparseArray<WeakReference<Activity>>()
private val stack = LinkedList<Int>()
fun push(item: Activity) {
val identifier = getIdentifier(item)
synchronized(this) {
stack.push(identifier)
map.put(identifier, WeakReference(item))
}
}
fun pop(): Activity? {
synchronized(this) {
if (!stack.isEmpty()) {
val identifier = stack.removeFirst()
val item = map.get(requireNotNull(identifier)).get()
map.remove(identifier)
return item
}
return null
}
}
fun remove(item: Activity) {
val identifier = getIdentifier(item)
synchronized(this) {
stack.remove(identifier)
map.remove(identifier)
}
}
fun peek(): Activity? {
synchronized(this) {
if (!stack.isEmpty()) {
return map.get(stack.first).get()
}
}
return null
}
private fun getIdentifier(item: Activity) = item.hashCode()
}
| 24.828571 | 75 | 0.679517 |
f01853fdef99763aa76db241019fe3f05895618d | 4,221 | py | Python | assets/src/ba_data/python/ba/_analytics.py | SahandAslani/ballistica | 7e3814cd2a1920ea8f5820cb1cdbb4dc5420d30e | [
"MIT"
] | 2 | 2020-07-02T22:18:58.000Z | 2020-07-02T22:19:49.000Z | assets/src/ba_data/python/ba/_analytics.py | MalTarDesigns/ballistica | c38ae5c39b3cc7985be166a959245ca060d3bf31 | [
"MIT"
] | null | null | null | assets/src/ba_data/python/ba/_analytics.py | MalTarDesigns/ballistica | c38ae5c39b3cc7985be166a959245ca060d3bf31 | [
"MIT"
] | null | null | null | # Copyright (c) 2011-2020 Eric Froemling
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# -----------------------------------------------------------------------------
"""Functionality related to analytics."""
from __future__ import annotations
from typing import TYPE_CHECKING
import _ba
if TYPE_CHECKING:
pass
def game_begin_analytics() -> None:
"""Update analytics events for the start of a game."""
# pylint: disable=too-many-branches
# pylint: disable=cyclic-import
from ba._dualteamsession import DualTeamSession
from ba._freeforallsession import FreeForAllSession
from ba._coopsession import CoopSession
from ba._gameactivity import GameActivity
activity = _ba.getactivity(False)
session = _ba.getsession(False)
# Fail gracefully if we didn't cleanly get a session and game activity.
if not activity or not session or not isinstance(activity, GameActivity):
return
if isinstance(session, CoopSession):
campaign = session.campaign
assert campaign is not None
_ba.set_analytics_screen(
'Coop Game: ' + campaign.name + ' ' +
campaign.getlevel(_ba.app.coop_session_args['level']).name)
_ba.increment_analytics_count('Co-op round start')
if len(activity.players) == 1:
_ba.increment_analytics_count('Co-op round start 1 human player')
elif len(activity.players) == 2:
_ba.increment_analytics_count('Co-op round start 2 human players')
elif len(activity.players) == 3:
_ba.increment_analytics_count('Co-op round start 3 human players')
elif len(activity.players) >= 4:
_ba.increment_analytics_count('Co-op round start 4+ human players')
elif isinstance(session, DualTeamSession):
_ba.set_analytics_screen('Teams Game: ' + activity.getname())
_ba.increment_analytics_count('Teams round start')
if len(activity.players) == 1:
_ba.increment_analytics_count('Teams round start 1 human player')
elif 1 < len(activity.players) < 8:
_ba.increment_analytics_count('Teams round start ' +
str(len(activity.players)) +
' human players')
elif len(activity.players) >= 8:
_ba.increment_analytics_count('Teams round start 8+ human players')
elif isinstance(session, FreeForAllSession):
_ba.set_analytics_screen('FreeForAll Game: ' + activity.getname())
_ba.increment_analytics_count('Free-for-all round start')
if len(activity.players) == 1:
_ba.increment_analytics_count(
'Free-for-all round start 1 human player')
elif 1 < len(activity.players) < 8:
_ba.increment_analytics_count('Free-for-all round start ' +
str(len(activity.players)) +
' human players')
elif len(activity.players) >= 8:
_ba.increment_analytics_count(
'Free-for-all round start 8+ human players')
# For some analytics tracking on the c layer.
_ba.reset_game_activity_tracking()
| 45.880435 | 79 | 0.664298 |
7554f41f3e7bbc3bc80adbb3e76a920df2c5b752 | 123 | rs | Rust | js/slothjs/src/builtin/console.rs | EarlGray/language-snippets | 31e4cd1cd32a444752e47484ff528a50bb6e14f6 | [
"BSD-3-Clause"
] | 22 | 2016-02-21T11:13:12.000Z | 2022-03-04T00:10:51.000Z | js/slothjs/src/builtin/console.rs | EarlGray/language-incubator | c875b0427daa5744fd0547eba5434ac4aa000a43 | [
"BSD-3-Clause"
] | null | null | null | js/slothjs/src/builtin/console.rs | EarlGray/language-incubator | c875b0427daa5744fd0547eba5434ac4aa000a43 | [
"BSD-3-Clause"
] | null | null | null | use crate::error::Exception;
use crate::heap::Heap;
pub fn init(_heap: &mut Heap) -> Result<(), Exception> {
Ok(())
}
| 17.571429 | 56 | 0.617886 |
dd98211ce447a08c1058fcc143c580b080ac9c1b | 2,775 | go | Go | functions/go/set-labels/generated/docs.go | Shell32-Natsu/kpt-functions-catalog | aa471013427a10fc006caeaebbf62e5f75cb84cf | [
"Apache-2.0"
] | null | null | null | functions/go/set-labels/generated/docs.go | Shell32-Natsu/kpt-functions-catalog | aa471013427a10fc006caeaebbf62e5f75cb84cf | [
"Apache-2.0"
] | null | null | null | functions/go/set-labels/generated/docs.go | Shell32-Natsu/kpt-functions-catalog | aa471013427a10fc006caeaebbf62e5f75cb84cf | [
"Apache-2.0"
] | null | null | null |
// Code generated by "mdtogo"; DO NOT EDIT.
package generated
var SetLabelsShort = `The ` + "`" + `set-labels` + "`" + ` function adds a list of labels to all resources. It's a common
practice to add a set of labels for all the resources in a package. Kubernetes
has some [recommended labels].
For example, labels can be used in the following scenarios:
- Identify the KRM resources by querying their labels.
- Set labels for all resources within a package (e.g. environment=staging).`
var SetLabelsLong = `
There are 2 kinds of ` + "`" + `functionConfig` + "`" + ` supported by this function:
- ` + "`" + `ConfigMap` + "`" + `
- A custom resource of kind ` + "`" + `SetLabels` + "`" + `
To use a ` + "`" + `ConfigMap` + "`" + ` as the ` + "`" + `functionConfig` + "`" + `, the desired labels must be
specified in the ` + "`" + `data` + "`" + ` field.
To add 2 labels ` + "`" + `color: orange` + "`" + ` and ` + "`" + `fruit: apple` + "`" + ` to all resources, we use the
following ` + "`" + `functionConfig` + "`" + `:
apiVersion: v1
kind: ConfigMap
metadata:
name: my-config
data:
color: orange
fruit: apple
To use a ` + "`" + `SetLabels` + "`" + ` custom resource as the ` + "`" + `functionConfig` + "`" + `, the desired labels
must be specified in the ` + "`" + `labels` + "`" + ` field. Sometimes you have resources (
especially custom resources) that have labels or selectors fields in fields
other than the [defaults][commonlabels], you can specify such label fields using
additionalLabelFields. It will be used jointly with the
[defaults][commonlabels].
` + "`" + `additionalLabelFields` + "`" + ` has following fields:
- ` + "`" + `group` + "`" + `: Select the resources by API version group. Will select all groups if
omitted.
- ` + "`" + `version` + "`" + `: Select the resources by API version. Will select all versions if
omitted.
- ` + "`" + `kind` + "`" + `: Select the resources by resource kind. Will select all kinds if
omitted.
- ` + "`" + `path` + "`" + `: Specify the path to the field that the value needs to be updated. This
field is required.
- ` + "`" + `create` + "`" + `: If it's set to true, the field specified will be created if it
doesn't exist. Otherwise, the function will only update the existing field.
To add 2 labels ` + "`" + `color: orange` + "`" + ` and ` + "`" + `fruit: apple` + "`" + ` to all built-in resources and
the path ` + "`" + `data.selector` + "`" + ` in ` + "`" + `MyOwnKind` + "`" + ` resource, we use the
following ` + "`" + `functionConfig` + "`" + `:
apiVersion: fn.kpt.dev/v1alpha1
kind: SetLabels
metadata:
name: my-config
labels:
color: orange
fruit: apple
additionalLabelFields:
- path: data/selector
kind: MyOwnKind
create: true
`
| 39.642857 | 121 | 0.618739 |
85979b8e956cbd77fe4a39c7492a1e66fd7f8325 | 1,584 | js | JavaScript | src/users/UsersContainer.js | grantba/food_nutrition_information_app | 24572ee96078ed6e34e0fd2094081c5d274d1309 | [
"MIT"
] | 1 | 2021-08-23T22:28:00.000Z | 2021-08-23T22:28:00.000Z | src/users/UsersContainer.js | grantba/food_nutrition_information_app | 24572ee96078ed6e34e0fd2094081c5d274d1309 | [
"MIT"
] | null | null | null | src/users/UsersContainer.js | grantba/food_nutrition_information_app | 24572ee96078ed6e34e0fd2094081c5d274d1309 | [
"MIT"
] | null | null | null | import React, { Component } from 'react'
import Login from './Login'
import Signup from './Signup'
import { Route, Switch, Redirect } from 'react-router-dom'
import { connect } from 'react-redux'
import {userLogin, userSignup, editUser, deleteUser} from '../actions/users'
import Homepage from '../components/Homepage'
import UsersHomepage from './UsersHomepage'
import UsersEditForm from './UsersEditForm'
class UsersContainer extends Component {
render() {
return (
<div>
{this.props.user.loggedIn === false ?
<Switch>
<Route exact path="/login"><Login userLogin={this.props.userLogin}/></Route>
<Route exact path="/signup"><Signup userSignup={this.props.userSignup}/></Route>
<Route path="/" component={Homepage}/>
</Switch>
:
<Switch>
<Route exact path="/home"><UsersHomepage user={this.props.user.user.attributes.username}/></Route>
<Route exact path="/users/:id/edit"><UsersEditForm user={this.props.user} editUser={this.props.editUser} deleteUser={this.props.deleteUser}/></Route>
<Redirect to="/home" />
</Switch>
}
</div>
)
}
}
const mapStateToProps = state => {
return {
user: state.user,
requesting: state.user.requesting,
message: state.user.message
}
}
export default connect(mapStateToProps, {userSignup, userLogin, editUser, deleteUser})(UsersContainer) | 37.714286 | 169 | 0.592172 |
ff131c3d80a7b87e808539622fd621ec58f94ef1 | 602 | asm | Assembly | oeis/013/A013757.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/013/A013757.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/013/A013757.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A013757: a(n) = 15^(3*n + 2).
; 225,759375,2562890625,8649755859375,29192926025390625,98526125335693359375,332525673007965087890625,1122274146401882171630859375,3787675244106352329254150390625,12783403948858939111232757568359375,43143988327398919500410556793212890625,145610960604971353313885629177093505859375,491436992041778317434363998472690582275390625,1658599848141001821340978494845330715179443359375,5597774487475881147025802420102991163730621337890625,18892488895231098871212083167847595177590847015380859375
mov $1,3375
pow $1,$0
mul $1,196
div $1,661304
mul $1,759150
add $1,225
mov $0,$1
| 54.727273 | 486 | 0.888704 |
b1a49002c21c366e88656aedd415e8c23191cabe | 919 | h | C | PermissionsManager.h | ant-ds/Scroll-Reverser | 9bc0d98aa3af0929a4d435c91aca63d487a4824c | [
"Apache-2.0"
] | null | null | null | PermissionsManager.h | ant-ds/Scroll-Reverser | 9bc0d98aa3af0929a4d435c91aca63d487a4824c | [
"Apache-2.0"
] | null | null | null | PermissionsManager.h | ant-ds/Scroll-Reverser | 9bc0d98aa3af0929a4d435c91aca63d487a4824c | [
"Apache-2.0"
] | null | null | null | //
// PermissionsManager.h
// Scroll Reverser
//
// Created by Nicholas Moore on 21/11/2019.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
extern NSString *const PermissionsManagerKeyAccessibilityEnabled;
extern NSString *const PermissionsManagerKeyInputMonitoringEnabled;
extern NSString *const PermissionsManagerKeyHasAllRequiredPermissions;
@interface PermissionsManager : NSObject
- (void)refresh;
@property (readonly) BOOL hasAllRequiredPermissions;
- (void)requestAccessibilityPermission;
@property (readonly, getter=isAccessibilityRequired) BOOL accessibilityRequired;
@property (readonly, getter=isAccessibilityEnabled) BOOL accessibilityEnabled;
- (void)requestInputMonitoringPermission;
@property (readonly, getter=isInputMonitoringEnabled) BOOL inputMonitoringEnabled;
@property (readonly, getter=isInputMonitoringRequired) BOOL inputMonitoringRequired;
@end
NS_ASSUME_NONNULL_END
| 28.71875 | 84 | 0.838955 |
ae0d3d1794bfbcd39384438b73c4f828a5dd067e | 1,629 | sql | SQL | sql/create_indiv_seg_support.sql | crashka/fecdb | b5c35ae782c24fc6a64c989e0107074d1684879f | [
"MIT"
] | null | null | null | sql/create_indiv_seg_support.sql | crashka/fecdb | b5c35ae782c24fc6a64c989e0107074d1684879f | [
"MIT"
] | null | null | null | sql/create_indiv_seg_support.sql | crashka/fecdb | b5c35ae782c24fc6a64c989e0107074d1684879f | [
"MIT"
] | null | null | null | --
-- Individual Segment
--
CREATE TABLE IF NOT EXISTS indiv_seg (
id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
name TEXT NOT NULL,
description TEXT
)
WITH (FILLFACTOR=70);
--
-- Individual Segment Members (composed of `indiv` records)
--
CREATE TABLE IF NOT EXISTS indiv_seg_memb (
id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY,
indiv_seg_id BIGINT NOT NULL,
indiv_id BIGINT NOT NULL
)
WITH (FILLFACTOR=70);
ALTER TABLE indiv_seg_memb ADD FOREIGN KEY (indiv_seg_id) REFERENCES indiv_seg (id) ON DELETE CASCADE;
ALTER TABLE indiv_seg_memb ADD FOREIGN KEY (indiv_id) REFERENCES indiv (id);
CREATE UNIQUE INDEX indiv_seg_name ON indiv_seg (name);
CREATE UNIQUE INDEX indiv_seg_memb_user_key ON indiv_seg_memb (indiv_seg_id, indiv_id);
CREATE INDEX indiv_seg_memb_indiv_id ON indiv_seg_memb (indiv_id);
CREATE OR REPLACE FUNCTION create_indiv_seg(indiv_ids BIGINT[], seg_name text, seg_desc text = null)
RETURNS BIGINT AS $$
DECLARE
indiv_tbl TEXT = 'indiv';
seg_id BIGINT;
indiv_id BIGINT;
BEGIN
EXECUTE 'insert into indiv_seg (name, description)
values ($1, $2)
on conflict do nothing
returning id'
INTO seg_id
USING seg_name, seg_desc;
FOREACH indiv_id IN ARRAY indiv_ids
LOOP
EXECUTE
'insert into indiv_seg_memb(indiv_seg_id, indiv_id)
values ($1, $2)
on conflict do nothing'
USING seg_id, indiv_id;
END LOOP;
RETURN seg_id;
END;
$$ LANGUAGE plpgsql;
| 30.735849 | 102 | 0.668508 |
983ae3c2a36974e4666fe7e248138019fe26e9d6 | 180 | kt | Kotlin | src/main/kotlin/com/sbrati/spring/boot/starter/kotlin/telegram/model/FinishWith.kt | rastiehaiev/spring-boot-starter-kotlin-telegram | 790206a088286766f1061a4ea836ce1c68daff86 | [
"MIT"
] | null | null | null | src/main/kotlin/com/sbrati/spring/boot/starter/kotlin/telegram/model/FinishWith.kt | rastiehaiev/spring-boot-starter-kotlin-telegram | 790206a088286766f1061a4ea836ce1c68daff86 | [
"MIT"
] | null | null | null | src/main/kotlin/com/sbrati/spring/boot/starter/kotlin/telegram/model/FinishWith.kt | rastiehaiev/spring-boot-starter-kotlin-telegram | 790206a088286766f1061a4ea836ce1c68daff86 | [
"MIT"
] | null | null | null | package com.sbrati.spring.boot.starter.kotlin.telegram.model
class FinishWith(val result: Any)
fun finish(operation: () -> Any): FinishWith {
return FinishWith(operation())
} | 25.714286 | 60 | 0.75 |
94f9c794ab77dddf2b8c325a1cce51655137475a | 27,574 | lua | Lua | CBM.lua | zick-elephant/ChessBoardManager-and-stuff | 785bb2eef7f61aaaa631483bde239e3d0521a552 | [
"MIT"
] | null | null | null | CBM.lua | zick-elephant/ChessBoardManager-and-stuff | 785bb2eef7f61aaaa631483bde239e3d0521a552 | [
"MIT"
] | null | null | null | CBM.lua | zick-elephant/ChessBoardManager-and-stuff | 785bb2eef7f61aaaa631483bde239e3d0521a552 | [
"MIT"
] | null | null | null | --
-- Author: zick_elephant
-- Date: 2015-12-15&H:48:59
-- ChessBoardManager,缩写成CBM
CBM = {}
-- 用于在scene之间传输参数的公共变量
CBM.sceneobj = {}
CBM.chosen = {}
CBM.partychangeEvent = {}
function CBM:new(o)
o = o or {}
setmetatable(o,self)
self.__index = self
self.rpvect = {}
self.rpcenter = {}
self.rows = 0
self.cols = 0
self.startx = 0
self.starty = 0
-- 默认六边形边长是41
self.sidelen = 41
-- 格子数据记录
self.mapData = {}
-- 默认地图定义
self.mapDefine = {}
-- 六个方向偏移量,行数为偶数时,后两个偏移量列数都加1,行数为奇数时,后两个偏移量列数都减1;
self.aDir = {{0,1},{0,-1},{-1,0},{1,0},{-1,1},{1,1}}
self.bDir = {{0,1},{0,-1},{-1,0},{1,0},{-1,-1},{1,-1}}
-- 起始点
self.starr = {}
--开闭列表
self.openlist = {}
self.closelist = {}
-- 所有步数集合
self.allpath = {}
-- 当前还可以通过的格子集合
self.passable_remain = {}
--
self.check = {}
return o
end
function CBM:getInstance()
if self.instance_ == nil then
self.instance_ = self:new()
end
return self.instance_
end
-- function CBM:initMapCheck(dest)
-- for i=1,#dest do
-- self.check[dest[i][1]][dest[i][2]] = true
-- end
-- end
-- 纯粹查看重复点,若未重复,则使该点的hash为true
function CBM:mapCheck(gd)
if self.check[gd[1]][gd[2]] then
return true
else
self.check[gd[1]][gd[2]] = true
return false
end
end
function CBM:resetMapCheck()
for i=1,self.rows do
self.check[i] = {}
end
end
function CBM:releaseInstance()
if self.instance_ then
self.instance_ = nil
end
end
function CBM:setInit( param )
if param == nil then
print("CBM初始传参错误,参数table为空")
return
end
self.rows = checkint(param.rows or 11)
self.cols = checkint(param.cols or 14)
self.sidelen = checknumber(param.sidelen or 41)
self.startx = checknumber(param.startx or 100)
self.starty = checknumber(param.starty or 30)
self:resetMapCheck()
end
-- 返回一个随机格子
function CBM:getRandomGrid(passAble,except)
local result = nil
passAble = CALC_3(passAble==false,false,true)
if except and #except>=#self.passable_remain then
except = nil
end
if self.rows>0 and self.cols>0 then
if passAble and #self.passable_remain>0 then
repeat
result = self.passable_remain[math.random(#self.passable_remain)]
until not except or not next(except) or not contain2D(result,except)
else
repeat
result = {math.random(self.rows),math.random(self.cols)}
until not except or not next(except) or not contain2D(result,except)
end
end
return result
end
-- 判断是否为有效格子(不超过或小于行列数)
function CBM:isValidGrid( pos )
if pos == nil or not next(pos) then
return false
end
if pos[1] > self.rows or pos[1] < 1 or pos[2] > self.cols or pos[2] < 1 then
return false
end
return true
end
-- 由行列数得到的确切x,y位置,注意行列数从1开始
function CBM:getPos(row,col,tocenter)
if not self:isValidGrid({row,col}) then
print("无效格子:"..row..","..col.."当前地图总行列数:",self.rows,self.cols)
return nil
end
tocenter = checkbool(tocenter or false)
scaleX = checknumber(scaleX or 1)
scaleY = checknumber(scaleY or 1)
local i = (row-1)*self.cols + col
-- print(i,row,col,self.cols,tocenter)
if tocenter then
return clone(self.rpcenter[i])
else
return clone(self.rpvect[i])
end
end
-- 返回对应col数的一整列格子坐标集合(只需要有rows和cols即可)
function CBM:getCol(which)
local result = {}
which = checkint(which or 1)
if self.rows>0 and self.cols>0 then
for i=1,self.rows do
Push(result,{i,which})
end
end
return result
end
-- 得到一条直线的格子坐标集合,参数(起点,方向,长度起始,长度(0表示到头),是否包含起点),方向为从水平左起顺时针由1到6,总共六个方向;
function CBM:getaline(pos,direct,begin,len,includeself)
if not self:isValidGrid(pos) then
-- print("参数为非法格子———getaline(pos)")
return nil
end
direct = checkint(direct or 1)
begin = checkint(begin or 0)
includeself = checkbool(includeself or false)
local long = checkint(len or 0)
local result = {}
if includeself then
Push(result,pos)
end
local newg = {}
local newar = {}
local b = 0
if direct == 1 then
newg = {pos[1],pos[2] - 1}
while newg[2]>= 1 do
newar = clone(newg)
Push(result,newar)
newg[2] = newg[2] - 1
if long > 0 then
long = long - 1
if long<=0 then
break
end
end
end
elseif direct == 4 then
newg = {pos[1],pos[2] + 1}
while newg[2]<=self.cols do
newar = clone(newg)
Push(result,newar)
newg[2] = newg[2] + 1
if long > 0 then
long = long - 1
if long<=0 then
break
end
end
end
elseif direct == 2 then
newg = clone(pos)
while self:isValidGrid(newg) do
newar = clone(newg)
b = CALC_3(newar[1]%2==0,-1,0)
newar[2] = newar[2] + b
newar[1] = newar[1] + 1
if self:isValidGrid(newar) then
Push(result,newar)
end
newg = newar
if long > 0 then
long = long - 1
if long<=0 then
break
end
end
end
elseif direct == 3 then
newg = clone(pos)
while self:isValidGrid(newg) do
newar = clone(newg)
b = CALC_3(newar[1]%2==0,0,1)
newar[2] = newar[2] + b
newar[1] = newar[1] + 1
if self:isValidGrid(newar) then
Push(result,newar)
end
newg = newar
if long > 0 then
long = long - 1
if long<=0 then
break
end
end
end
elseif direct == 6 then
newg = clone(pos)
while self:isValidGrid(newg) do
newar = clone(newg)
b = CALC_3(newar[1]%2==0,-1,0)
newar[2] = newar[2] + b
newar[1] = newar[1] - 1
if self:isValidGrid(newar) then
Push(result,newar)
end
newg = newar
if long > 0 then
long = long - 1
if long<=0 then
break
end
end
end
elseif direct == 5 then
newg = clone(pos)
while self:isValidGrid(newg) do
newar = clone(newg)
b = CALC_3(newar[1]%2==0,0,1)
newar[2] = newar[2] + b
newar[1] = newar[1] - 1
if self:isValidGrid(newar) then
Push(result,newar)
end
newg = newar
if long > 0 then
long = long - 1
if long<=0 then
break
end
end
end
else
print("得到直线方向超出第6个--getaline")
end
if begin > 0 then
while begin > 0 do
table.remove(result,1)
begin = begin - 1
end
end
return result
end
-- 得到一个(二维数组)为中心的米字形范围,参数:角色,方向起始,方向数(水平左起顺时针旋转),远起始,多远(far = 0表示到地图尽头);
function CBM:riceShape(po,directstart,directlength,startIndex,far,includeself)
-- print("riceShape传参:",directstart,directlength,startIndex,far)
far = checkint(far or 0)
includeself = checkbool(includeself or false)
local result = {}
local ric1 = {}
local ric2 = {}
local st = checkint(directstart or 1)
local dl = checkint(directlength or 6)
local sndex = checkint(startIndex or 0)
if next(po) then
for i=1,#po do
for j=1,dl do
local dst = CALC_3(j+st-1>6,(j+st-1)%6,j+st-1)
if i==1 then
local aline = self:getaline(po[i], dst, sndex, far, false)
for k=1,#aline do
ric1[#ric1+1] = aline[k]
end
-- ric1 = ASconcat(ric1,self:getaline(po[i], dst, sndex, far, false))
else
ric2 = ASconcat(ric2,self:getaline(po[i], dst, sndex, far, false))
end
end
end
result = combine2D(ric1,ric2)
if includeself then
for i=1,#po do
result[#result+1] = po[i]
end
-- result = ASconcat(result,po)
end
end
return result
end
-- 根据给定的起始点和目标格,返回一个固定长度的,包含此格子的规范化60度的扇形区域
function CBM:fanShape(startpos,despos,far,hollow,includeself)
far = checkint(far or 3)
local fanIndex = 0
local inside = nil
local result = {}
local jibo = startpos[1]%2 ~= 0
if despos[1] > startpos[1] then
if jibo then
if despos[2] <= startpos[2] then
fanIndex = 1
inside = {1,-1}
elseif despos[2] > startpos[2] + 1 then
fanIndex = 3
inside = {1,2}
else
fanIndex = 2
inside = {2,0}
end
else
if despos[2] < startpos[2] then
fanIndex = 1
inside = {1,-2}
elseif despos[2] > startpos[2] then
fanIndex = 3
inside = {1,1}
else
fanIndex = 2
inside = {2,0}
end
end
elseif despos[1] < startpos[1] then
if jibo then
if despos[2] < startpos[2] then
fanIndex = 6
inside = {-1,-1}
elseif despos[2] >= startpos[2] + 1 then
fanIndex = 4
inside = {-1,2}
else
fanIndex = 5
inside = {-2,0}
end
else
if despos[2] < startpos[2] - 1 then
fanIndex = 6
inside = {-1,-2}
elseif despos[2] >= startpos[2] then
fanIndex = 4
inside = {-1,1}
else
fanIndex = 5
inside = {-2,0}
end
end
else
if despos[2] >= startpos[2] then
fanIndex = 3
inside = CALC_3(jibo,{1,2},{1,1})
else
fanIndex = 6
inside = CALC_3(jibo,{-1,-1},{-1,-2})
end
end
local presetclose = self:riceShape({startpos}, fanIndex, 2, hollow, far, includeself)
if self:isValidGrid(inside) and far>2 then
result = self:getshotArea(inside, far - 1, hollow, includeself, presetclose)
else
result = presetclose
end
return result
end
-- 返回两个非重叠的角色,或格子之间的距离(非直线距离,而是在棋盘上要经过的最短格子数(无视地形))
function CBM:distanceOfGrid(arg1,arg2)
local dis = 0
local fur = 1
if arg1 and arg2 then
local from = {arg1}
if arg1.__cname == "RoleView" then from = occupy1or2(arg1) end
local to = {arg2}
if arg2.__cname == "RoleView" then to = occupy1or2(arg2) end
while fur < self.cols + self.rows do
local rea = self:getshotArea(from,fur,0,false)
if #intersection2D(rea,to)>0 then
-- 最少返回1
dis = fur
break
end
fur = fur + 1
end
end
return dis
end
-- 确定触摸点(单点触摸)位于哪一个六边形之内,返回{行,列}
function CBM:checker( point,scaleX,scaleY )
if point == nil then
print("CBM -- checker参数point为nil")
return nil
end
scaleX = checknumber(scaleX or 1)
scaleY = checknumber(scaleY or 1)
local high = (self.sidelen * 1.5 * self.rows + self.starty)*scaleY
local wide = (self.sidelen * 1.73 * self.cols + self.startx)*scaleX
if point.y < (self.starty - self.sidelen*0.5)*scaleY or point.y > high or point.x < (self.startx - 0.866*self.sidelen)*scaleX or point.x > wide then
-- print(point.x,point.y,"checker超出棋盘边界:",high,wide)
return nil
end
local result = {}
local gao = self.sidelen*1.5*scaleY
local kuan = self.sidelen*1.73*scaleX
local r = math.floor((point.y - self.starty*scaleY + 0.5*self.sidelen*scaleY)/gao)
local ra = {}
if r <= 0 then
ra[#ra + 1] = 1
elseif r >= self.rows then
ra[#ra + 1] = self.rows
else
ra[#ra + 1] = r
ra[#ra + 1] = r + 1
end
local c = math.floor((point.x - self.startx*scaleX + self.sidelen*0.86*scaleX)/kuan)
local ca = {}
if c <= 0 then
ca[#ca +1] = 1
elseif c >= self.cols then
ca[#ca + 1] = self.cols
else
ca[#ca + 1] = c
ca[#ca + 1] = c + 1
end
local pre = {}
for i=1,#ra do
for j=1,#ca do
pre[#pre + 1] = {self:getPos(ra[i],ca[j],true,scaleX,scaleY),ra[i],ca[j]}
end
end
-- dump(pre,"预判断格子")
-- 判断是否在内的内外接圆半径只接受等比缩放
local sr = self.sidelen*0.866*scaleX
local br = self.sidelen*scaleX
local aft = {}
for i=1,#pre do
local np = pre[i][1]
local dis = cc.pGetDistance(np, point)
if dis < sr then
result = {pre[i][2],pre[i][3]}
return result
elseif dis > br then
-- nothing
else
aft[#aft +1] = {dis,pre[i][2],pre[i][3]}
-- print(aft[#aft])
end
end
table.sort( aft, Sort2Dimen )
-- dump(aft)
if next(aft) then
result = {aft[1][2],aft[1][3]}
end
return result
end
function CBM:initMapData( tbl )
self.mapData = {}
for i=1,self.rows do
self.mapData[i] = {}
end
for i=1,self.rows do
for j=1,self.cols do
--- 下面数组内分别代表:id,是否可通过,通过代价,是否已标记,阵营,是否锁定
self.mapData[i][j] = {0,true,1,0,"",false}
end
end
-- 通过传入的参数初始化地图上的不可通过区域或其它,默认为无,使用锁定标记强制不通行地块
if tbl ~= nil and #tbl > 0 then
--todo
end
end
function CBM:updateMapData( arr,rvo,obj,removeBarrier)
removeBarrier = checkbool(removeBarrier or false)
self:initMapData(obj)
-- 数组存在,有长度,第一个值是角色类
if arr ~= nil and #arr ~= 0 then
local len = #arr
for i=1,len do
if arr[i] ~= nil and not arr[i]:isDead() and (not arr[i]:isSneaking() or arr[i]:getRoleVo().id < 0) then
if not(removeBarrier and arr[i]:getRoleVo().party == "abiotic") then
local arrvo = arr[i]:getRoleVo()
if arrvo.occupy == 1 then
-- 向地图数据组中录入角色位置信息,id为0则说明没有角色或障碍存在,大于1000且小于2000为人物ID,大于2000为召唤生物ID;
self.mapData[arrvo.row][arrvo.col] = {arrvo.id,arrvo.passable,arrvo.movecost,0,arrvo.party}
elseif arrvo.occupy == 2 then
self.mapData[arrvo.row][arrvo.col] = {arrvo.id,arrvo.passable,arrvo.movecost,0,arrvo.party}
self.mapData[arrvo.row][arrvo.col + 1] = {arrvo.id,arrvo.passable,arrvo.movecost,0,arrvo.party}
end
end
end
end
end
-- 重新初始passable_remain
self.passable_remain = {}
-- 下面这部分应改为对不同阵营的角色进行self.mapData的重新初始化
if rvo ~= nil and (rvo.party ~= "neutral" or rvo.party ~= "abiotic") or rvo == nil then
local opp
if rvo ~= nil and rvo.party ~= "neutral" then
opp = CALC_3(rvo.party=="mine" or rvo.party == "ally","enemy","mine")
end
for i=1,self.rows do
for j=1,self.cols do
if self.mapData[i][j][2] then
Push(self.passable_remain,{i,j})
end
-- id大于0是人物ID,小于0为召唤物(死物)ID,不会对周围的格子行动力消耗造成影响;
if rvo ~= nil and self.mapData[i][j][1] > 0 and self.mapData[i][j][5] == opp and not self.mapData[i][j][2] then
--- self.mapData[i][j] = {0,true,1,0,"",false}分别代表:id,是否可通过,通过代价,是否已标记,阵营,是否锁定
if i-1>=1 and self.mapData[i-1][j][4]==0 then
self.mapData[i - 1][j][3] = self.mapData[i - 1][j][3] + 1
self.mapData[i - 1][j][4] = 1
end
if i+1 <= self.rows and self.mapData[i+1][j][4] == 0 then
self.mapData[i + 1][j][3] = self.mapData[i + 1][j][3] + 1
self.mapData[i + 1][j][4] = 1
end
if j-1>=1 and self.mapData[i][j - 1][4]==0 then
self.mapData[i][j - 1][3] = self.mapData[i][j - 1][3] + 1
self.mapData[i][j - 1][4] = 1
end
if j+1 <= self.cols and self.mapData[i][j + 1][4]==0 then
self.mapData[i][j + 1][3] = self.mapData[i][j + 1][3] + 1
self.mapData[i][j + 1][4] = 1
end
if i % 2 ~= 0 then
if i-1>=1 and j+1 <= self.cols and self.mapData[i - 1][j + 1][4] == 0 then
self.mapData[i - 1][j + 1][3] = self.mapData[i - 1][j + 1][3] + 1
self.mapData[i - 1][j + 1][4] = 1
end
if i+1<= self.rows and j+1 <= self.cols and self.mapData[i + 1][j + 1][4]==0 then
self.mapData[i + 1][j + 1][3] = self.mapData[i + 1][j + 1][3] + 1
self.mapData[i + 1][j + 1][4] = 1
end
elseif i%2 ==0 then
if i-1>=1 and j-1>=1 and self.mapData[i - 1][j - 1][4]==0 then
self.mapData[i - 1][j - 1][3] = self.mapData[i - 1][j - 1][3] + 1
self.mapData[i - 1][j - 1][4] = 1
end
if i+1<= self.rows and j-1>=1 and self.mapData[i + 1][j - 1][4]==0 then
self.mapData[i + 1][j - 1][3] = self.mapData[i + 1][j - 1][3] + 1
self.mapData[i + 1][j - 1][4] = 1
end
end
end
end
end
end
end
-- 检测一个格子是否可以被召出召唤生物
function CBM:gridOKforSC(gd)
if next(gd) then
if self.mapData[gd[1]][gd[2]][1] == 0 and self.mapData[gd[1]][gd[2]][2] then
return true
end
end
return false
end
-- 检测该格是否有地雷
function CBM:isThereTrap(row,col)
if self.mapData[row][col][1] < 0 then
return true
end
return false
end
-- 检测path路径上,角色(单双格)是否会踩到地雷(i从2开始),并返回地雷格(一格或两格);
function CBM:trapDetect(ro,gds,pathType,parabolic)
local result = {}
local bro = false
pathType = CALC_3(pathType==false,false,true)
parabolic = checkbool(parabolic or false)
local sti = CALC_3(pathType,3,1)
if ro and next(gds) then
local rvo = ro:getRoleVo()
local len = #gds
if ro:isFly() or parabolic then
if self:isThereTrap(gds[len][1],gds[len][2]) then
Push(result,gds[len])
end
if rvo.occupy == 2 then
if self:isThereTrap(gds[len][1],gds[len][2] + 1) then
Push(result,{gds[len][1],gds[len][2] + 1})
end
end
else
for i=sti,len do
if self:isThereTrap(gds[i][1],gds[i][2]) then
Push(result,gds[i])
bro = true
end
if rvo.occupy == 2 then
if self:isThereTrap(gds[i][1],gds[i][2] + 1) then
Push(result,{gds[i][1],gds[i][2] + 1})
bro = true
end
end
if bro then
break
end
end
end
end
return result
end
-- 检测一个path内,角色(单双格)是否踩中地雷并返回修改后的值:新path
function CBM:trapDetectResult(ro,gds,pathType,parabolic)
local result = gds
pathType = CALC_3(pathType==false,false,true)
parabolic = checkbool(parabolic or false)
if ro and next(gds) then
if not ro:isFly() and not parabolic then
local sti = 0
if pathType then
sti = 3
else
sti = 1
end
local step = sti
for i=sti,#result do
if self.mapData[result[i][1]][result[i][2]][1] < 0 then
step = i
break
end
if ro:getRoleVo().occupy == 2 and self.mapData[result[i][1]][result[i][2]+1][1] < 0 then
step = i
break
end
end
local movcs = 0
-- print(step,#result)
if step < #result then
for i=#result,step+1,-1 do
movcs = movcs + self.mapData[result[i][1]][result[i][2]][3]
table.remove(result)
end
end
if pathType then
result[1] = result[1] + movcs
end
end
end
return result
end
--- 返回角色身后的格子集合
function CBM:getBehindArea( ro,range,hollow,includeself,reverse )
hollow = checknumber(hollow or 0)
includeself = checkbool(includeself)
local result = nil
local inside = nil
local index = 0
local rvo = ro:getRoleVo()
local dirbo = rvo.direct=="left"
if checkbool(reverse) then dirbo = not dirbo end
index = CALC_3(dirbo,4,1)
local pos = CALC_3(rvo.occupy==1,{rvo.row,rvo.col},CALC_3(rvo.direct =="right",{rvo.row,rvo.col},{rvo.row,rvo.col+1}))
local presetclose,hollowline
if index == 1 then
inside = {pos[1],pos[2] - 1}
presetclose = ASconcat(self:getaline(pos, 2, 0, range, true),self:getaline(pos, 6, 0, range, false))
if hollow>0 then
hollowline = ASconcat(self:getaline(pos, 2, 0, hollow, false),self:getaline(pos, 6, 0, hollow, false))
end
elseif index == 4 then
inside = {pos[1],pos[2] + 1}
presetclose = ASconcat(self:getaline(pos, 3, 0, range, true),self:getaline(pos, 5, 0, range, false))
if hollow > 0 then
hollowline = ASconcat(self:getaline(pos, 3, 0, hollow, false),self:getaline(pos, 5, 0, hollow, false))
end
end
if self:isValidGrid(inside) then
if hollow>0 then
result = self:getshotArea({inside}, range-1, hollow-1, false, presetclose)
else
result = self:getshotArea({inside}, range-1, 0, true, presetclose)
end
else
result = presetclose
end
if hollowline and next(hollowline) then
result = nonIntersection2D(result,hollowline)
end
if not includeself then
result = nonIntersection2D(result,{{ro:getRow(),ro:getCol()}})
end
return result
end
-- 得到一个无视地形的射程图,注意pos数组是二维数组,为了双格单位(起点,射程,中空,是否包含自身,预先设置closelist)
function CBM:getshotArea(pos,range,hollow,includeself,presetclose)
self.starr = {}
self.openlist = {}
self.closelist = {}
presetclose = checktable(presetclose)
if next(presetclose) then
self.closelist = presetclose
end
local limit = clone(self.closelist)
local result = {}
local hol = checkint(hollow or 0)
local fran = range
includeself = CALC_3(includeself==false,false,true)
for i=1,#pos do
Push(self.starr,pos[i])
end
self.openlist = clone(self.starr)
local tmpar = {}
local nextar = {}
while fran>0 do
for i=1,#self.openlist do
tmpar = self:getAround(self.openlist[i], true)
for j=1,#tmpar do
uniqPush(nextar,tmpar[j])
end
end
self.openlist = nextar
for i=1,#nextar do
self.closelist[#self.closelist+1] = nextar[i]
end
if hol>0 then
hol = hol - 1
else
for i=1,#nextar do
limit[#limit+1] = nextar[i]
end
end
nextar = {}
fran = fran - 1
end
if includeself then
for i=1,#self.starr do
limit[#limit+1] = self.starr[i]
end
result = limit
else
result = limit
end
return result
end
-- 返回一个对于该角色所能到达的范围的点集
function CBM:getMoveArea(arr,rolevo,mpReplaced,removeBarrier)
self:destroyData()
mpReplaced = checkint(mpReplaced or 0)
removeBarrier = checkbool(removeBarrier or false)
self:updateMapData(arr,rolevo,nil,removeBarrier)
local result ={}
local mp = rolevo.movepoint
if mpReplaced ~= 0 then
mp = mpReplaced;
end
if rolevo.haltednum > 0 then
mp = 0
end
if rolevo.occupy == 1 then
Push(self.starr,{rolevo.row,rolevo.col})
elseif rolevo.occupy == 2 then
Push(self.starr,{rolevo.row,rolevo.col})
Push(self.starr,{rolevo.row,rolevo.col+1})
end
self.openlist = clone(self.starr)
for i=1,#self.openlist do
local newarr = {mp,self.openlist[i]};
Push(self.allpath,newarr)
end
local tmpar = {}
local nextar = {}
local opls = self.openlist
local isflybo = rolevo.flynum>0 or (rolevo.flynum == 0 and rolevo.fly_default)
while #opls > 0 do
for i=1,#opls do
-- print("开始寻路")
tmpar = self:getAround(opls[i], isflybo)
self:xujie(self.allpath, opls[i], tmpar, rolevo.occupy)
for j=1,#tmpar do
if self:IsXujieAble(tmpar[j]) then
uniqPush(nextar,tmpar[j])
end
end
end
opls = nextar
for i=1,#nextar do
self.closelist[#self.closelist+1] = nextar[i]
end
nextar = {}
end
if isflybo then
self.closelist = self:ridOfImpassable(self.closelist)
end
for i=1,#self.starr do
self.closelist[#self.closelist+1] = self.starr[i]
end
result = self.closelist
-- print(os.difftime(t2, t1),os.difftime(t3, t2),os.difftime(t4, t3),os.difftime(t5, t4))
-- dump(self.mapData)
-- dump(self.allpath)
return result
end
-- 返回一条剩余行动力最多的路径(最易到达),参数(目的地,左右偏移量,左负右正)返回形式[剩余行动力,起点,后续坐标点...] plural返回所有可能路径
function CBM:getPath(des,offset,plural)
local result = {}
local paths = {}
local mvn = {}
offset = checkint(offset or 0)
plural = checkbool(plural or false)
for i=1,#self.allpath do
local elem = self.allpath[i]
if elem[#elem][1] == des[1] and elem[#elem][2] == des[2] then
Push(paths,elem)
end
end
table.sort(paths,Sort2Dimen)
result = paths[#paths]
-- 路径的左右偏移量,通常提供给两格单位使用
if offset ~= 0 then
for i=2,#result do
result[2] = result[2] + offset
end
end
if plural then
result = paths
end
return result
end
function CBM:getAround(apos,ignpass,ignStartCloselist)
ignpass = checkbool(ignpass)
ignStartCloselist = checkbool(ignStartCloselist)
local result = {}
local Dir = CALC_3(apos[1]%2~=0,self.aDir,self.bDir)
for i=1,#Dir do
local xp = apos[1] + Dir[i][1]
local yp = apos[2] + Dir[i][2]
if self:IsOutRange({xp,yp}) or (not ignpass and not self:IsPass({xp,yp})) or not ignStartCloselist and (self:IsStart({xp,yp}) or self:IsInClose({xp,yp})) then
else
Push(result,{xp,yp})
end
-- if not ignpass then
-- if self:IsOutRange({xp,yp}) or self:IsStart({xp,yp}) or not self:IsPass({xp,yp}) or self:IsInClose({xp,yp}) then
-- else
-- Push(result,{xp,yp})
-- end
-- else
-- if self:IsOutRange({xp,yp}) or self:IsStart({xp,yp}) or self:IsInClose({xp,yp}) then
-- else
-- Push(result,{xp,yp})
-- end
-- end
end
return result
end
--- 注意,for循环动态添加元素至table末尾可导致长度不断增加,无法结束循环
function CBM:xujie(arr,s,ra,occupy)
occupy = checkint(occupy or 1)
local newpaths = {}
for i=1,#arr do
if arr[i][#arr[i]][1] == s[1] and arr[i][#arr[i]][2] == s[2] then
-- print(#arr,"剩余行动力"..arr[i][1])
if arr[i][1] <= 0 then
else
for j=1,#ra do
local newar = clone(arr[i])
local cost = self.mapData[ra[j][1]][ra[j][2]][3]
local aft = newar[1] - cost
local bo = true
-- 占两格的单位,需要判断:如果起始格为左边,则判断每一步的右边是否可通过,反之亦然;
if occupy == 2 then
if arr[j][2][1] == self.starr[1][1] and arr[j][2][2] == self.starr[1][2] then
if not self.mapData[ra[j][1]][ra[j][2] + 1][2] then
bo = false
end
elseif arr[j][2][1] == self.starr[2][1] and arr[j][2][2] == self.starr[2][2] then
if not self.mapData[ra[j][1]][ra[j][2] - 1][2] then
bo = false
end
end
end
if bo and aft >= -1 then
newar[1] = aft
Push(newar,ra[j])
Push(newpaths,newar)
end
end
end
end
end
-- self.allpath = ASconcat(arr,newpaths) 替换为下
for i=1,#newpaths do
self.allpath[#self.allpath+1] = newpaths[i]
end
end
function CBM:IsXujieAble( tail )
-- print("tail is ",unpack(tail))
for i=1,#self.allpath do
-- print(dump(self.allpath[i]),#(self.allpath[i]))
if self.allpath[i][#self.allpath[i]][1] == tail[1] and self.allpath[i][#self.allpath[i]][2] == tail[2] then
return true
end
end
return false
end
function CBM:ridOfImpassable( gds )
local result = {}
local dd
if next(gds) ~= nil then
while #gds > 0 do
dd = table.remove(gds)
if self.mapData[dd[1]][dd[2]][2] then
Push(result,dd)
end
end
end
return result
end
function CBM:IsOutRange( apos )
if apos[1] < 1 or apos[1] > self.rows or apos[2] < 1 or apos[2] > self.cols then
return true
end
return false
end
function CBM:IsStart( apos )
for i=1,#self.starr do
if apos[1] == self.starr[i][1] and apos[2] == self.starr[i][2] then
return true
end
end
return false
end
function CBM:IsPass( apos )
if self:IsOutRange(apos) then
return false
else
return self.mapData[apos[1]][apos[2]][2]
end
end
function CBM:IsInClose( apos )
local bo = false
for i=1,#self.closelist do
if apos[1] == self.closelist[i][1] and apos[2] == self.closelist[i][2] then
bo = true
break
end
end
return bo
end
--- 伪A星寻路(不考虑通过代价,只选择最近的路线)
-- function CBM:astarPath(startpos,endpos)
-- local openlist = {}
-- local closelist = {startpos}
-- local pt2 = self:getPos(endpos[1],endpos[2])
-- local dis = {}
-- for j=1,self.rows+sel.cols do
-- local tmpar = self:getAround(startpos)
-- for i=1,#tmpar do
-- local pt1 = self:getPos(tmpar[i][1], tmpar[i][2])
-- dis[#dis+1] = {cc.pGetDistance(pt1, pt2),tmpar[i]}
-- end
-- table.sort(dis,Sort2Dimen)
-- if isEqual(dis[1][2],endpos) then
-- return closelist
-- end
-- local distm = self:getAround(dis[1][2])
-- if #distm>0 then
-- Push(closelist,dis[1][2])
-- end
-- end
-- end
-- 对于多个目标点,找到剩余行动力最多(或最小)的一点,并返回到达的路径
function CBM:optimalPath(arr,maxMpRemain)
local daxiao = {}
local paths = {}
maxMpRemain = CALC_3(maxMpRemain==false,false,true)
for i=1,#arr do
local np = self:getPath(arr[i])
Push(paths,np)
end
table.sort(paths,Sort2Dimen)
if maxMpRemain then
return paths[#paths]
else
return paths[1]
end
end
-- 检查ro1是否在ro2的角色攻击范围之内
function CBM:isInFireRange(ro1,ro2)
local bo = false
local pos_2 = occupy1or2(ro2)
local sa = self:getshotArea(pos_2,ro2:getRoleVo().firerange,ro2:getRoleVo().hindrance,false)
local pos_1 = occupy1or2(ro1)
local cross = intersection2D(pos_1,sa)
if next(cross) then
bo = true
end
return bo
end
-- 得到两个格子间真正的数值距离
function CBM:realDistance(gd1,gd2)
local pt1 = self:getPos(gd1[1], gd1[2])
local pt2 = self:getPos(gd2[1], gd2[2])
return cc.pGetDistance(pt1, pt2)
end
-- 清空各数组
function CBM:destroyData()
self.openlist = {}
self.closelist = {}
self.starr = {}
self.allpath = {}
self.mapData = {}
end
function CBM:reset()
self.rpvect = {}
self.rpcenter = {}
self:destroyData()
CBM.sceneobj = {}
end
return CBM | 26.386603 | 161 | 0.615761 |
05aadeff91ebc19d2bbdd325cc04d4e54dd25e32 | 602 | rb | Ruby | gtkhtml2/src/lib/gtkhtml2.rb | pkorenev/ruby-gnome2 | 08011d8535529a3866f877817f29361b1b0703d7 | [
"Ruby"
] | 2 | 2016-05-08T20:57:12.000Z | 2017-07-28T21:00:42.000Z | gtkhtml2/src/lib/gtkhtml2.rb | pkorenev/ruby-gnome2 | 08011d8535529a3866f877817f29361b1b0703d7 | [
"Ruby"
] | null | null | null | gtkhtml2/src/lib/gtkhtml2.rb | pkorenev/ruby-gnome2 | 08011d8535529a3866f877817f29361b1b0703d7 | [
"Ruby"
] | 2 | 2016-07-23T09:53:08.000Z | 2021-07-13T07:21:05.000Z | require 'gtk2'
require 'gtkhtml2.so'
module Gtk
module Html
LOG_DOMAIN = "GtkHtml"
end
class HtmlDocument
LOG_DOMAIN = "HtmlDocument"
end
class HtmlView
LOG_DOMAIN = "HtmlView"
end
end
GLib::Log.set_log_domain(Gtk::Html::LOG_DOMAIN)
GLib::Log.set_log_domain(Gtk::HtmlDocument::LOG_DOMAIN)
GLib::Log.set_log_domain(Gtk::HtmlView::LOG_DOMAIN)
GLib::Log.set_log_domain("HtmlA11y")
GLib::Log.set_log_domain("HtmlCss")
GLib::Log.set_log_domain("DomViews")
GLib::Log.set_log_domain("HtmlGraphics")
GLib::Log.set_log_domain("HtmlLayout")
GLib::Log.set_log_domain("HtmlUtil")
| 20.758621 | 55 | 0.749169 |
f6622361acaf9f31964eb7dc2980d3a6d750d796 | 946 | sql | SQL | Introduction to SQL Pt1/1 - SELECT.sql | SimonStride/Presentations | 80e3dbc532b3a0b5b2b546ac8d17ccc2975ed139 | [
"MIT"
] | 1 | 2020-05-28T19:07:01.000Z | 2020-05-28T19:07:01.000Z | Introduction to SQL Pt1/1 - SELECT.sql | SimonStride/Presentations | 80e3dbc532b3a0b5b2b546ac8d17ccc2975ed139 | [
"MIT"
] | 2 | 2019-03-01T22:45:18.000Z | 2019-03-01T22:45:40.000Z | Introduction to SQL Pt1/1 - SELECT.sql | SimonStride/Presentations | 80e3dbc532b3a0b5b2b546ac8d17ccc2975ed139 | [
"MIT"
] | null | null | null | /*
0. Tables and Schemas
Tables are the primary storage mechanism for RDBMS
They may be persisted to disk, or temporary
In SQL server, tables are grouped under Schemas for security and organisation purposes
e.g. Person schema, HumanResources
query a table...
*/
SELECT * FROM HumanResources.Employee
/*
SELECT * is often used for exploring data but should be avoided when writing code
Listing the columns we're interested is much better
*/
SELECT BusinessEntityID
, NationalIDNumber
, LoginID
FROM HumanResources.Employee
/*
This is fine for a small table - but what about a big table?
Or one of as-yet-unknown size?
The TOP clause allows us to limit the number of records returned either by number or percent
*/
SELECT TOP 10
BusinessEntityID
, NationalIDNumber
, LoginID
FROM HumanResources.Employee;
SELECT TOP 5 PERCENT
BusinessEntityID
, NationalIDNumber
, LoginID
FROM HumanResources.Employee; | 15.508197 | 93 | 0.762156 |
f173cecffef6f16ea1b4be4f0e1224b5000cfd01 | 884 | asm | Assembly | programs/oeis/169/A169611.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/169/A169611.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/169/A169611.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A169611: Number of prime divisors of n that are not greater than 3, counted with multiplicity.
; 0,1,1,2,0,2,0,3,2,1,0,3,0,1,1,4,0,3,0,2,1,1,0,4,0,1,3,2,0,2,0,5,1,1,0,4,0,1,1,3,0,2,0,2,2,1,0,5,0,1,1,2,0,4,0,3,1,1,0,3,0,1,2,6,0,2,0,2,1,1,0,5,0,1,1,2,0,2,0,4,4,1,0,3,0,1,1,3,0,3,0,2,1,1,0,6,0,1,2,2,0,2,0,3,1,1,0,5,0,1,1,4,0,2,0,2,2,1,0,4,0,1,1,2,0,3,0,7,1,1,0,3,0,1,3,3,0,2,0,2,1,1,0,6,0,1,1,2,0,2,0,3,2,1,0,3,0,1,1,5,0,5,0,2,1,1,0,4,0,1,2,2,0,2,0,4,1,1,0,4,0,1,1,3,0,2,0,2,3,1,0,7,0,1,1,2,0,3,0,3,1,1,0,3,0,1,2,4,0,2,0,2,1,1,0,6,0,1,1,2,0,2,0,5,2,1,0,3,0,1,1,3,0,3,0,2,1,1,0,5,0,1,5,2,0,2,0,3,1,1
mov $3,$0
mov $5,2
lpb $5,1
clr $0,3
mov $0,$3
sub $5,1
add $0,$5
mov $1,$0
lpb $0,1
div $1,3
add $2,$1
add $2,$0
div $0,2
lpe
mov $1,$2
mov $6,$5
lpb $6,1
mov $4,$1
sub $6,1
lpe
lpe
lpb $3,1
mov $3,0
sub $4,$1
lpe
mov $1,$4
sub $1,1
| 28.516129 | 501 | 0.512443 |
16239ee4af55365eb1e6ee2dadd03a770cd7c9e4 | 3,302 | c | C | thirdparty/ffmpeg/libavformat/epafdec.c | yashrajsingh1998/ApraPipes1 | ec93095613f4345d6044c7012f2d8c3b99f65f03 | [
"MIT"
] | 60 | 2018-11-09T12:08:37.000Z | 2022-03-10T03:14:46.000Z | thirdparty/ffmpeg/libavformat/epafdec.c | yashrajsingh1998/ApraPipes1 | ec93095613f4345d6044c7012f2d8c3b99f65f03 | [
"MIT"
] | 2 | 2022-03-30T14:52:15.000Z | 2022-03-31T11:30:20.000Z | thirdparty/ffmpeg/libavformat/epafdec.c | yashrajsingh1998/ApraPipes1 | ec93095613f4345d6044c7012f2d8c3b99f65f03 | [
"MIT"
] | 23 | 2018-11-23T03:58:40.000Z | 2021-12-11T04:42:19.000Z | /*
* Ensoniq Paris Audio File demuxer
* Copyright (c) 2012 Paul B Mahol
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/intreadwrite.h"
#include "libavcodec/internal.h"
#include "avformat.h"
#include "internal.h"
#include "pcm.h"
static int epaf_probe(const AVProbeData *p)
{
if (((AV_RL32(p->buf) == MKTAG('f','a','p',' ') &&
AV_RL32(p->buf + 8) == 1) ||
(AV_RL32(p->buf) == MKTAG(' ','p','a','f') &&
AV_RN32(p->buf + 8) == 0)) &&
!AV_RN32(p->buf + 4) && AV_RN32(p->buf + 12) &&
AV_RN32(p->buf + 20))
return AVPROBE_SCORE_MAX / 4 * 3;
return 0;
}
static int epaf_read_header(AVFormatContext *s)
{
int le, sample_rate, codec, channels;
AVStream *st;
avio_skip(s->pb, 4);
if (avio_rl32(s->pb))
return AVERROR_INVALIDDATA;
le = avio_rl32(s->pb);
if (le && le != 1)
return AVERROR_INVALIDDATA;
if (le) {
sample_rate = avio_rl32(s->pb);
codec = avio_rl32(s->pb);
channels = avio_rl32(s->pb);
} else {
sample_rate = avio_rb32(s->pb);
codec = avio_rb32(s->pb);
channels = avio_rb32(s->pb);
}
if (channels <= 0 || channels > FF_SANE_NB_CHANNELS || sample_rate <= 0)
return AVERROR_INVALIDDATA;
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->channels = channels;
st->codecpar->sample_rate = sample_rate;
switch (codec) {
case 0:
st->codecpar->codec_id = le ? AV_CODEC_ID_PCM_S16LE : AV_CODEC_ID_PCM_S16BE;
break;
case 2:
st->codecpar->codec_id = AV_CODEC_ID_PCM_S8;
break;
case 1:
avpriv_request_sample(s, "24-bit Paris PCM format");
default:
return AVERROR_INVALIDDATA;
}
st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id);
st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8;
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
if (avio_skip(s->pb, 2024) < 0)
return AVERROR_INVALIDDATA;
return 0;
}
AVInputFormat ff_epaf_demuxer = {
.name = "epaf",
.long_name = NULL_IF_CONFIG_SMALL("Ensoniq Paris Audio File"),
.read_probe = epaf_probe,
.read_header = epaf_read_header,
.read_packet = ff_pcm_read_packet,
.read_seek = ff_pcm_read_seek,
.extensions = "paf,fap",
.flags = AVFMT_GENERIC_INDEX,
};
| 31.150943 | 97 | 0.632647 |
d06434b20ccaff1086ea060f423824569f7d8964 | 915 | css | CSS | public/css/nanoscroller.css | klmnkien2/mototours | 919dec470347676ca7aae51d7bc7d45f30a1a0ea | [
"MIT"
] | null | null | null | public/css/nanoscroller.css | klmnkien2/mototours | 919dec470347676ca7aae51d7bc7d45f30a1a0ea | [
"MIT"
] | null | null | null | public/css/nanoscroller.css | klmnkien2/mototours | 919dec470347676ca7aae51d7bc7d45f30a1a0ea | [
"MIT"
] | null | null | null | /** initial setup **/
.nano{position:relative;width:100%;height:100%;overflow:hidden;}
.nano > .nano-content{position:absolute;overflow:scroll;overflow-x:hidden;top:0;right:0;bottom:0;left:0;}
.nano > .nano-content:focus{outline:thin dotted;}
.nano > .nano-content::-webkit-scrollbar{display:none;}
.has-scrollbar > .nano-content::-webkit-scrollbar{display:block;}
.nano > .nano-pane{background:rgba(0,0,0,0);position:absolute;width:7px;right:2px;top:0;bottom:0;visibility:hidden\9;opacity:.01;-webkit-transition:.2s;-moz-transition:.2s;-o-transition:.2s;transition:.2s;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;}
.nano > .nano-pane > .nano-slider{background:#444;background:rgba(0,0,0,0.1);position:relative;margin:0 1px;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;}
.nano:hover > .nano-pane, .nano-pane.active, .nano-pane.flashed{visibility:visible\9;opacity:0.99;} | 101.666667 | 273 | 0.756284 |
af9e064486c56dd056fb3d373603ea6a870cdb9b | 4,466 | rb | Ruby | ruby_quiz/quiz74_sols/solutions/Joern Dinkla/net.dinkla.ruby.quiz.74/test/tc_markov-chain.rb | J-Y/RubyQuiz | c85faf572b7e36b19ef49cefc2fd749093139ce7 | [
"MIT"
] | null | null | null | ruby_quiz/quiz74_sols/solutions/Joern Dinkla/net.dinkla.ruby.quiz.74/test/tc_markov-chain.rb | J-Y/RubyQuiz | c85faf572b7e36b19ef49cefc2fd749093139ce7 | [
"MIT"
] | null | null | null | ruby_quiz/quiz74_sols/solutions/Joern Dinkla/net.dinkla.ruby.quiz.74/test/tc_markov-chain.rb | J-Y/RubyQuiz | c85faf572b7e36b19ef49cefc2fd749093139ce7 | [
"MIT"
] | null | null | null | #
require 'test/unit'
require 'markov-chain'
# extend the class for testing
class MarkovChain
attr_reader :absolute, :relative, :sum_edges, :dirty
end
#
class TestMarkovChain < Test::Unit::TestCase
def setup()
@mc1 = MarkovChain.new()
@mc2 = MarkovChain.new()
@mc2.add(1,2)
@mc3 = MarkovChain.new()
@mc3.add(1,2)
@mc3.add(3,4)
@mc3.recalc(3)
@mc4 = MarkovChain.new()
@mc4.add(1,2)
@mc4.add(3,4)
@mc4.add(1,3)
@mc4.add(1,4)
@mc4.add(1,3)
@mc4.recalc_all()
@mc5 = MarkovChain.new(order = 2)
@mc5.add([1,2], 3)
@mc5.add([2,3], 5)
@mc5.add([1,3], 4)
@mc6 = MarkovChain.new(order = 2)
@mc6.add([1,2], 3)
@mc6.add([2,3], 5)
@mc6.add([1,2], 4)
@mc6.add([1,3], 4)
@mc6.recalc([1,2])
@mc6.recalc([2,3])
@mc7 = MarkovChain.new(order = 2)
@mc7.add_elems([20,21,20,22,21,22,20,23])
@mc7.recalc_all()
@mc8 = MarkovChain.new(order = 3)
@mc8.add_elems([30,31,32,33,30,31,32,34])
@mc8.recalc_all()
end
def test_initialize()
sub_test_sizes(@mc1, 0, 0, 0, 0)
end
#
def test_add_mc2()
sub_test_sizes(@mc2, 1, 0, 1, 1)
end
#
def test_add_mc3()
sub_test_sizes(@mc3, 2, 1, 2, 1)
end
#
def test_add_mc4()
sub_test_sizes(@mc4, 2, 2, 2, 0)
end
#
def test_add_mc5()
sub_test_sizes(@mc5, 3, 0, 3, 3)
end
#
def test_add_mc6()
sub_test_sizes(@mc6, 3, 2, 3, 1)
end
#
def test_add_elems_mc7()
sub_test_sizes(@mc7, 6, 6, 6, 0)
end
#
def test_add_elems_mc8()
sub_test_sizes(@mc8, 4, 4, 4, 0)
end
def test_absolute()
assert_equal({}, @mc1.absolute)
assert_equal({1=>{2=>1}}, @mc2.absolute)
assert_equal({1=>{2=>1}, 3=>{4=>1}}, @mc3.absolute)
assert_equal({1=>{2=>1,3=>2, 4=>1}, 3=>{4=>1}}, @mc4.absolute)
assert_equal({[1,2]=>{3=>1}, [2,3]=>{5=>1}, [1,3]=>{4=>1}}, @mc5.absolute)
assert_equal({[1,2]=>{3=>1, 4=>1}, [2,3]=>{5=>1}, [1,3]=>{4=>1}}, @mc6.absolute)
assert_equal({[22, 21]=>{22=>1}, [22, 20]=>{23=>1}, [20, 21]=>{20=>1}, [21, 22]=>{20=>1}, [20,22]=>{21=>1}, [21,20]=>{22=>1}}, @mc7.absolute)
assert_equal({[30,31,32]=>{33=>1,34=>1}, [31,32,33]=>{30=>1}, [32,33,30]=>{31=>1}, [33,30,31]=>{32=>1} }, @mc8.absolute)
end
def test_relative()
assert_equal({}, @mc1.relative)
assert_equal({}, @mc2.relative)
assert_equal({3=>{4=>1}}, @mc3.relative)
assert_equal({1=>{2=>0.25,3=>0.75, 4=>1.0}, 3=>{4=>1}}, @mc4.relative)
assert_equal({}, @mc5.relative)
assert_equal({[1, 2]=>{3=>0.5, 4=>1.0}, [2, 3]=>{5=>1.0}}, @mc6.relative)
assert_equal({[22, 21]=>{22=>1}, [22, 20]=>{23=>1}, [20, 21]=>{20=>1}, [21, 22]=>{20=>1}, [20,22]=>{21=>1}, [21,20]=>{22=>1}}, @mc7.relative)
assert_equal({[30,31,32]=>{33=>0.5,34=>1.0}, [31,32,33]=>{30=>1}, [32,33,30]=>{31=>1}, [33,30,31]=>{32=>1}}, @mc8.relative)
end
def test_dirty()
assert_equal({}, @mc1.dirty)
assert_equal({1=>true}, @mc2.dirty)
assert_equal({1=>true}, @mc3.dirty)
assert_equal({}, @mc4.dirty)
assert_equal({[1, 2]=>true, [2, 3]=>true, [1, 3]=>true}, @mc5.dirty)
assert_equal({[1, 3]=>true}, @mc6.dirty)
end
def test_sum_edges()
assert_equal({}, @mc1.sum_edges)
assert_equal({1 => 1}, @mc2.sum_edges)
assert_equal({1 => 1, 3=>1}, @mc3.sum_edges)
assert_equal({1 => 4, 3=>1}, @mc4.sum_edges)
assert_equal({[1, 2]=>1, [2, 3]=>1, [1, 3]=>1}, @mc5.sum_edges)
assert_equal({[1, 2]=>2, [2, 3]=>1, [1, 3]=>1}, @mc6.sum_edges)
end
#
def test_rand()
# this is probabilistic
n = 10
1.upto(n) { assert_nil(@mc1.rand(nil)) }
1.upto(n) { assert_nil(@mc1.rand("x")) }
1.upto(n) { assert_equal(2, @mc2.rand(1)) }
1.upto(n) { assert_equal(2, @mc3.rand(1)) }
1.upto(n) { assert_equal(4, @mc3.rand(3)) }
1.upto(n*n) { assert_not_nil([2,3,4].index(@mc4.rand(1))) }
1.upto(n) { assert_nil(@mc4.rand(2)) }
1.upto(n) { assert_equal(4, @mc4.rand(3)) }
1.upto(n) { assert_nil(@mc2.rand(4)) }
1.upto(n*n) { assert_not_nil([3,4].index(@mc5.rand([1,2]))) }
1.upto(n) { assert_equal(5, @mc5.rand([2,3])) }
1.upto(n) { assert_nil(@mc5.rand([3,1])) }
end
#
def sub_test_sizes(mc, a, b, c, d)
assert_equal(a, mc.absolute.length(), "absolute")
assert_equal(b, mc.relative.length(), "relative")
assert_equal(c, mc.sum_edges.length(), "sum_edges")
assert_equal(d, mc.dirty.length(), "dirty")
end
end
| 27.73913 | 145 | 0.549933 |
21d6edef49faa1211bf0b2ef37c21c7121eaf29b | 1,536 | html | HTML | index.html | Ewpratten/webcrypt | 1c9265f63b5edb69ca9afc8c68bd01e4b63cf8f5 | [
"MIT"
] | null | null | null | index.html | Ewpratten/webcrypt | 1c9265f63b5edb69ca9afc8c68bd01e4b63cf8f5 | [
"MIT"
] | null | null | null | index.html | Ewpratten/webcrypt | 1c9265f63b5edb69ca9afc8c68bd01e4b63cf8f5 | [
"MIT"
] | null | null | null | <head>
<title>webcrypt loading...</title>
<style>
body {
background: #eaecfa;
}
.loader {
width: 250px;
height: 50px;
line-height: 50px;
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
font-family: helvetica, arial, sans-serif;
text-transform: uppercase;
font-weight: 900;
color: #ce4233;
letter-spacing: 0.2em;
}
.confirm-title{
width: 80%;
margin-right:auto;
margin-left:auto;
font-family: helvetica, arial, sans-serif;
text-transform: uppercase;
font-weight: 900;
text-align:center;
color: #ce4233;
letter-spacing: 0.2em;
}
.confirm-text{
width: 80%;
margin-right:auto;
margin-left:auto;
font-family: helvetica, arial, sans-serif;
font-weight: 900;
text-align:center;
color: grey;
letter-spacing: 0.2em;
}
</style>
</head>
<body>
<div class="loader">Loading...</div>
<script src="kbpgp-2.0.8-min.js"></script>
<script>
// get the signed file
const Http = new XMLHttpRequest();
const url = window.location.href.replace(".html", ".pgp")
var payload;
Http.open("GET", url);
Http.send();
Http.onreadystatechange=(e)=>{
payload = Http.responseText.slice(47, -28).split("-----BEGIN PGP SIGNATURE-----");
// find the signer's info
var signature = payload[1];
}
// display prompt
if( confirm("Do you trust?") ){
document.body.innerHTML = payload[0];
}
// document.body.innerHTML = '<h1 class="confirm-title">Do you trust this signer?</h1><pre class="confirm-text">' + signature+ "</pre>";
// show page
// }
</script>
</body>
| 19.2 | 136 | 0.663411 |
5fca30f0d555f33405f2b6e322387d2612c0a7e0 | 3,219 | h | C | Source/SOrb/UI/InGame/Spells/SoUISpellSelection.h | LaudateCorpus1/WarriOrb | 7c20320484957e1a7fe0c09ab520967849ba65f1 | [
"MIT"
] | 200 | 2021-03-17T11:15:05.000Z | 2022-03-31T23:45:09.000Z | Source/SOrb/UI/InGame/Spells/SoUISpellSelection.h | LaudateCorpus1/WarriOrb | 7c20320484957e1a7fe0c09ab520967849ba65f1 | [
"MIT"
] | null | null | null | Source/SOrb/UI/InGame/Spells/SoUISpellSelection.h | LaudateCorpus1/WarriOrb | 7c20320484957e1a7fe0c09ab520967849ba65f1 | [
"MIT"
] | 38 | 2021-03-17T13:29:18.000Z | 2022-03-04T19:32:52.000Z | // Copyright (c) Csaba Molnar & Daniel Butum. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UI/InGame/SoUIGameActivity.h"
#include "Items/SoItem.h"
#include "SoUISpellSelection.generated.h"
class UWrapBox;
class USoItemTemplateRuneStone;
class UHorizontalBox;
class UFMODEvent;
UCLASS()
class SORB_API USoUISpellSelection : public USoInGameUIActivity
{
GENERATED_BODY()
protected:
// Begin UUserWidget Interface
void NativeConstruct() override;
// End UUserWidget Interface
// Begin USoInGameUIActivity Interface
bool SetInGameActivityEnabled_Implementation(UObject* Source, bool bEnable) override;
bool HandleCommand_Implementation(ESoUICommand Command) override;
bool Update_Implementation(float DeltaSeconds) override;
// End USoInGameUIActivity Interface
protected:
void Reinitialize();
void UpdateCanBeEquippedStates();
void EquipSelected();
void UnequipSelected();
void UpdateEquippedBorders();
void WriteEquippedStonesToCharacterSheet();
UFUNCTION(BlueprintPure, Category = SpellSelection)
bool CanEquipSelected() const;
UFUNCTION(BlueprintPure, Category = SpellSelection)
bool CanEquip(int32 Index) const;
UFUNCTION(BlueprintPure, Category = SpellSelection)
int32 GetEquippedCount(USoItemTemplateRuneStone* RuneStone) const;
bool HasOneEquipped(USoItemTemplateRuneStone* RuneStone, int32* IndexPtr = nullptr) const;
UFUNCTION(BlueprintPure, Category = SpellSelection)
int32 CalculateIndex() const;
UFUNCTION(BlueprintPure, Category = SpellSelection)
bool IsIndexEquipped(int32 Index) const;
UFUNCTION(BlueprintImplementableEvent, Category = SpellSelection)
void OnSelectionChange(USoItemTemplateRuneStone* RuneStone, bool bIsItEquipped);
UFUNCTION(BlueprintImplementableEvent, Category = SpellSelection)
void OnEquippedListChange();
protected:
UPROPERTY(BlueprintReadWrite, Category = ">Widgets", meta = (BindWidget))
UWrapBox* SoWrapBox;
UPROPERTY(BlueprintReadWrite, Category = ">Widgets", meta = (BindWidget))
UHorizontalBox* EquippedContainer;
bool bOpened = false;
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = ">Selection")
int32 ColNum = 8;
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = ">Selection")
int32 RowNum = 7;
UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = ">Selection")
bool bEditable = false;
UPROPERTY(BlueprintReadOnly, Category = ">Runtime")
TArray<USoItemTemplateRuneStone*> CurrentRuneStones;
UPROPERTY(BlueprintReadOnly, Category = ">Runtime")
TArray<FSoItem> EquippedRuneStones;
int32 SelectedRowIndex = 0;
int32 SelectedColIndex = 0;
UPROPERTY(BlueprintReadOnly, Category = ">Runtime")
int32 EquippedRuneStoneCount = 0;
UPROPERTY(BlueprintReadOnly, Category = ">Runtime")
int32 EquippedRuneStoneCapacity = 0;
UPROPERTY(BlueprintReadOnly, Category = ">Runtime")
int32 MaxCapacity = 0;
//
// SFX
//
UPROPERTY(EditAnywhere, Category = ">SFX")
UFMODEvent* SFXSpellSelectionSwitch = nullptr;
UPROPERTY(EditAnywhere, Category = ">SFX")
UFMODEvent* SFXSpellAdded= nullptr;
UPROPERTY(EditAnywhere, Category = ">SFX")
UFMODEvent* SFXSpellRemoved = nullptr;
UPROPERTY(EditAnywhere, Category = ">SFX")
UFMODEvent* SFXSpellPanelClosed = nullptr;
};
| 26.825 | 91 | 0.789997 |
e9b4b49b4317df17b767d90f986a6e81853588aa | 272 | swift | Swift | Sources/awesome-mac-os-apps-helper/Params.swift | lzmartinico/awesome-mac-os-apps-helper | e2536368879334056079fc5eb30b8f1f175a66d3 | [
"MIT"
] | 1 | 2019-07-24T09:26:02.000Z | 2019-07-24T09:26:02.000Z | Sources/awesome-mac-os-apps-helper/Params.swift | lzmartinico/awesome-mac-os-apps-helper | e2536368879334056079fc5eb30b8f1f175a66d3 | [
"MIT"
] | 1 | 2018-11-08T10:58:25.000Z | 2018-11-08T10:58:25.000Z | Sources/awesome-mac-os-apps-helper/Params.swift | lzmartinico/awesome-mac-os-apps-helper | e2536368879334056079fc5eb30b8f1f175a66d3 | [
"MIT"
] | 1 | 2018-10-27T23:35:17.000Z | 2018-10-27T23:35:17.000Z | //
// Params.swift
// awesome-mac-os-apps-helper
//
// Created by Serhii Londar on 10/15/18.
//
import Foundation
struct Params {
static var repositoryURL: String? = nil
static var repositoryDescription: String? = nil
static var language: String? = nil
}
| 18.133333 | 51 | 0.683824 |
16600396c14693c310c67c1706c3ad53a7b127ce | 280 | h | C | ImageMinMaxCoreImageFilter/NLMinMax/NLMinMax/NLMinMaxPlugInLoader.h | demitri/CoreImageMinMaxFilter | 6a77230742fc308dd677e5455a39ccd53cee2cc4 | [
"BSD-3-Clause"
] | 1 | 2019-07-28T05:20:18.000Z | 2019-07-28T05:20:18.000Z | ImageMinMaxCoreImageFilter/NLMinMax/NLMinMax/NLMinMaxPlugInLoader.h | demitri/CoreImageMinMaxFilter | 6a77230742fc308dd677e5455a39ccd53cee2cc4 | [
"BSD-3-Clause"
] | null | null | null | ImageMinMaxCoreImageFilter/NLMinMax/NLMinMax/NLMinMaxPlugInLoader.h | demitri/CoreImageMinMaxFilter | 6a77230742fc308dd677e5455a39ccd53cee2cc4 | [
"BSD-3-Clause"
] | null | null | null | //
// NLMinMaxPlugInLoader.h
// NLMinMax
//
// Created by Demitri Muna on 3/18/17.
// Copyright © 2017 Demitri Muna. All rights reserved.
//
#import <QuartzCore/CoreImage.h>
@interface NLMinMaxPlugInLoader : NSObject <CIPlugInRegistration>
- (BOOL)load:(void *)host;
@end
| 17.5 | 65 | 0.710714 |
dd7075e710a6cdb2bd5fe76c8c7be31cc53952b1 | 1,151 | go | Go | server/approvalrulesprocessing/engine_manual_approval_rules.go | fullstaq-labs/sqedule | 15682b486efe8b76a844ae1d88e136a0388214a2 | [
"Apache-2.0"
] | 6 | 2021-08-23T07:15:37.000Z | 2022-03-13T17:12:21.000Z | server/approvalrulesprocessing/engine_manual_approval_rules.go | fullstaq-labs/sqedule | 15682b486efe8b76a844ae1d88e136a0388214a2 | [
"Apache-2.0"
] | null | null | null | server/approvalrulesprocessing/engine_manual_approval_rules.go | fullstaq-labs/sqedule | 15682b486efe8b76a844ae1d88e136a0388214a2 | [
"Apache-2.0"
] | null | null | null | package approvalrulesprocessing
import (
"github.com/fullstaq-labs/sqedule/server/dbmodels"
"github.com/fullstaq-labs/sqedule/server/dbmodels/releasestate"
)
func (engine Engine) fetchManualApprovalRulePreviousOutcomes() (map[uint64]bool, error) {
// TODO
// outcomes, err := dbmodels.FindAllManualApprovalRuleOutcomes(engine.Db, engine.Organization.ID, engine.Release.ID)
// if err != nil {
// return nil, err
// }
outcomes := make([]dbmodels.ManualApprovalRuleOutcome, 0)
return indexManualApprovalRuleOutcomes(outcomes), nil
}
func (engine Engine) processManualApprovalRules(rulesetContents dbmodels.ApprovalRulesetContents, previousOutcomes map[uint64]bool, nAlreadyProcessed uint) (releasestate.State, uint, error) {
var nprocessed uint = 0
// TODO
return determineReleaseStateAfterProcessingRules(nAlreadyProcessed, nprocessed, rulesetContents.NumRules()),
nprocessed, nil
}
func indexManualApprovalRuleOutcomes(outcomes []dbmodels.ManualApprovalRuleOutcome) map[uint64]bool {
result := make(map[uint64]bool)
for _, outcome := range outcomes {
result[outcome.ManualApprovalRuleID] = outcome.Success
}
return result
}
| 32.885714 | 191 | 0.789748 |
73efddef6cd10b32a29b6f3f5343fcb2a041be0b | 638 | rs | Rust | src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs | komaeda/rust | b2c6b8c29f13f8d1f242da89e587960b95337819 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 10 | 2019-04-27T00:58:42.000Z | 2021-11-14T17:09:19.000Z | src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs | komaeda/rust | b2c6b8c29f13f8d1f242da89e587960b95337819 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 25 | 2018-10-18T13:45:54.000Z | 2019-03-23T19:38:49.000Z | src/test/ui/rfc-2005-default-binding-mode/explicit-mut.rs | komaeda/rust | b2c6b8c29f13f8d1f242da89e587960b95337819 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2 | 2020-06-21T06:50:31.000Z | 2020-10-07T12:27:33.000Z | // Verify the binding mode shifts - only when no `&` are auto-dereferenced is the
// final default binding mode mutable.
fn main() {
match &&Some(5i32) {
Some(n) => {
*n += 1; //~ ERROR cannot assign to immutable
let _ = n;
}
None => {},
};
match &mut &Some(5i32) {
Some(n) => {
*n += 1; //~ ERROR cannot assign to immutable
let _ = n;
}
None => {},
};
match &&mut Some(5i32) {
Some(n) => {
*n += 1; //~ ERROR cannot assign to immutable
let _ = n;
}
None => {},
};
}
| 22 | 81 | 0.4279 |
012a2eb5118d35818dc9a22b3e8fea8f2cd6e677 | 293 | kt | Kotlin | src/main/kotlin/com/jayrave/moshi/pristineModels/PropertyExtractor.kt | jayrave/moshi-pristine-models | aa60b0e4ff55518a6d5022afd9ec9aa404833783 | [
"Apache-2.0"
] | 19 | 2016-10-25T18:22:44.000Z | 2020-11-25T22:10:13.000Z | src/main/kotlin/com/jayrave/moshi/pristineModels/PropertyExtractor.kt | jayrave/moshi-pristine-models | aa60b0e4ff55518a6d5022afd9ec9aa404833783 | [
"Apache-2.0"
] | 3 | 2016-10-26T06:01:36.000Z | 2017-08-31T18:31:52.000Z | src/main/kotlin/com/jayrave/moshi/pristineModels/PropertyExtractor.kt | jayrave/moshi-pristine-models | aa60b0e4ff55518a6d5022afd9ec9aa404833783 | [
"Apache-2.0"
] | 2 | 2019-01-04T09:54:49.000Z | 2020-12-14T07:51:55.000Z | package com.jayrave.moshi.pristineModels
import java.lang.reflect.Type
interface PropertyExtractor<in T, out F> {
/**
* The type of this property
*/
val type: Type
/**
* To extract the property ([F]) from an instance of [T]
*/
fun extractFrom(t: T): F
} | 18.3125 | 60 | 0.617747 |
758f413263598babc4076a34a698bb2e4db33365 | 3,882 | h | C | System/Library/PrivateFrameworks/GeoServices.framework/GEOPDSearchBrowseCategorySuggestionParameters.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | 12 | 2019-06-02T02:42:41.000Z | 2021-04-13T07:22:20.000Z | System/Library/PrivateFrameworks/GeoServices.framework/GEOPDSearchBrowseCategorySuggestionParameters.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/GeoServices.framework/GEOPDSearchBrowseCategorySuggestionParameters.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | 3 | 2019-06-11T02:46:10.000Z | 2019-12-21T14:58:16.000Z | /*
* This header is generated by classdump-dyld 1.0
* on Saturday, June 1, 2019 at 6:43:34 PM Mountain Standard Time
* Operating System: Version 12.1.1 (Build 16C5050a)
* Image Source: /System/Library/PrivateFrameworks/GeoServices.framework/GeoServices
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
#import <GeoServices/GeoServices-Structs.h>
#import <ProtocolBuffer/PBCodable.h>
#import <libobjc.A.dylib/NSCopying.h>
@class PBUnknownFields, GEOPDVenueIdentifier, GEOPDViewportInfo;
@interface GEOPDSearchBrowseCategorySuggestionParameters : PBCodable <NSCopying> {
PBUnknownFields* _unknownFields;
SCD_Struct_GE2* _engineTypes;
double _requestLocalTimestamp;
int _minimumNumberOfCategories;
int _suggestionType;
GEOPDVenueIdentifier* _venueFilter;
GEOPDViewportInfo* _viewportInfo;
BOOL _isCarplayRequest;
SCD_Struct_GE70 _has;
}
@property (nonatomic,readonly) BOOL hasViewportInfo;
@property (nonatomic,retain) GEOPDViewportInfo * viewportInfo; //@synthesize viewportInfo=_viewportInfo - In the implementation block
@property (assign,nonatomic) BOOL hasRequestLocalTimestamp;
@property (assign,nonatomic) double requestLocalTimestamp; //@synthesize requestLocalTimestamp=_requestLocalTimestamp - In the implementation block
@property (assign,nonatomic) BOOL hasMinimumNumberOfCategories;
@property (assign,nonatomic) int minimumNumberOfCategories; //@synthesize minimumNumberOfCategories=_minimumNumberOfCategories - In the implementation block
@property (assign,nonatomic) BOOL hasIsCarplayRequest;
@property (assign,nonatomic) BOOL isCarplayRequest; //@synthesize isCarplayRequest=_isCarplayRequest - In the implementation block
@property (assign,nonatomic) BOOL hasSuggestionType;
@property (assign,nonatomic) int suggestionType; //@synthesize suggestionType=_suggestionType - In the implementation block
@property (nonatomic,readonly) unsigned long long engineTypesCount;
@property (nonatomic,readonly) int* engineTypes;
@property (nonatomic,readonly) BOOL hasVenueFilter;
@property (nonatomic,retain) GEOPDVenueIdentifier * venueFilter; //@synthesize venueFilter=_venueFilter - In the implementation block
@property (nonatomic,readonly) PBUnknownFields * unknownFields;
-(BOOL)readFrom:(id)arg1 ;
-(void)writeTo:(id)arg1 ;
-(void)mergeFrom:(id)arg1 ;
-(PBUnknownFields *)unknownFields;
-(void)setViewportInfo:(GEOPDViewportInfo *)arg1 ;
-(BOOL)hasViewportInfo;
-(GEOPDViewportInfo *)viewportInfo;
-(void)setRequestLocalTimestamp:(double)arg1 ;
-(void)setHasRequestLocalTimestamp:(BOOL)arg1 ;
-(BOOL)hasRequestLocalTimestamp;
-(double)requestLocalTimestamp;
-(void)setVenueFilter:(GEOPDVenueIdentifier *)arg1 ;
-(BOOL)hasVenueFilter;
-(GEOPDVenueIdentifier *)venueFilter;
-(unsigned long long)engineTypesCount;
-(void)clearEngineTypes;
-(int)engineTypeAtIndex:(unsigned long long)arg1 ;
-(void)addEngineType:(int)arg1 ;
-(int*)engineTypes;
-(void)setEngineTypes:(int*)arg1 count:(unsigned long long)arg2 ;
-(id)engineTypesAsString:(int)arg1 ;
-(int)StringAsEngineTypes:(id)arg1 ;
-(int)minimumNumberOfCategories;
-(void)setMinimumNumberOfCategories:(int)arg1 ;
-(void)setHasMinimumNumberOfCategories:(BOOL)arg1 ;
-(BOOL)hasMinimumNumberOfCategories;
-(void)setIsCarplayRequest:(BOOL)arg1 ;
-(void)setHasIsCarplayRequest:(BOOL)arg1 ;
-(BOOL)hasIsCarplayRequest;
-(int)suggestionType;
-(void)setSuggestionType:(int)arg1 ;
-(void)setHasSuggestionType:(BOOL)arg1 ;
-(BOOL)hasSuggestionType;
-(id)suggestionTypeAsString:(int)arg1 ;
-(int)StringAsSuggestionType:(id)arg1 ;
-(BOOL)isCarplayRequest;
-(void)dealloc;
-(BOOL)isEqual:(id)arg1 ;
-(unsigned long long)hash;
-(id)description;
-(id)copyWithZone:(NSZone*)arg1 ;
-(id)dictionaryRepresentation;
-(void)copyTo:(id)arg1 ;
@end
| 43.617978 | 177 | 0.776919 |
00646b21f61da34e5bf632d1aa0523acc111564c | 107 | sql | SQL | sql/171223_1524_add_original_cost.sql | s911415/ntut-db-project-F17u | 15d1870266f14e1da67affae4aadd7b21e6638b4 | [
"MIT"
] | null | null | null | sql/171223_1524_add_original_cost.sql | s911415/ntut-db-project-F17u | 15d1870266f14e1da67affae4aadd7b21e6638b4 | [
"MIT"
] | null | null | null | sql/171223_1524_add_original_cost.sql | s911415/ntut-db-project-F17u | 15d1870266f14e1da67affae4aadd7b21e6638b4 | [
"MIT"
] | null | null | null | ALTER TABLE `order` ADD `original_cost` INT NOT NULL DEFAULT '0' COMMENT '折扣前的原始價錢' AFTER `arrival_time`;
| 53.5 | 106 | 0.757009 |
2e6757230839f45aa1d13c974a288ed6b2f5499b | 6,108 | kt | Kotlin | app/src/main/java/com/raghav/spacedawn/ui/fragments/SearchArticleFragment.kt | avidraghav/SpaceFlightNewsApp | 8bfb05b7daadab9b19332a35ec29ac880d46214a | [
"MIT"
] | 2 | 2021-10-06T03:12:28.000Z | 2022-02-06T03:31:53.000Z | app/src/main/java/com/raghav/spacedawn/ui/fragments/SearchArticleFragment.kt | avidraghav/SpaceFlightNewsApp | 8bfb05b7daadab9b19332a35ec29ac880d46214a | [
"MIT"
] | null | null | null | app/src/main/java/com/raghav/spacedawn/ui/fragments/SearchArticleFragment.kt | avidraghav/SpaceFlightNewsApp | 8bfb05b7daadab9b19332a35ec29ac880d46214a | [
"MIT"
] | null | null | null | package com.raghav.spacedawn.ui.fragments
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.AbsListView
import android.widget.Toast
import androidx.core.widget.addTextChangedListener
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.raghav.spacedawn.R
import com.raghav.spacedawn.adapters.ArticlesAdapter
import com.raghav.spacedawn.databinding.FragmentSearchArticleBinding
import com.raghav.spacedawn.ui.AppViewModel
import com.raghav.spacedawn.ui.MainActivity
import com.raghav.spacedawn.utils.Constants
import com.raghav.spacedawn.utils.Constants.Companion.DELAY_TIME
import com.raghav.spacedawn.utils.Resource
import kotlinx.coroutines.*
class SearchArticleFragment : Fragment(R.layout.fragment_search_article) {
lateinit var viewModel: AppViewModel
lateinit var articlesAdapter: ArticlesAdapter
private lateinit var binding: FragmentSearchArticleBinding
private val TAG = "SearchArticleFragment"
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding = FragmentSearchArticleBinding.bind(view)
setupRecyclerView()
viewModel = (activity as MainActivity).viewModel
articlesAdapter.setOnItemClickListener {
val bundle = Bundle().apply {
putSerializable("article", it)
}
findNavController().navigate(
R.id.action_searchArticleFragment_to_articleDisplayFragment,
bundle
)
}
// Search Articles functionality implementation
var job: Job? = null
binding.etSearch.addTextChangedListener {
job?.cancel()
job = MainScope().launch {
delay(DELAY_TIME)
it.let {
if (it.toString().isNotEmpty()) {
viewModel.getSearchArticleList(it.toString())
Log.d(TAG, "inside is Notempty")
}
}
}
}
viewModel.searchArticleList.observe(viewLifecycleOwner, Observer { response ->
when (response) {
is Resource.Success -> {
Log.d(TAG, "inside success")
hideProgressBar()
hideErrorMessage()
response.data?.let {
articlesAdapter.differ.submitList(it)
}
}
is Resource.Error -> {
hideProgressBar()
Log.d(TAG, "inside failure")
response.message?.let { message ->
Toast.makeText(activity, "An error occured: $message", Toast.LENGTH_LONG)
.show()
showErrorMessage(message)
}
}
is Resource.Loading -> {
Log.d(TAG, "inside loading")
showProgressBar()
}
}
})
binding.btnRetry.setOnClickListener {
if (binding.etSearch.text.toString().isNotEmpty()) {
viewModel.getSearchArticleList(binding.etSearch.text.toString())
} else {
hideErrorMessage()
}
}
}
private fun hideProgressBar() {
binding.paginationProgressBar.visibility = View.INVISIBLE
isLoading = false
}
private fun showProgressBar() {
binding.paginationProgressBar.visibility = View.VISIBLE
isLoading = true
}
private fun hideErrorMessage() {
binding.itemErrorMessage.visibility = View.INVISIBLE
isError = false
}
private fun showErrorMessage(message: String) {
binding.itemErrorMessage.visibility = View.VISIBLE
binding.tvErrorMessage.text = message
isError = true
}
var isError = false
var isLoading = false
var isLastPage = false
var isScrolling = false
val scrollListener = object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
val layoutManager = recyclerView.layoutManager as LinearLayoutManager
val firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition()
val visibleItemCount = layoutManager.childCount
val totalItemCount = layoutManager.itemCount
val isNotLoadingAndNotLastPage = !isLoading && !isLastPage
val isAtLastItem = firstVisibleItemPosition + visibleItemCount >= totalItemCount
val isNotAtBeginning = firstVisibleItemPosition >= 0
val isTotalMoreThanVisible = totalItemCount >= Constants.QUERY_PAGE_SIZE
val shouldPaginate = isNotLoadingAndNotLastPage && isAtLastItem && isNotAtBeginning &&
isTotalMoreThanVisible && isScrolling
Log.d(TAG, shouldPaginate.toString())
if (shouldPaginate) {
viewModel.getSearchArticleList(binding.etSearch.text.toString())
isScrolling = false
} else {
binding.rvSearchArticles.setPadding(0, 0, 0, 0)
}
}
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
if (newState == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
isScrolling = true
}
}
}
private fun setupRecyclerView() {
articlesAdapter = ArticlesAdapter()
binding.rvSearchArticles.apply {
adapter = articlesAdapter
layoutManager = LinearLayoutManager(activity)
addOnScrollListener([email protected])
}
}
} | 38.175 | 98 | 0.625573 |
3e2bcab259b109badf81055d77027b3ec0d8d067 | 429 | h | C | Pod/objcrtxx_defs_cleanup.h | victor-pavlychko/ObjCxxRuntime | 54478ff1a74ab7242b7b8596592ea3b80f7cf7ff | [
"MIT"
] | null | null | null | Pod/objcrtxx_defs_cleanup.h | victor-pavlychko/ObjCxxRuntime | 54478ff1a74ab7242b7b8596592ea3b80f7cf7ff | [
"MIT"
] | null | null | null | Pod/objcrtxx_defs_cleanup.h | victor-pavlychko/ObjCxxRuntime | 54478ff1a74ab7242b7b8596592ea3b80f7cf7ff | [
"MIT"
] | null | null | null | //
// objcrtxx_defs_cleanup.h
//
// Created by Victor Pavlychko on 08.01.2016.
// Copyright © 2016 address.wtf. All rights reserved.
//
#ifdef OBJCRTXX_UMBRELLA_ACTIVE
#undef OBJCRTXX_BEGIN_NAMESPACE
#undef OBJCRTXX_END_NAMESPACE
#undef OBJCRTXX_EXPOSE_LIST_ACCESSORS
#undef OBJCXX_PRIMITIVE_WRAPPER
#undef OBJCRTXX_HAS_ABI
#undef OBJCRTXX_HAS_ABI_FPRET
#undef OBJCRTXX_HAS_ABI_FP2RET
#endif // OBJCRTXX_UMBRELLA_ACTIVE
| 19.5 | 54 | 0.815851 |
cb373f3776c4a27e69e8cf30e5b1c35d6e46b02b | 167 | go | Go | pkg/repository/user/errors.go | HordeGroup/Horde | 1dcbe0dbf0d1fbd217be6a5fb511ecfa8f09ef48 | [
"MIT"
] | 1 | 2020-08-30T08:45:21.000Z | 2020-08-30T08:45:21.000Z | pkg/repository/user/errors.go | HordeGroup/horde | 1dcbe0dbf0d1fbd217be6a5fb511ecfa8f09ef48 | [
"MIT"
] | null | null | null | pkg/repository/user/errors.go | HordeGroup/horde | 1dcbe0dbf0d1fbd217be6a5fb511ecfa8f09ef48 | [
"MIT"
] | null | null | null | package user
import "github.com/pkg/errors"
var (
ErrUserNotFound = errors.New("User Err: Not Found")
ErrUserDuplicate = errors.New("User Err: already exists")
)
| 18.555556 | 58 | 0.730539 |
503e5c546d7eb8c9659d6bad2509bf26a67cef4c | 1,454 | lua | Lua | examples/game_server.lua | samuelwbaird/brogue | 2eb185698f1fe94cc3ed6f72360c29203342fe8b | [
"MIT"
] | 1 | 2020-06-17T06:11:37.000Z | 2020-06-17T06:11:37.000Z | examples/game_server.lua | samuelwbaird/brogue | 2eb185698f1fe94cc3ed6f72360c29203342fe8b | [
"MIT"
] | null | null | null | examples/game_server.lua | samuelwbaird/brogue | 2eb185698f1fe94cc3ed6f72360c29203342fe8b | [
"MIT"
] | null | null | null | -- demonstration game server
-- copyright 2014 Samuel Baird MIT Licence
-- reference the brogue libraries
package.path = '../source/?.lua;' .. package.path
-- demonstrate a game server with the following features
-- sessions using cookies (no real security)
-- long polling status updates
-- rascal proxies used to run game logic in its own thread
-- use rascal
local rascal = require('rascal.core')
-- configure logging
-- rascal.log_service:log_to_file('log/game_server.log')
rascal.log_service:log_to_console(true)
-- standard rascal session db
rascal.service('rascal.session.session_server', { 'db/session.sqlite' })
-- we are going to use the game of blockers and runners
-- as demonstrated in the ORM example
-- the game will run in its own microserver process
-- launch this class as a micro server, with these parameters
rascal.service('classes.game_thread', { 'db/game.sqlite' })
-- configure an HTTP server
rascal.http_server('tcp://*:8080', 1, [[
prefix('/', {
-- access static files under resources prefix
prefix('resources/', {
static('static/', nil, false),
}),
-- otherwise chain in our custom handler
chain('classes.game_session', {}, {
prefix('api_', {
handler('classes.game_api', {}),
}),
handler('classes.game_view', {}),
}),
redirect('/')
})
]])
log('open your browser at http://localhost:8080/')
log('ctrl-c to exit')
-- last thing to do is run the main event loop
rascal.run_loop()
| 25.964286 | 72 | 0.700825 |
f115757d8ba9e30d322754db2bb2dbabe8bc00bd | 158 | rb | Ruby | db/migrate/20161117113809_add_timestamp_to_dataset_settings.rb | Vizzuality/forest-atlas-landpscape-cms | fd33a2b1e6d1f0b7ab496fb33d51d08a650da237 | [
"MIT"
] | 5 | 2016-10-05T04:48:15.000Z | 2019-08-19T02:14:40.000Z | db/migrate/20161117113809_add_timestamp_to_dataset_settings.rb | Vizzuality/forest-atlas-landpscape-cms | fd33a2b1e6d1f0b7ab496fb33d51d08a650da237 | [
"MIT"
] | 100 | 2016-06-23T07:10:01.000Z | 2022-03-30T22:06:27.000Z | db/migrate/20161117113809_add_timestamp_to_dataset_settings.rb | Vizzuality/forest-atlas-landpscape-cms | fd33a2b1e6d1f0b7ab496fb33d51d08a650da237 | [
"MIT"
] | 6 | 2017-02-10T06:56:42.000Z | 2019-06-03T16:33:07.000Z | class AddTimestampToDatasetSettings < ActiveRecord::Migration[5.0]
def change
add_column :dataset_settings, :fields_last_modified, :timestamp
end
end
| 26.333333 | 67 | 0.803797 |
130e52437838727d92184428d6d25abdc4f39066 | 83 | asm | Assembly | assembler/antlr/java/runtime/asm/505.asm | twystd/GA144 | 741d2f2fca82133d594c51807115bd5121aa5350 | [
"Unlicense"
] | 9 | 2015-01-31T11:25:01.000Z | 2021-06-28T19:10:01.000Z | cucumber/505.asm | twystd/GA144 | 741d2f2fca82133d594c51807115bd5121aa5350 | [
"Unlicense"
] | null | null | null | cucumber/505.asm | twystd/GA144 | 741d2f2fca82133d594c51807115bd5121aa5350 | [
"Unlicense"
] | null | null | null | results 0 org
main @b main ;
init down b! main ;
a9H org init ;
| 11.857143 | 23 | 0.518072 |
9a4cbcb4c874185008bbdff4537e187d259d8c80 | 2,865 | css | CSS | css/newcss.css | kakneprateek1/koincompare1 | c69472892352e72d752403472a0297e90aad2d6f | [
"UPL-1.0"
] | null | null | null | css/newcss.css | kakneprateek1/koincompare1 | c69472892352e72d752403472a0297e90aad2d6f | [
"UPL-1.0"
] | null | null | null | css/newcss.css | kakneprateek1/koincompare1 | c69472892352e72d752403472a0297e90aad2d6f | [
"UPL-1.0"
] | null | null | null | /*
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
*/
/*
Created on : Feb 8, 2018, 3:18:51 PM
Author : pkakne
*/
.image1{
content:url("images/bitcoin.png");
opacity:0.6;
height:250px;
padding-right: 20%;
float:right;
overflow:hidden;
}
.imag{
content:url("images/bitcoin.png");
opacity:1;
vertical-align:middle;
height:50px;
}
.telegram{
content:url("images/telegram.jpg");
opacity:1;
vertical-align:middle;
height:50px;
}
.ripple{
content:url("images/ripple.png");
opacity:1;
vertical-align:middle;
height:40px;
}
.litecoin{
content:url("images/litecoin.png");
opacity:1;
vertical-align:middle;
height:50px;
}
.ethereum{
content:url("images/ethereum.png");
opacity:1;
vertical-align:middle;
height:50px;
}
.bch{
content:url("images/bch.png");
opacity:1;
vertical-align:middle;
height:40px;
}
.logo{
content:url("images/logo5.png");
opacity:0.7;
float:left;
height: 60px;
}
.image2{
content:url("images/dash.png");
height: 100px;
}
#header{
background-color: #077b99;
text:red;
}
.home1{
}
#sec1{
margin-top:5px;
}
#oc{
margin-top:px;
}
h5{
font-family:"Times New Roman", Times, serif;
font-size: 30px;
}
.home1{
margin-top:-8px;
}
.homebutton{
color:red;
}
.defaultbutton {
display: inline-block;
border-radius: 10px;
background-color: #077b99;
border: none;
color:#EAF5FB;
font-family:"Times New Roman", Times, serif;
text-align: center;
font-size: 28px;
padding: 20px;
width: 150px;
transition: all 0.5s;
cursor: pointer;
margin: 5px;
}
.defaultbutton span {
cursor: pointer;
display: inline-block;
position: relative;
transition: 0.5s;
}
.defaultbutton span:after {
content: '\00bb';
position: absolute;
opacity: 0;
top: 0;
right: -20px;
transition: 0.5s;
}
.defaultbutton:hover span {
padding-right: 25px;
}
.defaultbutton:hover span:after {
opacity: 1;
right: 0;
}
#section1{
background-color:#52b1c9;
height:762px;
}
#compsec1{
background-color:#52b1c9;
height:762px;
}
#line{
}
#Caption{
}
.button {
background-color: #15819b; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
#section2{
background-color: #f1f3f4;
height:520px;
}
#section2quest{
color:black;
margin-left:550px;
}
#wia.h3{
margin-left:1000px;
color:black;
}
#answer{
color:black;
}
| 13.642857 | 76 | 0.60733 |
8fdd36a4d9ba86d95f2c2391df1d726a06247d52 | 39 | tab | SQL | www/bases-examples_Windows/opac_conf/es/lang.tab | ABCD-Community/development | a639f8a7c7290b19e197515692376d21719c5371 | [
"Unlicense"
] | null | null | null | www/bases-examples_Windows/opac_conf/es/lang.tab | ABCD-Community/development | a639f8a7c7290b19e197515692376d21719c5371 | [
"Unlicense"
] | null | null | null | www/bases-examples_Windows/opac_conf/es/lang.tab | ABCD-Community/development | a639f8a7c7290b19e197515692376d21719c5371 | [
"Unlicense"
] | null | null | null | en=English
es=Spanish
pt=Portuguese
| 9.75 | 14 | 0.769231 |
cbc1133d8015a2f35f39eb794017963c5a5a00e1 | 66 | go | Go | k3/log/log.go | peixy0/ntt | 0820de7d2e4b38b7917f28180bf85d37aba31c31 | [
"BSD-3-Clause"
] | 53 | 2018-05-03T16:52:26.000Z | 2022-03-14T08:08:53.000Z | k3/log/log.go | peixy0/ntt | 0820de7d2e4b38b7917f28180bf85d37aba31c31 | [
"BSD-3-Clause"
] | 113 | 2018-05-06T13:27:40.000Z | 2022-03-30T02:45:59.000Z | k3/log/log.go | peixy0/ntt | 0820de7d2e4b38b7917f28180bf85d37aba31c31 | [
"BSD-3-Clause"
] | 23 | 2018-02-08T14:13:18.000Z | 2022-02-22T08:38:46.000Z | // Package log supports parsing K3 runtime log files.
package log
| 22 | 53 | 0.787879 |
3b510c7ca3b0c73860c3ce02da4556d11213445c | 1,494 | kt | Kotlin | buildSrc/src/main/kotlin/Config.kt | StevenGG19/MovieHunt | 8f957c561defd2c2e0cf87324266fc40404423f2 | [
"MIT"
] | 1 | 2021-07-13T09:16:54.000Z | 2021-07-13T09:16:54.000Z | buildSrc/src/main/kotlin/Config.kt | virendersran01/MovieHunt | 19d4fa80396fd65fc0c67903d1109bb846e296df | [
"MIT"
] | null | null | null | buildSrc/src/main/kotlin/Config.kt | virendersran01/MovieHunt | 19d4fa80396fd65fc0c67903d1109bb846e296df | [
"MIT"
] | null | null | null | import com.android.build.gradle.BaseExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType
object Config {
const val API_ROOT = "\"https://api.themoviedb.org/3/\""
const val IMAGE_API_ROOT = "\"https://image.tmdb.org/t/p/\""
}
fun Project.configAndroid() = this.extensions.getByType<BaseExtension>().run {
compileSdkVersion(Versions.Android.sdk)
defaultConfig {
minSdkVersion(Versions.Android.minSdk)
targetSdkVersion(Versions.Android.sdk)
versionCode = Versions.App.versionCode
versionName = Versions.App.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "API_ROOT", Config.API_ROOT)
buildConfigField("String", "TMDB_API_KEY", TMDB_API_KEY)
buildConfigField("String", "IMAGE_API_KEY", Config.IMAGE_API_ROOT)
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
buildFeatures.dataBinding = true
buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
} | 32.478261 | 78 | 0.676707 |
545fa3602157682276f1fc088fdd2cb3a9d2e535 | 5,097 | go | Go | model/mock/interfaces.go | developertask/multiwallet | cbc739f642604647d6698a4a5cb7621dc7f66afa | [
"MIT"
] | null | null | null | model/mock/interfaces.go | developertask/multiwallet | cbc739f642604647d6698a4a5cb7621dc7f66afa | [
"MIT"
] | null | null | null | model/mock/interfaces.go | developertask/multiwallet | cbc739f642604647d6698a4a5cb7621dc7f66afa | [
"MIT"
] | null | null | null | package mock
import (
"encoding/hex"
"errors"
"fmt"
"sync"
gosocketio "github.com/developertask/golang-socketio"
"github.com/developertask/multiwallet/client"
"github.com/developertask/multiwallet/model"
"github.com/btcsuite/btcutil"
)
type MockAPIClient struct {
blockChan chan model.Block
txChan chan model.Transaction
listeningAddrs []btcutil.Address
chainTip int
feePerBlock int
info *model.Info
addrToScript func(btcutil.Address) ([]byte, error)
}
func NewMockApiClient(addrToScript func(btcutil.Address) ([]byte, error)) model.APIClient {
return &MockAPIClient{
blockChan: make(chan model.Block),
txChan: make(chan model.Transaction),
chainTip: 0,
addrToScript: addrToScript,
feePerBlock: 1,
info: &MockInfo,
}
}
func (m *MockAPIClient) Start() error {
return nil
}
func (m *MockAPIClient) GetInfo() (*model.Info, error) {
return m.info, nil
}
func (m *MockAPIClient) GetTransaction(txid string) (*model.Transaction, error) {
for _, tx := range MockTransactions {
if tx.Txid == txid {
return &tx, nil
}
}
return nil, errors.New("Not found")
}
func (m *MockAPIClient) GetRawTransaction(txid string) ([]byte, error) {
if raw, ok := MockRawTransactions[txid]; ok {
return raw, nil
}
return nil, errors.New("Not found")
}
func (m *MockAPIClient) GetTransactions(addrs []btcutil.Address) ([]model.Transaction, error) {
txs := make([]model.Transaction, len(MockTransactions))
copy(txs, MockTransactions)
txs[0].Outputs[1].ScriptPubKey.Addresses = []string{addrs[0].String()}
txs[1].Inputs[0].Addr = addrs[0].String()
txs[1].Outputs[1].ScriptPubKey.Addresses = []string{addrs[1].String()}
txs[2].Outputs[1].ScriptPubKey.Addresses = []string{addrs[2].String()}
return txs, nil
}
func (m *MockAPIClient) GetUtxos(addrs []btcutil.Address) ([]model.Utxo, error) {
utxos := make([]model.Utxo, len(MockUtxos))
copy(utxos, MockUtxos)
utxos[0].Address = addrs[1].String()
script, _ := m.addrToScript(addrs[1])
utxos[0].ScriptPubKey = hex.EncodeToString(script)
utxos[1].Address = addrs[2].String()
script, _ = m.addrToScript(addrs[2])
utxos[1].ScriptPubKey = hex.EncodeToString(script)
return utxos, nil
}
func (m *MockAPIClient) BlockNotify() <-chan model.Block {
return m.blockChan
}
func (m *MockAPIClient) TransactionNotify() <-chan model.Transaction {
return m.txChan
}
func (m *MockAPIClient) ListenAddresses(addrs ...btcutil.Address) {
m.listeningAddrs = append(m.listeningAddrs, addrs...)
}
func (m *MockAPIClient) Broadcast(tx []byte) (string, error) {
return "a8c685478265f4c14dada651969c45a65e1aeb8cd6791f2f5bb6a1d9952104d9", nil
}
func (m *MockAPIClient) GetBestBlock() (*model.Block, error) {
return &MockBlocks[m.chainTip], nil
}
func (m *MockAPIClient) EstimateFee(nBlocks int) (int, error) {
return m.feePerBlock * nBlocks, nil
}
func (m *MockAPIClient) Close() {}
func MockWebsocketClientOnClientPool(p *client.ClientPool) *MockSocketClient {
var (
callbacksMap = make(map[string]func(*gosocketio.Channel, interface{}))
mockSocketClient = &MockSocketClient{
callbacks: callbacksMap,
listeningAddresses: []string{},
}
)
for _, c := range p.Clients() {
c.SocketClient = mockSocketClient
}
return mockSocketClient
}
func NewMockWebsocketClient() *MockSocketClient {
var (
callbacksMap = make(map[string]func(*gosocketio.Channel, interface{}))
mockSocketClient = &MockSocketClient{
callbacks: callbacksMap,
listeningAddresses: []string{},
}
)
return mockSocketClient
}
type MockSocketClient struct {
callbackMutex sync.Mutex
callbacks map[string]func(*gosocketio.Channel, interface{})
listeningAddresses []string
}
func (m *MockSocketClient) SendCallback(method string, args ...interface{}) {
if gosocketChan, ok := args[0].(*gosocketio.Channel); ok {
m.callbacks[method](gosocketChan, args[1])
} else {
m.callbacks[method](nil, args[1])
}
}
func (m *MockSocketClient) IsListeningForAddress(addr string) bool {
for _, a := range m.listeningAddresses {
if a == addr {
return true
}
}
return false
}
func (m *MockSocketClient) On(method string, callback interface{}) error {
c, ok := callback.(func(h *gosocketio.Channel, args interface{}))
if !ok {
return fmt.Errorf("failed casting mock callback: %+v", callback)
}
m.callbackMutex.Lock()
defer m.callbackMutex.Unlock()
if method == "bitcoind/addresstxid" {
m.callbacks[method] = c
} else if method == "bitcoind/hashblock" {
m.callbacks[method] = c
}
return nil
}
func (m *MockSocketClient) Emit(method string, args []interface{}) error {
if method == "subscribe" {
subscribeTo, ok := args[0].(string)
if !ok || subscribeTo != "bitcoind/addresstxid" {
return fmt.Errorf("first emit arg is not bitcoind/addresstxid, was: %+v", args[0])
}
addrs, ok := args[1].([]string)
if !ok {
return fmt.Errorf("second emit arg is not address value, was %+v", args[1])
}
m.listeningAddresses = append(m.listeningAddresses, addrs...)
}
return nil
}
func (m *MockSocketClient) Close() {}
| 26.968254 | 95 | 0.701982 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.