{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n\n\n\n\n\n\n\n\n \n \t\n"},"repo_name":{"kind":"string","value":"GoC-Spending/data-corporations"},"path":{"kind":"string","value":"html/123456225077.html"},"language":{"kind":"string","value":"HTML"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":34161,"string":"34,161"}}},{"rowIdx":704,"cells":{"code":{"kind":"string","value":"# What is fakeLoader.js\n\nfakeLoader.js is a lightweight jQuery plugin that helps you create an animated spinner with a fullscreen loading mask to simulate the page preloading effect.\n\nCheck out the demo [http://joaopereirawd.github.io/fakeLoader.js/](http://joaopereirawd.github.io/fakeLoader.js)\n\n## Current Version \n`V2.0.0`\n\n### 1. Installing \n```js \nyarn add jq-fakeloader\nor\nnpm i jq-fakeloader\n```\n\n### 2. Include CSS\n```css\n\n```\n\n### 3. Include `javascript` dependencies\n```\n\n```\n\n### 6. Options\n\n\n`timeToHide` //Time in milliseconds for fakeLoader disappear\n\n`spinner` //'spinner1', 'spinner2', 'spinner3', 'spinner4', 'spinner5', 'spinner6', 'spinner7'\n\n`bgColor` //Hex, RGB or RGBA colors\n\n### Support\nIf you encounter an issue or want to request a feature, you can create an [issue](https://github.com/joaopereirawd/fakeLoader.js/issues)\n\n\n\n"},"repo_name":{"kind":"string","value":"joaopereirawd/fakeLoader.js"},"path":{"kind":"string","value":"README.md"},"language":{"kind":"string","value":"Markdown"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":1232,"string":"1,232"}}},{"rowIdx":705,"cells":{"code":{"kind":"string","value":"\n\n\n\n\n\n\nalternative Standard Libary: Elementverzeichnis\n\n\n\n\n\n\n\n\n\n\n\n
\n
\n\n \n \n \n \n \n \n
\"Logo\"\n
alternative Standard Libary\n  0.29.8\n
\n
\n
\n\n\n\n\n\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n\n
\n
\n
\n
std::Sys Elementverzeichnis
\n
\n
\n\n

Vollständige Aufstellung aller Elemente für std::Sys einschließlich aller geerbten Elemente.

\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
fClose(void *file)std::Sysstatic
fEOF(void *file)std::Sysstatic
fError(void *file)std::Sysstatic
fFlush(void *file)std::Sysstatic
fGetc(void *file)std::Sysstatic
fIsFile(const char *file)std::Sysstatic
fOpen(const char *file, const char *fmt)std::Sysstatic
fPrintf(void *file, const char *str)std::Sysstatic
fPutc(int c, void *file)std::Sysstatic
fPuts(const char *str, void *file)std::Sysstatic
fRead(void *data, const int count, const int size, void *file)std::Sysstatic
fSeek(void *file, int off, int org)std::Sysstatic
fTell(void *file)std::Sysstatic
fWrite(void *data, const int count, const int size, void *file)std::Sysstatic
mAlloc(size_t size)std::Sysstatic
mAllocE(int elements)std::Sysinlinestatic
MemCpy(void *to, const void *from, size_t bytes)std::Sysstatic
MemMove(void *to, const void *from, size_t bytes)std::Sysstatic
MemSet(void *buf, unsigned char value, size_t bytes)std::Sysstatic
mFree(void *mem)std::Sysstatic
mReAlloc(void *old, size_t newSize)std::Sysstatic
mutex_init_t enum-Bezeichnerstd::Sys
mutex_type typedefstd::Sys
mutexDestroy(mutex_type *mutex)std::Sysstatic
mutexInit(mutex_type *mutex, mutex_init_t type=mutex_init_t::Normal, bool shared=false, bool robust=false)std::Sysstatic
mutexLock(mutex_type *mutex)std::Sysstatic
mutexTryLock(mutex_type *mutex)std::Sysstatic
mutexUnLock(mutex_type *mutex)std::Sysstatic
pTotalMem()std::Sysstatic
spinlk_type typedefstd::Sys
spinlockDestroy(spinlk_type *mutex)std::Sysstatic
spinlockInit(spinlk_type *mutex, const void *attr)std::Sysstatic
spinlockLock(spinlk_type *mutex)std::Sysstatic
spinlockTryLock(spinlk_type *mutex)std::Sysstatic
spinlockUnLock(spinlk_type *mutex)std::Sysstatic
vsnPrintf(char *buffer, size_t count, const char *format, va_list argptr)std::Sysstatic
wMemCpy(void *to, const void *from, size_t bytes)std::Sysstatic
wMemMove(void *to, const void *from, size_t bytes)std::Sysstatic
wMemSet(void *buf, unsigned char value, size_t bytes)std::Sysstatic
\n
\n\n
\n
    \n
  • Erzeugt von\n \n \"doxygen\"/ 1.8.13
  • \n
\n
\n\n\n"},"repo_name":{"kind":"string","value":"RoseLeBlood/aSTL"},"path":{"kind":"string","value":"docs/html/da/d52/classstd_1_1_sys-members.html"},"language":{"kind":"string","value":"HTML"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":15410,"string":"15,410"}}},{"rowIdx":706,"cells":{"code":{"kind":"string","value":"var ExtractTextPlugin = require(\"extract-text-webpack-plugin\");\nvar HtmlWebpackPlugin = require(\"html-webpack-plugin\");\nvar path = require(\"path\");\nvar webpack = require(\"webpack\");\nvar projectTemplatesRoot = \"../../ppb/templates/\";\n\nmodule.exports = {\n context: path.resolve(__dirname, \"src\"),\n entry: {\n app: \"./js/main.js\"\n },\n output: {\n path: path.resolve(__dirname, \"dist\"),\n filename: \"js/site.js?[hash]\",\n publicPath: \"/site_media/static\"\n },\n module: {\n loaders: [\n {\n test: /\\.(gif|png|ico|jpg|svg)$/,\n include: [\n path.resolve(__dirname, \"src/images\")\n ],\n loader: \"file-loader?name=/images/[name].[ext]\"\n },\n { test: /\\.less$/, loader: ExtractTextPlugin.extract(\"style-loader\", \"css-loader!less-loader\") },\n {\n test: /\\.(woff|woff2|ttf|eot|svg)(\\?v=[0-9]\\.[0-9]\\.[0-9])?$/,\n include: [\n path.resolve(__dirname, \"/src/fonts\"),\n path.resolve(__dirname, \"../node_modules\")\n ],\n loader: \"file-loader?name=/fonts/[name].[ext]?[hash]\"\n },\n { test: /\\.jsx?$/, loader: \"babel-loader\", query: {compact: false} },\n ]\n },\n resolve: {\n extensions: [\"\", \".js\", \".jsx\"],\n },\n plugins: [\n new webpack.IgnorePlugin(/^\\.\\/locale$/, /moment$/),\n new ExtractTextPlugin(\"css/site.css?[hash]\"),\n new HtmlWebpackPlugin({\n filename: projectTemplatesRoot + \"_styles.html\",\n templateContent: function(templateParams, compilation) {\n var link = \"\";\n for (var css in templateParams.htmlWebpackPlugin.files.css) {\n link += \"\\n\"\n }\n return link;\n }\n }),\n new HtmlWebpackPlugin({\n filename: projectTemplatesRoot + \"_scripts.html\",\n templateContent: function(templateParams, compilation) {\n var script = \"\";\n for (var js in templateParams.htmlWebpackPlugin.files.js) {\n script += \"\\n\"\n }\n return script;\n }\n })\n ]\n};\n"},"repo_name":{"kind":"string","value":"pinax/blog.pinaxproject.com"},"path":{"kind":"string","value":"static/webpack.config.js"},"language":{"kind":"string","value":"JavaScript"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":2456,"string":"2,456"}}},{"rowIdx":707,"cells":{"code":{"kind":"string","value":"var h = require('hyperscript')\nvar human = require('human-time')\n\nexports.needs = {}\n\nexports.gives = 'message_meta'\n\nexports.create = function () {\n\n function updateTimestampEl(el) {\n el.firstChild.nodeValue = human(new Date(el.timestamp))\n return el\n }\n\n setInterval(function () {\n var els = [].slice.call(document.querySelectorAll('.timestamp'))\n els.forEach(updateTimestampEl)\n }, 60e3)\n\n return function (msg) {\n return updateTimestampEl(h('a.enter.timestamp', {\n href: '#'+msg.key,\n timestamp: msg.value.timestamp,\n title: new Date(msg.value.timestamp)\n }, ''))\n }\n\n}\n"},"repo_name":{"kind":"string","value":"cryptix/talebay"},"path":{"kind":"string","value":"modules_basic/timestamp.js"},"language":{"kind":"string","value":"JavaScript"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":613,"string":"613"}}},{"rowIdx":708,"cells":{"code":{"kind":"string","value":"import { HookContext, Application, createContext, getServiceOptions } from '@feathersjs/feathers';\nimport { NotFound, MethodNotAllowed, BadRequest } from '@feathersjs/errors';\nimport { createDebug } from '@feathersjs/commons';\nimport isEqual from 'lodash/isEqual';\nimport { CombinedChannel } from '../channels/channel/combined';\nimport { RealTimeConnection } from '../channels/channel/base';\n\nconst debug = createDebug('@feathersjs/transport-commons');\n\nexport const DEFAULT_PARAMS_POSITION = 1;\n\nexport const paramsPositions: { [key: string]: number } = {\n find: 0,\n update: 2,\n patch: 2\n};\n\nexport function normalizeError (e: any) {\n const hasToJSON = typeof e.toJSON === 'function';\n const result = hasToJSON ? e.toJSON() : {};\n\n if (!hasToJSON) {\n Object.getOwnPropertyNames(e).forEach(key => {\n result[key] = e[key];\n });\n }\n\n if (process.env.NODE_ENV === 'production') {\n delete result.stack;\n }\n\n delete result.hook;\n\n return result;\n}\n\nexport function getDispatcher (emit: string, socketMap: WeakMap, socketKey?: any) {\n return function (event: string, channel: CombinedChannel, context: HookContext, data?: any) {\n debug(`Dispatching '${event}' to ${channel.length} connections`);\n\n channel.connections.forEach(connection => {\n // The reference between connection and socket is set in `app.setup`\n const socket = socketKey ? connection[socketKey] : socketMap.get(connection);\n\n if (socket) {\n const eventName = `${context.path || ''} ${event}`.trim();\n\n let result = channel.dataFor(connection) || context.dispatch || context.result;\n\n // If we are getting events from an array but try to dispatch individual data\n // try to get the individual item to dispatch from the correct index.\n if (!Array.isArray(data) && Array.isArray(context.result) && Array.isArray(result)) {\n result = context.result.find(resultData => isEqual(resultData, data));\n }\n\n debug(`Dispatching '${eventName}' to Socket ${socket.id} with`, result);\n\n socket[emit](eventName, result);\n }\n });\n };\n}\n\nexport async function runMethod (app: Application, connection: RealTimeConnection, path: string, method: string, args: any[]) {\n const trace = `method '${method}' on service '${path}'`;\n const methodArgs = args.slice(0);\n const callback = typeof methodArgs[methodArgs.length - 1] === 'function'\n ? methodArgs.pop() : function () {};\n\n debug(`Running ${trace}`, connection, args);\n\n const handleError = (error: any) => {\n debug(`Error in ${trace}`, error);\n callback(normalizeError(error));\n };\n\n try {\n const lookup = app.lookup(path);\n\n // No valid service was found throw a NotFound error\n if (lookup === null) {\n throw new NotFound(`Service '${path}' not found`);\n }\n\n const { service, params: route = {} } = lookup;\n const { methods } = getServiceOptions(service);\n\n // Only service methods are allowed\n if (!methods.includes(method)) {\n throw new MethodNotAllowed(`Method '${method}' not allowed on service '${path}'`);\n }\n\n const position = paramsPositions[method] !== undefined ? paramsPositions[method] : DEFAULT_PARAMS_POSITION;\n const query = methodArgs[position] || {};\n // `params` have to be re-mapped to the query and added with the route\n const params = Object.assign({ query, route, connection }, connection);\n\n // `params` is always the last parameter. Error if we got more arguments.\n if (methodArgs.length > (position + 1)) {\n throw new BadRequest(`Too many arguments for '${method}' method`);\n }\n\n methodArgs[position] = params;\n\n const ctx = createContext(service, method);\n const returnedCtx: HookContext = await (service as any)[method](...methodArgs, ctx);\n const result = returnedCtx.dispatch || returnedCtx.result;\n\n debug(`Returned successfully ${trace}`, result);\n callback(null, result);\n } catch (error: any) {\n handleError(error);\n }\n}\n"},"repo_name":{"kind":"string","value":"feathersjs/feathers"},"path":{"kind":"string","value":"packages/transport-commons/src/socket/utils.ts"},"language":{"kind":"string","value":"TypeScript"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":3996,"string":"3,996"}}},{"rowIdx":709,"cells":{"code":{"kind":"string","value":"/*\n * Generated by class-dump 3.3.4 (64 bit).\n *\n * class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.\n */\n\n#import \n\n// Not exported\n@interface NSSQLLimitIntermediate : NSSQLIntermediate\n{\n unsigned long long _limit;\n}\n\n- (id)generateSQLStringInContext:(id)arg1;\n- (id)initWithLimit:(unsigned long long)arg1 inScope:(id)arg2;\n\n@end\n\n"},"repo_name":{"kind":"string","value":"matthewsot/CocoaSharp"},"path":{"kind":"string","value":"Headers/Frameworks/CoreData/NSSQLLimitIntermediate.h"},"language":{"kind":"string","value":"C"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":401,"string":"401"}}},{"rowIdx":710,"cells":{"code":{"kind":"string","value":"version https://git-lfs.github.com/spec/v1\noid sha256:e40a08695f05163cfb0eaeeef4588fcfad55a6576cfadfb079505495605beb33\nsize 27133\n"},"repo_name":{"kind":"string","value":"yogeshsaroya/new-cdnjs"},"path":{"kind":"string","value":"ajax/libs/fuelux/2.5.0/datepicker.js"},"language":{"kind":"string","value":"JavaScript"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":130,"string":"130"}}},{"rowIdx":711,"cells":{"code":{"kind":"string","value":"\n\n\n\t\n\t\n\t\n\tStranger Things Wall\n\t\n\n\n\t\"\"\n\t

Presiona una tecla

\n\t\n\n\n"},"repo_name":{"kind":"string","value":"chepegeek/stranger-things"},"path":{"kind":"string","value":"index.html"},"language":{"kind":"string","value":"HTML"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":441,"string":"441"}}},{"rowIdx":712,"cells":{"code":{"kind":"string","value":"has_many('Reply');\r\n\t}\r\n\r\n}"},"repo_name":{"kind":"string","value":"hassan-c/laravelapp"},"path":{"kind":"string","value":"application/models/thread.php"},"language":{"kind":"string","value":"PHP"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":193,"string":"193"}}},{"rowIdx":713,"cells":{"code":{"kind":"string","value":"\n\n \n \n \n Blog | Guilherme Matheus Costa\n \n \n \n \n \n

Guilherme Matheus Costa

\n

Resume

\n \n"},"repo_name":{"kind":"string","value":"GuilhermeMatheus/GuilhermeMatheus.github.io"},"path":{"kind":"string","value":"pages/resume.html"},"language":{"kind":"string","value":"HTML"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":467,"string":"467"}}},{"rowIdx":714,"cells":{"code":{"kind":"string","value":"#!/usr/bin/env python\n\nfrom hdf5handler import HDF5Handler\n\nhandler = HDF5Handler('mydata.hdf5')\nhandler.open()\n\nfor i in range(100):\n handler.put(i, 'numbers')\n\nhandler.close()\n\n\n"},"repo_name":{"kind":"string","value":"iambernie/hdf5handler"},"path":{"kind":"string","value":"examples/opening.py"},"language":{"kind":"string","value":"Python"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":183,"string":"183"}}},{"rowIdx":715,"cells":{"code":{"kind":"string","value":"/**\n * The MIT License (MIT)\n *\n * Copyright (c) 2015 Famous Industries Inc.\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n\n'use strict';\n\nimport { Geometry } from '../Geometry';\nimport { GeometryHelper } from '../GeometryHelper';\n\n/**\n * This function generates custom buffers and passes them to\n * a new static geometry, which is returned to the user.\n *\n * @class Tetrahedron\n * @constructor\n *\n * @param {Object} options Parameters that alter the\n * vertex buffers of the generated geometry.\n *\n * @return {Object} constructed geometry\n */\nclass Tetrahedron extends Geometry {\n constructor(options) {\n //handled by es6 transpiler\n //if (!(this instanceof Tetrahedron)) return new Tetrahedron(options);\n\n var textureCoords = [];\n var normals = [];\n var detail;\n var i;\n var t = Math.sqrt(3);\n\n var vertices = [\n // Back\n 1, -1, -1 / t,\n -1, -1, -1 / t,\n 0, 1, 0,\n\n // Right\n 0, 1, 0,\n 0, -1, t - 1 / t,\n 1, -1, -1 / t,\n\n // Left\n 0, 1, 0,\n -1, -1, -1 / t,\n 0, -1, t - 1 / t,\n\n // Bottom\n 0, -1, t - 1 / t,\n -1, -1, -1 / t,\n 1, -1, -1 / t\n ];\n\n var indices = [\n 0, 1, 2,\n 3, 4, 5,\n 6, 7, 8,\n 9, 10, 11\n ];\n\n for (i = 0; i < 4; i++) {\n textureCoords.push(\n 0.0, 0.0,\n 0.5, 1.0,\n 1.0, 0.0\n );\n }\n\n options = options || {};\n\n while (--detail) GeometryHelper.subdivide(indices, vertices, textureCoords);\n normals = GeometryHelper.computeNormals(vertices, indices);\n\n options.buffers = [\n {\n name: 'a_pos',\n data: vertices\n },\n {\n name: 'a_texCoord',\n data: textureCoords,\n size: 2\n },\n {\n name: 'a_normals',\n data: normals\n },\n {\n name: 'indices',\n data: indices,\n size: 1\n }\n ];\n\n super(options);\n }\n\n}\n\nexport { Tetrahedron };\n"},"repo_name":{"kind":"string","value":"talves/famous-engine"},"path":{"kind":"string","value":"src/webgl-geometries/primitives/Tetrahedron.js"},"language":{"kind":"string","value":"JavaScript"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":2960,"string":"2,960"}}},{"rowIdx":716,"cells":{"code":{"kind":"string","value":"/*\n * Copyright 2016 Christoph Brill \n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing libldt3.attributes;\nusing libldt3.model.enums;\nusing libldt3.model.regel;\nusing libldt3.model.regel.kontext;\nusing libldt3.model.saetze;\nusing NodaTime;\n\nnamespace libldt3\n{\n\n\t/**\n\t * Simple, reflection and annotation based reader for LDT 3.0.\n\t * \n\t * @author Christoph Brill &lt;egore911@gmail.com&gt;\n\t */\n\tpublic class LdtReader\n\t{\n\n\t\treadonly IDictionary regelCache = new Dictionary();\n\n\t\treadonly LdtConstants.Mode mode;\n\n\t\tpublic LdtReader(LdtConstants.Mode mode)\n\t\t{\n\t\t\tthis.mode = mode;\n\t\t}\n\n\t\t/**\n\t\t * Read the LDT found on a given path.\n\t\t * \n\t\t * @param path\n\t\t *\t\t\tthe path of the LDT file (any format handled by NIO\n\t\t *\t\t\t{@link Path})\n\t\t * @return the list of Satz elements found in the LDT file\n\t\t * @throws IOException\n\t\t *\t\t\t thrown if reading the file failed\n\t\t */\n\t\tpublic IList Read(string path)\n\t\t{\n\t\t\tusing (var f = File.Open(path, FileMode.Open))\n\t\t\t{\n\t\t\t\treturn Read(f);\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Read the LDT found on a given path.\n\t\t * \n\t\t * @param path\n\t\t *\t\t\tthe path of the LDT file\n\t\t * @return the list of Satz elements found in the LDT file\n\t\t * @throws IOException\n\t\t *\t\t\t thrown if reading the file failed\n\t\t */\n\t\tpublic IList Read(FileStream path)\n\t\t{\n\t\t\tvar stream = new StreamReader(path, Encoding.GetEncoding(\"ISO-8859-1\"));\n\t\t\treturn Read(stream);\n\t\t}\n\n\t\t/**\n\t\t * Read the LDT from a given string stream.\n\t\t * \n\t\t * @param stream\n\t\t *\t\t\tthe LDT lines as string stream\n\t\t * @return the list of Satz elements found in the LDT file\n\t\t */\n\t\tpublic IList Read(StreamReader stream)\n\t\t{\n\t\t\tStack stack = new Stack();\n\t\t\tIList data = new List();\n\t\t\tstring line;\n\t\t\tint integer = 0;\n\t\t\twhile ((line = stream.ReadLine()) != null)\n\t\t\t{\n\t\t\t\tHandleInput(line, stack, data, integer++);\n\t\t\t}\n\t\t\treturn data;\n\t\t}\n\n\t\tvoid HandleInput(string line, Stack stack, IList data, int lineNo)\n\t\t{\n\t\t\tTrace.TraceInformation(\"Reading line {0}\", line);\n\n\t\t\t// Check if the line meets the minimum requirements (3 digits for\n\t\t\t// length, 4 digits for the identifier)\n\t\t\tif (line.Length < 7)\n\t\t\t{\n\t\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t\t{\n\t\t\t\t\tthrow new ArgumentException(\"Line '\" + line + \"' (\" + lineNo + \") was less than 7 characters, aborting\");\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tTrace.TraceInformation(\"Line '{0}' ({1}) was less than 7 characters, continuing anyway\", line, lineNo);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Read the length and check whether it had the correct length\n\t\t\tint length = int.Parse(line.Substring(0, 3));\n\t\t\tif (length != line.Length + 2)\n\t\t\t{\n\t\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t\t{\n\t\t\t\t\tthrow new ArgumentException(\n\t\t\t\t\t\t\t\"Line '\" + line + \"' (\" + lineNo + \") should have length \" + (line.Length + 2) + \", but was \" + length);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tTrace.TraceInformation(\"Line '{0}' ({1}) should have length {2}, but was {3}. Ignoring specified length\", line, lineNo,\n\t\t\t\t\t\t(line.Length + 2), length);\n\t\t\t\t\tlength = line.Length + 2;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Read identifier and payload\n\t\t\tstring identifier = line.Substring(3, 7 - 3);\n\t\t\tstring payload = line.Substring(7, length - 2 - 7);\n\n\t\t\tswitch (identifier)\n\t\t\t{\n\t\t\t\tcase \"8000\":\n\t\t\t\t\t{\n\t\t\t\t\t\t// Start: Satz\n\t\t\t\t\t\tAssureLength(line, length, 13);\n\t\t\t\t\t\tif (stack.Count > 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tthrow new InvalidOperationException(\n\t\t\t\t\t\t\t\t\t\t\"Stack must be empty when starting a new Satz, but was \" + stack.Count + \" long\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tTrace.TraceInformation(\"Stack must be empty when starting a new Satz, but was {0}. Clearing and continuing\",\n\t\t\t\t\t\t\t\t\t\tstack);\n\t\t\t\t\t\t\t\tstack.Clear();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Extract Satzart from payload and create Satz matching it\n\t\t\t\t\t\tSatzart satzart = GetSatzart(payload);\n\t\t\t\t\t\tswitch (satzart)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase Satzart.Befund:\n\t\t\t\t\t\t\t\tstack.Push(new Befund());\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase Satzart.Auftrag:\n\t\t\t\t\t\t\t\tstack.Push(new Auftrag());\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase Satzart.LaborDatenpaketHeader:\n\t\t\t\t\t\t\t\tstack.Push(new LaborDatenpaketHeader());\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase Satzart.LaborDatenpaketAbschluss:\n\t\t\t\t\t\t\t\tstack.Push(new LaborDatenpaketAbschluss());\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase Satzart.PraxisDatenpaketHeader:\n\t\t\t\t\t\t\t\tstack.Push(new PraxisDatenpaketHeader());\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase Satzart.PraxisDatenpaketAbschluss:\n\t\t\t\t\t\t\t\tstack.Push(new PraxisDatenpaketAbschluss());\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tthrow new ArgumentException(\"Unsupported Satzart '\" + payload + \"' found\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase \"8001\":\n\t\t\t\t\t{\n\t\t\t\t\t\t// End: Satz\n\t\t\t\t\t\tAssureLength(line, length, 13);\n\t\t\t\t\t\tobject o = stack.Pop();\n\t\t\t\t\t\tDatenpaket datenpaket = o.GetType().GetCustomAttribute();\n\t\t\t\t\t\tif (datenpaket != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tEvaluateContextRules(o, datenpaket.Kontextregeln);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (stack.Count == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdata.Add((Satz)o);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase \"8002\":\n\t\t\t\t\t{\n\t\t\t\t\t\t// Start: Objekt\n\t\t\t\t\t\tAssureLength(line, length, 17);\n\t\t\t\t\t\tobject currentObject1 = PeekCurrentObject(stack);\n\t\t\t\t\t\tObjekt annotation1 = currentObject1.GetType().GetCustomAttribute();\n\t\t\t\t\t\tif (annotation1 != null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (annotation1.Value.Length == 0)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// If annotation is empty, the parent object would actually\n\t\t\t\t\t\t\t\t// be the one to deal with\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Match found, everything is fine\n\t\t\t\t\t\t\t\tif (payload.Equals(\"Obj_\" + annotation1.Value))\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// No match found, abort or inform the developer\n\t\t\t\t\t\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tthrow new ArgumentException(\n\t\t\t\t\t\t\t\t\t\t\t\"In line '\" + line + \"' (\" + lineNo + \") expected Obj_\" + annotation1.Value + \", got \" + payload);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tTrace.TraceError(\"In line {0} ({1}) expected Obj_{2}, got {3}\", line, lineNo, annotation1.Value, payload);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthrow new ArgumentException(\"Line '\" + line + \"' (\" + lineNo + \") started an unexpeted object, stack was \" + stack.ToArray());\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tTrace.TraceWarning(\"Line '{0}' ({1}) started an unexpeted object, stack was {2}\", line, lineNo, stack);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tcase \"8003\":\n\t\t\t\t\t{\n\t\t\t\t\t\t// End: Objekt\n\t\t\t\t\t\tAssureLength(line, length, 17);\n\t\t\t\t\t\tobject o;\n\t\t\t\t\t\tObjekt annotation1;\n\t\t\t\t\t\tdo\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\to = stack.Pop();\n\t\t\t\t\t\t\tannotation1 = o.GetType().GetCustomAttribute();\n\t\t\t\t\t\t\tif (annotation1 != null)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (annotation1.Value.Length != 0 && !(\"Obj_\" + annotation1.Value).Equals(payload)) {\n\t\t\t\t\t\t\t\t\tTrace.TraceWarning(\"Line: {0} ({1}), annotation {2}, payload {3}\", line, lineNo, annotation1.Value, payload);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tEvaluateContextRules(o, annotation1.Kontextregeln);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} while (annotation1 != null && annotation1.Value.Length == 0);\n\t\t\t\t\t\tif (stack.Count == 0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdata.Add((Satz)o);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\t// Any line not starting or completing a Satz or Objekt\n\t\t\t\t\tobject currentObject = PeekCurrentObject(stack);\n\t\t\t\t\tif (currentObject == null)\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new InvalidOperationException(\"No object when appplying line \" + line + \" (\" + lineNo + \")\");\n\t\t\t\t\t}\n\t\t\t\t\t// XXX iterating the fields could be replaced by a map to be a bit\n\t\t\t\t\t// faster when dealing with the same class\n\t\t\t\t\tforeach (FieldInfo info in currentObject.GetType().GetFields())\n\t\t\t\t\t{\n\n\t\t\t\t\t\t// Check if we found a Feld annotation, if not this is not our\n\t\t\t\t\t\t// field\n\t\t\t\t\t\tFeld annotation2 = info.GetCustomAttribute();\n\t\t\t\t\t\tif (annotation2 == null)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Check if the annotation matches the identifier, if not, this\n\t\t\t\t\t\t// is not our field\n\t\t\t\t\t\tif (!identifier.Equals(annotation2.Value))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Check if there is currently a value set\n\t\t\t\t\t\t\tobject o = info.GetValue(currentObject);\n\t\t\t\t\t\t\tif (o != null && GetGenericList(info.FieldType) == null)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tthrow new InvalidOperationException(\n\t\t\t\t\t\t\t\t\t\t\"Line '\" + line + \"' (\" + lineNo + \") would overwrite existing value \" + o + \" of \" + currentObject + \".\" + info.Name);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tTrace.TraceWarning(\"Line '{0}' ({1}) would overwrite existing value {2} in object {3}.{4}\", line, lineNo, o, currentObject, info);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tValidateFieldPayload(info, payload);\n\n\t\t\t\t\t\t\t// Convert the value to its target type ...\n\t\t\t\t\t\t\tobject value = ConvertType(info, info.FieldType, payload, stack);\n\n\t\t\t\t\t\t\t// .. and set the value on the target object\n\t\t\t\t\t\t\tinfo.SetValue(currentObject, value);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (Exception e)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tthrow new InvalidOperationException(e.Message, e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tTrace.TraceError(e.Message);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// We are done with this line\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// No field with a matching Feld annotation found, check if we are\n\t\t\t\t\t// an Objekt with an empty value (anonymous object), if so try our\n\t\t\t\t\t// parent\n\t\t\t\t\tObjekt annotation = currentObject.GetType().GetCustomAttribute();\n\t\t\t\t\tif (annotation != null && annotation.Value.Length == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tstack.Pop();\n\t\t\t\t\t\tHandleInput(line, stack, data, lineNo);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Neither we nor our parent could deal with this line\n\t\t\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new ArgumentException(\"Failed reading line \" + line + \" (\" + lineNo + \"), current stack: \" + string.Join(\" \", stack.ToArray()));\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tTrace.TraceWarning(\"Failed reading line {0} ({1}), current stack: {2}, skipping line\", line, lineNo, string.Join(\" \", stack.ToArray()));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tprivate void EvaluateContextRules(object o, Type[] kontextRegeln)\n\t\t{\n\t\t\tforeach (Type kontextregel in kontextRegeln)\n\t\t\t{\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tif (!((Kontextregel)Activator.CreateInstance(kontextregel)).IsValid(o))\n\t\t\t\t\t{\n\t\t\t\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tthrow new ArgumentException(\"Context rule \" + kontextregel.Name + \" failed on object \" + o);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tTrace.TraceWarning(\"Context rule {} failed on object {}\", kontextregel.Name, o);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcatch (Exception e)\n\t\t\t\t{\n\t\t\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new ArgumentException(\"Context rule \" + kontextregel.Name + \" failed on object \" + o, e);\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tTrace.TraceWarning(\"Context rule {} failed on object {}\", kontextregel.Name, o, e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvoid ValidateFieldPayload(FieldInfo field, string payload)\n\t\t{\n\t\t\tforeach (Regelsatz regelsatz in field.GetCustomAttributes())\n\t\t\t{\n\n\t\t\t\tif (regelsatz.Laenge >= 0)\n\t\t\t\t{\n\t\t\t\t\tif (payload.Length != regelsatz.Laenge)\n\t\t\t\t\t{\n\t\t\t\t\t\tValidationFailed(field.DeclaringType.Name + \".\" + field.Name + \": Value \" + payload + \" did not match expected length \"\n\t\t\t\t\t\t\t\t+ regelsatz.Laenge + \", was \" + payload.Length);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (regelsatz.MinLaenge >= 0)\n\t\t\t\t{\n\t\t\t\t\tif (payload.Length < regelsatz.MinLaenge)\n\t\t\t\t\t{\n\t\t\t\t\t\tValidationFailed(field.DeclaringType.Name + \".\" + field.Name + \": Value \" + payload + \" did not match expected minimum length \"\n\t\t\t\t\t\t\t\t+ regelsatz.MinLaenge + \", was \" + payload.Length);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (regelsatz.MaxLaenge >= 0)\n\t\t\t\t{\n\t\t\t\t\tif (payload.Length > regelsatz.MaxLaenge)\n\t\t\t\t\t{\n\t\t\t\t\t\tValidationFailed(field.DeclaringType.Name + \".\" + field.Name + \": Value \" + payload + \" did not match expected maximum length \"\n\t\t\t\t\t\t\t\t + regelsatz.MaxLaenge + \", was \" + payload.Length);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// No specific rules given, likely only length checks\n\t\t\t\tif (regelsatz.Value.Length == 0)\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tbool found = false;\n\t\t\t\tforeach (Type regel in regelsatz.Value)\n\t\t\t\t{\n\t\t\t\t\tif (GetRegel(regel).IsValid(payload))\n\t\t\t\t\t{\n\t\t\t\t\t\tfound = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!found)\n\t\t\t\t{\n\n\t\t\t\t\tValidationFailed(field.DeclaringType.Name + \".\" + field.Name + \": Value \" + payload + \" did not confirm to any rule of \"\n\t\t\t\t\t\t\t\t\t + ToString(regelsatz.Value));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvoid ValidationFailed(string message)\n\t\t{\n\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t{\n\t\t\t\tthrow new InvalidOperationException(message);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tTrace.TraceWarning(message);\n\t\t\t}\n\t\t}\n\n\t\tstring ToString(Type[] regeln)\n\t\t{\n\t\t\tStringBuilder buffer = new StringBuilder();\n\t\t\tforeach (Type regel in regeln)\n\t\t\t{\n\t\t\t\tif (buffer.Length > 0)\n\t\t\t\t{\n\t\t\t\t\tbuffer.Append(\" or \");\n\t\t\t\t}\n\t\t\t\tbuffer.Append(regel.Name);\n\t\t\t}\n\t\t\treturn buffer.ToString();\n\t\t}\n\n\t\tRegel GetRegel(Type regel)\n\t\t{\n\t\t\tRegel instance;\n\t\t\tregelCache.TryGetValue(regel, out instance);\n\t\t\tif (instance == null)\n\t\t\t{\n\t\t\t\tinstance = (Regel)Activator.CreateInstance(regel);\n\t\t\t\tregelCache[regel] = instance;\n\t\t\t}\n\t\t\treturn instance;\n\t\t}\n\n\t\t/**\n\t\t * Extract the Satzart form a given payload\n\t\t * \n\t\t * @param payload\n\t\t *\t\t\tthe payload of the line\n\t\t * @return the Satzart or {@code null}\n\t\t */\n\t\tSatzart GetSatzart(string payload)\n\t\t{\n\t\t\tforeach (Satzart sa in Enum.GetValues(typeof(Satzart)).Cast())\n\t\t\t{\n\t\t\t\tif (sa.GetCode().Equals(payload))\n\t\t\t\t{\n\t\t\t\t\treturn sa;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow new ArgumentException(\"Unsupported Satzart '\" + payload + \"' found\");\n\t\t}\n\n\t\t/**\n\t\t * Peek the current objekt from the stack, if any.\n\t\t * \n\t\t * @param stack\n\t\t *\t\t\tthe stack to peek the object from\n\t\t * @return the current top level element of the stack or {@code null}\n\t\t */\n\t\tstatic object PeekCurrentObject(Stack stack)\n\t\t{\n\t\t\tif (stack.Count == 0)\n\t\t\t{\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn stack.Peek();\n\t\t}\n\n\t\t/**\n\t\t * Check if the line matches the expected length.\n\t\t * \n\t\t * @param line\n\t\t *\t\t\tthe line to check\n\t\t * @param length\n\t\t *\t\t\tthe actual length\n\t\t * @param target\n\t\t *\t\t\tthe length specified by the line\n\t\t */\n\t\tvoid AssureLength(string line, int length, int target)\n\t\t{\n\t\t\tif (length != target)\n\t\t\t{\n\t\t\t\tif (mode == LdtConstants.Mode.STRICT)\n\t\t\t\t{\n\t\t\t\t\tthrow new ArgumentException(\n\t\t\t\t\t\t\t\"Line '\" + line + \"' must have length \" + target + \", was \" + length);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tTrace.TraceInformation(\"Line '{0}' must have length {1}, was {2}\", line, target, length);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Convert the string payload into a target class. (Note: There are\n\t\t * certainly better options out there but this one is simple enough for our\n\t\t * needs.)\n\t\t */\n\t\tstatic object ConvertType(FieldInfo field, Type type, string payload, Stack stack)\n\t\t{\n\t\t\tif (type == typeof(string))\n\t\t\t{\n\t\t\t\treturn payload;\n\t\t\t}\n\t\t\tif (type == typeof(float) || type == typeof(float?))\n\t\t\t{\n\t\t\t\treturn float.Parse(payload);\n\t\t\t}\n\t\t\tif (type == typeof(int) || type == typeof(int?))\n\t\t\t{\n\t\t\t\treturn int.Parse(payload);\n\t\t\t}\n\t\t\tif (type == typeof(long) || type == typeof(long?))\n\t\t\t{\n\t\t\t\treturn long.Parse(payload);\n\t\t\t}\n\t\t\tif (type == typeof(bool) || type == typeof(bool?))\n\t\t\t{\n\t\t\t\treturn \"1\".Equals(payload);\n\t\t\t}\n\t\t\tif (type == typeof(LocalDate?))\n\t\t\t{\n\t\t\t\treturn LdtConstants.FORMAT_DATE.Parse(payload).Value;\n\t\t\t}\n\t\t\tif (type == typeof(LocalTime?))\n\t\t\t{\n\t\t\t\treturn LdtConstants.FORMAT_TIME.Parse(payload).Value;\n\t\t\t}\n\t\t\tif (IsNullableEnum(type))\n\t\t\t{\n\t\t\t\tType enumType = Nullable.GetUnderlyingType(type);\n\t\t\t\tMethodInfo method = Type.GetType(enumType.FullName + \"Extensions\").GetMethod(\"GetCode\");\n\t\t\t\tif (method != null)\n\t\t\t\t{\n\t\t\t\t\tforeach (object e in Enum.GetValues(enumType))\n\t\t\t\t\t{\n\t\t\t\t\t\tstring code = (string)method.Invoke(e, new object[] { e });\n\t\t\t\t\t\tif (payload.Equals(code))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn e;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (type.IsEnum)\n\t\t\t{\n\t\t\t\tMethodInfo method = Type.GetType(type.FullName + \"Extensions\").GetMethod(\"GetCode\");\n\t\t\t\tif (method != null)\n\t\t\t\t{\n\t\t\t\t\tforeach (object e in Enum.GetValues(type))\n\t\t\t\t\t{\n\t\t\t\t\t\tstring code = (string)method.Invoke(e, new object[] { e });\n\t\t\t\t\t\tif (payload.Equals(code))\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\treturn e;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t}\n\t\t\tType genericType = GetGenericList(type);\n\t\t\tif (genericType != null)\n\t\t\t{\n\t\t\t\tobject currentObject = PeekCurrentObject(stack);\n\t\t\t\tvar o = (System.Collections.IList) field.GetValue(currentObject);\n\t\t\t\tif (o == null)\n\t\t\t\t{\n\t\t\t\t\to = (System.Collections.IList) Activator.CreateInstance(typeof(List<>).MakeGenericType(genericType.GetGenericArguments()[0]));\n\t\t\t\t\tfield.SetValue(currentObject, o);\n\t\t\t\t}\n\t\t\t\to.Add(ConvertType(field, type.GenericTypeArguments[0], payload, stack));\n\t\t\t\treturn o;\n\t\t\t}\n\t\t\tif (type.GetCustomAttribute() != null)\n\t\t\t{\n\t\t\t\tobject instance = Activator.CreateInstance(type);\n\t\t\t\tstack.Push(instance);\n\t\t\t\tFieldInfo declaredField = type.GetField(\"Value\");\n\t\t\t\tif (declaredField != null)\n\t\t\t\t{\n\t\t\t\t\tdeclaredField.SetValue(instance, ConvertType(declaredField, declaredField.FieldType, payload, stack));\n\t\t\t\t}\n\t\t\t\treturn instance;\n\t\t\t}\n\t\t\tthrow new ArgumentException(\"Don't know how to handle type \" + type);\n\t\t}\n\n\t\tstatic bool IsNullableEnum(Type t)\n\t\t{\n\t\t\tType u = Nullable.GetUnderlyingType(t);\n\t\t\treturn (u != null) && u.IsEnum;\n\t\t}\n\n\t\tstatic Type GetGenericList(Type type)\n\t\t{\n\t\t\tif (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IList<>))\n\t\t\t{\n\t\t\t\treturn type;\n\t\t\t}\n\n\t\t\tforeach (Type interfaceType in type.GetInterfaces())\n\t\t\t{\n\t\t\t\tif (interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IList<>))\n\t\t\t\t{\n\t\t\t\t\treturn interfaceType;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t}\n}\n"},"repo_name":{"kind":"string","value":"egore/libldt3-cs"},"path":{"kind":"string","value":"libldt3/LdtReader.cs"},"language":{"kind":"string","value":"C#"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":18803,"string":"18,803"}}},{"rowIdx":717,"cells":{"code":{"kind":"string","value":"var map;\nvar bounds;\nvar markers = {};\nvar cluster_polygons = {};\nvar zoomTimeout;\nvar cluster_center_overlay;\nvar white_overlay;\nvar overlay_opacity = 50;\nvar OPACITY_MAX_PIXELS = 57;\nvar active_cluster_poly;\nvar marker_image;\nvar center_marker;\nvar cluster_center_marker_icon;\n\nfunction createMap() {\n bounds = new google.maps.LatLngBounds ();\n markers;\n cluster_polygons;\n marker_image = {\n url: STATIC_URL + \"images/red_marker.png\",\n anchor: new google.maps.Point(4,4)};\n center_marker = {\n url: STATIC_URL + \"images/black_marker.png\",\n size: new google.maps.Size(20, 20),\n anchor: new google.maps.Point(10,10)};\n cluster_center_marker_icon = {\n url: STATIC_URL + \"images/transparent_marker_20_20.gif\",\n size: new google.maps.Size(20, 20),\n anchor: new google.maps.Point(10,10)};\n\n var mapOptions = {\n center: new google.maps.LatLng(0, 0),\n zoom: 4,\n mapTypeId: google.maps.MapTypeId.ROADMAP,\n scaleControl: true\n };\n map = new google.maps.Map(document.getElementById(\"canvas\"),\n mapOptions); \n\n // google.maps.event.addListener(map, 'bounds_changed', function(e) {\n // if (zoomTimeout) {\n // window.clearTimeout(zoomTimeout);\n // }\n // zoomTimeout = window.setTimeout(query_points_for_view, 5000);\n // })\n \n $.getScript(STATIC_URL + \"script/CustomTileOverlay.js\", function() {\n white_overlay = new CustomTileOverlay(map, overlay_opacity);\n white_overlay.show();\n\n google.maps.event.addListener(map, 'tilesloaded', function () {\n white_overlay.deleteHiddenTiles(map.getZoom());\n });\n createOpacityControl(map, overlay_opacity);\n });\n}\n\n// Thanks https://github.com/gavinharriss/google-maps-v3-opacity-control/!\nfunction createOpacityControl(map, opacity) {\n var sliderImageUrl = STATIC_URL + \"images/opacity-slider3d14.png\";\n \n // Create main div to hold the control.\n var opacityDiv = document.createElement('DIV');\n opacityDiv.setAttribute(\"style\", \"margin:5px;overflow-x:hidden;overflow-y:hidden;background:url(\" + sliderImageUrl + \") no-repeat;width:71px;height:21px;cursor:pointer;\");\n\n // Create knob\n var opacityKnobDiv = document.createElement('DIV');\n opacityKnobDiv.setAttribute(\"style\", \"padding:0;margin:0;overflow-x:hidden;overflow-y:hidden;background:url(\" + sliderImageUrl + \") no-repeat -71px 0;width:14px;height:21px;\");\n opacityDiv.appendChild(opacityKnobDiv);\n\n var opacityCtrlKnob = new ExtDraggableObject(opacityKnobDiv, {\n restrictY: true,\n container: opacityDiv\n });\n\n google.maps.event.addListener(opacityCtrlKnob, \"dragend\", function () {\n set_overlay_opacity(opacityCtrlKnob.valueX());\n });\n\n // google.maps.event.addDomListener(opacityDiv, \"click\", function (e) {\n // var left = findPosLeft(this);\n // var x = e.pageX - left - 5; // - 5 as we're using a margin of 5px on the div\n // opacityCtrlKnob.setValueX(x);\n // set_overlay_opacity(x);\n // });\n\n map.controls[google.maps.ControlPosition.TOP_RIGHT].push(opacityDiv);\n\n // Set initial value\n var initialValue = OPACITY_MAX_PIXELS / (100 / opacity);\n opacityCtrlKnob.setValueX(initialValue);\n set_overlay_opacity(initialValue);\n}\n\n// Thanks https://github.com/gavinharriss/google-maps-v3-opacity-control/!\nfunction findPosLeft(obj) {\n var curleft = 0;\n if (obj.offsetParent) {\n do {\n curleft += obj.offsetLeft;\n } while (obj = obj.offsetParent);\n return curleft;\n }\n return undefined;\n}\n\nfunction set_overlay_opacity(value) {\n overlay_opacity = (100.0 / OPACITY_MAX_PIXELS) * value;\n if (value < 0) value = 0;\n if (value == 0) {\n if (white_overlay.visible == true) {\n white_overlay.hide();\n }\n }\n else {\n white_overlay.setOpacity(overlay_opacity);\n if (white_overlay.visible == false) {\n white_overlay.show();\n }\n }\n}\n\nfunction query_points_for_view() {\n var bounds = map.getBounds();\n var x0 = bounds.getNorthEast().lng();\n var y0 = bounds.getNorthEast().lat();\n var x1 = bounds.getSouthWest().lng();\n var y1 = bounds.getSouthWest().lat();\n\n // Remove stuff off screen\n var to_remove = [];\n\n // What to remove\n $.each(markers, function(idx, marker){\n if (!bounds.contains(marker.getPosition()))\n {\n marker.setMap(null);\n to_remove.push(idx);\n }\n });\n $.each(to_remove, function(i, idx){\n delete markers[idx];\n })\n\n // $.getJSON(\"/rest/photos_box_contains?x0=\" + x0 + \"&y0=\" + y0 + \"&x1=\" + x1 + \"&y1=\" + y1, function(data){\n // console.log(\"got \" + data.features.length);\n // add_photo_to_map(data.features, 0, 128);\n // })\n\n $.getJSON(\"/rest/clusters_box_contains?x0=\" + x0 + \"&y0=\" + y0 + \"&x1=\" + x1 + \"&y1=\" + y1, function(data){\n console.log(\"got \" + data.features.length);\n add_cluster_to_map(data.features, 0);\n })\n\n}\n\nfunction create_photo_marker(photo_info) {\n var loc = new google.maps.LatLng(photo_info.geometry.coordinates[1], photo_info.geometry.coordinates[0]);\n var marker = new google.maps.Marker({\n map: map,\n position: loc,\n icon: marker_image\n });\n\n var infowindow = new google.maps.InfoWindow({\n content: \"
\"\n }); \n google.maps.event.addListener(marker, 'click', function() {\n infowindow.open(map,marker);\n });\n markers[photo_info.id] = marker;\n}\n\nfunction add_photo_to_map(photos, i, step) {\n for (var j = 0; j < step; j++) {\n if (i + j >= photos.length)\n {\n break;\n }\n var photo_info = photos[i + j];\n if (!markers[photo_info.id]) {\n create_photo_marker(photo_info);\n }\n }\n i += step;\n if (i < photos.length) {\n window.setTimeout(function(){add_photo_to_map(photos, i, step);}, 1);\n }\n}\n\nfunction add_clustering_run_to_map(data){\n $.each(cluster_polygons, function(idx, poly){\n poly.setMap(null);\n });\n bounds = new google.maps.LatLngBounds ();\n cluster_polygons = [];\n\n cluster_center_overlay = new google.maps.OverlayView();\n\n cluster_center_overlay.onAdd = function() {\n var layer = d3.select(this.getPanes().overlayMouseTarget).append(\"div\")\n .attr(\"class\", \"cluster_center\");\n\n var projection = this.getProjection();\n var max_size = 300;\n var max_size_per_2 = max_size / 2;\n\n var marker = layer.selectAll(\"svg\")\n .data(data.features)\n .each(transform)\n .enter().append(\"svg:svg\")\n .each(transform)\n .each(tie_to_g_marker)\n .attr(\"class\", \"marker\")\n .style(\"z-index\", function(cluster) {\n return set_default_z_index(cluster);\n })\n .append(\"svg:g\");\n\n function set_default_z_index(cluster) {\n return parseInt(cluster.properties.point_count_relative * 1000 + 100000);\n }\n\n marker.append(\"svg:polygon\")\n .attr(\"points\", function(cluster){\n var out = [];\n var last_phase = 0.0;\n var last_length = 1.0 / 12.0 * (max_size_per_2 - 1);\n var min_l = 0.0;//0.3 * max_size_per_2 * (Math.sqrt(cluster.properties.point_count_relative) * 0.7 + 0.3);\n for (var j = 1.0; j <= 12.0; j += 1.0){\n var phase = j / 12.0 * 2 * Math.PI;\n out.push([max_size_per_2 + Math.sin(last_phase) * min_l, max_size_per_2 - Math.cos(last_phase) * min_l]);\n out.push([max_size_per_2 + Math.sin(phase) * min_l, max_size_per_2 - Math.cos(phase) * min_l]);\n\n var second_poly = [];\n var l = ( (cluster.properties[\"points_month_\" + parseInt(j) + \"_relative\"]) * 0.9 + 0.1) * \n max_size_per_2 * (cluster.properties.point_count_relative * 0.8 + 0.2);\n second_poly.push([max_size_per_2 + Math.sin(last_phase) * min_l, max_size_per_2 - Math.cos(last_phase) * min_l]);\n second_poly.push([max_size_per_2 + Math.sin(last_phase) * l, max_size_per_2 - Math.cos(last_phase) * l]);\n second_poly.push([max_size_per_2 + Math.sin(phase) * l, max_size_per_2 - Math.cos(phase) * l]);\n second_poly.push([max_size_per_2 + Math.sin(phase) * min_l, max_size_per_2 - Math.cos(phase) * min_l]);\n second_poly.push(second_poly[0]);\n last_phase = phase;\n d3.select(this.parentElement)\n .append(\"svg:polygon\")\n .attr(\"points\", second_poly.join(\" \"))\n .attr(\"class\", \"month_\" + parseInt(j));\n }\n return out.join(\" \");\n })\n .attr(\"class\", \"cluster_center_marker\");\n\n function transform(cluster) {\n var coords = cluster.geometry.geometries[0].coordinates;\n var d = new google.maps.LatLng(coords[1], coords[0]);\n d = projection.fromLatLngToDivPixel(d);\n return d3.select(this)\n .style(\"left\", (d.x - max_size_per_2) + \"px\")\n .style(\"top\", (d.y - max_size_per_2) + \"px\");\n }\n\n function tie_to_g_marker(cluster){\n var coords = cluster.geometry.geometries[0].coordinates;\n var d = new google.maps.LatLng(coords[1], coords[0]);\n var marker = new google.maps.Marker({\n map: map,\n position: d,\n icon: cluster_center_marker_icon,\n zIndex: set_default_z_index(d3.select(this).data()[0])\n });\n var cluster_center = this;\n\n google.maps.event.addListener(marker, 'mouseover', function() {\n d3_cluster_center = d3.select(cluster_center);\n d3_cluster_center\n .style(\"transform\", \"scale(3.0)\")\n .style(\"animation-name\", \"cluster_center_highlight\")\n .style(\"z-index\", 1001001);\n });\n\n google.maps.event.addListener(marker, 'click', function() {\n if (active_cluster_poly) {\n active_cluster_poly.setMap(null);\n }\n\n sidebar_display_cluster_info(d3_cluster_center.data()[0][\"id\"]);\n\n d3_cluster_center = d3.select(cluster_center);\n poly_bounds = new google.maps.LatLngBounds ();\n\n // Define the LatLng coordinates for the polygon's path.\n var coords = d3_cluster_center.data()[0].geometry.geometries[1].coordinates[0];\n var g_coords = [];\n for (j in coords)\n { \n var c = coords[j];\n var co = new google.maps.LatLng(c[1], c[0]);\n g_coords.push(co);\n poly_bounds.extend(co);\n }\n\n // Construct the polygon.\n var poly = new google.maps.Polygon({\n paths: g_coords,\n strokeColor: '#FF0000',\n strokeOpacity: 0.8,\n strokeWeight: 2,\n fillColor: '#FF0000',\n fillOpacity: 0.35\n });\n\n poly.setMap(map);\n active_cluster_poly = poly;\n\n map.fitBounds(poly_bounds);\n });\n\n google.maps.event.addListener(marker, 'mouseout', function() {\n d3.select(cluster_center)\n .style(\"transform\", \"scale(1.0)\")\n .style(\"animation-name\", \"cluster_center_unhighlight\")\n .style(\"z-index\", function(cluster) {\n return set_default_z_index(cluster);\n });\n });\n\n bounds.extend(d);\n }\n map.fitBounds(bounds);\n\n cluster_center_overlay.draw = function() {\n var projection = this.getProjection();\n layer.selectAll(\"svg\")\n .data(data.features)\n .each(transform); \n };\n };\n cluster_center_overlay.setMap(map);\n}\n\nfunction finalize_clustering_run_to_map(clusters){\n console.log(\"finalizing\");\n map.fitBounds(bounds);\n}\n\nfunction show_clusters_lame() {\n var $form = $(\"#clustering_run_get_form\"), url = $form.attr(\"action\");\n\n // Fire some AJAX!\n $.ajax({\n type: \"GET\",\n url: url,\n dataType: \"json\",\n data: {id: $(\"#clustering_run_get_form_select\").val()}\n })\n .done(function(msg){\n add_cluster_to_map(msg.features, 0);\n });\n}\n\nfunction show_cluster_centers_lame() {\n var $form = $(\"#clustering_run_get_form\"), url = $form.attr(\"action\");\n\n // Fire some AJAX!\n $.ajax({\n type: \"GET\",\n url: url,\n dataType: \"json\",\n data: {id: $(\"#clustering_run_get_form_select\").val()}\n })\n .done(function(msg){\n add_cluster_center_to_map(msg.features, 0);\n });\n}\n\nfunction add_cluster_to_map(clusters, i){\n // Define the LatLng coordinates for the polygon's path.\n var cluster = clusters[i];\n var coords = [];\n var points = cluster.geometry.geometries[1].coordinates[0];\n for (var j = 0; j < points.length; j += 1)\n { \n coords.push(new google.maps.LatLng(\n points[j][1], points[j][0]));\n }\n\n var center = cluster.geometry.geometries[0].coordinates;\n var loc = new google.maps.LatLng(\n center[1],\n center[0])\n bounds.extend(loc);\n\n // Construct the polygon.\n var poly = new google.maps.Polygon({\n paths: coords,\n strokeColor: '#000000',\n strokeOpacity: 1.0,\n strokeWeight: 1,\n fillColor: '#FF0000',\n fillOpacity: 0.1\n });\n\n poly.setMap(map);\n // cluster_polygons.push(poly);\n\n if (i < clusters.length - 1) {\n window.setTimeout(function(){add_cluster_to_map(clusters, i + 1);}, 1);\n } else {\n finalize_clustering_run_to_map(clusters);\n }\n\n}\n\nfunction add_cluster_center_to_map(clusters, i){\n // Define the LatLng coordinates for the polygon's path.\n var cluster = clusters[i];\n var coords = [];\n\n var center = cluster.geometry.geometries[0].coordinates;\n var loc = new google.maps.LatLng(\n center[1],\n center[0])\n bounds.extend(loc);\n var marker = new google.maps.Marker({\n map: map,\n position: loc\n });\n\n if (i < clusters.length - 1) {\n window.setTimeout(function(){add_cluster_center_to_map(clusters, i + 1);}, 1);\n } else {\n finalize_clustering_run_to_map(clusters);\n }\n\n}\n\n\nfunction show_all() {\n map.fitBounds(bounds);\n}"},"repo_name":{"kind":"string","value":"joonamo/photoplaces"},"path":{"kind":"string","value":"photoplaces/static/script/map.js"},"language":{"kind":"string","value":"JavaScript"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":15053,"string":"15,053"}}},{"rowIdx":718,"cells":{"code":{"kind":"string","value":"#include \"sendcoinsdialog.h\"\n#include \"ui_sendcoinsdialog.h\"\n#include \"walletmodel.h\"\n#include \"bitcoinunits.h\"\n#include \"addressbookpage.h\"\n#include \"optionsmodel.h\"\n#include \"sendcoinsentry.h\"\n#include \"guiutil.h\"\n#include \"askpassphrasedialog.h\"\n#include \"base58.h\"\n\n#include \n#include \n#include \n#include \n\nSendCoinsDialog::SendCoinsDialog(QWidget *parent) :\n QDialog(parent),\n ui(new Ui::SendCoinsDialog),\n model(0)\n{\n ui->setupUi(this);\n\n#ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac\n ui->addButton->setIcon(QIcon());\n ui->clearButton->setIcon(QIcon());\n ui->sendButton->setIcon(QIcon());\n#endif\n\n addEntry();\n\n connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addEntry()));\n connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));\n\n fNewRecipientAllowed = true;\n}\n\nvoid SendCoinsDialog::setModel(WalletModel *model)\n{\n this->model = model;\n\n for(int i = 0; i < ui->entries->count(); ++i)\n {\n SendCoinsEntry *entry = qobject_cast(ui->entries->itemAt(i)->widget());\n if(entry)\n {\n entry->setModel(model);\n }\n }\n if(model && model->getOptionsModel())\n {\n setBalance(model->getBalance(), model->getStake(), model->getUnconfirmedBalance(), model->getImmatureBalance());\n connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64, qint64)));\n connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));\n }\n}\n\nSendCoinsDialog::~SendCoinsDialog()\n{\n delete ui;\n}\n\nvoid SendCoinsDialog::on_sendButton_clicked()\n{\n QList recipients;\n bool valid = true;\n\n if(!model)\n return;\n\t\n for(int i = 0; i < ui->entries->count(); ++i)\n {\n SendCoinsEntry *entry = qobject_cast(ui->entries->itemAt(i)->widget());\n if(entry)\n {\n if(entry->validate())\n {\n recipients.append(entry->getValue());\n }\n else\n {\n valid = false;\n }\n }\n }\n\n if(!valid || recipients.isEmpty())\n {\n return;\n }\n\n // Format confirmation message\n QStringList formatted;\n foreach(const SendCoinsRecipient &rcp, recipients)\n {\n#if QT_VERSION < 0x050000\n formatted.append(tr(\"%1 to %2 (%3)\").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount), Qt::escape(rcp.label), rcp.address));\n#else\n formatted.append(tr(\"%1 to %2 (%3)\").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount), rcp.label.toHtmlEscaped(), rcp.address));\n#endif\n }\n\n fNewRecipientAllowed = false;\n\n QMessageBox::StandardButton retval = QMessageBox::question(this, tr(\"Confirm send coins\"),\n tr(\"Are you sure you want to send %1?\").arg(formatted.join(tr(\" and \"))),\n QMessageBox::Yes|QMessageBox::Cancel,\n QMessageBox::Cancel);\n\n if(retval != QMessageBox::Yes)\n {\n fNewRecipientAllowed = true;\n return;\n }\n\n WalletModel::UnlockContext ctx(model->requestUnlock());\n if(!ctx.isValid())\n {\n // Unlock wallet was cancelled\n fNewRecipientAllowed = true;\n return;\n }\n\n WalletModel::SendCoinsReturn sendstatus = model->sendCoins(recipients);\n switch(sendstatus.status)\n {\n case WalletModel::InvalidAddress:\n QMessageBox::warning(this, tr(\"Send Coins\"),\n tr(\"The recipient address is not valid, please recheck.\"),\n QMessageBox::Ok, QMessageBox::Ok);\n break;\n case WalletModel::InvalidAmount:\n QMessageBox::warning(this, tr(\"Send Coins\"),\n tr(\"The amount to pay must be larger than 0.\"),\n QMessageBox::Ok, QMessageBox::Ok);\n break;\n case WalletModel::AmountExceedsBalance:\n QMessageBox::warning(this, tr(\"Send Coins\"),\n tr(\"The amount exceeds your balance.\"),\n QMessageBox::Ok, QMessageBox::Ok);\n break;\n case WalletModel::AmountWithFeeExceedsBalance:\n QMessageBox::warning(this, tr(\"Send Coins\"),\n tr(\"The total exceeds your balance when the %1 transaction fee is included.\").\n arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, sendstatus.fee)),\n QMessageBox::Ok, QMessageBox::Ok);\n break;\n case WalletModel::DuplicateAddress:\n QMessageBox::warning(this, tr(\"Send Coins\"),\n tr(\"Duplicate address found, can only send to each address once per send operation.\"),\n QMessageBox::Ok, QMessageBox::Ok);\n break;\n case WalletModel::TransactionCreationFailed:\n QMessageBox::warning(this, tr(\"Send Coins\"),\n tr(\"Error: Transaction creation failed.\"),\n QMessageBox::Ok, QMessageBox::Ok);\n break;\n case WalletModel::TransactionCommitFailed:\n QMessageBox::warning(this, tr(\"Send Coins\"),\n tr(\"Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.\"),\n QMessageBox::Ok, QMessageBox::Ok);\n break;\n case WalletModel::Aborted: // User aborted, nothing to do\n break;\n case WalletModel::OK:\n accept();\n break;\n }\n fNewRecipientAllowed = true;\n}\n\nvoid SendCoinsDialog::clear()\n{\n // Remove entries until only one left\n while(ui->entries->count())\n {\n delete ui->entries->takeAt(0)->widget();\n }\n addEntry();\n\n updateRemoveEnabled();\n\n ui->sendButton->setDefault(true);\n}\n\nvoid SendCoinsDialog::reject()\n{\n clear();\n}\n\nvoid SendCoinsDialog::accept()\n{\n clear();\n}\n\nSendCoinsEntry *SendCoinsDialog::addEntry()\n{\n SendCoinsEntry *entry = new SendCoinsEntry(this);\n entry->setModel(model);\n ui->entries->addWidget(entry);\n connect(entry, SIGNAL(removeEntry(SendCoinsEntry*)), this, SLOT(removeEntry(SendCoinsEntry*)));\n\n updateRemoveEnabled();\n\n // Focus the field, so that entry can start immediately\n entry->clear();\n entry->setFocus();\n ui->scrollAreaWidgetContents->resize(ui->scrollAreaWidgetContents->sizeHint());\n QCoreApplication::instance()->processEvents();\n QScrollBar* bar = ui->scrollArea->verticalScrollBar();\n if(bar)\n bar->setSliderPosition(bar->maximum());\n return entry;\n}\n\nvoid SendCoinsDialog::updateRemoveEnabled()\n{\n // Remove buttons are enabled as soon as there is more than one send-entry\n bool enabled = (ui->entries->count() > 1);\n for(int i = 0; i < ui->entries->count(); ++i)\n {\n SendCoinsEntry *entry = qobject_cast(ui->entries->itemAt(i)->widget());\n if(entry)\n {\n entry->setRemoveEnabled(enabled);\n }\n }\n setupTabChain(0);\n}\n\nvoid SendCoinsDialog::removeEntry(SendCoinsEntry* entry)\n{\n delete entry;\n updateRemoveEnabled();\n}\n\nQWidget *SendCoinsDialog::setupTabChain(QWidget *prev)\n{\n for(int i = 0; i < ui->entries->count(); ++i)\n {\n SendCoinsEntry *entry = qobject_cast(ui->entries->itemAt(i)->widget());\n if(entry)\n {\n prev = entry->setupTabChain(prev);\n }\n }\n QWidget::setTabOrder(prev, ui->addButton);\n QWidget::setTabOrder(ui->addButton, ui->sendButton);\n return ui->sendButton;\n}\n\nvoid SendCoinsDialog::pasteEntry(const SendCoinsRecipient &rv)\n{\n if(!fNewRecipientAllowed)\n return;\n\n SendCoinsEntry *entry = 0;\n // Replace the first entry if it is still unused\n if(ui->entries->count() == 1)\n {\n SendCoinsEntry *first = qobject_cast(ui->entries->itemAt(0)->widget());\n if(first->isClear())\n {\n entry = first;\n }\n }\n if(!entry)\n {\n entry = addEntry();\n }\n\n entry->setValue(rv);\n}\n\nbool SendCoinsDialog::handleURI(const QString &uri)\n{\n SendCoinsRecipient rv;\n // URI has to be valid\n if (GUIUtil::parseBitcoinURI(uri, &rv))\n {\n CBitcoinAddress address(rv.address.toStdString());\n if (!address.IsValid())\n return false;\n pasteEntry(rv);\n return true;\n }\n\n return false;\n}\n\nvoid SendCoinsDialog::setBalance(qint64 balance, qint64 stake, qint64 unconfirmedBalance, qint64 immatureBalance)\n{\n Q_UNUSED(stake);\n Q_UNUSED(unconfirmedBalance);\n Q_UNUSED(immatureBalance);\n if(!model || !model->getOptionsModel())\n return;\n\n int unit = model->getOptionsModel()->getDisplayUnit();\n ui->labelBalance->setText(BitcoinUnits::formatWithUnit(unit, balance));\n}\n\nvoid SendCoinsDialog::updateDisplayUnit()\n{\n if(model && model->getOptionsModel())\n {\n // Update labelBalance with the current balance and the current unit\n ui->labelBalance->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), model->getBalance()));\n }\n}\n"},"repo_name":{"kind":"string","value":"devxxxcoin/xxxcoin"},"path":{"kind":"string","value":"src/qt/sendcoinsdialog.cpp"},"language":{"kind":"string","value":"C++"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":9070,"string":"9,070"}}},{"rowIdx":719,"cells":{"code":{"kind":"string","value":"{!!\n Form::select(\n 'routes[]',\n $allRoutes,\n (isset($routes) ? array_keys($routes) : []),\n array(\n 'class' => 'form-control select2',\n 'placeholder' => 'Enter Routes',\n 'multiple' => true\n )\n )\n!!}\n"},"repo_name":{"kind":"string","value":"stevebauman/maintenance"},"path":{"kind":"string","value":"resources/views/select/routes.blade.php"},"language":{"kind":"string","value":"PHP"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":273,"string":"273"}}},{"rowIdx":720,"cells":{"code":{"kind":"string","value":"setCredentials(getenv('FEDEX_KEY'), getenv('FEDEX_PASSWORD'), getenv('FEDEX_ACCOUNT_NUMBER'), getenv('FEDEX_METER_NUMBER'))\n ->send(new TrackShipmentResponse);\n }\n \n public static function customsAndDuties(Shipment $shipment, Address $shipper)\n {\n return (new CustomsAndDutiesRequest($shipment, $shipper))\n ->setCredentials(getenv('FEDEX_KEY'), getenv('FEDEX_PASSWORD'), getenv('FEDEX_ACCOUNT_NUMBER'), getenv('FEDEX_METER_NUMBER'))\n ->send(new CustomsAndDutiesResponse($shipment->getItems()));\n }\n\n public static function validateAddress(Address $address)\n {\n return (new ValidateAddressRequest($address))\n ->setCredentials(getenv('FEDEX_KEY'), getenv('FEDEX_PASSWORD'), getenv('FEDEX_ACCOUNT_NUMBER'), getenv('FEDEX_METER_NUMBER'))\n ->send(new ValidateAddressResponse);\n }\n}"},"repo_name":{"kind":"string","value":"aquaticpond/fedex"},"path":{"kind":"string","value":"src/Aquatic/FedEx.php"},"language":{"kind":"string","value":"PHP"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":1667,"string":"1,667"}}},{"rowIdx":721,"cells":{"code":{"kind":"string","value":"using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"Pesho\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"Pesho\")]\n[assembly: AssemblyCopyright(\"Copyright © 2013\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components. If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"fc740c6d-ec21-40c6-ad6d-6823d61e8446\")]\n\n// Version information for an assembly consists of the following four values:\n//\n// Major Version\n// Minor Version \n// Build Number\n// Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n// by using the '*' as shown below:\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"},"repo_name":{"kind":"string","value":"d-georgiev-91/TelerikAcademy"},"path":{"kind":"string","value":"Programming/HighQualityProgrammingCode/ConsoleApplication1/Pesho/Properties/AssemblyInfo.cs"},"language":{"kind":"string","value":"C#"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":1346,"string":"1,346"}}},{"rowIdx":722,"cells":{"code":{"kind":"string","value":"@charset \"utf-8\";\n/* CSS Document */\n/* -------------------------------------------------------------------------- */\n/* BASE AD - typically, we do not mess with this section\n/* -------------------------------------------------------------------------- */\nbody, body * {\n vertical-align: baseline;\n border: 0;\n outline: 0;\n padding: 0;\n margin: 0;\n}\n\n/* Div layer for the entire banner. */\n#adkit_container {\n position: absolute;\n width: {{width}}px;\n height: {{height}}px;\n border: #9b9b9b 1px solid;\n top: 0;\n left: 0;\n margin: auto;\n overflow: hidden;\n display: none;\n}\n\n#adkit_content {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n z-index: 100;\n}\n\n/* Invisible button for background clickthrough. */\n#adkit_background_exit {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n cursor: pointer;\n opacity: 0;\n z-index: 400;\n}\n\n:focus {\n outline: none;\n}\n\n::-moz-focus-inner {\n border: 0;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Your ad styles here */\n"},"repo_name":{"kind":"string","value":"tsantor/banner-ad-toolkit"},"path":{"kind":"string","value":"adkit/templates/style.css"},"language":{"kind":"string","value":"CSS"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":1134,"string":"1,134"}}},{"rowIdx":723,"cells":{"code":{"kind":"string","value":" \n"},"repo_name":{"kind":"string","value":"pcdummy/hugo-theme-persona"},"path":{"kind":"string","value":"layouts/post/list.html"},"language":{"kind":"string","value":"HTML"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":617,"string":"617"}}},{"rowIdx":724,"cells":{"code":{"kind":"string","value":"import React, { Component } from 'react'\nimport PropTypes from 'prop-types'\n\nimport { MultiSelect } from '../../src'\n\nclass MultiSelectWithStringValues extends Component {\n constructor(props) {\n super(props)\n\n this.state = {\n value: []\n }\n }\n\n handleChange = (event) => {\n const { valueKey } = this.props\n this.setState({ value: event.value.map((val) => val[valueKey]) })\n }\n\n render() {\n const { value } = this.state\n return \n }\n}\n\nMultiSelectWithStringValues.propTypes = {\n valueKey: PropTypes.string.isRequired\n}\n\nexport default MultiSelectWithStringValues\n"},"repo_name":{"kind":"string","value":"sthomas1618/react-crane"},"path":{"kind":"string","value":"stories/components/MultiSelectWithStringValues.js"},"language":{"kind":"string","value":"JavaScript"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":667,"string":"667"}}},{"rowIdx":725,"cells":{"code":{"kind":"string","value":"/* util/operators.hpp\r\n *\r\n * Copyright (C) 2007 Antonio Di Monaco\r\n *\r\n * This software may be modified and distributed under the terms\r\n * of the MIT license. See the LICENSE file for details.\r\n */\r\n\r\n#ifndef __OPERATORS_HPP__\r\n#define __OPERATORS_HPP__\r\n\r\ntemplate< typename T >\r\nstruct EqualComparable\r\n{\r\n friend bool operator!=(const T &a,const T &b) { return !(a == b); }\r\n};\r\n\r\ntemplate< typename T >\r\nstruct Comparable : public EqualComparable< T >\r\n{\r\n friend bool operator<=(const T &a, const T &b) { return (a < b) || (a == b); }\r\n friend bool operator>(const T &a,const T &b) { return !(a <= b); }\r\n friend bool operator>=(const T &a,const T &b) { return !(a < b); }\r\n};\r\n\r\n#endif\r\n"},"repo_name":{"kind":"string","value":"becrux/xfspp"},"path":{"kind":"string","value":"util/operators.hpp"},"language":{"kind":"string","value":"C++"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":700,"string":"700"}}},{"rowIdx":726,"cells":{"code":{"kind":"string","value":"\"\"\"\n[2015-07-13] Challenge #223 [Easy] Garland words\n\nhttps://www.reddit.com/r/dailyprogrammer/comments/3d4fwj/20150713_challenge_223_easy_garland_words/\n\n# Description\nA [_garland word_](http://blog.vivekhaldar.com/post/89763722591/garland-words) is one that starts and ends with the\nsame N letters in the same order, for some N greater than 0, but less than the length of the word. I'll call the\nmaximum N for which this works the garland word's _degree_. For instance, \"onion\" is a garland word of degree 2,\nbecause its first 2 letters \"on\" are the same as its last 2 letters. The name \"garland word\" comes from the fact that\nyou can make chains of the word in this manner:\n onionionionionionionionionionion...\nToday's challenge is to write a function `garland` that, given a lowercase word, returns the degree of the word if it's\na garland word, and 0 otherwise.\n# Examples\n garland(\"programmer\") -> 0\n garland(\"ceramic\") -> 1\n garland(\"onion\") -> 2\n garland(\"alfalfa\") -> 4\n# Optional challenges\n1. Given a garland word, print out the chain using that word, as with \"onion\" above. You can make it as long or short\nas you like, even infinite.\n1. Find the largest degree of any garland word in the [enable1 English word\nlist](https://code.google.com/p/dotnetperls-controls/downloads/detail?name=enable1.txt).\n1. Find a word list for some other language, and see if you can find a language with a garland word with a higher\ndegree.\n*Thanks to /u/skeeto for submitting this challenge on /r/dailyprogrammer_ideas!*\n\"\"\"\n\n\ndef main():\n pass\n\n\nif __name__ == \"__main__\":\n main()\n"},"repo_name":{"kind":"string","value":"DayGitH/Python-Challenges"},"path":{"kind":"string","value":"DailyProgrammer/DP20150713A.py"},"language":{"kind":"string","value":"Python"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":1597,"string":"1,597"}}},{"rowIdx":727,"cells":{"code":{"kind":"string","value":"/**\n *\n * Licensed Property to China UnionPay Co., Ltd.\n * \n * (C) Copyright of China UnionPay Co., Ltd. 2010\n * All Rights Reserved.\n *\n * \n * Modification History:\n * =============================================================================\n * Author Date Description\n * ------------ ---------- ---------------------------------------------------\n * xshu 2014-05-28 MPI插件包常量定义\n * =============================================================================\n */\npackage com.boyuanitsm.pay.unionpay.config;\n\npublic class SDKConstants {\n\n\tpublic final static String COLUMN_DEFAULT = \"-\";\n\n\tpublic final static String KEY_DELIMITER = \"#\";\n\n\t/** memeber variable: blank. */\n\tpublic static final String BLANK = \"\";\n\n\t/** member variabel: space. */\n\tpublic static final String SPACE = \" \";\n\n\t/** memeber variable: unline. */\n\tpublic static final String UNLINE = \"_\";\n\n\t/** memeber varibale: star. */\n\tpublic static final String STAR = \"*\";\n\n\t/** memeber variable: line. */\n\tpublic static final String LINE = \"-\";\n\n\t/** memeber variable: add. */\n\tpublic static final String ADD = \"+\";\n\n\t/** memeber variable: colon. */\n\tpublic final static String COLON = \"|\";\n\n\t/** memeber variable: point. */\n\tpublic final static String POINT = \".\";\n\n\t/** memeber variable: comma. */\n\tpublic final static String COMMA = \",\";\n\n\t/** memeber variable: slash. */\n\tpublic final static String SLASH = \"/\";\n\n\t/** memeber variable: div. */\n\tpublic final static String DIV = \"/\";\n\n\t/** memeber variable: left . */\n\tpublic final static String LB = \"(\";\n\n\t/** memeber variable: right. */\n\tpublic final static String RB = \")\";\n\n\t/** memeber variable: rmb. */\n\tpublic final static String CUR_RMB = \"RMB\";\n\n\t/** memeber variable: .page size */\n\tpublic static final int PAGE_SIZE = 10;\n\n\t/** memeber variable: String ONE. */\n\tpublic static final String ONE = \"1\";\n\n\t/** memeber variable: String ZERO. */\n\tpublic static final String ZERO = \"0\";\n\n\t/** memeber variable: number six. */\n\tpublic static final int NUM_SIX = 6;\n\n\t/** memeber variable: equal mark. */\n\tpublic static final String EQUAL = \"=\";\n\n\t/** memeber variable: operation ne. */\n\tpublic static final String NE = \"!=\";\n\n\t/** memeber variable: operation le. */\n\tpublic static final String LE = \"<=\";\n\n\t/** memeber variable: operation ge. */\n\tpublic static final String GE = \">=\";\n\n\t/** memeber variable: operation lt. */\n\tpublic static final String LT = \"<\";\n\n\t/** memeber variable: operation gt. */\n\tpublic static final String GT = \">\";\n\n\t/** memeber variable: list separator. */\n\tpublic static final String SEP = \"./\";\n\n\t/** memeber variable: Y. */\n\tpublic static final String Y = \"Y\";\n\n\t/** memeber variable: AMPERSAND. */\n\tpublic static final String AMPERSAND = \"&\";\n\n\t/** memeber variable: SQL_LIKE_TAG. */\n\tpublic static final String SQL_LIKE_TAG = \"%\";\n\n\t/** memeber variable: @. */\n\tpublic static final String MAIL = \"@\";\n\n\t/** memeber variable: number zero. */\n\tpublic static final int NZERO = 0;\n\n\tpublic static final String LEFT_BRACE = \"{\";\n\n\tpublic static final String RIGHT_BRACE = \"}\";\n\n\t/** memeber variable: string true. */\n\tpublic static final String TRUE_STRING = \"true\";\n\t/** memeber variable: string false. */\n\tpublic static final String FALSE_STRING = \"false\";\n\n\t/** memeber variable: forward success. */\n\tpublic static final String SUCCESS = \"success\";\n\t/** memeber variable: forward fail. */\n\tpublic static final String FAIL = \"fail\";\n\t/** memeber variable: global forward success. */\n\tpublic static final String GLOBAL_SUCCESS = \"$success\";\n\t/** memeber variable: global forward fail. */\n\tpublic static final String GLOBAL_FAIL = \"$fail\";\n\n\tpublic static final String UTF_8_ENCODING = \"UTF-8\";\n\tpublic static final String GBK_ENCODING = \"GBK\";\n\tpublic static final String CONTENT_TYPE = \"Content-type\";\n\tpublic static final String APP_XML_TYPE = \"application/xml;charset=utf-8\";\n\tpublic static final String APP_FORM_TYPE = \"application/x-www-form-urlencoded;charset=\";\n\n\t/******************************************** 5.0报文接口定义 ********************************************/\n\t/** 版本号. */\n\tpublic static final String param_version = \"version\";\n\t/** 证书ID. */\n\tpublic static final String param_certId = \"certId\";\n\t/** 签名. */\n\tpublic static final String param_signature = \"signature\";\n\t/** 编码方式. */\n\tpublic static final String param_encoding = \"encoding\";\n\t/** 交易类型. */\n\tpublic static final String param_txnType = \"txnType\";\n\t/** 交易子类. */\n\tpublic static final String param_txnSubType = \"txnSubType\";\n\t/** 业务类型. */\n\tpublic static final String param_bizType = \"bizType\";\n\t/** 前台通知地址 . */\n\tpublic static final String param_frontUrl = \"frontUrl\";\n\t/** 后台通知地址. */\n\tpublic static final String param_backUrl = \"backUrl\";\n\t/** 接入类型. */\n\tpublic static final String param_accessType = \"accessType\";\n\t/** 收单机构代码. */\n\tpublic static final String param_acqInsCode = \"acqInsCode\";\n\t/** 商户类别. */\n\tpublic static final String param_merCatCode = \"merCatCode\";\n\t/** 商户类型. */\n\tpublic static final String param_merType = \"merType\";\n\t/** 商户代码. */\n\tpublic static final String param_merId = \"merId\";\n\t/** 商户名称. */\n\tpublic static final String param_merName = \"merName\";\n\t/** 商户简称. */\n\tpublic static final String param_merAbbr = \"merAbbr\";\n\t/** 二级商户代码. */\n\tpublic static final String param_subMerId = \"subMerId\";\n\t/** 二级商户名称. */\n\tpublic static final String param_subMerName = \"subMerName\";\n\t/** 二级商户简称. */\n\tpublic static final String param_subMerAbbr = \"subMerAbbr\";\n\t/** Cupsecure 商户代码. */\n\tpublic static final String param_csMerId = \"csMerId\";\n\t/** 商户订单号. */\n\tpublic static final String param_orderId = \"orderId\";\n\t/** 交易时间. */\n\tpublic static final String param_txnTime = \"txnTime\";\n\t/** 发送时间. */\n\tpublic static final String param_txnSendTime = \"txnSendTime\";\n\t/** 订单超时时间间隔. */\n\tpublic static final String param_orderTimeoutInterval = \"orderTimeoutInterval\";\n\t/** 支付超时时间. */\n\tpublic static final String param_payTimeoutTime = \"payTimeoutTime\";\n\t/** 默认支付方式. */\n\tpublic static final String param_defaultPayType = \"defaultPayType\";\n\t/** 支持支付方式. */\n\tpublic static final String param_supPayType = \"supPayType\";\n\t/** 支付方式. */\n\tpublic static final String param_payType = \"payType\";\n\t/** 自定义支付方式. */\n\tpublic static final String param_customPayType = \"customPayType\";\n\t/** 物流标识. */\n\tpublic static final String param_shippingFlag = \"shippingFlag\";\n\t/** 收货地址-国家. */\n\tpublic static final String param_shippingCountryCode = \"shippingCountryCode\";\n\t/** 收货地址-省. */\n\tpublic static final String param_shippingProvinceCode = \"shippingProvinceCode\";\n\t/** 收货地址-市. */\n\tpublic static final String param_shippingCityCode = \"shippingCityCode\";\n\t/** 收货地址-地区. */\n\tpublic static final String param_shippingDistrictCode = \"shippingDistrictCode\";\n\t/** 收货地址-详细. */\n\tpublic static final String param_shippingStreet = \"shippingStreet\";\n\t/** 商品总类. */\n\tpublic static final String param_commodityCategory = \"commodityCategory\";\n\t/** 商品名称. */\n\tpublic static final String param_commodityName = \"commodityName\";\n\t/** 商品URL. */\n\tpublic static final String param_commodityUrl = \"commodityUrl\";\n\t/** 商品单价. */\n\tpublic static final String param_commodityUnitPrice = \"commodityUnitPrice\";\n\t/** 商品数量. */\n\tpublic static final String param_commodityQty = \"commodityQty\";\n\t/** 是否预授权. */\n\tpublic static final String param_isPreAuth = \"isPreAuth\";\n\t/** 币种. */\n\tpublic static final String param_currencyCode = \"currencyCode\";\n\t/** 账户类型. */\n\tpublic static final String param_accType = \"accType\";\n\t/** 账号. */\n\tpublic static final String param_accNo = \"accNo\";\n\t/** 支付卡类型. */\n\tpublic static final String param_payCardType = \"payCardType\";\n\t/** 发卡机构代码. */\n\tpublic static final String param_issInsCode = \"issInsCode\";\n\t/** 持卡人信息. */\n\tpublic static final String param_customerInfo = \"customerInfo\";\n\t/** 交易金额. */\n\tpublic static final String param_txnAmt = \"txnAmt\";\n\t/** 余额. */\n\tpublic static final String param_balance = \"balance\";\n\t/** 地区代码. */\n\tpublic static final String param_districtCode = \"districtCode\";\n\t/** 附加地区代码. */\n\tpublic static final String param_additionalDistrictCode = \"additionalDistrictCode\";\n\t/** 账单类型. */\n\tpublic static final String param_billType = \"billType\";\n\t/** 账单号码. */\n\tpublic static final String param_billNo = \"billNo\";\n\t/** 账单月份. */\n\tpublic static final String param_billMonth = \"billMonth\";\n\t/** 账单查询要素. */\n\tpublic static final String param_billQueryInfo = \"billQueryInfo\";\n\t/** 账单详情. */\n\tpublic static final String param_billDetailInfo = \"billDetailInfo\";\n\t/** 账单金额. */\n\tpublic static final String param_billAmt = \"billAmt\";\n\t/** 账单金额符号. */\n\tpublic static final String param_billAmtSign = \"billAmtSign\";\n\t/** 绑定标识号. */\n\tpublic static final String param_bindId = \"bindId\";\n\t/** 风险级别. */\n\tpublic static final String param_riskLevel = \"riskLevel\";\n\t/** 绑定信息条数. */\n\tpublic static final String param_bindInfoQty = \"bindInfoQty\";\n\t/** 绑定信息集. */\n\tpublic static final String param_bindInfoList = \"bindInfoList\";\n\t/** 批次号. */\n\tpublic static final String param_batchNo = \"batchNo\";\n\t/** 总笔数. */\n\tpublic static final String param_totalQty = \"totalQty\";\n\t/** 总金额. */\n\tpublic static final String param_totalAmt = \"totalAmt\";\n\t/** 文件类型. */\n\tpublic static final String param_fileType = \"fileType\";\n\t/** 文件名称. */\n\tpublic static final String param_fileName = \"fileName\";\n\t/** 批量文件内容. */\n\tpublic static final String param_fileContent = \"fileContent\";\n\t/** 商户摘要. */\n\tpublic static final String param_merNote = \"merNote\";\n\t/** 商户自定义域. */\n\t// public static final String param_merReserved = \"merReserved\";//接口变更删除\n\t/** 请求方保留域. */\n\tpublic static final String param_reqReserved = \"reqReserved\";// 新增接口\n\t/** 保留域. */\n\tpublic static final String param_reserved = \"reserved\";\n\t/** 终端号. */\n\tpublic static final String param_termId = \"termId\";\n\t/** 终端类型. */\n\tpublic static final String param_termType = \"termType\";\n\t/** 交互模式. */\n\tpublic static final String param_interactMode = \"interactMode\";\n\t/** 发卡机构识别模式. */\n\t// public static final String param_recognitionMode = \"recognitionMode\";\n\tpublic static final String param_issuerIdentifyMode = \"issuerIdentifyMode\";// 接口名称变更\n\t/** 商户端用户号. */\n\tpublic static final String param_merUserId = \"merUserId\";\n\t/** 持卡人IP. */\n\tpublic static final String param_customerIp = \"customerIp\";\n\t/** 查询流水号. */\n\tpublic static final String param_queryId = \"queryId\";\n\t/** 原交易查询流水号. */\n\tpublic static final String param_origQryId = \"origQryId\";\n\t/** 系统跟踪号. */\n\tpublic static final String param_traceNo = \"traceNo\";\n\t/** 交易传输时间. */\n\tpublic static final String param_traceTime = \"traceTime\";\n\t/** 清算日期. */\n\tpublic static final String param_settleDate = \"settleDate\";\n\t/** 清算币种. */\n\tpublic static final String param_settleCurrencyCode = \"settleCurrencyCode\";\n\t/** 清算金额. */\n\tpublic static final String param_settleAmt = \"settleAmt\";\n\t/** 清算汇率. */\n\tpublic static final String param_exchangeRate = \"exchangeRate\";\n\t/** 兑换日期. */\n\tpublic static final String param_exchangeDate = \"exchangeDate\";\n\t/** 响应时间. */\n\tpublic static final String param_respTime = \"respTime\";\n\t/** 原交易应答码. */\n\tpublic static final String param_origRespCode = \"origRespCode\";\n\t/** 原交易应答信息. */\n\tpublic static final String param_origRespMsg = \"origRespMsg\";\n\t/** 应答码. */\n\tpublic static final String param_respCode = \"respCode\";\n\t/** 应答码信息. */\n\tpublic static final String param_respMsg = \"respMsg\";\n\t// 新增四个报文字段merUserRegDt merUserEmail checkFlag activateStatus\n\t/** 商户端用户注册时间. */\n\tpublic static final String param_merUserRegDt = \"merUserRegDt\";\n\t/** 商户端用户注册邮箱. */\n\tpublic static final String param_merUserEmail = \"merUserEmail\";\n\t/** 验证标识. */\n\tpublic static final String param_checkFlag = \"checkFlag\";\n\t/** 开通状态. */\n\tpublic static final String param_activateStatus = \"activateStatus\";\n\t/** 加密证书ID. */\n\tpublic static final String param_encryptCertId = \"encryptCertId\";\n\t/** 用户MAC、IMEI串号、SSID. */\n\tpublic static final String param_userMac = \"userMac\";\n\t/** 关联交易. */\n\t// public static final String param_relationTxnType = \"relationTxnType\";\n\t/** 短信类型 */\n\tpublic static final String param_smsType = \"smsType\";\n\n\t/** 风控信息域 */\n\tpublic static final String param_riskCtrlInfo = \"riskCtrlInfo\";\n\n\t/** IC卡交易信息域 */\n\tpublic static final String param_ICTransData = \"ICTransData\";\n\n\t/** VPC交易信息域 */\n\tpublic static final String param_VPCTransData = \"VPCTransData\";\n\n\t/** 安全类型 */\n\tpublic static final String param_securityType = \"securityType\";\n\n\t/** 银联订单号 */\n\tpublic static final String param_tn = \"tn\";\n\n\t/** 分期付款手续费率 */\n\tpublic static final String param_instalRate = \"instalRate\";\n\n\t/** 分期付款手续费率 */\n\tpublic static final String param_mchntFeeSubsidy = \"mchntFeeSubsidy\";\n\n\t\n}\n"},"repo_name":{"kind":"string","value":"smjie2800/spring-cloud-microservice-redis-activemq-hibernate-mysql"},"path":{"kind":"string","value":"microservice-provider-pay/src/main/java/com/boyuanitsm/pay/unionpay/config/SDKConstants.java"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":13548,"string":"13,548"}}},{"rowIdx":728,"cells":{"code":{"kind":"string","value":"require 'faraday'\nrequire 'simple_ratings/foursquare/meta/venue'\n\nmodule SimpleRatings\n class Foursquare < Faraday::Connection\n def initialize\n super(url: 'https://api.foursquare.com/v2/')\n end\n\n def default_params\n {\n client_id: ENV['FOURSQUARE_CLIENT_ID'],\n client_secret: ENV['FOURSQUARE_CLIENT_SECRET'],\n v: 20130214\n }\n end\n\n def search(params)\n get('venues/search', default_params.merge(params))\n end\n\n def get(url = nil, params = nil, headers = nil)\n params ||= {}\n\n params = default_params.merge(params)\n\n super(url, params, headers)\n end\n\n # def get(*args)\n # super(*build_default_request_arguments(*args))\n # end\n\n # def build_default_request_arguments(url = nil, params = nil, headers = nil)\n # params ||= {}\n\n # params = default_params.merge(params)\n\n # [url, params, headers]\n # end\n end\nend"},"repo_name":{"kind":"string","value":"benastan/simple_ratings"},"path":{"kind":"string","value":"lib/simple_ratings/foursquare.rb"},"language":{"kind":"string","value":"Ruby"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":918,"string":"918"}}},{"rowIdx":729,"cells":{"code":{"kind":"string","value":"//\r\n// Copyright (C) 2006-2008 Mateusz Loskot\r\n// Distributed under the Boost Software License, Version 1.0.\r\n// (See accompanying file LICENSE_1_0.txt or copy at\r\n// http://www.boost.org/LICENSE_1_0.txt)\r\n//\r\n\r\n#ifndef SOCI_PLATFORM_H_INCLUDED\r\n#define SOCI_PLATFORM_H_INCLUDED\r\n\r\n#if defined(_MSC_VER) || defined(__MINGW32__)\r\n#define LL_FMT_FLAGS \"I64\"\r\n#else\r\n#define LL_FMT_FLAGS \"ll\"\r\n#endif\r\n\r\n// Portability hacks for Microsoft Visual C++ compiler\r\n#ifdef _MSC_VER\r\n#include \r\n\r\n// Define if you have the vsnprintf variants.\r\n#if _MSC_VER < 1500\r\n# define vsnprintf _vsnprintf\r\n#endif\r\n\r\n// Define if you have the snprintf variants.\r\n#if _MSC_VER < 1900\r\n#define snprintf _snprintf\r\n#endif\r\n\r\n// Define if you have the strtoll and strtoull variants.\r\n#if _MSC_VER < 1300\r\n# error \"Visual C++ versions prior 1300 don't support _strtoi64 and _strtoui64\"\r\n#elif _MSC_VER >= 1300 && _MSC_VER < 1800\r\nnamespace std {\r\n inline long long strtoll(char const* str, char** str_end, int base)\r\n {\r\n return _strtoi64(str, str_end, base);\r\n }\r\n\r\n inline unsigned long long strtoull(char const* str, char** str_end, int base)\r\n {\r\n return _strtoui64(str, str_end, base);\r\n }\r\n}\r\n#endif // _MSC_VER < 1800\r\n#endif // _MSC_VER\r\n\r\n#if defined(__CYGWIN__) || defined(__MINGW32__)\r\n#include \r\nnamespace std {\r\n using ::strtoll;\r\n using ::strtoull;\r\n}\r\n#endif\r\n\r\n#endif // SOCI_PLATFORM_H_INCLUDED\r\n"},"repo_name":{"kind":"string","value":"LedgerHQ/lib-ledger-core"},"path":{"kind":"string","value":"core/lib/soci/core/soci-platform.h"},"language":{"kind":"string","value":"C"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":1445,"string":"1,445"}}},{"rowIdx":730,"cells":{"code":{"kind":"string","value":"using System;\nusing System.Text;\n\nnamespace ExifLibrary\n{\n /// \n /// Represents an enumerated value.\n /// \n public class ExifEnumProperty : ExifProperty\n {\n protected T mValue;\n protected bool mIsBitField;\n protected override object _Value { get { return Value; } set { Value = (T)value; } }\n public new T Value { get { return mValue; } set { mValue = value; } }\n public bool IsBitField { get { return mIsBitField; } }\n\n static public implicit operator T(ExifEnumProperty obj) { return (T)obj.mValue; }\n\n public override string ToString() { return mValue.ToString(); }\n\n public ExifEnumProperty(ExifTag tag, T value, bool isbitfield)\n : base(tag)\n {\n mValue = value;\n mIsBitField = isbitfield;\n }\n\n public ExifEnumProperty(ExifTag tag, T value)\n : this(tag, value, false)\n {\n ;\n }\n\n public override ExifInterOperability Interoperability\n {\n get\n {\n ushort tagid = ExifTagFactory.GetTagID(mTag);\n\n Type type = typeof(T);\n Type basetype = Enum.GetUnderlyingType(type);\n\n if (type == typeof(FileSource) || type == typeof(SceneType))\n {\n // UNDEFINED\n return new ExifInterOperability(tagid, 7, 1, new byte[] { (byte)((object)mValue) });\n }\n else if (type == typeof(GPSLatitudeRef) || type == typeof(GPSLongitudeRef) ||\n type == typeof(GPSStatus) || type == typeof(GPSMeasureMode) ||\n type == typeof(GPSSpeedRef) || type == typeof(GPSDirectionRef) ||\n type == typeof(GPSDistanceRef))\n {\n // ASCII\n return new ExifInterOperability(tagid, 2, 2, new byte[] { (byte)((object)mValue), 0 });\n }\n else if (basetype == typeof(byte))\n {\n // BYTE\n return new ExifInterOperability(tagid, 1, 1, new byte[] { (byte)((object)mValue) });\n }\n else if (basetype == typeof(ushort))\n {\n // SHORT\n return new ExifInterOperability(tagid, 3, 1, ExifBitConverter.GetBytes((ushort)((object)mValue), BitConverterEx.SystemByteOrder, BitConverterEx.SystemByteOrder));\n }\n else\n throw new UnknownEnumTypeException();\n }\n }\n }\n\n /// \n /// Represents an ASCII string. (EXIF Specification: UNDEFINED) Used for the UserComment field.\n /// \n public class ExifEncodedString : ExifProperty\n {\n protected string mValue;\n private Encoding mEncoding;\n protected override object _Value { get { return Value; } set { Value = (string)value; } }\n public new string Value { get { return mValue; } set { mValue = value; } }\n public Encoding Encoding { get { return mEncoding; } set { mEncoding = value; } }\n\n static public implicit operator string(ExifEncodedString obj) { return obj.mValue; }\n\n public override string ToString() { return mValue; }\n\n public ExifEncodedString(ExifTag tag, string value, Encoding encoding)\n : base(tag)\n {\n mValue = value;\n mEncoding = encoding;\n }\n\n public override ExifInterOperability Interoperability\n {\n get\n {\n string enc = \"\";\n if (mEncoding == null)\n enc = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n else if (mEncoding.EncodingName == \"US-ASCII\")\n enc = \"ASCII\\0\\0\\0\";\n else if (mEncoding.EncodingName == \"Japanese (JIS 0208-1990 and 0212-1990)\")\n enc = \"JIS\\0\\0\\0\\0\\0\";\n else if (mEncoding.EncodingName == \"Unicode\")\n enc = \"Unicode\\0\";\n else\n enc = \"\\0\\0\\0\\0\\0\\0\\0\\0\";\n\n byte[] benc = Encoding.ASCII.GetBytes(enc);\n byte[] bstr = (mEncoding == null ? Encoding.ASCII.GetBytes(mValue) : mEncoding.GetBytes(mValue));\n byte[] data = new byte[benc.Length + bstr.Length];\n Array.Copy(benc, 0, data, 0, benc.Length);\n Array.Copy(bstr, 0, data, benc.Length, bstr.Length);\n\n return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 7, (uint)data.Length, data);\n }\n }\n }\n\n /// \n /// Represents an ASCII string formatted as DateTime. (EXIF Specification: ASCII) Used for the date time fields.\n /// \n public class ExifDateTime : ExifProperty\n {\n protected DateTime mValue;\n protected override object _Value { get { return Value; } set { Value = (DateTime)value; } }\n public new DateTime Value { get { return mValue; } set { mValue = value; } }\n\n static public implicit operator DateTime(ExifDateTime obj) { return obj.mValue; }\n\n public override string ToString() { return mValue.ToString(\"yyyy.MM.dd HH:mm:ss\"); }\n\n public ExifDateTime(ExifTag tag, DateTime value)\n : base(tag)\n {\n mValue = value;\n }\n\n public override ExifInterOperability Interoperability\n {\n get\n {\n return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 2, (uint)20, ExifBitConverter.GetBytes(mValue, true));\n }\n }\n }\n\n /// \n /// Represents the exif version as a 4 byte ASCII string. (EXIF Specification: UNDEFINED) \n /// Used for the ExifVersion, FlashpixVersion, InteroperabilityVersion and GPSVersionID fields.\n /// \n public class ExifVersion : ExifProperty\n {\n protected string mValue;\n protected override object _Value { get { return Value; } set { Value = (string)value; } }\n public new string Value { get { return mValue; } set { mValue = value.Substring(0, 4); } }\n\n public ExifVersion(ExifTag tag, string value)\n : base(tag)\n {\n if (value.Length > 4)\n mValue = value.Substring(0, 4);\n else if (value.Length < 4)\n mValue = value + new string(' ', 4 - value.Length);\n else\n mValue = value;\n }\n\n public override string ToString()\n {\n return mValue;\n }\n\n public override ExifInterOperability Interoperability\n {\n get\n {\n if (mTag == ExifTag.ExifVersion || mTag == ExifTag.FlashpixVersion || mTag == ExifTag.InteroperabilityVersion)\n return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 7, 4, Encoding.ASCII.GetBytes(mValue));\n else\n {\n byte[] data = new byte[4];\n for (int i = 0; i < 4; i++)\n data[i] = byte.Parse(mValue[0].ToString());\n return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 7, 4, data);\n }\n }\n }\n }\n\n /// \n /// Represents the location and area of the subject (EXIF Specification: 2xSHORT)\n /// The coordinate values, width, and height are expressed in relation to the \n /// upper left as origin, prior to rotation processing as per the Rotation tag.\n /// \n public class ExifPointSubjectArea : ExifUShortArray\n {\n protected new ushort[] Value { get { return mValue; } set { mValue = value; } }\n public ushort X { get { return mValue[0]; } set { mValue[0] = value; } }\n public ushort Y { get { return mValue[1]; } set { mValue[1] = value; } }\n\n public override string ToString()\n {\n StringBuilder sb = new StringBuilder();\n sb.AppendFormat(\"({0:d}, {1:d})\", mValue[0], mValue[1]);\n return sb.ToString();\n }\n\n public ExifPointSubjectArea(ExifTag tag, ushort[] value)\n : base(tag, value)\n {\n ;\n }\n\n public ExifPointSubjectArea(ExifTag tag, ushort x, ushort y)\n : base(tag, new ushort[] { x, y })\n {\n ;\n }\n }\n\n /// \n /// Represents the location and area of the subject (EXIF Specification: 3xSHORT)\n /// The coordinate values, width, and height are expressed in relation to the \n /// upper left as origin, prior to rotation processing as per the Rotation tag.\n /// \n public class ExifCircularSubjectArea : ExifPointSubjectArea\n {\n public ushort Diamater { get { return mValue[2]; } set { mValue[2] = value; } }\n\n public override string ToString()\n {\n StringBuilder sb = new StringBuilder();\n sb.AppendFormat(\"({0:d}, {1:d}) {2:d}\", mValue[0], mValue[1], mValue[2]);\n return sb.ToString();\n }\n\n public ExifCircularSubjectArea(ExifTag tag, ushort[] value)\n : base(tag, value)\n {\n ;\n }\n\n public ExifCircularSubjectArea(ExifTag tag, ushort x, ushort y, ushort d)\n : base(tag, new ushort[] { x, y, d })\n {\n ;\n }\n }\n\n /// \n /// Represents the location and area of the subject (EXIF Specification: 4xSHORT)\n /// The coordinate values, width, and height are expressed in relation to the \n /// upper left as origin, prior to rotation processing as per the Rotation tag.\n /// \n public class ExifRectangularSubjectArea : ExifPointSubjectArea\n {\n public ushort Width { get { return mValue[2]; } set { mValue[2] = value; } }\n public ushort Height { get { return mValue[3]; } set { mValue[3] = value; } }\n\n public override string ToString()\n {\n StringBuilder sb = new StringBuilder();\n sb.AppendFormat(\"({0:d}, {1:d}) ({2:d} x {3:d})\", mValue[0], mValue[1], mValue[2], mValue[3]);\n return sb.ToString();\n }\n\n public ExifRectangularSubjectArea(ExifTag tag, ushort[] value)\n : base(tag, value)\n {\n ;\n }\n\n public ExifRectangularSubjectArea(ExifTag tag, ushort x, ushort y, ushort w, ushort h)\n : base(tag, new ushort[] { x, y, w, h })\n {\n ;\n }\n }\n\n /// \n /// Represents GPS latitudes and longitudes (EXIF Specification: 3xRATIONAL)\n /// \n public class GPSLatitudeLongitude : ExifURationalArray\n {\n protected new MathEx.UFraction32[] Value { get { return mValue; } set { mValue = value; } }\n public MathEx.UFraction32 Degrees { get { return mValue[0]; } set { mValue[0] = value; } }\n public MathEx.UFraction32 Minutes { get { return mValue[1]; } set { mValue[1] = value; } }\n public MathEx.UFraction32 Seconds { get { return mValue[2]; } set { mValue[2] = value; } }\n\n public static explicit operator float(GPSLatitudeLongitude obj) { return obj.ToFloat(); }\n public float ToFloat()\n {\n return (float)Degrees + ((float)Minutes) / 60.0f + ((float)Seconds) / 3600.0f;\n }\n\n public override string ToString()\n {\n return string.Format(\"{0:F2}°{1:F2}'{2:F2}\\\"\", (float)Degrees, (float)Minutes, (float)Seconds);\n }\n\n public GPSLatitudeLongitude(ExifTag tag, MathEx.UFraction32[] value)\n : base(tag, value)\n {\n ;\n }\n\n public GPSLatitudeLongitude(ExifTag tag, float d, float m, float s)\n : base(tag, new MathEx.UFraction32[] { new MathEx.UFraction32(d), new MathEx.UFraction32(m), new MathEx.UFraction32(s) })\n {\n ;\n }\n }\n\n /// \n /// Represents a GPS time stamp as UTC (EXIF Specification: 3xRATIONAL)\n /// \n public class GPSTimeStamp : ExifURationalArray\n {\n protected new MathEx.UFraction32[] Value { get { return mValue; } set { mValue = value; } }\n public MathEx.UFraction32 Hour { get { return mValue[0]; } set { mValue[0] = value; } }\n public MathEx.UFraction32 Minute { get { return mValue[1]; } set { mValue[1] = value; } }\n public MathEx.UFraction32 Second { get { return mValue[2]; } set { mValue[2] = value; } }\n\n public override string ToString()\n {\n return string.Format(\"{0:F2}:{1:F2}:{2:F2}\\\"\", (float)Hour, (float)Minute, (float)Second);\n }\n\n public GPSTimeStamp(ExifTag tag, MathEx.UFraction32[] value)\n : base(tag, value)\n {\n ;\n }\n\n public GPSTimeStamp(ExifTag tag, float h, float m, float s)\n : base(tag, new MathEx.UFraction32[] { new MathEx.UFraction32(h), new MathEx.UFraction32(m), new MathEx.UFraction32(s) })\n {\n ;\n }\n }\n\n /// \n /// Represents an ASCII string. (EXIF Specification: BYTE) \n /// Used by Windows XP.\n /// \n public class WindowsByteString : ExifProperty\n {\n protected string mValue;\n protected override object _Value { get { return Value; } set { Value = (string)value; } }\n public new string Value { get { return mValue; } set { mValue = value; } }\n\n static public implicit operator string(WindowsByteString obj) { return obj.mValue; }\n\n public override string ToString() { return mValue; }\n\n public WindowsByteString(ExifTag tag, string value)\n : base(tag)\n {\n mValue = value;\n }\n\n public override ExifInterOperability Interoperability\n {\n get\n {\n byte[] data = Encoding.Unicode.GetBytes(mValue);\n return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 1, (uint)data.Length, data);\n }\n }\n }\n}\n"},"repo_name":{"kind":"string","value":"ahzf/ExifLibrary"},"path":{"kind":"string","value":"ExifLibrary/ExifExtendedProperty.cs"},"language":{"kind":"string","value":"C#"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":13977,"string":"13,977"}}},{"rowIdx":731,"cells":{"code":{"kind":"string","value":"using System.Collections.Generic;\r\nusing System.Threading.Tasks;\r\nusing MongoDB.Bson;\r\nusing MongoDB.Driver;\r\nusing ShowFinder.Models;\r\n\r\nnamespace ShowFinder.Repositories.Interfaces\r\n{\r\n public interface IMongoRepository\r\n {\r\n IMongoDatabase Database(string name);\r\n Task GetUserProfile(IMongoCollection userProfilesCollection, string hash);\r\n Task UpdateShows(IMongoCollection userProfilesCollection, string userHash, IEnumerable showList);\r\n Task UpdateDownloadedEpisode(IMongoCollection userProfilesCollection, string profileId,\r\n string episodeId, string filteredShowName, DownloadedEpisode downloadedEpisodeData);\r\n Task DeleteDownloadedEpisode(IMongoCollection userProfilesCollection, string profileId,\r\n string episodeId, string filtereShowdName);\r\n Task UpdateTimeSpan(IMongoCollection userProfilesCollection, UserProfile profile);\r\n Task GetFromCache(IMongoCollection collection, string id);\r\n Task SetToCache(IMongoCollection collection, string id, BsonDocument doc, int daysToExpire);\r\n }\r\n}"},"repo_name":{"kind":"string","value":"YanivHaramati/ShowFinder"},"path":{"kind":"string","value":"ShowFinder/Repositories/Interfaces/IMongoRepository.cs"},"language":{"kind":"string","value":"C#"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":1257,"string":"1,257"}}},{"rowIdx":732,"cells":{"code":{"kind":"string","value":"\n\n\n\n\n\n/home/pavm/programming/lib/gft/src/gft_stack.cpp File Reference\n\n\n\n\n\n\n
\n\n\n \n \n
\n \n
\n
\n
\n \n
\n
gft_stack.cpp File Reference
\n
\n
\n
#include &quot;gft_stack.h&quot;
\n
\n\n\n\n\n\n\n

\nNamespaces

&#160;gft
&#160;Base namespace for common definitions and prototypes.
&#160;
&#160;gft::Stack
&#160;
\n\n\n\n\n\n\n\n\n\n

\nFunctions

Stack *&#160;gft::Stack::Create (int n)
&#160;
void&#160;gft::Stack::Destroy (Stack **S)
&#160;
void&#160;gft::Stack::Push (Stack *S, int p)
&#160;
int&#160;gft::Stack::Pop (Stack *S)
&#160;
\n
\n\n
\nGenerated on Wed Feb 25 2015 10:27:50 by &#160;\n\"doxygen\"/\n 1.8.6\n
\n\n\n"},"repo_name":{"kind":"string","value":"ademirtc/bandeirantes"},"path":{"kind":"string","value":"lib/gft/doc/html/gft__stack_8cpp.html"},"language":{"kind":"string","value":"HTML"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":4861,"string":"4,861"}}},{"rowIdx":733,"cells":{"code":{"kind":"string","value":"//\n// BABAudioPlaylist.h\n// Pods\n//\n// Created by Bryn Bodayle on May/12/2015.\n//\n//\n\n#import \n\n@interface BABAudioPlaylist : NSObject\n\n+ (instancetype)audioPlaylistWithArray:(NSArray *)array;\n- (instancetype)initWithArray:(NSArray *)array;\n\n\n- (id)objectAtIndexedSubscript:(NSUInteger)idx;\n- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx;\n\n@property (nonatomic, readonly) NSInteger count;\n\n@end\n"},"repo_name":{"kind":"string","value":"brynbodayle/BABAudioPlayer"},"path":{"kind":"string","value":"Pod/Classes/BABAudioPlaylist.h"},"language":{"kind":"string","value":"C"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":437,"string":"437"}}},{"rowIdx":734,"cells":{"code":{"kind":"string","value":"/*!\n * Module dependencies.\n */\n\nvar util = require('util'),\n\tmoment = require('moment'),\n\tsuper_ = require('../Type');\n\n/**\n * Date FieldType Constructor\n * @extends Field\n * @api public\n */\n\nfunction datearray(list, path, options) {\n\t\n\tthis._nativeType = [Date];\n\tthis._defaultSize = 'medium';\n\tthis._underscoreMethods = ['format'];\n\tthis._properties = ['formatString'];\n\n\tthis.parseFormatString = options.parseFormat || 'YYYY-MM-DD';\n\tthis.formatString = (options.format === false) ? false : (options.format || 'Do MMM YYYY');\n\t\n\tif (this.formatString && 'string' !== typeof this.formatString) {\n\t\tthrow new Error('FieldType.Date: options.format must be a string.');\n\t}\n\t\n\tdatearray.super_.call(this, list, path, options);\n}\n\n/*!\n * Inherit from Field\n */\n\nutil.inherits(datearray, super_);\n\n/**\n * Formats the field value\n *\n * @api public\n */\n\ndatearray.prototype.format = function(item, format) {\n\tif (format || this.formatString) {\n\t\treturn item.get(this.path) ? moment(item.get(this.path)).format(format || this.formatString) : '';\n\t} else {\n\t\treturn item.get(this.path) || '';\n\t}\n};\n\n/**\n * Checks that a valid array of dates has been provided in a data object\n *\n * An empty value clears the stored value and is considered valid\n *\n * @api public\n */\n\ndatearray.prototype.inputIsValid = function(data, required, item) {\n\n\tvar value = this.getValueFromData(data);\n\tvar parseFormatString = this.parseFormatString;\n\n\tif ('string' === typeof value) {\n\t\tif (!moment(value, parseFormatString).isValid()) {\n\t\t\treturn false;\n\t\t}\n\t\tvalue = [value];\n\t}\n\t\n\tif (required) {\n\t\tif (value === undefined && item && item.get(this.path) && item.get(this.path).length) {\n\t\t\treturn true;\n\t\t}\n\t\tif (value === undefined || !Array.isArray(value)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (Array.isArray(value) && !value.length) {\n\t\t\treturn false;\n\t\t}\n\t}\n\t\n\tif (Array.isArray(value)) {\n\t\t// filter out empty fields\n\t\tvalue = value.filter(function(date) {\n\t\t\treturn date.trim() !== '';\n\t\t});\n\t\t// if there are no values left, and requried is true, return false\n\t\tif (required && !value.length) {\n\t\t\treturn false;\n\t\t}\n\t\t// if any date in the array is invalid, return false\n\t\tif (value.some(function (dateValue) { return !moment(dateValue, parseFormatString).isValid(); })) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn (value === undefined || Array.isArray(value));\n\n};\n\n\n/**\n * Updates the value for this field in the item from a data object\n *\n * @api public\n */\n\ndatearray.prototype.updateItem = function(item, data, callback) {\n\n\tvar value = this.getValueFromData(data);\n\t\n\tif (value !== undefined) {\n\t\tif (Array.isArray(value)) {\n\t\t\t// Only save valid dates\n\t\t\tvalue = value.filter(function(date) {\n\t\t\t\treturn moment(date).isValid();\n\t\t\t});\n\t\t}\n\t\tif (value === null) {\n\t\t\tvalue = [];\n\t\t}\n\t\tif ('string' === typeof value) {\n\t\t\tif (moment(value).isValid()) {\n\t\t\t\tvalue = [value];\n\t\t\t}\n\t\t}\n\t\tif (Array.isArray(value)) {\n\t\t\titem.set(this.path, value);\n\t\t}\n\t} else item.set(this.path, []);\n\n\tprocess.nextTick(callback);\n};\n\n\n/*!\n * Export class\n */\n\nmodule.exports = datearray;\n"},"repo_name":{"kind":"string","value":"riyadhalnur/keystone"},"path":{"kind":"string","value":"fields/types/datearray/DateArrayType.js"},"language":{"kind":"string","value":"JavaScript"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":3038,"string":"3,038"}}},{"rowIdx":735,"cells":{"code":{"kind":"string","value":"# -*- coding: utf-8 -*-\nrequire \"em-websocket\"\nrequire \"eventmachine-tail\"\n\nmodule Tailer\n # Extends FileTail to push data tailed to an EM::Channel. All open websockets\n # subscribe to a channel for the request stack and this pushes the data to\n # all of them at once.\n class StackTail < EventMachine::FileTail\n def initialize(filename, channel, startpos=-1)\n super(filename, startpos)\n @channel = channel\n @buffer = BufferedTokenizer.new\n end\n\n # This method is called whenever FileTail receives an inotify event for\n # the tailed file. It breaks up the data per line and pushes a line at a\n # time. This is to prevent the last javascript line from being broken up\n # over 2 pushes thus breaking the eval on the front end.\n def receive_data(data)\n # replace non UTF-8 characters with ?\n data.encode!('UTF-8', invalid: :replace, undef: :replace, replace: '�')\n @buffer.extract(data).each do |line|\n @channel.push line\n end\n end\n end\n\n # Checks if stack log symlink exists and creates Tailer for it\n def self.stack_tail(stack, channel, channel_count)\n if Deployinator.get_visible_stacks.include?(stack)\n filename = \"#{Deployinator::Helpers::RUN_LOG_PATH}current-#{stack}\"\n start_pos = (channel_count == 0) ? 0 : -1\n File.exists?(filename) ? StackTail.new(filename, channel, start_pos) : false\n end\n end\nend\n"},"repo_name":{"kind":"string","value":"etsy/deployinator"},"path":{"kind":"string","value":"lib/deployinator/stack-tail.rb"},"language":{"kind":"string","value":"Ruby"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":1403,"string":"1,403"}}},{"rowIdx":736,"cells":{"code":{"kind":"string","value":"\n\n\n\n\n\nedu.sdsc.inca\n\n\n\n\n\n\n\n\n\n\n\nedu.sdsc.inca\n\n\n\n\n
\nClasses&nbsp;\n\n
\nConsumer\n
\nConsumerTest\n
\nConsumerTest.ConsumerTester\n
\nConsumerTest.MockAgent\n
\nConsumerTest.MockDepot
\n\n\n\n\n"},"repo_name":{"kind":"string","value":"IncaProject/IncaProject.github.io"},"path":{"kind":"string","value":"releases/2.4/docs/javadocs/inca-consumers/edu/sdsc/inca/package-frame.html"},"language":{"kind":"string","value":"HTML"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":1321,"string":"1,321"}}},{"rowIdx":737,"cells":{"code":{"kind":"string","value":"// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nnamespace DotNetty.Transport.Channels.Sockets\n{\n using System;\n using System.Diagnostics.Contracts;\n using System.Net;\n using System.Net.NetworkInformation;\n using System.Net.Sockets;\n\n public class DefaultDatagramChannelConfig : DefaultChannelConfiguration, IDatagramChannelConfig\n {\n const int DefaultFixedBufferSize = 2048;\n\n readonly Socket socket;\n\n public DefaultDatagramChannelConfig(IDatagramChannel channel, Socket socket)\n : base(channel, new FixedRecvByteBufAllocator(DefaultFixedBufferSize))\n {\n Contract.Requires(socket != null);\n\n this.socket = socket;\n }\n\n public override T GetOption(ChannelOption option)\n {\n if (ChannelOption.SoBroadcast.Equals(option))\n {\n return (T)(object)this.Broadcast;\n }\n if (ChannelOption.SoRcvbuf.Equals(option))\n {\n return (T)(object)this.ReceiveBufferSize;\n }\n if (ChannelOption.SoSndbuf.Equals(option))\n {\n return (T)(object)this.SendBufferSize;\n }\n if (ChannelOption.SoReuseaddr.Equals(option))\n {\n return (T)(object)this.ReuseAddress;\n }\n if (ChannelOption.IpMulticastLoopDisabled.Equals(option))\n {\n return (T)(object)this.LoopbackModeDisabled;\n }\n if (ChannelOption.IpMulticastTtl.Equals(option))\n {\n return (T)(object)this.TimeToLive;\n }\n if (ChannelOption.IpMulticastAddr.Equals(option))\n {\n return (T)(object)this.Interface;\n }\n if (ChannelOption.IpMulticastIf.Equals(option))\n {\n return (T)(object)this.NetworkInterface;\n }\n if (ChannelOption.IpTos.Equals(option))\n {\n return (T)(object)this.TrafficClass;\n }\n\n return base.GetOption(option);\n }\n\n public override bool SetOption(ChannelOption option, T value)\n {\n if (base.SetOption(option, value))\n {\n return true;\n }\n\n if (ChannelOption.SoBroadcast.Equals(option))\n {\n this.Broadcast = (bool)(object)value;\n }\n else if (ChannelOption.SoRcvbuf.Equals(option))\n {\n this.ReceiveBufferSize = (int)(object)value;\n }\n else if (ChannelOption.SoSndbuf.Equals(option))\n {\n this.SendBufferSize = (int)(object)value;\n }\n else if (ChannelOption.SoReuseaddr.Equals(option))\n {\n this.ReuseAddress = (bool)(object)value;\n }\n else if (ChannelOption.IpMulticastLoopDisabled.Equals(option))\n {\n this.LoopbackModeDisabled = (bool)(object)value;\n }\n else if (ChannelOption.IpMulticastTtl.Equals(option))\n {\n this.TimeToLive = (short)(object)value;\n }\n else if (ChannelOption.IpMulticastAddr.Equals(option))\n {\n this.Interface = (EndPoint)(object)value;\n }\n else if (ChannelOption.IpMulticastIf.Equals(option))\n {\n this.NetworkInterface = (NetworkInterface)(object)value;\n }\n else if (ChannelOption.IpTos.Equals(option))\n {\n this.TrafficClass = (int)(object)value;\n }\n else\n {\n return false;\n }\n\n return true;\n }\n\n public int SendBufferSize\n {\n get\n {\n try\n {\n return this.socket.SendBufferSize;\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n set\n {\n try\n {\n this.socket.SendBufferSize = value;\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n }\n\n public int ReceiveBufferSize\n {\n get\n {\n try\n {\n return this.socket.ReceiveBufferSize;\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n set\n {\n try\n {\n this.socket.ReceiveBufferSize = value;\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n }\n\n public int TrafficClass\n {\n get\n {\n try\n {\n return (int)this.socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.TypeOfService);\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n set\n {\n try\n {\n this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.TypeOfService, value);\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n }\n\n public bool ReuseAddress\n {\n get\n {\n try\n {\n return (int)this.socket.GetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress) != 0;\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n set\n {\n try\n {\n this.socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, value ? 1 : 0);\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n }\n\n public bool Broadcast\n {\n get\n {\n try\n {\n return this.socket.EnableBroadcast;\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n set\n {\n try\n {\n this.socket.EnableBroadcast = value;\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n }\n\n public bool LoopbackModeDisabled\n {\n get\n {\n try\n {\n return !this.socket.MulticastLoopback;\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n set\n {\n try\n {\n this.socket.MulticastLoopback = !value;\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n }\n\n public short TimeToLive\n {\n get\n {\n try\n {\n return (short)this.socket.GetSocketOption(\n this.AddressFamilyOptionLevel,\n SocketOptionName.MulticastTimeToLive);\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n set\n {\n try\n {\n this.socket.SetSocketOption(\n this.AddressFamilyOptionLevel,\n SocketOptionName.MulticastTimeToLive, \n value);\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n }\n\n public EndPoint Interface\n {\n get\n {\n try\n {\n return this.socket.LocalEndPoint;\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n set\n {\n Contract.Requires(value != null);\n\n try\n {\n this.socket.Bind(value);\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n }\n\n public NetworkInterface NetworkInterface\n {\n get\n {\n try\n {\n NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();\n int value = (int)this.socket.GetSocketOption(\n this.AddressFamilyOptionLevel, \n SocketOptionName.MulticastInterface);\n int index = IPAddress.NetworkToHostOrder(value);\n \n if (interfaces.Length > 0 \n && index >= 0 \n && index < interfaces.Length)\n {\n return interfaces[index];\n }\n\n return null;\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n set\n {\n Contract.Requires(value != null);\n\n try\n {\n int index = this.GetNetworkInterfaceIndex(value);\n if (index >= 0)\n {\n this.socket.SetSocketOption(\n this.AddressFamilyOptionLevel, \n SocketOptionName.MulticastInterface, \n index);\n }\n }\n catch (ObjectDisposedException ex)\n {\n throw new ChannelException(ex);\n }\n catch (SocketException ex)\n {\n throw new ChannelException(ex);\n }\n }\n }\n\n internal SocketOptionLevel AddressFamilyOptionLevel\n {\n get\n {\n if (this.socket.AddressFamily == AddressFamily.InterNetwork)\n {\n return SocketOptionLevel.IP;\n }\n\n if (this.socket.AddressFamily == AddressFamily.InterNetworkV6)\n {\n return SocketOptionLevel.IPv6;\n }\n\n throw new NotSupportedException($\"Socket address family {this.socket.AddressFamily} not supported, expecting InterNetwork or InterNetworkV6\");\n }\n }\n\n internal int GetNetworkInterfaceIndex(NetworkInterface networkInterface)\n {\n Contract.Requires(networkInterface != null);\n\n NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();\n for (int index = 0; index < interfaces.Length; index++)\n {\n if (interfaces[index].Id == networkInterface.Id)\n {\n return index;\n }\n }\n\n return -1;\n }\n }\n}\n"},"repo_name":{"kind":"string","value":"dragonphoenix/proto-java-csharp"},"path":{"kind":"string","value":"DotNetty/DotNetty.Transport/Channels/Sockets/DefaultDatagramChannelConfig.cs"},"language":{"kind":"string","value":"C#"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":14695,"string":"14,695"}}},{"rowIdx":738,"cells":{"code":{"kind":"string","value":"/*\n * Search first occurence of a particular string in a given text [Finite Automata]\n * Author: Progyan Bhattacharya \n * Repo: Design-And-Analysis-of-Algorithm [MIT LICENSE]\n */\n\n#include \"Search.h\"\n\nstatic int NextState(int m, char* pattern, int state, int symbol) {\n if (state < m && pattern[state] == symbol) {\n return state + 1;\n }\n for (int next = state, prev = next - 1, i = 0; next > 0; next--) {\n if (pattern[prev] == symbol) {\n for (i = 0; i < prev; i++) {\n if (pattern[i] != pattern[state - next + 1 + i]) {\n break;\n }\n }\n if (i == prev) {\n return next;\n }\n }\n }\n return 0;\n}\n\nstatic void GenerateTable(int m, char* pattern, int Table[m][CHAR_MAX]) {\n for (int state = 0, symbol = 0; symbol < CHAR_MAX || (symbol = 0, ++state) < m; symbol++) {\n Table[state][symbol] = NextState(m, pattern, state, symbol);\n }\n}\n\nint Search(int n, char* haystack, int m, char* needle) {\n int Table[m + 1][CHAR_MAX], state = 0;\n GenerateTable(m + 1, needle, Table);\n for (int i = 0; i < n; i++) {\n state = Table[state][haystack[i]];\n if (state == m) {\n return (i - m + 1);\n }\n }\n return -1;\n}\n"},"repo_name":{"kind":"string","value":"Progyan1997/Design-and-Analysis-of-Algorithm"},"path":{"kind":"string","value":"String Search/Finite Automata/Search.c"},"language":{"kind":"string","value":"C"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":1307,"string":"1,307"}}},{"rowIdx":739,"cells":{"code":{"kind":"string","value":"require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')\n\nclass Video\n\tinclude Claire::Client::Item\nend\n\ndescribe Claire::Client::Item do\n\t#@session.should_receive(:post).with(\"url\", \"data\", \"headers\")\n\t#@session = mock(\"session\")\n\tbefore do \n\t\tClaire::Client.stub(:get).with('videos/id').and_return xml :item\n\t\t@video = Video.new(hash_from_xml(:item))\n\tend\n\t\n\tdescribe \"its initializer\" do\n\t\t\n\t\tdescribe \"its base_url class attribute\" do\n\t\t\tit \"should default to the class name, pluralized\" do\n\t\t\t\tVideo.base_url.should == \"videos\"\t\t\t\n\t\t\tend\n\t\t\t\n\t\t\tit \"should accept manual overwrite on the class\" do\n\t\t\t\tVideo.base_url = \"lists\"\n\t\t\t\tVideo.base_url.should == \"lists\"\n\t\t\t\tVideo.base_url = nil\n\t\t\t\tVideo.base_url.should == \"videos\"\n\t\t\tend\n\t\t\t\n\t\t\tit \"if the class is in a module, it should get the class name only\" do\n\t\t\t\teval %(\n\t\t\t\t\tmodule Testing\n\t\t\t\t\t\tclass Video\n\t\t\t\t\t\t\tinclude Claire::Client::Item\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t)\n\t\t\t\tTesting::Video.base_url.should == \"videos\"\n\t\t\tend\n\t\tend\n\t\t\n\t\tcontext \"upon receiving a Hash\" do\n\t\t\tbefore :each do\t\t\t\t\n\t\t\t\t@video = Video.new(hash_from_xml(:item))\n\t\t\tend\n\t\t\t\n\t\t\tit \"should set partial do true\" do\n\t\t\t\t@video.should be_partial\n\t\t\tend\n\t\t\t\n\t\t\tit \"should skip the container if it is present\" do\n\t\t\t\t@video.title.should be_a_kind_of String\n\t\t\t\t@video.should_not respond_to :rss\n\t\t\tend\n\t\t\t\n\t\t\tit \"should skip the container if its present\" do\n\t\t\t\tvideo = Video.new(hash_from_xml(:item_with_channel))\n\t\t\t\tvideo.title.should be_a_kind_of String\n\t\t\t\tvideo.should_not respond_to :channel\n\t\t\tend\n\t\t\t\n\t\t\tit \"should never set 'items' attributes \" do\n\t\t\t\t%w(item item_with_channel).each do |type|\n\t\t\t\t\tvideo = Video.new(hash_from_xml(type))\n\t\t\t\t\tvideo.should_not respond_to :item\n\t\t\t\t\tvideo.title.should be_a_kind_of String\n\t\t\t\t\t\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\tit \"should set the link attribute properly (eg ignoring links to other objects/pages)\" do\n\t\t\t\tvideo = Video.new hash_from_xml :item_with_channel\n\t\t\t\tvideo.link.should be_a_kind_of String\t\t\t\t\t\t\t\t\n\t\t\tend\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\n\t\t\tit \"should set its key/values as properties of the element\" do\n\t\t\t\t%w(title link category keywords description).each do |item|\n\t\t\t\t\t@video.send(item).should be_a_kind_of String\n\t\t\t\tend\n\t\t\t\t%w(thumbnail content).each{ |item| @video.send(item).should be_a_kind_of Array }\n\t\t\tend\n\t\t\tit \"should fail if there is not a link attribute\" do\n\t\t\t\tlambda { Video.new( {:rss => {:item => {:name => 'bla'}}} ) }.should raise_error Claire::Error\n\t\t\tend\n\t\tend\n\t\t\n\t\tcontext \"upon receiving a String\" do\n\t\t\tbefore { @video = Video.new 'id' }\n\t\t\tit \"should open the given string\" do\n\t\t\t\tlambda { Video.new \"\" }.should raise_error\n\t\t\t\tlambda { Video.new \"id\" }.should_not raise_error\n\t\t\tend\n\t\t\tit \"should parse the result using the XML parsing rules\" do\n\t\t\t\t@video.title.should be_a_kind_of String \n\t\t\tend\n\t\t\tit \"should set partial to false\" do\n\t\t\t\t@video.should_not be_partial\n\t\t\tend\n\t\t\t\n\t\tend\t\t\n\t\t\t\t \t\t\t\t\t\t\t\t\n\tend\n\t\n\tdescribe \"its comparison (spaceship) operator\" do\t\t\n\t\tit \"should be defined\" do\n\t\t\t@video.should respond_to '<=>'\t\t \n\t\tend\n\t\t\n\t\tit \"should compare items by title\" do\n\t\t @video2 = @video.clone\n\t\t\t(@video <=> @video2).should be 0\n\t\tend\n\t\t\n\tend\n\t\n\tcontext \"when an undefined method is called\" do\n\t\tit \"it should raise error if partial is false\"\n\t\tcontext \"if the item is partial\" do\n\t\t\tit \"should request the full object from server, and replace itself\"\n\t\t\tit \"should return the asked attribute\"\n\t\tend\n\tend\t\n\t\n\tit \"should have a list of its children as the children class attribute\" do\n\t\tClaire::Client::Item.children.include?(Video).should be true\n\tend\n\t\n\t\nend"},"repo_name":{"kind":"string","value":"memuller/claire.client"},"path":{"kind":"string","value":"spec/claire_client/item_spec.rb"},"language":{"kind":"string","value":"Ruby"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":3595,"string":"3,595"}}},{"rowIdx":740,"cells":{"code":{"kind":"string","value":"PathMission\r\n===========\r\n\r\n### Prefix: pm\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Enum`\r\n\r\nPathMissionDisplayType\r\n----------------------\r\n\r\n- **Soldier\\_Assassination**\r\n- **Soldier\\_Defend**\r\n- **Soldier\\_Demolition**\r\n- **Soldier\\_FirstStrike**\r\n- **Soldier\\_Holdout**\r\n- **Soldier\\_RescueOp**\r\n- **Soldier\\_Security**\r\n- **Soldier\\_Swat**\r\n- **Settler\\_Cache**\r\n- **Settler\\_CivilService**\r\n- **Settler\\_Expansion**\r\n- **Settler\\_Project**\r\n- **Settler\\_PublicSafety**\r\n- **Scientist\\_Analysis**\r\n- **Scientist\\_Archaeology**\r\n- **Scientist\\_Biology**\r\n- **Scientist\\_Botany**\r\n- **Scientist\\_Chemistry**\r\n- **Scientist\\_DatacubeDecryption**\r\n- **Scientist\\_Diagnostics**\r\n- **Scientist\\_Experimentation**\r\n- **Scientist\\_FieldStudy**\r\n- **Scientist\\_SpecimenSurvey**\r\n- **Explorer\\_Cartography**\r\n- **Explorer\\_Exploration**\r\n- **Explorer\\_Operations**\r\n- **Explorer\\_ScavengerHunt**\r\n- **Explorer\\_StakingClaim**\r\n- **Explorer\\_Surveillance**\r\n- **Explorer\\_Tracking**\r\n- **Explorer\\_Vista**\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Function`\r\n\r\nis()\r\n----\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\n\\_\\_eq() (Deprecated)\r\n---------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\n\\_\\_gc() (Deprecated)\r\n---------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nAttemptScientistExperimentation()\r\n---------------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetCompletedString()\r\n--------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetDisplayType()\r\n----------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetDistance()\r\n-------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetEpisode()\r\n------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetExplorerClueRatio()\r\n----------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetExplorerClueStatus()\r\n-----------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetExplorerClueString()\r\n-----------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetExplorerClueType()\r\n---------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetExplorerHuntSprite()\r\n-----------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetExplorerHuntStartCreature()\r\n------------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetExplorerHuntStartText()\r\n--------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetExplorerNodeCount()\r\n----------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetExplorerNodeInfo()\r\n---------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetExplorerPowerMapInfo()\r\n-------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetExplorerPowerMapReadyText()\r\n------------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetId()\r\n-------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetMapIcon()\r\n------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetMapLocations()\r\n-----------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetMapRegions()\r\n---------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetMissionState()\r\n-----------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetName()\r\n---------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetNumCompleted()\r\n-----------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetNumNeeded()\r\n--------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetRewardData()\r\n---------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetRewardXp()\r\n-------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetScientistDatacubeDiscoveryZone()\r\n-----------------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetScientistExperimentationCurrentPatterns()\r\n--------------------------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetScientistExperimentationInfo()\r\n---------------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetScientistFieldStudy()\r\n------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetScientistIcon()\r\n------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetScientistSpecimenSurvey()\r\n----------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetSettlerMayorInfo()\r\n---------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetSettlerResourceRegions()\r\n---------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetSettlerScoutInfo()\r\n---------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetSettlerSheriffInfo()\r\n-----------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetSoldierHoldout()\r\n-------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetSpell()\r\n----------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetSubType()\r\n------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetSummary()\r\n------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetType()\r\n---------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nGetUnlockString()\r\n-----------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nIsComplete()\r\n------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nIsExplorerPowerMapActive()\r\n--------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nIsExplorerPowerMapReady()\r\n-------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nIsInArea()\r\n----------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nIsOptional()\r\n------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nIsStarted()\r\n-----------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nRefreshScientistExperimentation()\r\n---------------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nScientistCreatureType\\_History() (Deprecated)\r\n---------------------------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nShowExplorerClueHintArrow()\r\n---------------------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nShowHintArrow()\r\n---------------\r\n\r\n------------------------------------------------------------------------\r\n\r\n`Method`\r\n\r\nShowPathChecklistHintArrow()\r\n----------------------------\r\n"},"repo_name":{"kind":"string","value":"Hammster/wildstar-api-docs"},"path":{"kind":"string","value":"Classes/PathMission.md"},"language":{"kind":"string","value":"Markdown"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":8646,"string":"8,646"}}},{"rowIdx":741,"cells":{"code":{"kind":"string","value":"banner;\n }\n\n /**\n * @param string $banner\n *\n * @return $this\n * @throws SMException\n */\n public function setBanner($banner) {\n if (!is_string($banner)) {\n throw new SMException(\"Banner must be a string\");\n }\n $this->banner = $banner;\n\n return $this;\n }\n}"},"repo_name":{"kind":"string","value":"jasonwatt/SMParser"},"path":{"kind":"string","value":"src/Traits/Song/Banner.php"},"language":{"kind":"string","value":"PHP"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":541,"string":"541"}}},{"rowIdx":742,"cells":{"code":{"kind":"string","value":"if ( !window.console ) window.console = { log:function(){} };\n\njQuery(document).ready(function($) {\n\n console.log('Keep being awesome.');\n\n});"},"repo_name":{"kind":"string","value":"shampine/180"},"path":{"kind":"string","value":"public/js/src/script.js"},"language":{"kind":"string","value":"JavaScript"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":143,"string":"143"}}},{"rowIdx":743,"cells":{"code":{"kind":"string","value":"package parser\n\nimport (\n\t\"monkey/ast\"\n\t\"monkey/token\"\n)\n\nfunc (p *Parser) parseStringLiteralExpression() ast.Expression {\n\treturn &ast.StringLiteral{Token: p.curToken, Value: p.curToken.Literal}\n}\n\nfunc (p *Parser) parseInterpolatedString() ast.Expression {\n\tis := &ast.InterpolatedString{Token: p.curToken, Value: p.curToken.Literal, ExprMap: make(map[byte]ast.Expression)}\n\n\tkey := \"0\"[0]\n\tfor {\n\t\tif p.curTokenIs(token.LBRACE) {\n\t\t\tp.nextToken()\n\t\t\texpr := p.parseExpression(LOWEST)\n\t\t\tis.ExprMap[key] = expr\n\t\t\tkey++\n\t\t}\n\t\tp.nextInterpToken()\n\t\tif p.curTokenIs(token.ISTRING) {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn is\n}\n"},"repo_name":{"kind":"string","value":"mayoms/monkey"},"path":{"kind":"string","value":"parser/strings.go"},"language":{"kind":"string","value":"GO"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":612,"string":"612"}}},{"rowIdx":744,"cells":{"code":{"kind":"string","value":"using System;\r\nusing System.Collections.Generic;\r\nusing System.ComponentModel;\r\nusing System.Data;\r\nusing System.Drawing;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Windows.Forms;\r\nusing System.Timers;\r\nusing System.Diagnostics;\r\n\r\nnamespace ForumHelper\r\n{\r\n public partial class ToastForm : Form\r\n {\r\n public ToastForm()\r\n {\r\n InitializeComponent();\r\n TopMost = true;\r\n ShowInTaskbar = false;\r\n timer = new System.Windows.Forms.Timer();\r\n timer.Interval = 500;\r\n timer.Tick += timer_Tick;\r\n\r\n }\r\n\r\n private System.Windows.Forms.Timer timer;\r\n private int startPosX;\r\n private int startPosY;\r\n\r\n private void ToastForm_Load(object sender, EventArgs e)\r\n {\r\n \r\n }\r\n protected override void OnLoad(EventArgs e)\r\n {\r\n startPosX = Screen.PrimaryScreen.WorkingArea.Width - Width;\r\n startPosY = Screen.PrimaryScreen.WorkingArea.Height - Height;\r\n SetDesktopLocation(startPosX, startPosY);\r\n pageLinkLabel.Text = URLEventArgs.Url;\r\n // base.OnLoad(e);\r\n timer.Start();\r\n }\r\n\r\n void timer_Tick(object sender, EventArgs e)\r\n {\r\n startPosY -= 50;\r\n if (startPosY < Screen.PrimaryScreen.WorkingArea.Height - Height) timer.Stop();\r\n else\r\n {\r\n SetDesktopLocation(startPosX, startPosY); \r\n timer.Stop();\r\n }\r\n }\r\n\r\n private void ToastForm_Click(object sender, EventArgs e)\r\n {\r\n this.Close();\r\n }\r\n\r\n private void pageLinkLabelClick(object sender, EventArgs e)\r\n {\r\n Process.Start(this.pageLinkLabel.Text);\r\n this.Close();\r\n }\r\n }\r\n}\r\n"},"repo_name":{"kind":"string","value":"ttitto/PersonalProjects"},"path":{"kind":"string","value":"ForumHelper/ForumHelper/ToastForm.cs"},"language":{"kind":"string","value":"C#"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":1852,"string":"1,852"}}},{"rowIdx":745,"cells":{"code":{"kind":"string","value":" 'A256CBC-HS512',\n 'alg' => 'RSA-OAEP-256',\n 'zip' => 'DEF',\n ],\n [],\n 'foo,bar,baz'\n );\n\n $jwe = $jwe->addRecipientInformation($this->getRSARecipientKey());\n\n $encrypter->encrypt($jwe);\n\n $encrypted = $jwe->toFlattenedJSON(0);\n\n $loader = new Loader(new FakeLogger());\n $loaded = $loader->load($encrypted);\n\n self::assertInstanceOf(JWEInterface::class, $loaded);\n self::assertEquals('RSA-OAEP-256', $loaded->getSharedProtectedHeader('alg'));\n self::assertEquals('A256CBC-HS512', $loaded->getSharedProtectedHeader('enc'));\n self::assertEquals('DEF', $loaded->getSharedProtectedHeader('zip'));\n self::assertNull($loaded->getPayload());\n\n $decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);\n\n self::assertEquals(0, $index);\n self::assertEquals('FOO', $loaded->getPayload());\n }\n\n public function testCreateCompactJWEUsingFactory()\n {\n $jwe = JWEFactory::createJWEToCompactJSON(\n 'FOO',\n $this->getRSARecipientKey(),\n [\n 'enc' => 'A256CBC-HS512',\n 'alg' => 'RSA-OAEP-256',\n 'zip' => 'DEF',\n ]\n );\n\n $loader = new Loader(new FakeLogger());\n $loaded = $loader->load($jwe);\n\n self::assertInstanceOf(JWEInterface::class, $loaded);\n self::assertEquals('RSA-OAEP-256', $loaded->getSharedProtectedHeader('alg'));\n self::assertEquals('A256CBC-HS512', $loaded->getSharedProtectedHeader('enc'));\n self::assertEquals('DEF', $loaded->getSharedProtectedHeader('zip'));\n self::assertNull($loaded->getPayload());\n\n $decrypter = Decrypter::createDecrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n $decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);\n\n self::assertEquals(0, $index);\n self::assertEquals('FOO', $loaded->getPayload());\n }\n\n public function testCreateFlattenedJWEUsingFactory()\n {\n $jwe = JWEFactory::createJWEToFlattenedJSON(\n 'FOO',\n $this->getRSARecipientKey(),\n [\n 'enc' => 'A256CBC-HS512',\n 'alg' => 'RSA-OAEP-256',\n 'zip' => 'DEF',\n ],\n [\n 'foo' => 'bar',\n ],\n [\n 'plic' => 'ploc',\n ],\n 'A,B,C,D'\n );\n\n $loader = new Loader(new FakeLogger());\n $loaded = $loader->load($jwe);\n\n self::assertInstanceOf(JWEInterface::class, $loaded);\n self::assertEquals('RSA-OAEP-256', $loaded->getSharedProtectedHeader('alg'));\n self::assertEquals('A256CBC-HS512', $loaded->getSharedProtectedHeader('enc'));\n self::assertEquals('DEF', $loaded->getSharedProtectedHeader('zip'));\n self::assertEquals('bar', $loaded->getSharedHeader('foo'));\n self::assertEquals('A,B,C,D', $loaded->getAAD('foo'));\n self::assertEquals('ploc', $loaded->getRecipient(0)->getHeader('plic'));\n self::assertNull($loaded->getPayload());\n\n $decrypter = Decrypter::createDecrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n $decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);\n\n self::assertEquals(0, $index);\n self::assertEquals('FOO', $loaded->getPayload());\n }\n\n public function testEncryptAndLoadFlattenedWithAAD()\n {\n $encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n $decrypter = Decrypter::createDecrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE(\n $this->getKeyToEncrypt(),\n [\n 'enc' => 'A256CBC-HS512',\n 'alg' => 'RSA-OAEP-256',\n 'zip' => 'DEF',\n ],\n [],\n 'foo,bar,baz'\n );\n\n $jwe = $jwe->addRecipientInformation($this->getRSARecipientKey());\n\n $encrypter->encrypt($jwe);\n\n $encrypted = $jwe->toFlattenedJSON(0);\n\n $loader = new Loader(new FakeLogger());\n $loaded = $loader->load($encrypted);\n\n self::assertInstanceOf(JWEInterface::class, $loaded);\n self::assertEquals('RSA-OAEP-256', $loaded->getSharedProtectedHeader('alg'));\n self::assertEquals('A256CBC-HS512', $loaded->getSharedProtectedHeader('enc'));\n self::assertEquals('DEF', $loaded->getSharedProtectedHeader('zip'));\n self::assertNull($loaded->getPayload());\n\n $decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);\n\n self::assertEquals(0, $index);\n self::assertTrue(is_array($loaded->getPayload()));\n self::assertEquals($this->getKeyToEncrypt(), new JWK($loaded->getPayload()));\n }\n\n /**\n * @expectedException \\InvalidArgumentException\n * @expectedExceptionMessage Compression method \"FIP\" not supported\n */\n public function testCompressionAlgorithmNotSupported()\n {\n $encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE(\n $this->getKeyToEncrypt(),\n [\n 'enc' => 'A256CBC-HS512',\n 'alg' => 'RSA-OAEP-256',\n 'zip' => 'FIP',\n ],\n [],\n 'foo,bar,baz'\n );\n\n $jwe = $jwe->addRecipientInformation($this->getRSARecipientKey());\n\n $encrypter->encrypt($jwe);\n }\n\n public function testMultipleInstructionsNotAllowedWithCompactSerialization()\n {\n $encrypter = Encrypter::createEncrypter(['RSA-OAEP', 'RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE('Live long and Prosper.');\n $jwe = $jwe->withSharedProtectedHeaders([\n 'enc' => 'A256CBC-HS512',\n ]);\n\n $jwe = $jwe->addRecipientInformation($this->getRSARecipientKeyWithAlgorithm(), ['alg' => 'RSA-OAEP']);\n $jwe = $jwe->addRecipientInformation($this->getRSARecipientKey(), ['alg' => 'RSA-OAEP-256']);\n\n $encrypter->encrypt($jwe);\n\n self::assertEquals(2, $jwe->countRecipients());\n }\n\n public function testMultipleInstructionsNotAllowedWithFlattenedSerialization()\n {\n $encrypter = Encrypter::createEncrypter(['RSA-OAEP-256', 'ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE('Live long and Prosper.');\n $jwe = $jwe->withSharedProtectedHeaders([\n 'enc' => 'A256CBC-HS512',\n ]);\n\n $jwe = $jwe->addRecipientInformation(\n $this->getECDHRecipientPublicKey(),\n ['kid' => 'e9bc097a-ce51-4036-9562-d2ade882db0d', 'alg' => 'ECDH-ES+A256KW']\n );\n $jwe = $jwe->addRecipientInformation(\n $this->getRSARecipientKey(),\n ['kid' => '123456789', 'alg' => 'RSA-OAEP-256']\n );\n\n $encrypter->encrypt($jwe);\n\n self::assertEquals(2, $jwe->countRecipients());\n }\n\n /**\n * @expectedException \\InvalidArgumentException\n * @expectedExceptionMessage Foreign key management mode forbidden.\n */\n public function testForeignKeyManagementModeForbidden()\n {\n $encrypter = Encrypter::createEncrypter(['dir', 'ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE('Live long and Prosper.');\n $jwe = $jwe->withSharedProtectedHeaders([\n 'enc' => 'A256CBC-HS512',\n ]);\n\n $jwe = $jwe->addRecipientInformation(\n $this->getECDHRecipientPublicKey(),\n ['kid' => 'e9bc097a-ce51-4036-9562-d2ade882db0d', 'alg' => 'ECDH-ES+A256KW']\n );\n $jwe = $jwe->addRecipientInformation(\n $this->getDirectKey(),\n ['kid' => 'DIR_1', 'alg' => 'dir']\n );\n\n $encrypter->encrypt($jwe);\n }\n\n /**\n * @expectedException \\InvalidArgumentException\n * @expectedExceptionMessage Key cannot be used to encrypt\n */\n public function testOperationNotAllowedForTheKey()\n {\n $encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE(\n 'Foo',\n [\n 'enc' => 'A256CBC-HS512',\n 'alg' => 'RSA-OAEP-256',\n 'zip' => 'DEF',\n ],\n [],\n 'foo,bar,baz'\n );\n $jwe = $jwe->addRecipientInformation(\n $this->getSigningKey()\n );\n\n $encrypter->encrypt($jwe);\n }\n\n /**\n * @expectedException \\InvalidArgumentException\n * @expectedExceptionMessage Key is only allowed for algorithm \"RSA-OAEP\".\n */\n public function testAlgorithmNotAllowedForTheKey()\n {\n $encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE(\n 'FOO',\n [\n 'enc' => 'A256CBC-HS512',\n 'alg' => 'RSA-OAEP-256',\n 'zip' => 'DEF',\n ],\n [],\n 'foo,bar,baz'\n );\n $jwe = $jwe->addRecipientInformation(\n $this->getRSARecipientKeyWithAlgorithm()\n );\n\n $encrypter->encrypt($jwe);\n }\n\n public function testEncryptAndLoadFlattenedWithDeflateCompression()\n {\n $encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], ['A128CBC-HS256'], ['DEF'], new FakeLogger());\n $decrypter = Decrypter::createDecrypter(['RSA-OAEP-256'], ['A128CBC-HS256'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE($this->getKeySetToEncrypt());\n $jwe = $jwe->withSharedProtectedHeaders([\n 'kid' => '123456789',\n 'enc' => 'A128CBC-HS256',\n 'alg' => 'RSA-OAEP-256',\n 'zip' => 'DEF',\n ]);\n $jwe = $jwe->addRecipientInformation(\n $this->getRSARecipientKey()\n );\n\n $encrypter->encrypt($jwe);\n\n $encrypted = $jwe->toCompactJSON(0);\n\n $loader = new Loader(new FakeLogger());\n $loaded = $loader->load($encrypted);\n\n self::assertInstanceOf(JWEInterface::class, $loaded);\n self::assertEquals('RSA-OAEP-256', $loaded->getSharedProtectedHeader('alg'));\n self::assertEquals('A128CBC-HS256', $loaded->getSharedProtectedHeader('enc'));\n self::assertEquals('DEF', $loaded->getSharedProtectedHeader('zip'));\n self::assertNull($loaded->getPayload());\n\n $decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);\n\n self::assertEquals(0, $index);\n self::assertTrue(is_array($loaded->getPayload()));\n self::assertEquals($this->getKeySetToEncrypt(), new JWKSet($loaded->getPayload()));\n }\n\n /**\n * @expectedException \\InvalidArgumentException\n * @expectedExceptionMessage Parameter \"alg\" is missing.\n */\n public function testAlgParameterIsMissing()\n {\n $encrypter = Encrypter::createEncrypter(['A256CBC-HS512'], [], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE($this->getKeyToEncrypt());\n $jwe = $jwe->withSharedProtectedHeaders([\n 'kid' => '123456789',\n 'enc' => 'A256CBC-HS512',\n 'zip' => 'DEF',\n ]);\n $jwe = $jwe->addRecipientInformation(\n $this->getRSARecipientKey()\n );\n\n $encrypter->encrypt($jwe);\n }\n\n /**\n * @expectedException \\InvalidArgumentException\n * @expectedExceptionMessage Parameter \"enc\" is missing.\n */\n public function testEncParameterIsMissing()\n {\n $encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], [], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE($this->getKeyToEncrypt());\n $jwe = $jwe->withSharedProtectedHeaders([\n 'kid' => '123456789',\n 'alg' => 'RSA-OAEP-256',\n 'zip' => 'DEF',\n ]);\n $jwe = $jwe->addRecipientInformation(\n $this->getRSARecipientKey()\n );\n\n $encrypter->encrypt($jwe);\n }\n\n /**\n * @expectedException \\InvalidArgumentException\n * @expectedExceptionMessage The key encryption algorithm \"A256CBC-HS512\" is not supported or not a key encryption algorithm instance.\n */\n public function testNotAKeyEncryptionAlgorithm()\n {\n $encrypter = Encrypter::createEncrypter(['A256CBC-HS512'], [], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE($this->getKeyToEncrypt());\n $jwe = $jwe->withSharedProtectedHeaders([\n 'kid' => '123456789',\n 'enc' => 'A256CBC-HS512',\n 'alg' => 'A256CBC-HS512',\n 'zip' => 'DEF',\n ]);\n $jwe = $jwe->addRecipientInformation(\n $this->getRSARecipientKey()\n );\n\n $encrypter->encrypt($jwe);\n }\n\n /**\n * @expectedException \\InvalidArgumentException\n * @expectedExceptionMessage The content encryption algorithm \"RSA-OAEP-256\" is not supported or not a content encryption algorithm instance.\n */\n public function testNotAContentEncryptionAlgorithm()\n {\n $encrypter = Encrypter::createEncrypter(['RSA-OAEP-256'], [], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE($this->getKeyToEncrypt());\n $jwe = $jwe->withSharedProtectedHeaders([\n 'kid' => '123456789',\n 'enc' => 'RSA-OAEP-256',\n 'alg' => 'RSA-OAEP-256',\n 'zip' => 'DEF',\n ]);\n\n $jwe = $jwe->addRecipientInformation(\n $this->getRSARecipientKey()\n );\n\n $encrypter->encrypt($jwe);\n }\n\n public function testEncryptAndLoadCompactWithDirectKeyEncryption()\n {\n $encrypter = Encrypter::createEncrypter(['dir'], ['A192CBC-HS384'], ['DEF'], new FakeLogger());\n $decrypter = Decrypter::createDecrypter(['dir'], ['A192CBC-HS384'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE($this->getKeyToEncrypt());\n $jwe = $jwe->withSharedProtectedHeaders([\n 'kid' => 'DIR_1',\n 'enc' => 'A192CBC-HS384',\n 'alg' => 'dir',\n ]);\n\n $jwe = $jwe->addRecipientInformation(\n $this->getDirectKey()\n );\n $encrypter->encrypt($jwe);\n\n $encrypted = $jwe->toFlattenedJSON(0);\n\n $loader = new Loader(new FakeLogger());\n $loaded = $loader->load($encrypted);\n\n self::assertInstanceOf(JWEInterface::class, $loaded);\n self::assertEquals('dir', $loaded->getSharedProtectedHeader('alg'));\n self::assertEquals('A192CBC-HS384', $loaded->getSharedProtectedHeader('enc'));\n self::assertFalse($loaded->hasSharedHeader('zip'));\n self::assertNull($loaded->getPayload());\n\n $decrypter->decryptUsingKeySet($loaded, $this->getSymmetricKeySet(), $index);\n\n self::assertEquals(0, $index);\n self::assertTrue(is_array($loaded->getPayload()));\n self::assertEquals($this->getKeyToEncrypt(), new JWK($loaded->getPayload()));\n }\n\n public function testEncryptAndLoadCompactKeyAgreement()\n {\n $encrypter = Encrypter::createEncrypter(['ECDH-ES'], ['A192CBC-HS384'], ['DEF'], new FakeLogger());\n $decrypter = Decrypter::createDecrypter(['ECDH-ES'], ['A192CBC-HS384'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE(['user_id' => '1234', 'exp' => time() + 3600]);\n $jwe = $jwe->withSharedProtectedHeaders([\n 'kid' => 'e9bc097a-ce51-4036-9562-d2ade882db0d',\n 'enc' => 'A192CBC-HS384',\n 'alg' => 'ECDH-ES',\n ]);\n\n $jwe = $jwe->addRecipientInformation(\n $this->getECDHRecipientPublicKey()\n );\n\n $encrypter->encrypt($jwe);\n\n $loader = new Loader(new FakeLogger());\n $loaded = $loader->load($jwe->toFlattenedJSON(0));\n\n self::assertInstanceOf(JWEInterface::class, $loaded);\n self::assertEquals('ECDH-ES', $loaded->getSharedProtectedHeader('alg'));\n self::assertEquals('A192CBC-HS384', $loaded->getSharedProtectedHeader('enc'));\n self::assertFalse($loaded->hasSharedProtectedHeader('zip'));\n self::assertNull($loaded->getPayload());\n\n $decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);\n\n self::assertEquals(0, $index);\n self::assertTrue($loaded->hasClaims());\n self::assertTrue($loaded->hasClaim('user_id'));\n self::assertEquals('1234', $loaded->getClaim('user_id'));\n }\n\n public function testEncryptAndLoadCompactKeyAgreementWithWrappingCompact()\n {\n $encrypter = Encrypter::createEncrypter(['ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n $decrypter = Decrypter::createDecrypter(['ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE('Live long and Prosper.');\n $jwe = $jwe->withSharedProtectedHeaders([\n 'kid' => 'e9bc097a-ce51-4036-9562-d2ade882db0d',\n 'enc' => 'A256CBC-HS512',\n 'alg' => 'ECDH-ES+A256KW',\n ]);\n\n $jwe = $jwe->addRecipientInformation(\n $this->getECDHRecipientPublicKey()\n );\n\n $encrypter->encrypt($jwe);\n\n $loader = new Loader(new FakeLogger());\n $loaded = $loader->load($jwe->toFlattenedJSON(0));\n\n self::assertInstanceOf(JWEInterface::class, $loaded);\n self::assertEquals('ECDH-ES+A256KW', $loaded->getSharedProtectedHeader('alg'));\n self::assertEquals('A256CBC-HS512', $loaded->getSharedProtectedHeader('enc'));\n self::assertFalse($loaded->hasSharedProtectedHeader('zip'));\n self::assertFalse($loaded->hasSharedHeader('zip'));\n self::assertNull($loaded->getPayload());\n\n $decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);\n\n self::assertEquals(0, $index);\n self::assertTrue(is_string($loaded->getPayload()));\n self::assertEquals('Live long and Prosper.', $loaded->getPayload());\n }\n\n public function testEncryptAndLoadWithGCMAndAAD()\n {\n $encrypter = Encrypter::createEncrypter(['ECDH-ES+A256KW'], ['A256GCM'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE(\n 'Live long and Prosper.',\n [\n 'kid' => 'e9bc097a-ce51-4036-9562-d2ade882db0d',\n 'enc' => 'A256GCM',\n 'alg' => 'ECDH-ES+A256KW',\n ],\n [],\n 'foo,bar,baz'\n );\n\n $jwe = $jwe->addRecipientInformation(\n $this->getECDHRecipientPublicKey()\n );\n\n $encrypter->encrypt($jwe);\n\n $loader = new Loader(new FakeLogger());\n $loaded = $loader->load($jwe->toFlattenedJSON(0));\n\n $decrypter = Decrypter::createDecrypter(['A256GCM'], ['ECDH-ES+A256KW'], ['DEF'], new FakeLogger());\n\n self::assertInstanceOf(JWEInterface::class, $loaded);\n self::assertEquals('ECDH-ES+A256KW', $loaded->getSharedProtectedHeader('alg'));\n self::assertEquals('A256GCM', $loaded->getSharedProtectedHeader('enc'));\n self::assertFalse($loaded->hasSharedProtectedHeader('zip'));\n self::assertFalse($loaded->hasSharedHeader('zip'));\n self::assertNull($loaded->getPayload());\n\n $decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);\n\n self::assertEquals(0, $index);\n self::assertTrue(is_string($loaded->getPayload()));\n self::assertEquals('Live long and Prosper.', $loaded->getPayload());\n }\n\n public function testEncryptAndLoadCompactKeyAgreementWithWrapping()\n {\n $encrypter = Encrypter::createEncrypter(['RSA-OAEP-256', 'ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n $decrypter = Decrypter::createDecrypter(['RSA-OAEP-256', 'ECDH-ES+A256KW'], ['A256CBC-HS512'], ['DEF'], new FakeLogger());\n\n $jwe = JWEFactory::createJWE('Live long and Prosper.');\n $jwe = $jwe->withSharedProtectedHeaders(['enc' => 'A256CBC-HS512']);\n\n $jwe = $jwe->addRecipientInformation(\n $this->getECDHRecipientPublicKey(),\n ['kid' => 'e9bc097a-ce51-4036-9562-d2ade882db0d', 'alg' => 'ECDH-ES+A256KW']\n );\n $jwe = $jwe->addRecipientInformation(\n $this->getRSARecipientKey(),\n ['kid' => '123456789', 'alg' => 'RSA-OAEP-256']\n );\n\n $encrypter->encrypt($jwe);\n\n $loader = new Loader(new FakeLogger());\n $loaded = $loader->load($jwe->toJSON());\n\n self::assertEquals(2, $loaded->countRecipients());\n\n self::assertInstanceOf(JWEInterface::class, $loaded);\n self::assertEquals('A256CBC-HS512', $loaded->getSharedProtectedHeader('enc'));\n self::assertEquals('ECDH-ES+A256KW', $loaded->getRecipient(0)->getHeader('alg'));\n self::assertEquals('RSA-OAEP-256', $loaded->getRecipient(1)->getHeader('alg'));\n self::assertFalse($loaded->hasSharedHeader('zip'));\n self::assertFalse($loaded->hasSharedProtectedHeader('zip'));\n self::assertNull($loaded->getPayload());\n\n $decrypter->decryptUsingKeySet($loaded, $this->getPrivateKeySet(), $index);\n\n self::assertEquals(0, $index);\n self::assertTrue(is_string($loaded->getPayload()));\n self::assertEquals('Live long and Prosper.', $loaded->getPayload());\n }\n\n /**\n * @return JWK\n */\n private function getKeyToEncrypt()\n {\n $key = new JWK([\n 'kty' => 'EC',\n 'use' => 'enc',\n 'crv' => 'P-256',\n 'x' => 'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU',\n 'y' => 'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0',\n 'd' => 'jpsQnnGQmL-YBIffH1136cspYG6-0iY7X1fCE9-E9LI',\n ]);\n\n return $key;\n }\n\n /**\n * @return JWKSet\n */\n private function getKeySetToEncrypt()\n {\n $key = new JWK([\n 'kty' => 'EC',\n 'use' => 'enc',\n 'crv' => 'P-256',\n 'x' => 'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU',\n 'y' => 'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0',\n 'd' => 'jpsQnnGQmL-YBIffH1136cspYG6-0iY7X1fCE9-E9LI',\n ]);\n\n $key_set = new JWKSet();\n $key_set->addKey($key);\n\n return $key_set;\n }\n\n /**\n * @return JWK\n */\n private function getRSARecipientKey()\n {\n $key = new JWK([\n 'kty' => 'RSA',\n 'use' => 'enc',\n 'n' => 'tpS1ZmfVKVP5KofIhMBP0tSWc4qlh6fm2lrZSkuKxUjEaWjzZSzs72gEIGxraWusMdoRuV54xsWRyf5KeZT0S-I5Prle3Idi3gICiO4NwvMk6JwSBcJWwmSLFEKyUSnB2CtfiGc0_5rQCpcEt_Dn5iM-BNn7fqpoLIbks8rXKUIj8-qMVqkTXsEKeKinE23t1ykMldsNaaOH-hvGti5Jt2DMnH1JjoXdDXfxvSP_0gjUYb0ektudYFXoA6wekmQyJeImvgx4Myz1I4iHtkY_Cp7J4Mn1ejZ6HNmyvoTE_4OuY1uCeYv4UyXFc1s1uUyYtj4z57qsHGsS4dQ3A2MJsw',\n 'e' => 'AQAB',\n ]);\n\n return $key;\n }\n\n /**\n * @return JWK\n */\n private function getRSARecipientKeyWithAlgorithm()\n {\n $key = new JWK([\n 'kty' => 'RSA',\n 'use' => 'enc',\n 'alg' => 'RSA-OAEP',\n 'n' => 'tpS1ZmfVKVP5KofIhMBP0tSWc4qlh6fm2lrZSkuKxUjEaWjzZSzs72gEIGxraWusMdoRuV54xsWRyf5KeZT0S-I5Prle3Idi3gICiO4NwvMk6JwSBcJWwmSLFEKyUSnB2CtfiGc0_5rQCpcEt_Dn5iM-BNn7fqpoLIbks8rXKUIj8-qMVqkTXsEKeKinE23t1ykMldsNaaOH-hvGti5Jt2DMnH1JjoXdDXfxvSP_0gjUYb0ektudYFXoA6wekmQyJeImvgx4Myz1I4iHtkY_Cp7J4Mn1ejZ6HNmyvoTE_4OuY1uCeYv4UyXFc1s1uUyYtj4z57qsHGsS4dQ3A2MJsw',\n 'e' => 'AQAB',\n ]);\n\n return $key;\n }\n\n /**\n * @return JWK\n */\n private function getSigningKey()\n {\n $key = new JWK([\n 'kty' => 'EC',\n 'key_ops' => ['sign', 'verify'],\n 'crv' => 'P-256',\n 'x' => 'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU',\n 'y' => 'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0',\n 'd' => 'jpsQnnGQmL-YBIffH1136cspYG6-0iY7X1fCE9-E9LI',\n ]);\n\n return $key;\n }\n\n /**\n * @return JWK\n */\n private function getECDHRecipientPublicKey()\n {\n $key = new JWK([\n 'kty' => 'EC',\n 'key_ops' => ['encrypt', 'decrypt'],\n 'crv' => 'P-256',\n 'x' => 'f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU',\n 'y' => 'x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0',\n ]);\n\n return $key;\n }\n\n /**\n * @return JWK\n */\n private function getDirectKey()\n {\n $key = new JWK([\n 'kid' => 'DIR_1',\n 'key_ops' => ['encrypt', 'decrypt'],\n 'kty' => 'oct',\n 'k' => Base64Url::encode(hex2bin('00112233445566778899AABBCCDDEEFF000102030405060708090A0B0C0D0E0F')),\n ]);\n\n return $key;\n }\n}\n"},"repo_name":{"kind":"string","value":"Spomky-Labs/jose"},"path":{"kind":"string","value":"tests/Functional/EncrypterBaseTest.php"},"language":{"kind":"string","value":"PHP"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":25820,"string":"25,820"}}},{"rowIdx":746,"cells":{"code":{"kind":"string","value":"// Fill out your copyright notice in the Description page of Project Settings.\n\nusing UnrealBuildTool;\nusing System.Collections.Generic;\n\npublic class UnrealCamDemoTarget : TargetRules\n{\n\tpublic UnrealCamDemoTarget(TargetInfo Target) : base(Target)\n\t{\n\t\tType = TargetType.Game;\n\n\t\tExtraModuleNames.AddRange( new string[] { \"UnrealCamDemo\" } );\n\t}\n}\n"},"repo_name":{"kind":"string","value":"mrayy/UnityCam"},"path":{"kind":"string","value":"UnrealCamDemo/Source/UnrealCamDemo.Target.cs"},"language":{"kind":"string","value":"C#"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":349,"string":"349"}}},{"rowIdx":747,"cells":{"code":{"kind":"string","value":"package br.com.gamemods.tutorial.ctf;\n\nimport org.bukkit.plugin.java.JavaPlugin;\n\npublic class CTFGameMods extends JavaPlugin\n{\n\n}\n"},"repo_name":{"kind":"string","value":"joserobjr/CTFGameMods"},"path":{"kind":"string","value":"src/main/java/br/com/gamemods/tutorial/ctf/CTFGameMods.java"},"language":{"kind":"string","value":"Java"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":131,"string":"131"}}},{"rowIdx":748,"cells":{"code":{"kind":"string","value":"---\ncategory: Components\ntype: Navigation\ntitle: Dropdown\ncover: https://gw.alipayobjects.com/zos/alicdn/eedWN59yJ/Dropdown.svg\n---\n\nA dropdown list.\n\n## When To Use\n\nWhen there are more than a few options to choose from, you can wrap them in a `Dropdown`. By hovering or clicking on the trigger, a dropdown menu will appear, which allows you to choose an option and execute the relevant action.\n\n## API\n\n### Dropdown\n\n| Property | Description | Type | Default | Version |\n| --- | --- | --- | --- | --- |\n| arrow | Whether the dropdown arrow should be visible | boolean \\| { pointAtCenter: boolean } | false | |\n| disabled | Whether the dropdown menu is disabled | boolean | - | |\n| destroyPopupOnHide | Whether destroy dropdown when hidden | boolean | false | |\n| getPopupContainer | To set the container of the dropdown menu. The default is to create a div element in body, but you can reset it to the scrolling area and make a relative reposition. [Example on CodePen](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | (triggerNode: HTMLElement) => HTMLElement | () => document.body | |\n| overlay | The dropdown menu | [Menu](/components/menu) \\| () => Menu | - | |\n| overlayClassName | The class name of the dropdown root element | string | - | |\n| overlayStyle | The style of the dropdown root element | CSSProperties | - | |\n| placement | Placement of popup menu: `bottom` `bottomLeft` `bottomRight` `top` `topLeft` `topRight` | string | `bottomLeft` | |\n| trigger | The trigger mode which executes the dropdown action. Note that hover can't be used on touchscreens | Array&lt;`click`\\|`hover`\\|`contextMenu`> | \\[`hover`] | |\n| visible | Whether the dropdown menu is currently visible | boolean | - | |\n| onVisibleChange | Called when the visible state is changed. Not trigger when hidden by click item | (visible: boolean) => void | - | |\n\nYou should use [Menu](/components/menu/) as `overlay`. The menu items and dividers are also available by using `Menu.Item` and `Menu.Divider`.\n\n> Warning: You must set a unique `key` for `Menu.Item`.\n>\n> Menu of Dropdown is unselectable by default, you can make it selectable via ``.\n\n### Dropdown.Button\n\n| Property | Description | Type | Default | Version |\n| --- | --- | --- | --- | --- |\n| buttonsRender | Custom buttons inside Dropdown.Button | (buttons: ReactNode\\[]) => ReactNode\\[] | - | |\n| loading | Set the loading status of button | boolean \\| { delay: number } | false | |\n| disabled | Whether the dropdown menu is disabled | boolean | - | |\n| icon | Icon (appears on the right) | ReactNode | - | |\n| overlay | The dropdown menu | [Menu](/components/menu) | - | |\n| placement | Placement of popup menu: `bottom` `bottomLeft` `bottomRight` `top` `topLeft` `topRight` | string | `bottomLeft` | |\n| size | Size of the button, the same as [Button](/components/button/#API) | string | `default` | |\n| trigger | The trigger mode which executes the dropdown action | Array&lt;`click`\\|`hover`\\|`contextMenu`> | \\[`hover`] | |\n| type | Type of the button, the same as [Button](/components/button/#API) | string | `default` | |\n| visible | Whether the dropdown menu is currently visible | boolean | - | |\n| onClick | The same as [Button](/components/button/#API): called when you click the button on the left | (event) => void | - | |\n| onVisibleChange | Called when the visible state is changed | (visible: boolean) => void | - | |\n"},"repo_name":{"kind":"string","value":"ant-design/ant-design"},"path":{"kind":"string","value":"components/dropdown/index.en-US.md"},"language":{"kind":"string","value":"Markdown"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":3428,"string":"3,428"}}},{"rowIdx":749,"cells":{"code":{"kind":"string","value":"/************************\n BUBBLE SORT\nAuthor:Rhysn Date:2015\n*************************/\n\n#include \n#include \n\ntypedef int ElemType;\n\nvoid swap(ElemType *left,ElemType *right){\n ElemType temp = *left;\n *left = *right;\n *right = temp;\n}\n\nvoid BubbleSort(ElemType *array,int num){\n if(num == 1) return;\n\n ElemType *left = array,*right = array + 1;\n int key = num;\n while(--key){\n if(*left > *right)\n swap(left,right);\n left++;\n right++;\n }\n BubbleSort(array,--num);\n}\n\nint main(){\n \n int a[14];\n\n int *b=a;\n int num = 14;\n srand((unsigned)time(NULL));\n while (num--) *b++ = rand()%10;\n\n b=a;\n num=14;\n while(num--){\n printf(\"%d \",*b++ );\n }\n printf(\"\\n\");\n\n BubbleSort(a,14);\n\n num = 14;\n b=a;\n while(num--){\n printf(\"%d \",*b++ );\n }\n printf(\"\\n\");\n\n return 0;\n}\n"},"repo_name":{"kind":"string","value":"Rhysn/Data-Structure-And-Algorithm"},"path":{"kind":"string","value":"Sort/BubbleSort.c"},"language":{"kind":"string","value":"C"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":917,"string":"917"}}},{"rowIdx":750,"cells":{"code":{"kind":"string","value":"/**\n * Keyframes.\n */\n@-webkit-keyframes rotation {\n 0% {\n -moz-transform: rotate(0deg);\n -ms-transform: rotate(0deg);\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n\n 100% {\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n@keyframes rotation {\n 0% {\n -moz-transform: rotate(0deg);\n -ms-transform: rotate(0deg);\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n\n 100% {\n -moz-transform: rotate(360deg);\n -ms-transform: rotate(360deg);\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n@-webkit-keyframes rotation-reverse {\n 0% {\n -moz-transform: rotate(0deg);\n -ms-transform: rotate(0deg);\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n\n 100% {\n -moz-transform: rotate(-360deg);\n -ms-transform: rotate(-360deg);\n -webkit-transform: rotate(-360deg);\n transform: rotate(-360deg);\n }\n}\n@keyframes rotation-reverse {\n 0% {\n -moz-transform: rotate(0deg);\n -ms-transform: rotate(0deg);\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n\n 100% {\n -moz-transform: rotate(-360deg);\n -ms-transform: rotate(-360deg);\n -webkit-transform: rotate(-360deg);\n transform: rotate(-360deg);\n }\n}\nbody {\n background-color: #000;\n}\n\n#sun {\n background-color: #aa0;\n height: 50px;\n left: calc(50% - 25px);\n position: absolute;\n top: calc(50% - 25px);\n width: 50px;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n -moz-box-shadow: 0 0 10px 2px #aa5500;\n -webkit-box-shadow: 0 0 10px 2px #aa5500;\n box-shadow: 0 0 10px 2px #aa5500;\n}\n\n#mercury-orbit {\n -webkit-animation: rotation 8s linear infinite;\n animation: rotation 8s linear infinite;\n height: 10%;\n left: 45%;\n position: absolute;\n top: 45%;\n width: 10%;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n}\n\n#mercury {\n background: #953;\n height: 10px;\n width: 10px;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n -moz-box-shadow: inset 0 0 5px 1px #222222;\n -webkit-box-shadow: inset 0 0 5px 1px #222222;\n box-shadow: inset 0 0 5px 1px #222222;\n}\n\n#venus-orbit {\n -webkit-animation: rotation-reverse 16s linear infinite;\n animation: rotation-reverse 16s linear infinite;\n height: 14%;\n left: 43%;\n position: absolute;\n top: 43%;\n width: 14%;\n}\n\n#venus {\n background: #db5;\n height: 15px;\n width: 15px;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n -moz-box-shadow: 0 0 3px 0 #ffff88;\n -webkit-box-shadow: 0 0 3px 0 #ffff88;\n box-shadow: 0 0 3px 0 #ffff88;\n}\n\n#earth-orbit {\n -webkit-animation: rotation 24s linear infinite;\n animation: rotation 24s linear infinite;\n height: 20%;\n left: 40%;\n position: absolute;\n top: 40%;\n width: 20%;\n}\n\n#earth {\n background-color: #0bf;\n height: 20px;\n width: 20px;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n -moz-box-shadow: 0 0 8px 1px white;\n -webkit-box-shadow: 0 0 8px 1px white;\n box-shadow: 0 0 8px 1px white;\n}\n\n#mars-orbit {\n -webkit-animation: rotation 44s linear infinite;\n animation: rotation 44s linear infinite;\n height: 30%;\n left: 35%;\n position: absolute;\n top: 35%;\n width: 30%;\n}\n\n#mars {\n background-color: #833;\n height: 18px;\n width: 18px;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n -moz-box-shadow: inset 0 0 5px #220000;\n -webkit-box-shadow: inset 0 0 5px #220000;\n box-shadow: inset 0 0 5px #220000;\n}\n\n#jupiter-orbit {\n -webkit-animation: rotation 68s linear infinite;\n animation: rotation 68s linear infinite;\n height: 40%;\n left: 30%;\n position: absolute;\n top: 30%;\n width: 40%;\n}\n\n#jupiter {\n background-color: #ffa500;\n height: 40px;\n width: 40px;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n -moz-box-shadow: inset 0 0 10px 1px black;\n -webkit-box-shadow: inset 0 0 10px 1px black;\n box-shadow: inset 0 0 10px 1px black;\n}\n\n#jupiter-spot {\n background-color: rgba(160, 0, 0, 0.5);\n height: 8px;\n left: 20px;\n position: absolute;\n top: 19px;\n width: 8px;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n -moz-box-shadow: 0 0 5px 0 #990000;\n -webkit-box-shadow: 0 0 5px 0 #990000;\n box-shadow: 0 0 5px 0 #990000;\n}\n\n#saturn-orbit {\n -webkit-animation: rotation 80s linear infinite;\n animation: rotation 80s linear infinite;\n height: 48%;\n left: 26%;\n position: absolute;\n top: 26%;\n width: 48%;\n}\n\n#saturn {\n background-color: #ab5;\n height: 36px;\n width: 36px;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n -moz-box-shadow: inset 0 0 5px #445511;\n -webkit-box-shadow: inset 0 0 5px #445511;\n box-shadow: inset 0 0 5px #445511;\n}\n\n#uranus-orbit {\n -webkit-animation: rotation 100s linear infinite;\n animation: rotation 100s linear infinite;\n height: 60%;\n left: 20%;\n position: absolute;\n top: 20%;\n width: 60%;\n}\n\n#uranus {\n background-color: #3da;\n height: 30px;\n width: 30px;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n -moz-box-shadow: inset 0 0 5px #445511;\n -webkit-box-shadow: inset 0 0 5px #445511;\n box-shadow: inset 0 0 5px #445511;\n}\n\n#neptune-orbit {\n -webkit-animation: rotation 120s linear infinite;\n animation: rotation 120s linear infinite;\n height: 70%;\n left: 15%;\n position: absolute;\n top: 15%;\n width: 70%;\n}\n\n#neptune {\n background-color: #05a;\n height: 32px;\n width: 32px;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n -moz-box-shadow: inset 0 0 10px 1px black;\n -webkit-box-shadow: inset 0 0 10px 1px black;\n box-shadow: inset 0 0 10px 1px black;\n}\n\n#pluto-orbit {\n -webkit-animation: rotation 120s linear infinite;\n animation: rotation 120s linear infinite;\n height: 70%;\n left: 15%;\n position: absolute;\n top: 15%;\n width: 70%;\n}\n\n#pluto {\n background-color: #7a7474;\n height: 10px;\n width: 10px;\n -moz-border-radius: 50%;\n -webkit-border-radius: 50%;\n border-radius: 50%;\n -moz-box-shadow: inset 0 0 10px 1px black;\n -webkit-box-shadow: inset 0 0 10px 1px black;\n box-shadow: inset 0 0 10px 1px black;\n}\n"},"repo_name":{"kind":"string","value":"jonahkirangi/solarsystem"},"path":{"kind":"string","value":"css/style.css"},"language":{"kind":"string","value":"CSS"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":6321,"string":"6,321"}}},{"rowIdx":751,"cells":{"code":{"kind":"string","value":"\n\n \n \n 18 --> 19\n \n \n \n

You have to be fast

\n Teleport\n
\n About (Spoilers! )\n \n \n \n \n"},"repo_name":{"kind":"string","value":"simonmysun/praxis"},"path":{"kind":"string","value":"TAIHAO2019/pub/SmallGame/AsFastAsYouCan2/c5cb57467c267c20a35f92318f4692026c064ad7ef73843ba6db5d1bcd65b843.html"},"language":{"kind":"string","value":"HTML"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":550,"string":"550"}}},{"rowIdx":752,"cells":{"code":{"kind":"string","value":"\n\n \n \n 18 --> 19\n \n \n \n

You have to be fast

\n Teleport\n
\n About (Spoilers! )\n \n \n \n \n"},"repo_name":{"kind":"string","value":"simonmysun/praxis"},"path":{"kind":"string","value":"TAIHAO2019/pub/SmallGame/AsFastAsYouCan2/cfa46991bdb810d48aaad070e86d32606ad11ab98dba37c82ee2433179f9b2ce.html"},"language":{"kind":"string","value":"HTML"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":550,"string":"550"}}},{"rowIdx":753,"cells":{"code":{"kind":"string","value":"/****************************************************************\n Copyright (C) 2014 All rights reserved.\n\t\t\t\t\t \t\t\t\t\t\t\t\t\t \n > File Name: < echo_server.c >\n > Author: < Sean Guo >\n > Mail: < iseanxp+code@gmail.com >\n > Created Time: < 2014/06/19 >\n > Last Changed: \t < 2015/11/30 >\n > Description:\t\techo server for ARM\n\n\t//{{{\n \tint bind(int sockfd, struct sockaddr * my_addr, int addrlen);\n \tbind()用来设置给参数sockfd 的socket 一个名称. \n \t此名称由参数my_addr 指向一个sockaddr 结构, 对于不同的socket domain 定义了一个通用的数据结构\n\n \tstruct sockaddr\n \t{\n \tunsigned short int sa_family;\n\t \tchar sa_data[14];\n\t};\n\t\n\t1、sa_family 为调用socket()时的domain 参数, 即AF_xxxx 值.\n\t2、sa_data 最多使用14 个字符长度.\n\n\t此sockaddr 结构会因使用不同的socket domain 而有不同结构定义, \n\t例如使用AF_INET domain,其socketaddr 结构定义便为\n\tstruct socketaddr_in\n\t{\n\t\tunsigned short int sin_family;\n\t uint16_t sin_port;\n\t\tstruct in_addr sin_addr;\n\t\tunsigned char sin_zero[8];\n\t};\n\n\tstruct in_addr\n\t{\n\t\tuint32_t s_addr;\n\t};\n\t\n\t1、sin_family 即为sa_family\n 2、sin_port 为使用的port 编号\n 3、sin_addr. s_addr 为IP 地址 sin_zero 未使用.\n 参数 addrlen 为sockaddr 的结构长度.\n\n 返回值:成功则返回0, 失败返回-1, 错误原因存于errno 中.\n\n\t错误代码:\n\t1、EBADF 参数sockfd 非合法socket 处理代码.\n\t2、EACCESS 权限不足\n\t3、ENOTSOCK 参数sockfd 为一文件描述词, 非socket.\n\t//}}}\n\n\tUsage: ./echo_server\n\n****************************************************************/\n//{{{ include files\n#include \n#include \n#include \t// waitpid()\n#include \t\t// exit();\n#include \t\t// bzero();\n#include \t// struct sockaddr_in;\n#include \t\t// time();\n#include // inet_pton();\n#include // write();\n#include \t\t// errno\n#include \t\t// SIGCHLD\n//}}}\n\n#define MAXLINE \t4096\t/* max text line length */\n#define LISTENQ 1024 /* 2nd argument to listen() , 排队的最大连接数*/\n#define LISTEN_PORT\t9669\t//服务器监听端口\n\n//参数: 已连接的socket描述符.\n//功能: echo此socket发送的一切数据;\n//阻塞函数, 直到对方socket关闭.\nvoid str_echo(int sockfd);\n\n//信号处理函数, 将等待一个子进程的结束。\nvoid sig_child(int signo);\n\nint main(int argc, char **argv)\n//{{{\n{\n\tint\tlistenfd, connfd;\n\tstruct sockaddr_in server_addr, client_addr;\n\tsocklen_t addr_len;\n\tchar buffer[MAXLINE];\n\tpid_t child_pid;\n\n\tlistenfd = socket(AF_INET, SOCK_STREAM, 0);\n\n\tbzero(&server_addr, sizeof(server_addr));\n\tserver_addr.sin_family = AF_INET;\n\tserver_addr.sin_addr.s_addr = htonl(INADDR_ANY);\n\tserver_addr.sin_port = htons(LISTEN_PORT);\n\n\t// int bind(int sockfd, struct sockaddr * my_addr, int addrlen);\n\t// bind()用来设置给参数sockfd 的socket 一个名称. \n\t// 此名称由参数my_addr 指向一个sockaddr 结构, 对于不同的socket domain 定义了一个通用的数据结构\n\tbind(listenfd, (struct sockaddr *) &server_addr, sizeof(server_addr));\n\n\t// int listen(int s, int backlog);\n\t// listen()用来监听描述符s 的socket连接请求. \n\t// 参数backlog 指定同时能处理的最大连接要求, 如果连接数目达此上限则client 端将收到ECONNREFUSED 的错误. \n\t// listen()并未开始接收连接请求, 只设置socket 为listen 模式,真正接收client 端连线的是accept().\n\t// 通常listen()会在socket(), bind()之后调用, 接着才调用accept().\n\t// 成功则返回0, 失败返回-1, 错误原因存于errno\n\t// listen()只适用SOCK_STREAM 或SOCK_SEQPACKET 的socket 类型. \n\t// 如果socket 为AF_INET 则参数backlog 最大值可设至128.\n\tlisten(listenfd, LISTENQ);\n\n\tsignal(SIGCHLD, sig_child);\t//为SIGCHLD匹配自定义的函数, 使得处理子进程僵死的问题.\n\n\t//主进程就为一个监听端口, 为每个连接fork一个新的进程.\n\tfor ( ; ; ) {\n\t\taddr_len = sizeof(client_addr);\n\t\t// int accept(int s, struct sockaddr * addr, int * addrlen);\n\t\t// accept()用来接受描述符s 的socket连接请求. \n\t\t// socket 必需先经bind()、listen()函数处理过, \n\t\t// 当有连接请求进来时, accept()会返回一个新的socket 处理代码, 往后的数据传送与读取就是经由新的socket处理, \n\t\t// 而原来参数s 的socket 能继续使用accept()来接受新的连线要求. \n\t\t// 连线成功时, 参数addr 所指的结构会被系统填入远程主机的地址数据, 参数addrlen 为scokaddr 的结构长度.\n\t\t// 成功则返回新的socket 处理代码, 失败返回-1, 错误原因存于errno 中.\n\t\tconnfd = accept(listenfd, (struct sockaddr *) &client_addr, &addr_len);\n\n\t\t//创建子进程处理客户端请求, 主进程继续监听.\n\t\tchild_pid = fork();\n\t\tif(child_pid < 0)\t//failed to fork a process.\n\t\t{\n\t\t\tfprintf(stderr, \"error: failed in fork()\\n\");\n\t\t\texit(1);\n\t\t}\n\t\telse if(child_pid == 0) //the child process.\n\t\t{\n\t\t\tclose(listenfd);\t//close listenfd in child process.\n\t\t\tstr_echo(connfd);\t//the task of child process - As a echo server.\n\t\t\texit(0);\n\t\t}\n\t\telse\t// the parent process.\n\t\t\tclose(connfd);\t\t//close connfd in parent process.\n\t\t//调用close()只会减少对应socket描述符的引用数, 当引用数为0才会清楚对应的socket.\n\t}\n}//}}}\n\nvoid str_echo(int sockfd)\n//{{{\n{\n\tssize_t n;\n\tchar buf[1024];\n\nagain:\n\twhile( (n = read(sockfd, buf, 1024)) > 0)\t//不断从sockfd中读取数据\n\t\twrite(sockfd, buf, n);\n\t\n\tif(n < 0 && errno == EINTR)\t\t//由于信号中断(EINTR)而没有读取到数据时, 返回while循环.\n\t\tgoto again;\n\telse if( n < 0)\t//无法读取数据\n\t\tperror(\"str_echo: read error\");\n}//}}}\n\n//信号处理函数, 将等待一个子进程的结束。\nvoid sig_child(int signo)\n//{{{\n{\n\tpid_t pid;\n\tint state;\n\n\t//pid = wait(&state);\t//等待一个子进程的结束\n\twhile( (pid = waitpid(-1, &state, WNOHANG)) > 0)\t//使用非阻塞的waitpid等待可结束的所有子进程\n\t\tprintf(\"child pid[%d] terminated.\\n\", pid);\n}//}}}\n"},"repo_name":{"kind":"string","value":"SeanXP/ARM-Tiny6410"},"path":{"kind":"string","value":"linux/linux-example/socket_echo_server/echo_server.c"},"language":{"kind":"string","value":"C"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":6157,"string":"6,157"}}},{"rowIdx":754,"cells":{"code":{"kind":"string","value":"'use strict';\n\nvar emojiArr = require('./emojis');\nvar i = 0;\nvar existingRules = {};\n\nvar generateEmoji = function(selector) {\n if (!existingRules[selector]) {\n existingRules[selector] = emojiArr[i];\n if (i !== emojiArr.length) {\n \ti++\n } else {\n \ti = 0;\n }\n }\n return existingRules[selector];\n}\n\nmodule.exports = generateEmoji;\n"},"repo_name":{"kind":"string","value":"thuongvu/postcss-emoji"},"path":{"kind":"string","value":"emojify.js"},"language":{"kind":"string","value":"JavaScript"},"license":{"kind":"string","value":"mit"},"size":{"kind":"number","value":382,"string":"382"}}},{"rowIdx":755,"cells":{"code":{"kind":"string","value":"// ------------------------------------------------------------------------------\n// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.\n// ------------------------------------------------------------------------------\n\n// **NOTE** This file was generated by a tool and any changes will be overwritten.\n\n// Template Source: Templates\\CSharp\\Requests\\MethodRequest.cs.tt\n\nnamespace Microsoft.Graph\n{\n using System;\n using System.Collections.Generic;\n using System.IO;\n using System.Net.Http;\n using System.Threading;\n\n /// \n /// The type WorkbookFunctionsBesselIRequest.\n /// \n public partial class WorkbookFunctionsBesselIRequest : BaseRequest, IWorkbookFunctionsBesselIRequest\n {\n /// \n /// Constructs a new WorkbookFunctionsBesselIRequest.\n /// \n public WorkbookFunctionsBesselIRequest(\n string requestUrl,\n IBaseClient client,\n IEnumerable