text
stringlengths
2
1.04M
meta
dict
use std::borrow::Borrow; use std::cell::UnsafeCell; use std::cmp::Ordering::{Less, Equal, Greater}; use std::default::Default; use std::iter::{FromIterator, IntoIterator}; use std::mem; use std::ops::{Index, IndexMut}; use super::node::Node; /// The implementation of this splay tree is largely based on the c code at: /// ftp://ftp.cs.cmu.edu/usr/ftp/usr/sleator/splaying/top-down-splay.c /// This version of splaying is a top-down splay operation. pub struct SplayMap<K: Ord, V> { root: UnsafeCell<Option<Box<Node<K, V>>>>, size: usize, } pub struct IntoIter<K, V> { cur: Option<Box<Node<K, V>>>, remaining: usize, } /// Performs a top-down splay operation on a tree rooted at `node`. This will /// modify the pointer to contain the new root of the tree once the splay /// operation is done. When finished, if `key` is in the tree, it will be at the /// root. Otherwise the closest key to the specified key will be at the root. fn splay<K, V, Q: ?Sized>(key: &Q, node: &mut Box<Node<K, V>>) where K: Ord + Borrow<Q>, Q: Ord { let mut newleft = None; let mut newright = None; // Eplicitly grab a new scope so the loans on newleft/newright are // terminated before we move out of them. { // Yes, these are backwards, that's intentional. let mut l = &mut newright; let mut r = &mut newleft; loop { match key.cmp(node.key.borrow()) { // Found it, yay! Equal => { break } Less => { let mut left = match node.pop_left() { Some(left) => left, None => break }; // rotate this node right if necessary if key.cmp(left.key.borrow()) == Less { // A bit odd, but avoids drop glue mem::swap(&mut node.left, &mut left.right); mem::swap(&mut left, node); let none = mem::replace(&mut node.right, Some(left)); match mem::replace(&mut node.left, none) { Some(l) => { left = l; } None => { break } } } *r = Some(mem::replace(node, left)); let tmp = r; r = &mut tmp.as_mut().unwrap().left; } // If you look closely, you may have seen some similar code // before Greater => { match node.pop_right() { None => { break } // rotate left if necessary Some(mut right) => { if key.cmp(right.key.borrow()) == Greater { mem::swap(&mut node.right, &mut right.left); mem::swap(&mut right, node); let none = mem::replace(&mut node.left, Some(right)); match mem::replace(&mut node.right, none) { Some(r) => { right = r; } None => { break } } } *l = Some(mem::replace(node, right)); let tmp = l; l = &mut tmp.as_mut().unwrap().right; } } } } } mem::swap(l, &mut node.left); mem::swap(r, &mut node.right); } node.left = newright; node.right = newleft; } impl<K: Ord, V> SplayMap<K, V> { pub fn new() -> SplayMap<K, V> { SplayMap { root: UnsafeCell::new(None), size: 0 } } /// Moves all values out of this map, transferring ownership to the given /// iterator. pub fn into_iter(mut self) -> IntoIter<K, V> { IntoIter { cur: self.root_mut().take(), remaining: self.size } } pub fn len(&self) -> usize { self.size } pub fn is_empty(&self) -> bool { self.len() == 0 } /// Clears the tree in O(1) extra space (including the stack). This is /// necessary to prevent stack exhaustion with extremely large trees. pub fn clear(&mut self) { let iter = IntoIter { cur: self.root_mut().take(), remaining: self.size, }; for _ in iter { // ignore, drop the values (and the node) } self.size = 0; } /// Return true if the map contains a value for the specified key pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where K: Borrow<Q>, Q: Ord, { self.get(key).is_some() } /// Return a reference to the value corresponding to the key pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where K: Borrow<Q>, Q: Ord, { // Splay trees are self-modifying, so they can't exactly operate with // the immutable self given by the Map interface for this method. It can // be guaranteed, however, that the callers of this method are not // modifying the tree, they may just be rotating it. Each node is a // pointer on the heap, so we know that none of the pointers inside // these nodes (the value returned from this function) will be moving. // // With this in mind, we can unsafely use a mutable version of this tree // to invoke the splay operation and return a pointer to the inside of // one of the nodes (the pointer won't be deallocated or moved). // // However I'm not entirely sure whether this works with iteration or // not. Arbitrary lookups can occur during iteration, and during // iteration there's some form of "stack" remembering the nodes that // need to get visited. I don't believe that it's safe to allow lookups // while the tree is being iterated. Right now there are no iterators // exposed on this splay tree implementation, and more thought would be // required if there were. unsafe { match *self.root.get() { Some(ref mut root) => { splay(key, root); if key == root.key.borrow() { return Some(&root.value); } None } None => None, } } } /// Return a mutable reference to the value corresponding to the key pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where K: Borrow<Q>, Q: Ord, { match *self.root_mut() { None => { return None; } Some(ref mut root) => { splay(key, root); if key == root.key.borrow() { return Some(&mut root.value); } return None; } } } /// Insert a key-value pair from the map. If the key already had a value /// present in the map, that value is returned. Otherwise None is returned. pub fn insert(&mut self, key: K, value: V) -> Option<V> { match self.root_mut() { &mut Some(ref mut root) => { splay(&key, root); match key.cmp(&root.key) { Equal => { let old = mem::replace(&mut root.value, value); return Some(old); } /* TODO: would unsafety help perf here? */ Less => { let left = root.pop_left(); let new = Node::new(key, value, left, None); let prev = mem::replace(root, new); root.right = Some(prev); } Greater => { let right = root.pop_right(); let new = Node::new(key, value, None, right); let prev = mem::replace(root, new); root.left = Some(prev); } } } slot => { *slot = Some(Node::new(key, value, None, None)); } } self.size += 1; return None; } /// Removes a key from the map, returning the value at the key if the key /// was previously in the map. pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V> where K: Borrow<Q>, Q: Ord { match *self.root_mut() { None => { return None; } Some(ref mut root) => { splay(key, root); if key != root.key.borrow() { return None } } } // TODO: Extra storage of None isn't necessary let (value, left, right) = match *self.root_mut().take().unwrap() { Node {left, right, value, ..} => (value, left, right) }; *self.root_mut() = match left { None => right, Some(mut node) => { splay(key, &mut node); node.right = right; Some(node) } }; self.size -= 1; return Some(value); } } impl<K: Ord, V> SplayMap<K, V> { // These two functions provide safe access to the root node, and they should // be valid to call in virtually all contexts. fn root_mut(&mut self) -> &mut Option<Box<Node<K, V>>> { unsafe { &mut *self.root.get() } } fn root_ref(&self) -> &Option<Box<Node<K, V>>> { unsafe { &*self.root.get() } } } impl<'a, K: Ord, V, Q: ?Sized> Index<&'a Q> for SplayMap<K, V> where K: Borrow<Q>, Q: Ord { type Output = V; fn index(&self, index: &'a Q) -> &V { self.get(index).expect("key not present in SplayMap") } } impl<'a, K: Ord, V, Q: ?Sized> IndexMut<&'a Q> for SplayMap<K, V> where K: Borrow<Q>, Q: Ord { fn index_mut(&mut self, index: &'a Q) -> &mut V { self.get_mut(index).expect("key not present in SplayMap") } } impl<K: Ord, V> Default for SplayMap<K, V> { fn default() -> SplayMap<K, V> { SplayMap::new() } } impl<K: Ord, V> FromIterator<(K, V)> for SplayMap<K, V> { fn from_iter<I: IntoIterator<Item=(K, V)>>(iterator: I) -> SplayMap<K, V> { let mut map = SplayMap::new(); map.extend(iterator); map } } impl<K: Ord, V> Extend<(K, V)> for SplayMap<K, V> { fn extend<I: IntoIterator<Item=(K, V)>>(&mut self, i: I) { for (k, v) in i { self.insert(k, v); } } } impl<K, V> Iterator for IntoIter<K, V> { type Item = (K, V); fn next(&mut self) -> Option<(K, V)> { let mut cur = match self.cur.take() { Some(cur) => cur, None => return None, }; loop { match cur.pop_left() { Some(node) => { let mut node = node; cur.left = node.pop_right(); node.right = Some(cur); cur = node; } None => { self.cur = cur.pop_right(); // left and right fields are both None let node = *cur; let Node { key, value, .. } = node; self.remaining -= 1; return Some((key, value)); } } } } fn size_hint(&self) -> (usize, Option<usize>) { (self.remaining, Some(self.remaining)) } } impl<K, V> DoubleEndedIterator for IntoIter<K, V> { // Pretty much the same as the above code, but with left replaced with right // and vice-versa. fn next_back(&mut self) -> Option<(K, V)> { let mut cur = match self.cur.take() { Some(cur) => cur, None => return None, }; loop { match cur.pop_right() { Some(node) => { let mut node = node; cur.right = node.pop_left(); node.left = Some(cur); cur = node; } None => { self.cur = cur.pop_left(); // left and right fields are both None let node = *cur; let Node { key, value, .. } = node; self.remaining -= 1; return Some((key, value)); } } } } } impl<K, V> ExactSizeIterator for IntoIter<K, V> {} impl<K: Clone + Ord, V: Clone> Clone for SplayMap<K, V> { fn clone(&self) -> SplayMap<K, V> { SplayMap { root: UnsafeCell::new(self.root_ref().clone()), size: self.size, } } } impl<K: Ord, V> Drop for SplayMap<K, V> { fn drop(&mut self) { // Be sure to not recurse too deep on destruction self.clear(); } }
{ "content_hash": "0410e7a626e9923d6cb6b1ab3ca1cbaa", "timestamp": "", "source": "github", "line_count": 381, "max_line_length": 80, "avg_line_length": 34.338582677165356, "alnum_prop": 0.47076358633340976, "repo_name": "alexcrichton/splay-rs", "id": "05c7c9963b8fd213791283e5966213a2239f1958", "size": "13083", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/map.rs", "mode": "33188", "license": "mit", "language": [ { "name": "Rust", "bytes": "20862" } ], "symlink_target": "" }
/** * @file **/ #pragma once #include <memory> #include "modules/common/proto/pnc_point.pb.h" #include "modules/common/status/status.h" #include "modules/common/util/factory.h" #include "modules/planning/proto/traffic_rule_config.pb.h" #include "modules/planning/reference_line/reference_line.h" #include "modules/planning/traffic_rules/traffic_rule.h" namespace apollo { namespace planning { /** * @class TrafficDecider * @brief Create traffic related decision in this class. * The created obstacles is added to obstacles_, and the decision is added to * obstacles_ * Traffic obstacle examples include: * * Traffic Light * * End of routing * * Select the drivable reference line. */ class TrafficDecider { public: TrafficDecider() = default; bool Init(const TrafficRuleConfigs &config); virtual ~TrafficDecider() = default; apollo::common::Status Execute( Frame *frame, ReferenceLineInfo *reference_line_info, const std::shared_ptr<DependencyInjector> &injector); private: static apollo::common::util::Factory< TrafficRuleConfig::RuleId, TrafficRule, TrafficRule *(*)(const TrafficRuleConfig &config, const std::shared_ptr<DependencyInjector> &injector)> s_rule_factory; void RegisterRules(); void BuildPlanningTarget(ReferenceLineInfo *reference_line_info); TrafficRuleConfigs rule_configs_; }; } // namespace planning } // namespace apollo
{ "content_hash": "f5cc7ce8e4d6276ba4bc246f0cb1b83c", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 77, "avg_line_length": 26.685185185185187, "alnum_prop": 0.7217210270645386, "repo_name": "ycool/apollo", "id": "907ec608542ee53c275a3f1491bb0a662025196b", "size": "2213", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "modules/planning/traffic_rules/traffic_decider.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "1922" }, { "name": "Batchfile", "bytes": "791" }, { "name": "C", "bytes": "66747" }, { "name": "C++", "bytes": "19613034" }, { "name": "CMake", "bytes": "3600" }, { "name": "Cuda", "bytes": "221003" }, { "name": "Dockerfile", "bytes": "8522" }, { "name": "GLSL", "bytes": "7000" }, { "name": "HTML", "bytes": "9768" }, { "name": "Handlebars", "bytes": "991" }, { "name": "JavaScript", "bytes": "461346" }, { "name": "Makefile", "bytes": "6626" }, { "name": "Python", "bytes": "1178333" }, { "name": "SCSS", "bytes": "52149" }, { "name": "Shell", "bytes": "783043" }, { "name": "Smarty", "bytes": "33183" }, { "name": "Starlark", "bytes": "1023973" }, { "name": "Vim script", "bytes": "161" } ], "symlink_target": "" }
 #pragma once #include <aws/glacier/Glacier_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace Glacier { namespace Model { /** * <p>Returned if there is insufficient capacity to process this expedited request. * This error only applies to expedited retrievals and not to standard or bulk * retrievals.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/glacier-2012-06-01/InsufficientCapacityException">AWS * API Reference</a></p> */ class AWS_GLACIER_API InsufficientCapacityException { public: InsufficientCapacityException(); InsufficientCapacityException(Aws::Utils::Json::JsonView jsonValue); InsufficientCapacityException& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; inline const Aws::String& GetType() const{ return m_type; } inline bool TypeHasBeenSet() const { return m_typeHasBeenSet; } inline void SetType(const Aws::String& value) { m_typeHasBeenSet = true; m_type = value; } inline void SetType(Aws::String&& value) { m_typeHasBeenSet = true; m_type = std::move(value); } inline void SetType(const char* value) { m_typeHasBeenSet = true; m_type.assign(value); } inline InsufficientCapacityException& WithType(const Aws::String& value) { SetType(value); return *this;} inline InsufficientCapacityException& WithType(Aws::String&& value) { SetType(std::move(value)); return *this;} inline InsufficientCapacityException& WithType(const char* value) { SetType(value); return *this;} inline const Aws::String& GetCode() const{ return m_code; } inline bool CodeHasBeenSet() const { return m_codeHasBeenSet; } inline void SetCode(const Aws::String& value) { m_codeHasBeenSet = true; m_code = value; } inline void SetCode(Aws::String&& value) { m_codeHasBeenSet = true; m_code = std::move(value); } inline void SetCode(const char* value) { m_codeHasBeenSet = true; m_code.assign(value); } inline InsufficientCapacityException& WithCode(const Aws::String& value) { SetCode(value); return *this;} inline InsufficientCapacityException& WithCode(Aws::String&& value) { SetCode(std::move(value)); return *this;} inline InsufficientCapacityException& WithCode(const char* value) { SetCode(value); return *this;} inline const Aws::String& GetMessage() const{ return m_message; } inline bool MessageHasBeenSet() const { return m_messageHasBeenSet; } inline void SetMessage(const Aws::String& value) { m_messageHasBeenSet = true; m_message = value; } inline void SetMessage(Aws::String&& value) { m_messageHasBeenSet = true; m_message = std::move(value); } inline void SetMessage(const char* value) { m_messageHasBeenSet = true; m_message.assign(value); } inline InsufficientCapacityException& WithMessage(const Aws::String& value) { SetMessage(value); return *this;} inline InsufficientCapacityException& WithMessage(Aws::String&& value) { SetMessage(std::move(value)); return *this;} inline InsufficientCapacityException& WithMessage(const char* value) { SetMessage(value); return *this;} private: Aws::String m_type; bool m_typeHasBeenSet; Aws::String m_code; bool m_codeHasBeenSet; Aws::String m_message; bool m_messageHasBeenSet; }; } // namespace Model } // namespace Glacier } // namespace Aws
{ "content_hash": "728e088433bb3213dc2189828f663340", "timestamp": "", "source": "github", "line_count": 127, "max_line_length": 121, "avg_line_length": 28.834645669291337, "alnum_prop": 0.6925177498634626, "repo_name": "cedral/aws-sdk-cpp", "id": "2bc77029a8de5805d0e084f4ec0f9e8379d0e085", "size": "3781", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "aws-cpp-sdk-glacier/include/aws/glacier/model/InsufficientCapacityException.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "294220" }, { "name": "C++", "bytes": "428637022" }, { "name": "CMake", "bytes": "862025" }, { "name": "Dockerfile", "bytes": "11688" }, { "name": "HTML", "bytes": "7904" }, { "name": "Java", "bytes": "352201" }, { "name": "Python", "bytes": "106761" }, { "name": "Shell", "bytes": "10891" } ], "symlink_target": "" }
__BEGIN_DECLS // Typically, apps seem to have ~700 binary images loaded #define CLS_BINARY_IMAGE_RUNTIME_NODE_COUNT (1024) #define CLS_BINARY_IMAGE_RUNTIME_NODE_NAME_SIZE (32) #define CLS_BINARY_IMAGE_RUNTIME_NODE_RECORD_NAME 0 #define FIRCLSUUIDStringLength (33) typedef struct { _Atomic(void*) volatile baseAddress; uint64_t size; #if CLS_DWARF_UNWINDING_SUPPORTED const void* ehFrame; #endif #if CLS_COMPACT_UNWINDING_SUPPORTED const void* unwindInfo; #endif const void* crashInfo; #if CLS_BINARY_IMAGE_RUNTIME_NODE_RECORD_NAME char name[CLS_BINARY_IMAGE_RUNTIME_NODE_NAME_SIZE]; #endif } FIRCLSBinaryImageRuntimeNode; typedef struct { char uuidString[FIRCLSUUIDStringLength]; bool encrypted; FIRCLSMachOVersion builtSDK; FIRCLSMachOVersion minSDK; FIRCLSBinaryImageRuntimeNode node; struct FIRCLSMachOSlice slice; intptr_t vmaddr_slide; } FIRCLSBinaryImageDetails; typedef struct { const char* path; } FIRCLSBinaryImageReadOnlyContext; typedef struct { FIRCLSFile file; FIRCLSBinaryImageRuntimeNode nodes[CLS_BINARY_IMAGE_RUNTIME_NODE_COUNT]; } FIRCLSBinaryImageReadWriteContext; void FIRCLSBinaryImageInit(FIRCLSBinaryImageReadOnlyContext* roContext, FIRCLSBinaryImageReadWriteContext* rwContext); #if CLS_COMPACT_UNWINDING_SUPPORTED bool FIRCLSBinaryImageSafeFindImageForAddress(uintptr_t address, FIRCLSBinaryImageRuntimeNode* image); bool FIRCLSBinaryImageSafeHasUnwindInfo(FIRCLSBinaryImageRuntimeNode* image); #endif bool FIRCLSBinaryImageFindImageForUUID(const char* uuidString, FIRCLSBinaryImageDetails* imageDetails); bool FIRCLSBinaryImageRecordMainExecutable(FIRCLSFile* file); __END_DECLS
{ "content_hash": "3b0daa44de87b495b8026e1351b9058b", "timestamp": "", "source": "github", "line_count": 58, "max_line_length": 83, "avg_line_length": 30.344827586206897, "alnum_prop": 0.7653409090909091, "repo_name": "firebase/firebase-ios-sdk", "id": "725020af041adfaefcd98fe4ad8d376758180fad", "size": "2574", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Crashlytics/Crashlytics/Components/FIRCLSBinaryImage.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "365959" }, { "name": "C++", "bytes": "8345652" }, { "name": "CMake", "bytes": "91856" }, { "name": "JavaScript", "bytes": "3675" }, { "name": "Objective-C", "bytes": "10276029" }, { "name": "Objective-C++", "bytes": "837306" }, { "name": "Python", "bytes": "117723" }, { "name": "Ruby", "bytes": "179250" }, { "name": "Shell", "bytes": "127192" }, { "name": "Swift", "bytes": "2052268" }, { "name": "sed", "bytes": "2015" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_55) on Sun Oct 26 05:56:52 EDT 2014 --> <meta http-equiv="Content-Type" content="text/html" charset="utf-8"> <title>org.apache.solr.handler.extraction (Solr 4.10.2 API)</title> <meta name="date" content="2014-10-26"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="org.apache.solr.handler.extraction (Solr 4.10.2 API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../../../../../org/apache/solr/handler/extraction/package-summary.html">Package</a></li> <li>Class</li> <li><a href="package-use.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev Package</li> <li>Next Package</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/solr/handler/extraction/package-summary.html" target="_top">Frames</a></li> <li><a href="package-summary.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 title="Package" class="title">Package&nbsp;org.apache.solr.handler.extraction</h1> <div class="docSummary"> <div class="block"><a href="../../../../../org/apache/solr/handler/extraction/ExtractingRequestHandler.html" title="class in org.apache.solr.handler.extraction"><code>ExtractingRequestHandler</code></a> and related code.</div> </div> <p>See:&nbsp;<a href="#package_description">Description</a></p> </div> <div class="contentContainer"> <ul class="blockList"> <li class="blockList"> <table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Interface Summary table, listing interfaces, and an explanation"> <caption><span>Interface Summary</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Interface</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="../../../../../org/apache/solr/handler/extraction/ExtractingMetadataConstants.html" title="interface in org.apache.solr.handler.extraction">ExtractingMetadataConstants</a></td> <td class="colLast"> <div class="block">Constants used internally by the <a href="../../../../../org/apache/solr/handler/extraction/ExtractingRequestHandler.html" title="class in org.apache.solr.handler.extraction"><code>ExtractingRequestHandler</code></a>.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../../org/apache/solr/handler/extraction/ExtractingParams.html" title="interface in org.apache.solr.handler.extraction">ExtractingParams</a></td> <td class="colLast"> <div class="block">The various Solr Parameters names to use when extracting content.</div> </td> </tr> </tbody> </table> </li> <li class="blockList"> <table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation"> <caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Class</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="../../../../../org/apache/solr/handler/extraction/ExtractingDocumentLoader.html" title="class in org.apache.solr.handler.extraction">ExtractingDocumentLoader</a></td> <td class="colLast"> <div class="block">The class responsible for loading extracted content into Solr.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../../org/apache/solr/handler/extraction/ExtractingRequestHandler.html" title="class in org.apache.solr.handler.extraction">ExtractingRequestHandler</a></td> <td class="colLast"> <div class="block">Handler for rich documents like PDF or Word or any other file format that Tika handles that need the text to be extracted first from the document.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../../org/apache/solr/handler/extraction/RegexRulesPasswordProvider.html" title="class in org.apache.solr.handler.extraction">RegexRulesPasswordProvider</a></td> <td class="colLast"> <div class="block">Password provider for Extracting request handler which finds correct password based on file name matching against a list of regular expressions.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../../../../../org/apache/solr/handler/extraction/SolrContentHandler.html" title="class in org.apache.solr.handler.extraction">SolrContentHandler</a></td> <td class="colLast"> <div class="block">The class responsible for handling Tika events and translating them into <a href="../../../../../../solr-solrj/org/apache/solr/common/SolrInputDocument.html?is-external=true" title="class or interface in org.apache.solr.common"><code>SolrInputDocument</code></a>s.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><a href="../../../../../org/apache/solr/handler/extraction/SolrContentHandlerFactory.html" title="class in org.apache.solr.handler.extraction">SolrContentHandlerFactory</a></td> <td class="colLast">&nbsp;</td> </tr> </tbody> </table> </li> </ul> <a name="package_description"> <!-- --> </a> <h2 title="Package org.apache.solr.handler.extraction Description">Package org.apache.solr.handler.extraction Description</h2> <div class="block"><a href="../../../../../org/apache/solr/handler/extraction/ExtractingRequestHandler.html" title="class in org.apache.solr.handler.extraction"><code>ExtractingRequestHandler</code></a> and related code.</div> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="../../../../../org/apache/solr/handler/extraction/package-summary.html">Package</a></li> <li>Class</li> <li><a href="package-use.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev Package</li> <li>Next Package</li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?org/apache/solr/handler/extraction/package-summary.html" target="_top">Frames</a></li> <li><a href="package-summary.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small> <i>Copyright &copy; 2000-2014 Apache Software Foundation. All Rights Reserved.</i> <script src='../../../../../prettify.js' type='text/javascript'></script> <script type='text/javascript'> (function(){ var oldonload = window.onload; if (typeof oldonload != 'function') { window.onload = prettyPrint; } else { window.onload = function() { oldonload(); prettyPrint(); } } })(); </script> </small></p> </body> </html>
{ "content_hash": "c6b6bb09f2453979bacc2f680afe662f", "timestamp": "", "source": "github", "line_count": 207, "max_line_length": 289, "avg_line_length": 42.95169082125604, "alnum_prop": 0.6561691598245417, "repo_name": "eissac/solr4sentiment", "id": "cf0e72ecda77db2868091b04f165d900b8271f8f", "size": "8891", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/solr-cell/org/apache/solr/handler/extraction/package-summary.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "125503" }, { "name": "Groff", "bytes": "4194391" }, { "name": "HTML", "bytes": "84659" }, { "name": "JavaScript", "bytes": "1019096" }, { "name": "Shell", "bytes": "78948" }, { "name": "XSLT", "bytes": "124615" } ], "symlink_target": "" }
package core.driver; import java.util.Arrays; import core.party.Dispatcher; import core.party.SearcherShell; /** * This is the entry point for the searchparty jar and will split between the * client or the server depending on the argument to the program. * @author sloscal1 * */ public class Main { public static void main(String[] args) throws Exception { boolean dispatcher = false; //See if this is a dispatcher or searcher if(args.length > 0){ dispatcher = "--dispatcher".startsWith(args[0]) || "-d".equals(args[0]); boolean dropArg = dispatcher; dropArg |= "--searcher".startsWith(args[0]) || "-s".equals(args[0]); //Ditch the parameter that is needed to switch between these if(dropArg) args = Arrays.copyOfRange(args, 1, args.length); } //Fork to the appropriate part of the program, assume Searcher if(dispatcher) Dispatcher.main(args); else SearcherShell.main(args); } }
{ "content_hash": "39a6fea72063f166d6f8929a6689943c", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 77, "avg_line_length": 26.714285714285715, "alnum_prop": 0.7005347593582888, "repo_name": "sloscal1/SearchParty", "id": "d4b26077926bb976cc3967f33f11dfd60aa44b43", "size": "1493", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "java/src/core/driver/Main.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "93389" }, { "name": "Protocol Buffer", "bytes": "7965" }, { "name": "Shell", "bytes": "3919" } ], "symlink_target": "" }
package gx.fpinscala import scala.annotation.tailrec import scala.runtime.Nothing$ /** * Created by Joe on 2016/8/26. */ object chapter03_functional_data_structures { /* EXERCISE 2: Implement the tail function for "removing" the first element of a List. */ def tail[A](xs: List[A]): List[A] = xs match { case head :: tail => tail case Nil => Nil } /* EXERCISE 3: Generalize tail to the function drop, which removes the first n elements from a list */ @tailrec def drop[A](xs: List[A], n: Int): List[A] = { if (n == 0) xs else drop(tail(xs), n - 1) } /* EXERCISE 4: Implement dropWhile, which removes elements from the List prefix as long as they match a predicate. */ @tailrec def dropWhile[A](xs: List[A])(f: A => Boolean): List[A] = xs match { case head :: tail => if (f(head)) dropWhile(tail)(f) else xs case Nil => Nil } /* EXERCISE 5: Using the same idea, implement the function setHead for replacing the first element of a List with a different value. */ def setHead[A](xs: List[A], elem: A): List[A] = xs match { case head :: tail => elem :: tail case Nil => Nil } /* EXERCISE 6: Not everything works out so nicely. Implement a function, init, which returns a consisting of all but the last element of a . */ def init[A](xs: List[A]): List[A] = xs match { case last :: Nil => Nil case head :: last => head :: init(last) case Nil => throw new UnsupportedOperationException("empty.init") } /* EXERCISE 7: Can implemented product using foldRight immediately halt the recursion and return 0.0 if it encounters a 0.0? Why or why not? */ // No, it can not. Because foldRight always traverses all elements in the list. /* EXERCISE 9: Compute the length of a list using foldRight. */ def length[A](l: List[A]): Int = { l.foldRight(0)((x, y) => y + 1) } /* EXERCISE 10: foldRight is not tail-recursive and will StackOverflow for large lists. Convince yourself that this is the case, then write another general list-recursion function, foldLeft that is tail-recursive, using the techniques we discussed in the previous chapter. */ def foldLeft[A, B](l: List[A], z: B)(f: (B, A) => B): B = l match { case Nil => z case head :: tail => foldLeft(tail, f(z, head))(f) } /* EXERCISE 11: Write sum, product, and a function to compute the length of a list using foldLeft. */ def sum(xs: List[Int]): Int = { foldLeft(xs, 0)(_ + _) } def product(xs: List[Int]): Int = { foldLeft(xs, 1)(_ * _) } def length2[A](xs: List[A]): Int = { foldLeft(xs, 0)((x, _) => x + 1) } /* EXERCISE 12: Write a function that returns the reverse of a list (so given List(1,2,3) it returns List(3,2,1)). See if you can write it using a fold. */ def reverse[A](xs: List[A]): List[A] = { foldLeft(xs, List[A]())((x, y) => y :: x) } /* EXERCISE 13 (hard): Can you write foldLeft in terms of foldRight? How about the other way around? */ def foldLeft2[A, B](xs: List[A], z: B)(f: (B, A) => B): B = { //xs.reverse.foldRight(z)((a, b) => f(b, a)) xs.foldRight((b: B) => b)((a, g) => c => g(f(c, a)))(z) } /* EXERCISE 14: Implement append in terms of either foldLeft or foldRight */ def append[A](l: List[A], r: List[A]): List[A] = { l.foldRight(r)((a, b) => a :: b) } /* EXERCISE 15 (hard): Write a function that concatenates a list of lists into a single list. Its runtime should be linear in the total length of all lists. Try to use functions we have already defined. */ def concat[A](xs: List[List[A]]): List[A] = { xs.foldRight(List[A]())(append) } /* EXERCISE 16: Write a function that transforms a list of integers by adding 1 to each element. (Reminder: this should be a pure function that returns a new List!) */ def add1(xs: List[Int]): List[Int] = { xs.map(_ + 1) } /* EXERCISE 17: Write a function that turns each value in a List[Double] into a String. */ def doubleToString(xs: List[Double]): List[String] = { xs.map(_.toString) } /* EXERCISE 18: Write a function map, that generalizes modifying each element in a list while maintaining the structure of the list. */ def map[A, B](xs: List[A])(f: A => B): List[B] = xs match { case Nil => Nil case head :: tail => f(head) :: map(tail)(f) } /* EXERCISE 19: Write a filter function that removes elements from a list unless they satisfy a given predicate. Use it to remote all odd numbers from a List[Int] */ def filter[A](xs: List[A])(f: A => Boolean): List[A] = { foldLeft(xs, List[A]())((b, a) => if (f(a)) b :+ a else b) } /* EXERCISE 20: Write a function flatMap, that works like map except that the function given will return a list instead of a single result, and that list should be inserted into the final resulting list. */ def flatMap[A, B](xs: List[A])(f: A => List[B]): List[B] = xs match { case Nil => Nil case head :: tail => f(head) ::: flatMap(tail)(f) } /* EXERCISE 21: Can you use flatMap to filter implement? */ def filter2[A](xs: List[A])(f: A => Boolean): List[A] = { flatMap(xs)(x => if (f(x)) List(x) else List()) } /* EXERCISE 22: Write a function that accepts two lists and constructs a new list by adding corresponding elements. For example, List(1,2,3) and List(4,5,6) becomes List(5,7,9) */ def addList(al: List[Int], bl: List[Int]): List[Int] = (al, bl) match { case (Nil, _) => Nil case (_, Nil) => Nil case (h1 :: t1, h2 :: t2) => (h1 + h2) :: addList(t1, t2) } /* EXERCISE 23: Generalize the function you just wrote so that it's not specific to integers or addition. */ def addListGen[A, B](al: List[A], bl: List[A])(f: (A, A) => B): List[B] = (al, bl) match { case (Nil, _) => Nil case (_, Nil) => Nil case (h1 :: t1, h2 :: t2) => f(h1, h2) :: addListGen(t1, t2)(f) } /* EXERCISE 24 (hard): As an example, implement hasSubsequence for checking whether a contains another as a subsequence. For instance, List List List(1,2,3,4) would have List(1,2) List(2,3) List(4) , , and as subsequences, among others. */ @tailrec def startWith[A](al: List[A], bl: List[A]): Boolean = (al, bl) match { case (_, Nil) => true case (Nil, _) => false case (h1 :: t1, h2 :: t2) => if (h1 == h2) startWith(t1, t2) else false } @tailrec def hasSubsequence[A](l: List[A], sub: List[A]): Boolean = (l, sub) match { case (_, Nil) => true case (Nil, _) => false case (h1 :: t1, _) => if (startWith(l, sub)) true else hasSubsequence(t1, sub) } sealed trait Tree[+A] case class Leaf[A](value: A) extends Tree[A] case class Branch[A](left: Tree[A], right: Tree[A]) extends Tree[A] /* EXERCISE 25: Write a function size that counts the number of nodes in a tree. */ def size[A](t: Tree[A]): Int = t match { case Leaf(_) => 1 case Branch(left, right) => 1 + size(left) + size(right) } /* EXERCISE 26: Write a function maximum that returns the maximum element in a Tree[Int]. */ def maximum(t: Tree[Int]): Int = t match { case Leaf(a) => a case Branch(left, right) => maximum(left) max maximum(right) } /* EXERCISE 27: Write a function depth that returns the maximum path length from the root of a tree to any leaf */ def depth[A](t: Tree[A]): Int = t match { case Leaf(a) => 0 case Branch(left, right) => 1 + (depth(left) max depth(right)) } /* EXERCISE 28: Write a map function , analogous to the method of the same name on , that modifies each element in a tree with a given function. */ def map[A, B](t: Tree[A])(f: A => B): Tree[B] = t match { case Leaf(a) => Leaf(f(a)) case Branch(left, right) => Branch(map(left)(f), map(right)(f)) } /* EXERCISE 29: Generalize size, maximum, depth and map, writing a new function fold that abstracts over their similarities. Reimplement them in terms of this more general function. */ def fold[A, B](t: Tree[A])(f: A => B)(g: (B, B) => B): B = t match { case Leaf(a) => f(a) case Branch(l, r) => g(fold(l)(f)(g), fold(r)(f)(g)) } def size2[A](t: Tree[A]): Int = { fold(t)(_ => 1)(1 + _ + _) } def maximum2(t: Tree[Int]): Int = { fold(t)(a => a)((b1, b2) => b1 max b2) } def depth2[A](t: Tree[A]): Int = { fold(t)(a => 0)((b1, b2) => 1 + (b1 max b2)) } def map2[A, B](t: Tree[A])(f: A => B): Tree[B] = { fold(t)(a => Leaf(f(a)): Tree[B])((b1, b2) => Branch(b1, b2)) } }
{ "content_hash": "b5ec3e7ba239e989d25b96bdbc0a084d", "timestamp": "", "source": "github", "line_count": 297, "max_line_length": 93, "avg_line_length": 29.410774410774412, "alnum_prop": 0.5945048654836863, "repo_name": "josephguan/fpinscala-exercise", "id": "f154ccf921e63d7f03ca2d19483edfd5c7444311", "size": "8735", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/scala/gx/fpinscala/chapter03_functional_data_structures.scala", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Scala", "bytes": "24423" } ], "symlink_target": "" }
from IPython.html.widgets import * w = TextWidget() def handle_submit(name, new): print(new) w.on_trait_change(handle_submit, 'value') w
{ "content_hash": "837831295367c0b9e04cc3072838f755", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 41, "avg_line_length": 23.333333333333332, "alnum_prop": 0.7214285714285714, "repo_name": "alexandrejaguar/strata-sv-2015-tutorial", "id": "ddf4d615b35d05689401f3ea65bba1864c5f602f", "size": "140", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "soln/on_trait_change.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "Python", "bytes": "5652" } ], "symlink_target": "" }
inbook.models.User = (function() { return Backbone.Model.extend({ urlRoot: "/users", url: function(skip) { var url = this.urlRoot; if (!this.isNew()) { url = url + "/" + encodeURIComponent(this.id); } if (!skip) { url = url + ".json"; } return url; }, free: function() { return !this.get("paid"); }, profileImage: function(type) { type || (type = "large"); var id = this.get("graph_id"), token = this.get("access_token"); return "https://graph.facebook.com/" + id + "/picture?return_ssl_resources=1&access_token=" + token + "&type=" + type; } }); }()); inbook.models.User.profileImage = function(id) { var token = inbook.currentUser.get("access_token"); return "https://graph.facebook.com/" + id + "/picture?return_ssl_resources=1&access_token=" + token + "&type=large"; };
{ "content_hash": "dddfb9350e2e53114d64c529564e6278", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 124, "avg_line_length": 24.45945945945946, "alnum_prop": 0.5558011049723757, "repo_name": "bnorton/inbook", "id": "eb49c2fd9cc797be58e90106f51cd382fe415ba5", "size": "905", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/assets/javascripts/inbook/models/user.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "10100" }, { "name": "JavaScript", "bytes": "94998" }, { "name": "Ruby", "bytes": "92856" } ], "symlink_target": "" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.6.0_34) on Tue Apr 07 13:58:18 MDT 2015 --> <title>views</title> <meta name="date" content="2015-04-07"> <link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="views"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../overview-summary.html">Overview</a></li> <li class="navBarCell1Rev">Package</li> <li>Class</li> <li><a href="package-use.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../deprecated-list.html">Deprecated</a></li> <li><a href="../index-files/index-1.html">Index</a></li> <li><a href="../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../dataManagers/package-summary.html">PREV PACKAGE</a></li> <li>NEXT PACKAGE</li> </ul> <ul class="navList"> <li><a href="../index.html?views/package-summary.html" target="_top">FRAMES</a></li> <li><a href="package-summary.html" target="_top">NO FRAMES</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <div class="header"> <h1 title="Package" class="title">Package&nbsp;views</h1> </div> <div class="contentContainer"> <ul class="blockList"> <li class="blockList"> <table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation"> <caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Class</th> <th class="colLast" scope="col">Description</th> </tr> <tbody> <tr class="altColor"> <td class="colFirst"><a href="../views/ExpandedListView.html" title="class in views">ExpandedListView</a></td> <td class="colLast"> <div class="block">ExpandedListView is the base class for <a href="../views/MultiSelectionSpinner.html" title="class in views"><code>MultiSelectionSpinner</code></a> which allow an application to expand the listview's components realized on various number of items or onto off-screen images.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><a href="../views/MultiSelectionSpinner.html" title="class in views">MultiSelectionSpinner&lt;T&gt;</a></td> <td class="colLast"> <div class="block">Implements a "MultiSelectionSpinner", when clicked it presents a dialog allowing for selection of a subset of items from a list using checkboxes.</div> </td> </tr> </tbody> </table> </li> </ul> </div> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../overview-summary.html">Overview</a></li> <li class="navBarCell1Rev">Package</li> <li>Class</li> <li><a href="package-use.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../deprecated-list.html">Deprecated</a></li> <li><a href="../index-files/index-1.html">Index</a></li> <li><a href="../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../dataManagers/package-summary.html">PREV PACKAGE</a></li> <li>NEXT PACKAGE</li> </ul> <ul class="navList"> <li><a href="../index.html?views/package-summary.html" target="_top">FRAMES</a></li> <li><a href="package-summary.html" target="_top">NO FRAMES</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "content_hash": "b9ff1b0b52aa0ce81c5ca84fbe1737bf", "timestamp": "", "source": "github", "line_count": 144, "max_line_length": 165, "avg_line_length": 33.65972222222222, "alnum_prop": 0.6511244068495977, "repo_name": "CMPUT301W15T01/Team1Project", "id": "9bfac2de52712895f4866c6527d2a04bfe096d69", "size": "4847", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/documentation/views/package-summary.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "375676" } ], "symlink_target": "" }
ACCEPTED #### According to International Plant Names Index #### Published in null #### Original name null ### Remarks null
{ "content_hash": "d8242ea3d56299a40857a7ed47949dda", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 31, "avg_line_length": 9.692307692307692, "alnum_prop": 0.7063492063492064, "repo_name": "mdoering/backbone", "id": "66155be3ed0bb77ef4d36dfd4c575606cfa5edd4", "size": "175", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Lamiales/Lamiaceae/Cedronella/Cedronella cordata/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
{% extends "base.html" %} {% load i18n %} {% block title %}{% trans "Delete debate" %}{% endblock %} {% block logo %} {% if get_place %} <a href="{{ get_place.get_absolute_url }}"><img src="{{ MEDIA_URL }}/{{ get_place.logo }}" /></a> {% endif %} {% endblock %} {% block banner %} {% if get_place %} <img src="{{ MEDIA_URL }}/{{ get_place.banner }}" /> {% endif %} {% endblock %} {% block content %} <div class="row"> <div class="span12"> <h4>{% trans "Delete debate" %}</h4> <form action="" method="post">{% csrf_token %} <p>{% trans "Are you sure you want to delete this debate? This action cannot be undone." %}</p> <hr /> <a href="{{ get_place.get_absolute_url }}" class="btn btn-small">&laquo; {% trans "Go back" %}</a> <input class="btn btn-small btn-danger" type="submit" value="{% trans 'Delete' %}" /> </form> </div> </div> {% endblock %}
{ "content_hash": "242189b99d01a99db84e98bd05818aa1", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 114, "avg_line_length": 31.625, "alnum_prop": 0.4891304347826087, "repo_name": "cidadania/e-cidadania", "id": "f0d3ac3a1c8749c76b5f01fb89027f6519a873da", "size": "1012", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/apps/ecidadania/debate/templates/debate/debate_confirm_delete.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "306436" }, { "name": "JavaScript", "bytes": "670545" }, { "name": "Python", "bytes": "489277" } ], "symlink_target": "" }
@interface REDBookCell () @property (weak, nonatomic) IBOutlet UILabel *nameLabel; @property (weak, nonatomic) IBOutlet UILabel *progressLabel; @property (weak, nonatomic) IBOutlet UILabel *percentCompletedLabel; @property (weak, nonatomic) IBOutlet UIImageView *coverImageView; @property (weak, nonatomic) IBOutlet UIImageView *heartImageView; @property (setter=injected:) id<REDTransactionManager> transactionManager; @end @implementation REDBookCell #pragma mark - override -(void)awakeFromNib { [super awakeFromNib]; self.selectionStyle = UITableViewCellSelectionStyleNone; } #pragma mark - setters -(void)setBook:(id<REDBookProtocol>)book { _book = book; //loved if ([book loved]) self.heartImageView.image = [[UIImage imageNamed:@"heart_fill"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; else self.heartImageView.image = nil; self.nameLabel.text = book.name; self.coverImageView.image = [book coverImage] ? [book coverImage] : [UIImage imageNamed:@"404"]; if ([book coverImage] == nil && [book coverURL].length > 0) { [self.coverImageView sd_setImageWithURL:[NSURL URLWithString:[book coverURL]] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { [self.transactionManager begin]; [book setCoverImage:image]; [self.transactionManager commit]; }]; } self.percentCompletedLabel.text = [NSString stringWithFormat:@"%lu%% completed", (unsigned long)[book percentage]]; if ([book completed]) { self.tintColor = [UIColor red_redColor]; self.accessoryType = UITableViewCellAccessoryCheckmark; self.progressLabel.text = [NSString stringWithFormat:@"Finished"]; } else { self.accessoryType = UITableViewCellAccessoryDisclosureIndicator; self.progressLabel.text = [NSString stringWithFormat:@"Current Page: %lu", (unsigned long)[book pagesReadValue]]; } } #pragma mark - customization @end
{ "content_hash": "db25e9ac2f7879f1d46ee29b72dd4510", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 176, "avg_line_length": 35.59649122807018, "alnum_prop": 0.7116806308526368, "repo_name": "rafagonc/Reading-List", "id": "729543527d9e6c068aa4ce7ae4abff7930ad9cdc", "size": "2303", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "ReadingList/REDBookCell.m", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "316993" }, { "name": "Ruby", "bytes": "615" } ], "symlink_target": "" }
import React from 'react'; import PropTypes from 'prop-types'; const IconButton = ({className, icon, id, onClick, title}) => { let buttonClass = 'ias-button ias-icon-button'; if (className) { buttonClass += ' ' + className; } return ( <button className={buttonClass} id={id} onClick={onClick} title={title} type="button" > <i className={`ias-icon ias-icon-${icon}`} /> </button> ); }; IconButton.propTypes = { className: PropTypes.string, icon: PropTypes.string.isRequired, id: PropTypes.string, onClick: PropTypes.func.isRequired, title: PropTypes.string.isRequired }; export default IconButton;
{ "content_hash": "d2384498ba4f419185de8f1be2391f19", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 63, "avg_line_length": 24.8, "alnum_prop": 0.581989247311828, "repo_name": "MicroFocus/CX", "id": "9fd5e1f8b48b98979551b82442bc629859b75b4f", "size": "744", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "aaf-enrollment/src/ux/IconButton.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "122592" }, { "name": "Dockerfile", "bytes": "3597" }, { "name": "HTML", "bytes": "68705" }, { "name": "JavaScript", "bytes": "516067" }, { "name": "Jsonnet", "bytes": "84637" }, { "name": "Python", "bytes": "37887" }, { "name": "Shell", "bytes": "1056" }, { "name": "TSQL", "bytes": "15975" }, { "name": "TypeScript", "bytes": "112259" } ], "symlink_target": "" }
import os import sys import shlex sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.githubpages', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] source_suffix = '.rst' # The master toctree document. master_doc = 'index' # General information about the project. project = u'gramfuzz' copyright = u'2016, James \'d0c_s4vage\' Johnson' author = u'James \'d0c_s4vage\' Johnson' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = u'{{VERSION}}' # The full version, including alpha/beta/rc tags. release = u'{{VERSION}}' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path exclude_patterns = [] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # import sphinx_rtd_theme html_theme = 'sphinx_rtd_theme' html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # # html_theme_options = {} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. htmlhelp_basename = 'gramfuzzdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # # 'preamble': '', # Latex figure (float) alignment # # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ (master_doc, 'gramfuzz.tex', u'gramfuzz Documentation', u'James \'d0c\\_s4vage\' Johnson', 'manual'), ] # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ (master_doc, 'gramfuzz', u'gramfuzz Documentation', [author], 1) ] # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ (master_doc, 'gramfuzz', u'gramfuzz Documentation', author, 'gramfuzz', 'One line description of project.', 'Miscellaneous'), ] def skip(app, what, name, obj, skip, options): if name == "__init__": return False return skip def setup(app): app.connect("autodoc-skip-member", skip)
{ "content_hash": "75e74228ee7a98371a872c07ff324a65", "timestamp": "", "source": "github", "line_count": 153, "max_line_length": 78, "avg_line_length": 29.209150326797385, "alnum_prop": 0.6587603490713806, "repo_name": "d0c-s4vage/gramfuzz", "id": "febe7c5567e5b163bddda21eec7bf54ab53fbee5", "size": "5130", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/source/conf.py", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "73132" }, { "name": "Shell", "bytes": "222" } ], "symlink_target": "" }
<?php namespace Application\Migrations; use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; /** * Auto-generated Migration: Please modify to your needs! */ class Version20141222222117 extends AbstractMigration { public function up(Schema $schema) { // this up() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->addSql('ALTER TABLE event ADD user_id INT DEFAULT NULL, CHANGE name name VARCHAR(30) NOT NULL, CHANGE slug slug VARCHAR(30) NOT NULL'); $this->addSql('ALTER TABLE event ADD CONSTRAINT FK_3BAE0AA7A76ED395 FOREIGN KEY (user_id) REFERENCES user (id)'); $this->addSql('CREATE INDEX IDX_3BAE0AA7A76ED395 ON event (user_id)'); } public function down(Schema $schema) { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->addSql('ALTER TABLE event DROP FOREIGN KEY FK_3BAE0AA7A76ED395'); $this->addSql('DROP INDEX IDX_3BAE0AA7A76ED395 ON event'); $this->addSql('ALTER TABLE event DROP user_id, CHANGE name name VARCHAR(50) NOT NULL COLLATE utf8_unicode_ci, CHANGE slug slug VARCHAR(50) NOT NULL COLLATE utf8_unicode_ci'); } }
{ "content_hash": "297b9b2a9bc7cffcd09ac31d60be07fb", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 182, "avg_line_length": 46.5, "alnum_prop": 0.7009408602150538, "repo_name": "marionlecorre/planit", "id": "d77232e9c72acfb3041092039ed714e37997c767", "size": "1488", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/DoctrineMigrations/Version20141222222117.php", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "3085" }, { "name": "CSS", "bytes": "65234" }, { "name": "JavaScript", "bytes": "145279" }, { "name": "PHP", "bytes": "461018" }, { "name": "Shell", "bytes": "522" } ], "symlink_target": "" }
<?php namespace Emayk\Ics\Repo\Transreceiveproduct; use Carbon\Carbon; use Illuminate\Support\Facades\Auth; use \Response; use \Input; class TransreceiveproductEloquent implements TransreceiveproductInterface{ protected $transreceiveproduct; function __construct(Transreceiveproduct $transreceiveproduct) { $this->transreceiveproduct = $transreceiveproduct; } /** * * Mendapatkan Record Transreceiveproduct berdasarkan ID yang diberikan * @param int $id ID Record * @return Model Record Transreceiveproduct **/ public function find($id){ return $this->transreceiveproduct->find($id); } /** * Mendapatkan Semua Transreceiveproduct * @return mixed */ public function all() { $page = \Input::get('page',1); $a_transreceiveproduct = $this->transreceiveproduct; $transreceiveproduct = \Cache::remember('transreceiveproduct'.$page,10,function() use($a_transreceiveproduct){ $limit = \Input::get('limit',1); $start = \Input::get('start',0); return $a_transreceiveproduct->skip($start)->take($limit)->get(); }); $total = $this->transreceiveproduct->count(); $transreceiveproducts = array( 'success' => true, 'results' => $transreceiveproduct->toArray(), 'total' => $total ); return Response::json($transreceiveproducts) ->setCallback(\Input::get('callback')); } /** * * Proses Simpan Transreceiveproduct * * @return mixed */ public function store() { if (!$this->hasAccess()) { return Response::json( array( 'success' => false, 'reason' => 'Action Need Login First', 'results' => null ))->setCallback(); } /*========== Sesuaikan dengan Field di table ==========*/ // $this->transreceiveproduct->name = Input::get('name'); // $this->transreceiveproduct->info = Input::get('info'); // $this->transreceiveproduct->uuid = uniqid('New_'); // $this->transreceiveproduct->createby_id = \Auth::user()->id; // $this->transreceiveproduct->lastupdateby_id = \Auth::user()->id; // $this->transreceiveproduct->created_at = new Carbon(); // $this->transreceiveproduct->updated_at = new Carbon(); $saved = $this->transreceiveproduct->save() ? true : false ; return Response::json(array( 'success' => $saved, 'results' => $this->transreceiveproduct->toArray() ))->setCallback(); } /** * Menghapus Transreceiveproduct * * @param $id * @return mixed * */ public function delete($id) { if ($this->hasAccess()) { $deleted = $this->transreceiveproduct ->find($id) ->delete(); return \Icsoutput::toJson(array( 'results' => $deleted ),$deleted); }else{ return \Icsoutput::toJson(array( 'results' => false, 'reason' => 'Dont Have Access to Delete ' ),false); } } /** * Update Informasi [[cName]] * * @param $id * @return mixed */ public function update($id) { $db = $this->transreceiveproduct->find($id); /*========== Sesuaikan ==========*/ // $db->name = Input::get('name'); // $db->info = Input::get('info'); $db->uuid = uniqid('Update_'); return ($db->save()) ? \Icsoutput::msgSuccess( $db->toArray() ) : \Icsoutput::msgError(array('reason' => 'Cannot Update')); } /** * * Apakah Sudah Login * * @return boolean * **/ protected function hasAccess() { return (!Auth::guest()); } /** * * Menampilkan Page Create data Transreceiveproduct * **/ public function create() { // TODO: Implement create() method. } /** * Menampilkan Resource * * @param int $id * @return Response */ public function show($id) { // TODO: Implement show() method. } /** * Menampilkan Data Untuk di edit * * @param int $id * @return Response */ public function edit($id) { // TODO: Implement edit() method. } /** * Remove Storage * * @param int $id * @return Response */ public function destroy($id) { return $this->delete($id); } }
{ "content_hash": "fdfa514561c764ef5817bf3b8a62d42e", "timestamp": "", "source": "github", "line_count": 189, "max_line_length": 118, "avg_line_length": 24.96825396825397, "alnum_prop": 0.5170586988768807, "repo_name": "emayk/ics", "id": "2ba4a4b3d711925b05bc40842c564b0769346821", "size": "5462", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/Emayk/Ics/Repo/Transreceiveproduct/TransreceiveproductEloquent.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "16862" }, { "name": "JavaScript", "bytes": "1830361" }, { "name": "PHP", "bytes": "1775873" }, { "name": "Shell", "bytes": "190" } ], "symlink_target": "" }
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.share.clipboard; import android.graphics.Bitmap; import android.net.Uri; import android.os.Looper; import androidx.test.filters.SmallTest; import org.hamcrest.Matchers; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.ContentUriUtils; import org.chromium.base.ContextUtils; import org.chromium.base.task.AsyncTask; import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; import org.chromium.chrome.browser.FileProviderHelper; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.components.browser_ui.share.ClipboardImageFileProvider; import org.chromium.ui.base.Clipboard; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; /** * Tests of {@link ClipboardImageFileProvider}. */ @RunWith(ChromeJUnit4ClassRunner.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class ClipboardImageFileProviderTest { @Rule public ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); private static final long WAIT_TIMEOUT_SECONDS = 30L; private static final String TEST_PNG_IMAGE_FILE_EXTENSION = ".png"; private byte[] mTestImageData; private class AsyncTaskRunnableHelper extends CallbackHelper implements Runnable { @Override public void run() { notifyCalled(); } } private void waitForAsync() throws TimeoutException { try { AsyncTaskRunnableHelper runnableHelper = new AsyncTaskRunnableHelper(); AsyncTask.SERIAL_EXECUTOR.execute(runnableHelper); runnableHelper.waitForCallback(0, 1, WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS); } catch (TimeoutException ex) { } } @Before public void setUp() { Looper.prepare(); // Clear the clipboard. Clipboard.getInstance().setText(""); Bitmap bitmap = Bitmap.createBitmap(/* width = */ 10, /* height = */ 10, Bitmap.Config.ARGB_8888); ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, /*quality = (0-100) */ 100, baos); mTestImageData = baos.toByteArray(); mActivityTestRule.startMainActivityFromLauncher(); ContentUriUtils.setFileProviderUtil(new FileProviderHelper()); } @After public void tearDown() throws TimeoutException { // Clear the clipboard. Clipboard.getInstance().setText(""); } @Test @SmallTest public void testClipboardSetImage() throws TimeoutException, IOException { Clipboard.getInstance().setImageFileProvider(new ClipboardImageFileProvider()); Clipboard.getInstance().setImage(mTestImageData, TEST_PNG_IMAGE_FILE_EXTENSION); CriteriaHelper.pollUiThread(() -> { Criteria.checkThat(Clipboard.getInstance().getImageUri(), Matchers.notNullValue()); Criteria.checkThat(Clipboard.getInstance().getImageUriIfSharedByThisApp(), Matchers.is(Clipboard.getInstance().getImageUri())); }); Uri uri = Clipboard.getInstance().getImageUri(); Assert.assertNotNull(uri); Bitmap bitmap = ApiCompatibilityUtils.getBitmapByUri( ContextUtils.getApplicationContext().getContentResolver(), uri); Assert.assertNotNull(bitmap); // Wait for the above check to complete. waitForAsync(); } }
{ "content_hash": "ffd4424bd90327ed7cb2517170da7731", "timestamp": "", "source": "github", "line_count": 114, "max_line_length": 98, "avg_line_length": 36.166666666666664, "alnum_prop": 0.7256851806936696, "repo_name": "ric2b/Vivaldi-browser", "id": "8f66542e0ad9c717829112bd010439fba66f8cb3", "size": "4123", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "chromium/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/clipboard/ClipboardImageFileProviderTest.java", "mode": "33188", "license": "bsd-3-clause", "language": [], "symlink_target": "" }
@class NSString; @interface SBDefaultWindowLayoutStrategy : NSObject <SBWindowLayoutStrategy> { } + (id)sharedInstance; - (int)jailBehavior; - (struct CGRect)frameForWindow:(id)arg1; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
{ "content_hash": "9675d98db484b9a2102d3799fccfc50c", "timestamp": "", "source": "github", "line_count": 18, "max_line_length": 76, "avg_line_length": 22.38888888888889, "alnum_prop": 0.7841191066997518, "repo_name": "iMokhles/iPhone5S-iOS8.1-SBHeaders", "id": "52b954bfa3aaa76808bab0158626449c906de9db", "size": "600", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "SBDefaultWindowLayoutStrategy.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "3780" }, { "name": "Objective-C", "bytes": "1133894" } ], "symlink_target": "" }
<mvc:View controllerName="sap.ui.rta.appVariant.manageApps.webapp.controller.ManageApps" xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core" xmlns="sap.m"> <Table id="Table1" showNoData="false" inset="false" growing="true" growingThreshold="500" items="{/appVariants}"> <columns> <Column width="6em" hAlign="Left"> <core:InvisibleText text="{i18n>MAA_DIALOG_APP_TYPE}" /> </Column> <Column width="2em" minScreenWidth="tablet" demandPopin="true" popinDisplay="WithoutHeader" hAlign="Left"> <core:InvisibleText text="{i18n>MAA_DIALOG_ICON}" /> </Column> <Column width="12em" minScreenWidth="tablet" demandPopin="true" popinDisplay="WithoutHeader" hAlign="Left"> <core:InvisibleText text="{i18n>MAA_DIALOG_TITLE_SUBTITLE}" /> </Column> <Column width="12em" minScreenWidth="tablet" demandPopin="true" popinDisplay="WithoutHeader" hAlign="Left"> <core:InvisibleText text="{i18n>MAA_DIALOG_DESCRIPTION}" /> </Column> <Column width="4em" minScreenWidth="Desktop" demandPopin="true" popinDisplay="WithoutHeader" hAlign="Center"> <core:InvisibleText text="{i18n>MAA_DIALOG_COPY_ID_ACTION}" /> </Column> <Column width="4em" minScreenWidth="Desktop" demandPopin="true" popinDisplay="WithoutHeader" hAlign="Center"> <core:InvisibleText text="{i18n>MAA_DIALOG_ADAPT_UI_ACTION}" /> </Column> <Column width="4em" minScreenWidth="Desktop" demandPopin="true" popinDisplay="WithoutHeader" hAlign="Center"> <core:InvisibleText text="{i18n>MAA_DIALOG_SAVE_AS_ACTION}" /> </Column> </columns> <items> <ColumnListItem highlight="{path: 'currentStatus', formatter:'.formatRowHighlight'}"> <cells> <ObjectIdentifier title="{typeOfApp}" text="{currentStatus}" /> <core:Icon src="{icon}" class="sapUiListTableIconSize" /> <ObjectIdentifier title="{title}" text="{subTitle}" /> <Text text="{description}" /> <Button text="{i18n>MAA_DIALOG_COPY_ID}" press="copyId"/> <Button text="{i18n>MAA_DIALOG_ADAPT_UI}" enabled="{adaptUIButtonVisibility}" press="handleUiAdaptation" visible="{isKeyUser}" /> <Button text="{i18n>MAA_DIALOG_SAVE_AS_APP}" tooltip="{i18n>TOOLTIP_MAA_DIALOG_SAVE_AS_APP}" press="saveAsAppVariant" visible="{isKeyUser}" /> </cells> </ColumnListItem> </items> </Table> </mvc:View>
{ "content_hash": "4f0c8bd43faea79795b574e70e0c6c53", "timestamp": "", "source": "github", "line_count": 88, "max_line_length": 147, "avg_line_length": 28.03409090909091, "alnum_prop": 0.6542359140656668, "repo_name": "cschuff/openui5", "id": "50e42a6ce9416ee2e77d71fab2016d25d99d661d", "size": "2467", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/sap.ui.rta/src/sap/ui/rta/appVariant/manageApps/webapp/view/ManageApps.view.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "2918722" }, { "name": "Gherkin", "bytes": "17198" }, { "name": "HTML", "bytes": "18167339" }, { "name": "Java", "bytes": "84288" }, { "name": "JavaScript", "bytes": "49673115" } ], "symlink_target": "" }
<?php /** * Crystal DBAL * * An open source application for database manipulation * * @package Crystal DBAL * @author Martin Rusev * @link http://crystal.martinrusev.net * @since Version 0.1 * @version 0.1 */ // ------------------------------------------------------------------------ class Crystal_Manipulation_Mysql_Rename { function __construct($method, $params) { $this->rename = "RENAME TABLE" . Crystal_Helper_Mysql::add_apostrophe($params[0]); $this-> rename .= "TO"; $this->rename .= Crystal_Helper_Mysql::add_apostrophe($params[1]); } public function __toString() { return $this->rename; } } //RENAME TABLE current_db.tbl_name TO other_db.tbl_name;
{ "content_hash": "8631942802ee811609d98092c8c519dc", "timestamp": "", "source": "github", "line_count": 48, "max_line_length": 89, "avg_line_length": 16.354166666666668, "alnum_prop": 0.5235668789808917, "repo_name": "MatiasNAmendola/Crystal", "id": "34d501d4c3d714950aff0516741bdde7673c75ae", "size": "785", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Crystal/Manipulation/Mysql/Rename.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3585" }, { "name": "PHP", "bytes": "1174137" } ], "symlink_target": "" }
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>The source code</title> <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="../resources/prettify/prettify.js"></script> <style type="text/css"> .highlight { display: block; background-color: #ddd; } </style> <script type="text/javascript"> function highlight() { document.getElementById(location.hash.replace(/#/, "")).className = "highlight"; } </script> </head> <body onload="prettyPrint(); highlight();"> <pre class="prettyprint lang-js">Ext.define('Ext.rtl.util.Renderable', { override: 'Ext.util.Renderable', _rtlCls: Ext.baseCSSPrefix + 'rtl', _ltrCls: Ext.baseCSSPrefix + 'ltr', // this template should be exactly the same as frameTableTple, except with the order // of right and left TD elements switched. rtlFrameTableTpl: [ '{%this.renderDockedItems(out,values,0);%}', '&lt;table id=&quot;{fgid}Table&quot; class=&quot;', Ext.plainTableCls, '&quot; cellpadding=&quot;0&quot; role=&quot;presentation&quot;&gt;', '&lt;tbody role=&quot;presentation&quot;&gt;', '&lt;tpl if=&quot;top&quot;&gt;', '&lt;tr role=&quot;presentation&quot;&gt;', '&lt;tpl if=&quot;right&quot;&gt;&lt;td id=&quot;{fgid}TR&quot; class=&quot;{frameCls}-tr {baseCls}-tr {baseCls}-{ui}-tr&lt;tpl for=&quot;uiCls&quot;&gt; {parent.baseCls}-{parent.ui}-{.}-tr&lt;/tpl&gt;{frameElCls}&quot; role=&quot;presentation&quot;&gt;&lt;/td&gt;&lt;/tpl&gt;', '&lt;td id=&quot;{fgid}TC&quot; class=&quot;{frameCls}-tc {baseCls}-tc {baseCls}-{ui}-tc&lt;tpl for=&quot;uiCls&quot;&gt; {parent.baseCls}-{parent.ui}-{.}-tc&lt;/tpl&gt;{frameElCls}&quot; role=&quot;presentation&quot;&gt;&lt;/td&gt;', '&lt;tpl if=&quot;left&quot;&gt;&lt;td id=&quot;{fgid}TL&quot; class=&quot;{frameCls}-tl {baseCls}-tl {baseCls}-{ui}-tl&lt;tpl for=&quot;uiCls&quot;&gt; {parent.baseCls}-{parent.ui}-{.}-tl&lt;/tpl&gt;{frameElCls}&quot; role=&quot;presentation&quot;&gt;&lt;/td&gt;&lt;/tpl&gt;', '&lt;/tr&gt;', '&lt;/tpl&gt;', '&lt;tr role=&quot;presentation&quot;&gt;', '&lt;tpl if=&quot;right&quot;&gt;&lt;td id=&quot;{fgid}MR&quot; class=&quot;{frameCls}-mr {baseCls}-mr {baseCls}-{ui}-mr&lt;tpl for=&quot;uiCls&quot;&gt; {parent.baseCls}-{parent.ui}-{.}-mr&lt;/tpl&gt;{frameElCls}&quot; role=&quot;presentation&quot;&gt;&lt;/td&gt;&lt;/tpl&gt;', '&lt;td id=&quot;{fgid}MC&quot; class=&quot;{frameCls}-mc {baseCls}-mc {baseCls}-{ui}-mc&lt;tpl for=&quot;uiCls&quot;&gt; {parent.baseCls}-{parent.ui}-{.}-mc&lt;/tpl&gt;{frameElCls}&quot; role=&quot;presentation&quot;&gt;', '{%this.applyRenderTpl(out, values)%}', '&lt;/td&gt;', '&lt;tpl if=&quot;left&quot;&gt;&lt;td id=&quot;{fgid}ML&quot; class=&quot;{frameCls}-ml {baseCls}-ml {baseCls}-{ui}-ml&lt;tpl for=&quot;uiCls&quot;&gt; {parent.baseCls}-{parent.ui}-{.}-ml&lt;/tpl&gt;{frameElCls}&quot; role=&quot;presentation&quot;&gt;&lt;/td&gt;&lt;/tpl&gt;', '&lt;/tr&gt;', '&lt;tpl if=&quot;bottom&quot;&gt;', '&lt;tr role=&quot;presentation&quot;&gt;', '&lt;tpl if=&quot;right&quot;&gt;&lt;td id=&quot;{fgid}BR&quot; class=&quot;{frameCls}-br {baseCls}-br {baseCls}-{ui}-br&lt;tpl for=&quot;uiCls&quot;&gt; {parent.baseCls}-{parent.ui}-{.}-br&lt;/tpl&gt;{frameElCls}&quot; role=&quot;presentation&quot;&gt;&lt;/td&gt;&lt;/tpl&gt;', '&lt;td id=&quot;{fgid}BC&quot; class=&quot;{frameCls}-bc {baseCls}-bc {baseCls}-{ui}-bc&lt;tpl for=&quot;uiCls&quot;&gt; {parent.baseCls}-{parent.ui}-{.}-bc&lt;/tpl&gt;{frameElCls}&quot; role=&quot;presentation&quot;&gt;&lt;/td&gt;', '&lt;tpl if=&quot;left&quot;&gt;&lt;td id=&quot;{fgid}BL&quot; class=&quot;{frameCls}-bl {baseCls}-bl {baseCls}-{ui}-bl&lt;tpl for=&quot;uiCls&quot;&gt; {parent.baseCls}-{parent.ui}-{.}-bl&lt;/tpl&gt;{frameElCls}&quot; role=&quot;presentation&quot;&gt;&lt;/td&gt;&lt;/tpl&gt;', '&lt;/tr&gt;', '&lt;/tpl&gt;', '&lt;/tbody&gt;&lt;/table&gt;', '{%this.renderDockedItems(out,values,1);%}' ], beforeRender: function() { var rtl = this.getHierarchyState().rtl; if (rtl) { this.addCls(this._rtlCls); } else if (rtl === false) { this.addCls(this._ltrCls); } this.callParent(); }, getFrameTpl: function(table) { return (table &amp;&amp; this.getHierarchyState().rtl) ? this.getTpl('rtlFrameTableTpl') : this.callParent(arguments); }, initRenderData: function() { var me = this, renderData = me.callParent(), rtlCls = me._rtlCls; if (rtlCls &amp;&amp; me.getHierarchyState().rtl) { renderData.childElCls = ' ' + rtlCls; } return renderData; }, getFrameRenderData: function () { var me = this, data = me.callParent(), rtlCls = me._rtlCls; if (rtlCls &amp;&amp; me.getHierarchyState().rtl) { data.frameElCls = ' ' + rtlCls; } return data; } }); </pre> </body> </html>
{ "content_hash": "cf9c7c311e7c8cde767f5729a5b9561d", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 298, "avg_line_length": 55.649484536082475, "alnum_prop": 0.5891070766950722, "repo_name": "zhench/learnExt", "id": "9dfb2bb33ea5025f2499f930c385f6e5d2a0a678", "size": "5398", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "extjs4/docs/source/Renderable.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "18611606" }, { "name": "HTML", "bytes": "10358505" }, { "name": "JavaScript", "bytes": "86764363" }, { "name": "PHP", "bytes": "85028" }, { "name": "Python", "bytes": "2505" }, { "name": "Ruby", "bytes": "10284" } ], "symlink_target": "" }
"""Implementations of `ClientData` backed by a file system.""" from collections.abc import Callable, Mapping import os.path import tensorflow as tf from tensorflow_federated.python.common_libs import py_typecheck from tensorflow_federated.python.simulation.datasets import client_data from tensorflow_federated.python.tensorflow_libs import tensor_utils class FilePerUserClientData(client_data.ClientData): """A `tff.simulation.datasets.ClientData` that maps a set of files to a dataset. This mapping is restricted to one file per user. """ def __init__(self, client_ids_to_files: Mapping[str, str], dataset_fn: Callable[[str], tf.data.Dataset]): """Constructs a `tff.simulation.datasets.ClientData` object. Args: client_ids_to_files: A mapping from string client IDs to filepaths containing the user's data. dataset_fn: A factory function that takes a filepath (must accept both strings and tensors) and returns a `tf.data.Dataset` corresponding to this path. """ py_typecheck.check_type(client_ids_to_files, Mapping) if not client_ids_to_files: raise ValueError('`client_ids` must have at least one client ID') py_typecheck.check_callable(dataset_fn) self._client_ids = sorted(client_ids_to_files.keys()) # Creates a dataset in a manner that can be serialized by TF. def serializable_dataset_fn(client_id: str) -> tf.data.Dataset: client_ids_to_path = tf.lookup.StaticHashTable( tf.lookup.KeyValueTensorInitializer( list(client_ids_to_files.keys()), list(client_ids_to_files.values())), '') client_path = client_ids_to_path.lookup(client_id) return dataset_fn(client_path) self._serializable_dataset_fn = serializable_dataset_fn tf_dataset = serializable_dataset_fn(tf.constant(self._client_ids[0])) self._element_type_structure = tf_dataset.element_spec @property def serializable_dataset_fn(self): """Creates a `tf.data.Dataset` for a client in a TF-serializable manner.""" return self._serializable_dataset_fn @property def client_ids(self): return self._client_ids def create_tf_dataset_for_client(self, client_id: str) -> tf.data.Dataset: """Creates a new `tf.data.Dataset` containing the client training examples. This function will create a dataset for a given client if `client_id` is contained in the `client_ids` property of the `FilePerUserClientData`. Unlike `self.serializable_dataset_fn`, this method is not serializable. Args: client_id: The string identifier for the desired client. Returns: A `tf.data.Dataset` object. """ if client_id not in self.client_ids: raise ValueError( 'ID [{i}] is not a client in this ClientData. See ' 'property `client_ids` for the list of valid ids.'.format( i=client_id)) client_dataset = self.serializable_dataset_fn(tf.constant(client_id)) tensor_utils.check_nested_equal(client_dataset.element_spec, self._element_type_structure) return client_dataset @property def element_type_structure(self): return self._element_type_structure @classmethod def create_from_dir(cls, path, create_tf_dataset_fn=tf.data.TFRecordDataset): """Builds a `tff.simulation.datasets.FilePerUserClientData`. Iterates over all files in `path`, using the filename as the client ID. Does not recursively search `path`. Args: path: A directory path to search for per-client files. create_tf_dataset_fn: A callable that creates a `tf.data.Datasaet` object for a given file in the directory specified in `path`. Returns: A `tff.simulation.datasets.FilePerUserClientData` object. """ client_ids_to_paths_dict = { filename: os.path.join(path, filename) for filename in tf.io.gfile.listdir(path) } return FilePerUserClientData(client_ids_to_paths_dict, create_tf_dataset_fn)
{ "content_hash": "f7ab19e0b0ed308c426c100b90eecb2b", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 82, "avg_line_length": 37.6822429906542, "alnum_prop": 0.6941964285714286, "repo_name": "tensorflow/federated", "id": "7f4f13964e2785cf030b962e4edec6aade7bed6b", "size": "4631", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "tensorflow_federated/python/simulation/datasets/file_per_user_client_data.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C++", "bytes": "729470" }, { "name": "Dockerfile", "bytes": "1983" }, { "name": "Python", "bytes": "6700736" }, { "name": "Shell", "bytes": "7123" }, { "name": "Starlark", "bytes": "387382" } ], "symlink_target": "" }
package org.camunda.bpm.engine.impl.cmd; import org.camunda.bpm.application.ProcessApplicationReference; import org.camunda.bpm.engine.impl.cfg.CommandChecker; import org.camunda.bpm.engine.impl.context.Context; import org.camunda.bpm.engine.impl.interceptor.Command; import org.camunda.bpm.engine.impl.interceptor.CommandContext; /** * @author Daniel Meyer * */ public class GetProcessApplicationForDeploymentCmd implements Command<String> { protected String deploymentId; public GetProcessApplicationForDeploymentCmd(String deploymentId) { this.deploymentId = deploymentId; } public String execute(CommandContext commandContext) { commandContext.getAuthorizationManager().checkCamundaAdminOrPermission(CommandChecker::checkReadProcessApplicationForDeployment); ProcessApplicationReference reference = Context.getProcessEngineConfiguration() .getProcessApplicationManager() .getProcessApplicationForDeployment(deploymentId); if(reference != null) { return reference.getName(); } else { return null; } } }
{ "content_hash": "04ae273bdde90022bbea1ce9964eb7e4", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 133, "avg_line_length": 29.88888888888889, "alnum_prop": 0.7881040892193308, "repo_name": "ingorichtsmeier/camunda-bpm-platform", "id": "5ab2384b9ef5e2d03a4b008c609972ddfcfdbf80", "size": "1883", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "engine/src/main/java/org/camunda/bpm/engine/impl/cmd/GetProcessApplicationForDeploymentCmd.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "8608" }, { "name": "CSS", "bytes": "5486" }, { "name": "Fluent", "bytes": "3111" }, { "name": "FreeMarker", "bytes": "1442812" }, { "name": "Groovy", "bytes": "1904" }, { "name": "HTML", "bytes": "961289" }, { "name": "Java", "bytes": "44047866" }, { "name": "JavaScript", "bytes": "3063613" }, { "name": "Less", "bytes": "154956" }, { "name": "Python", "bytes": "192" }, { "name": "Ruby", "bytes": "60" }, { "name": "SQLPL", "bytes": "44180" }, { "name": "Shell", "bytes": "11634" } ], "symlink_target": "" }
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>HistoryLike | @uirouter/core</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../assets/css/main.css"> <link rel="stylesheet" href="../assets/css/uirouter.css"> <script src="../assets/js/modernizr.js"></script> <script src="../assets/js/reset.js"></script> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="../index.html" class="title">@uirouter/core</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <!-- <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> --> <input type="checkbox" id="tsd-filter-externals" checked /> <label class="tsd-widget" for="tsd-filter-externals">Internal UI-Router API</label> <!-- <input type="checkbox" id="tsd-filter-only-exported" /> <label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label> --> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <ul class="tsd-breadcrumb"> <li> <a href="../index.html">@uirouter/core</a> </li> <li> <a href="../modules/vanilla.html">vanilla</a> </li> <li> <a href="vanilla.historylike.html">HistoryLike</a> </li> </ul> <h1>Interface HistoryLike</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <section class="tsd-panel tsd-hierarchy"> <h3>Hierarchy</h3> <ul class="tsd-hierarchy"> <li> <span class="target">HistoryLike</span> </li> </ul> </section> <section class="tsd-panel-group tsd-index-group"> <h2>Index</h2> <section class="tsd-panel tsd-index-panel"> <div class="tsd-index-content"> <section class="tsd-index-section tsd-is-external"> <h3>Methods</h3> <ul class="tsd-index-list"> <li class="tsd-kind-method tsd-parent-kind-interface tsd-is-external"><a href="vanilla.historylike.html#back" class="tsd-kind-icon">back</a></li> <li class="tsd-kind-method tsd-parent-kind-interface tsd-is-external"><a href="vanilla.historylike.html#forward" class="tsd-kind-icon">forward</a></li> <li class="tsd-kind-method tsd-parent-kind-interface tsd-is-external"><a href="vanilla.historylike.html#pushstate" class="tsd-kind-icon">push<wbr>State</a></li> <li class="tsd-kind-method tsd-parent-kind-interface tsd-is-external"><a href="vanilla.historylike.html#replacestate" class="tsd-kind-icon">replace<wbr>State</a></li> </ul> </section> </div> </section> </section> <section class="tsd-panel-group tsd-member-group tsd-is-external"> <h2>Methods</h2> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <a name="back" class="tsd-anchor"></a> <!-- <h3>back</h3> --> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <li class="tsd-signature tsd-kind-icon">back<span class="tsd-signature-symbol">(</span>distance<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>distance: <span class="tsd-flag ts-flagOptional">Optional</span>&nbsp; <span class="tsd-signature-type">any</span></h5> </li> </ul> <div class="tsd-returns"> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </div> <hr> <aside class="tsd-sources"> <ul> <li>Defined in private/var/folders/4n/ys7v20b52y9gyyx7kfdb93580000gp/T/tmp-16028wEw5zOIy63UQ/ui-router-core/src/vanilla/interface.ts:23</li> </ul> </aside> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <a name="forward" class="tsd-anchor"></a> <!-- <h3>forward</h3> --> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <li class="tsd-signature tsd-kind-icon">forward<span class="tsd-signature-symbol">(</span>distance<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>distance: <span class="tsd-flag ts-flagOptional">Optional</span>&nbsp; <span class="tsd-signature-type">any</span></h5> </li> </ul> <div class="tsd-returns"> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </div> <hr> <aside class="tsd-sources"> <ul> <li>Defined in private/var/folders/4n/ys7v20b52y9gyyx7kfdb93580000gp/T/tmp-16028wEw5zOIy63UQ/ui-router-core/src/vanilla/interface.ts:24</li> </ul> </aside> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <a name="pushstate" class="tsd-anchor"></a> <!-- <h3>push<wbr>State</h3> --> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <li class="tsd-signature tsd-kind-icon">push<wbr>State<span class="tsd-signature-symbol">(</span>statedata<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, title<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, url<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>statedata <span class="tsd-signature-type">any</span></h5> </li> <li> <h5>title: <span class="tsd-flag ts-flagOptional">Optional</span>&nbsp; <span class="tsd-signature-type">string</span></h5> </li> <li> <h5>url: <span class="tsd-flag ts-flagOptional">Optional</span>&nbsp; <span class="tsd-signature-type">string</span></h5> </li> </ul> <div class="tsd-returns"> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </div> <hr> <aside class="tsd-sources"> <ul> <li>Defined in private/var/folders/4n/ys7v20b52y9gyyx7kfdb93580000gp/T/tmp-16028wEw5zOIy63UQ/ui-router-core/src/vanilla/interface.ts:25</li> </ul> </aside> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <a name="replacestate" class="tsd-anchor"></a> <!-- <h3>replace<wbr>State</h3> --> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <li class="tsd-signature tsd-kind-icon">replace<wbr>State<span class="tsd-signature-symbol">(</span>statedata<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span>, title<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span>, url<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>statedata <span class="tsd-signature-type">any</span></h5> </li> <li> <h5>title: <span class="tsd-flag ts-flagOptional">Optional</span>&nbsp; <span class="tsd-signature-type">string</span></h5> </li> <li> <h5>url: <span class="tsd-flag ts-flagOptional">Optional</span>&nbsp; <span class="tsd-signature-type">string</span></h5> </li> </ul> <div class="tsd-returns"> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </div> <hr> <aside class="tsd-sources"> <ul> <li>Defined in private/var/folders/4n/ys7v20b52y9gyyx7kfdb93580000gp/T/tmp-16028wEw5zOIy63UQ/ui-router-core/src/vanilla/interface.ts:26</li> </ul> </aside> </li> </ul> </section> </section> </div> <div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <nav class="tsd-navigation primary"> <ul> <li class="globals "> <a href="../index.html"><em>@uirouter/core</em></a> </li> <li class="label tsd-is-external"> <span>Public API</span> </li> <li class=" tsd-kind-external-module"> <a href="../modules/common.html">common</a> </li> <li class=" tsd-kind-external-module"> <a href="../modules/core.html">core</a> </li> <li class=" tsd-kind-external-module"> <a href="../modules/params.html">params</a> </li> <li class=" tsd-kind-external-module"> <a href="../modules/resolve.html">resolve</a> </li> <li class=" tsd-kind-external-module"> <a href="../modules/state.html">state</a> </li> <li class=" tsd-kind-external-module"> <a href="../modules/transition.html">transition</a> </li> <li class=" tsd-kind-external-module"> <a href="../modules/url.html">url</a> </li> <li class=" tsd-kind-external-module"> <a href="../modules/view.html">view</a> </li> <li class="label tsd-is-external"> <span>Internal UI-<wbr><wbr>Router API</span> </li> <li class=" tsd-kind-external-module tsd-is-external"> <a href="../modules/_common_safeconsole_.html">&quot;common/safe<wbr>Console&quot;</a> </li> <li class=" tsd-kind-external-module tsd-is-external"> <a href="../modules/_common_trace_.html">&quot;common/trace&quot;</a> </li> <li class=" tsd-kind-external-module tsd-is-external"> <a href="../modules/common_hof.html">common_<wbr>hof</a> </li> <li class=" tsd-kind-external-module tsd-is-external"> <a href="../modules/common_predicates.html">common_<wbr>predicates</a> </li> <li class=" tsd-kind-external-module tsd-is-external"> <a href="../modules/common_strings.html">common_<wbr>strings</a> </li> <li class=" tsd-kind-external-module tsd-is-external"> <a href="../modules/hooks.html">hooks</a> </li> <li class=" tsd-kind-external-module tsd-is-external"> <a href="../modules/path.html">path</a> </li> <li class="current tsd-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html">vanilla</a> </li> </ul> </nav> <nav class="tsd-navigation secondary menu-sticky"> <ul class="before-current"> <li class=" tsd-kind-class tsd-parent-kind-external-module tsd-is-external"> <a href="../classes/vanilla.baselocationservices.html" class="tsd-kind-icon">Base<wbr>Location<wbr>Services</a> </li> <li class=" tsd-kind-class tsd-parent-kind-external-module tsd-is-external"> <a href="../classes/vanilla.browserlocationconfig.html" class="tsd-kind-icon">Browser<wbr>Location<wbr>Config</a> </li> <li class=" tsd-kind-class tsd-parent-kind-external-module tsd-is-external"> <a href="../classes/vanilla.hashlocationservice.html" class="tsd-kind-icon">Hash<wbr>Location<wbr>Service</a> </li> <li class=" tsd-kind-class tsd-parent-kind-external-module tsd-is-external"> <a href="../classes/vanilla.memorylocationconfig.html" class="tsd-kind-icon">Memory<wbr>Location<wbr>Config</a> </li> <li class=" tsd-kind-class tsd-parent-kind-external-module tsd-is-external"> <a href="../classes/vanilla.memorylocationservice.html" class="tsd-kind-icon">Memory<wbr>Location<wbr>Service</a> </li> <li class=" tsd-kind-class tsd-parent-kind-external-module tsd-is-external"> <a href="../classes/vanilla.pushstatelocationservice.html" class="tsd-kind-icon">Push<wbr>State<wbr>Location<wbr>Service</a> </li> </ul> <ul class="current"> <li class="current tsd-kind-interface tsd-parent-kind-external-module tsd-is-external"> <a href="vanilla.historylike.html" class="tsd-kind-icon">History<wbr>Like</a> <ul> <li class=" tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <a href="vanilla.historylike.html#back" class="tsd-kind-icon">back</a> </li> <li class=" tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <a href="vanilla.historylike.html#forward" class="tsd-kind-icon">forward</a> </li> <li class=" tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <a href="vanilla.historylike.html#pushstate" class="tsd-kind-icon">push<wbr>State</a> </li> <li class=" tsd-kind-method tsd-parent-kind-interface tsd-is-external"> <a href="vanilla.historylike.html#replacestate" class="tsd-kind-icon">replace<wbr>State</a> </li> </ul> </li> </ul> <ul class="after-current"> <li class=" tsd-kind-interface tsd-parent-kind-external-module tsd-is-external"> <a href="vanilla.locationlike.html" class="tsd-kind-icon">Location<wbr>Like</a> </li> <li class=" tsd-kind-interface tsd-parent-kind-external-module tsd-is-external"> <a href="vanilla.locationplugin.html" class="tsd-kind-icon">Location<wbr>Plugin</a> </li> <li class=" tsd-kind-interface tsd-parent-kind-external-module tsd-is-external"> <a href="vanilla.servicesplugin.html" class="tsd-kind-icon">Services<wbr>Plugin</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html#_injector" class="tsd-kind-icon">$injector</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html#_q" class="tsd-kind-icon">$q</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-external tsd-is-not-exported"> <a href="../modules/vanilla.html#argument_names" class="tsd-kind-icon">ARGUMENT_<wbr>NAMES</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-external tsd-is-not-exported"> <a href="../modules/vanilla.html#strip_comments" class="tsd-kind-icon">STRIP_<wbr>COMMENTS</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-external tsd-is-not-exported"> <a href="../modules/vanilla.html#globals" class="tsd-kind-icon">globals</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html#hashlocationplugin" class="tsd-kind-icon">hash<wbr>Location<wbr>Plugin</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html#memorylocationplugin" class="tsd-kind-icon">memory<wbr>Location<wbr>Plugin</a> </li> <li class=" tsd-kind-variable tsd-parent-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html#pushstatelocationplugin" class="tsd-kind-icon">push<wbr>State<wbr>Location<wbr>Plugin</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html#buildurl" class="tsd-kind-icon">build<wbr>Url</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html#getparams" class="tsd-kind-icon">get<wbr>Params</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html#keyvalstoobjectr" class="tsd-kind-icon">key<wbr>Vals<wbr>ToObjectR</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html#locationpluginfactory" class="tsd-kind-icon">location<wbr>Plugin<wbr>Factory</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html#parseurl" class="tsd-kind-icon">parse<wbr>Url</a> </li> <li class=" tsd-kind-function tsd-parent-kind-external-module tsd-is-external"> <a href="../modules/vanilla.html#servicesplugin-1" class="tsd-kind-icon">services<wbr>Plugin</a> </li> </ul> </nav> </div> </div> </div> <footer class="with-border-bottom"> <div class="container"> <h2>Legend</h2> <div class="tsd-legend-group"> <ul class="tsd-legend"> <li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li> <li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li> <li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li> <li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li> <li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li> <li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li> <li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li> <li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li> <li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li> <li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li> <li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li> <li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li> <li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li> <li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li> <li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li> <li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li> </ul> </div> </div> </footer> <div class="container tsd-generator"> <p>Generated using <a href="http://typedoc.io" target="_blank">TypeDoc</a></p> </div> <div class="overlay"></div> <script src="../assets/js/main.js"></script> <script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script> </body> </html>
{ "content_hash": "80e497638dd43d4af8a9096180bd5b6e", "timestamp": "", "source": "github", "line_count": 453, "max_line_length": 532, "avg_line_length": 52.38852097130243, "alnum_prop": 0.638715658183044, "repo_name": "ui-router/ui-router.github.io", "id": "05ee599ccf67bd68ad8492d9b22fd671d359c2fc", "size": "23740", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "_core_docs/6.0.2/interfaces/vanilla.historylike.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "4640890" }, { "name": "HTML", "bytes": "276915023" }, { "name": "JavaScript", "bytes": "831953" }, { "name": "Ruby", "bytes": "140" }, { "name": "SCSS", "bytes": "66332" }, { "name": "Shell", "bytes": "5090" } ], "symlink_target": "" }
CodePath iOS Bootcamp Twitter client - Part 2 This is a basic twitter app to read and compose tweets the [Twitter API](https://apps.twitter.com/). Time spent: 12 hours ### Features #### Required - [x] Hamburger menu - [x] Dragging anywhere in the view should reveal the menu. - [x] The menu should include links to your profile, the home timeline, and the mentions view. - [x] The menu can look similar to the LinkedIn menu below or feel free to take liberty with the UI. - [x] Profile page - [x] Contains the user header view - [x] Contains a section with the users basic stats: # tweets, # following, # followers - [ ] Optional: Implement the paging view for the user description. - [ ] Optional: As the paging view moves, increase the opacity of the background screen. See the actual Twitter app for this effect - [ ] Optional: Pulling down the profile page should blur and resize the header image. - [x] Home Timeline - [x] Tapping on a user image should bring up that user's profile page - [ ] Optional: Account switching - [ ] Long press on tab bar to bring up Account view with animation - [ ] Tap account to switch to - [ ] Include a plus button to Add an Account - [ ] Swipe to delete an account ![Video Walkthrough](walkthrough2.gif) # Previous Version: Time spent: 15 hours ### Features #### Required - [x] User can sign in using OAuth login flow - [x] User can view last 20 tweets from their home timeline - [x] The current signed in user will be persisted across restarts - [x] In the home timeline, user can view tweet with the user profile picture, username, tweet text, and timestamp. In other words, design the custom cell with the proper Auto Layout settings. You will also need to augment the model classes. - [x] User can pull to refresh - [x] User can compose a new tweet by tapping on a compose button. - [x] User can tap on a tweet to view it, with controls to retweet, favorite, and reply. - [x] User can retweet, favorite, and reply to the tweet directly from the timeline feed. #### Optional - [x] When composing, you should have a countdown in the upper right for the tweet limit. - [ ] After creating a new tweet, a user should be able to view it in the timeline immediately without refetching the timeline from the network. - [x] Retweeting and favoriting should increment the retweet and favorite count. - [1/2] User should be able to unretweet and unfavorite and should decrement the retweet and favorite count. - [ ] Replies should be prefixed with the username and the reply_id should be set when posting the tweet, - [ ] User can load more tweets once they reach the bottom of the feed using infinite loading similar to the actual Twitter client. ### Walkthrough ![Video Walkthrough](walkthrough.gif)
{ "content_hash": "47730dc7bc650e92e1a0060860a7b1e0", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 243, "avg_line_length": 44.15873015873016, "alnum_prop": 0.7368799424874192, "repo_name": "asp2insp/Twittercism", "id": "32912f42aa7bc40bbf40a37272e573e8827b94bf", "size": "2796", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "530" }, { "name": "Objective-C", "bytes": "61876" }, { "name": "Ruby", "bytes": "51" }, { "name": "Swift", "bytes": "70817" } ], "symlink_target": "" }
Tools (:py:mod:`indra.tools`) ============================= Run assembly components in a pipeline (:py:mod:`indra.tools.assemble_corpus`) ----------------------------------------------------------------------------- .. automodule:: indra.tools.assemble_corpus :members: Real-time feedback for assembly (:py:mod:`indra.tools.live_curation`) --------------------------------------------------------------------- .. automodule:: indra.tools.live_curation :members: Build a network from a gene list (:py:mod:`indra.tools.gene_network`) --------------------------------------------------------------------- .. automodule:: indra.tools.gene_network :members: Build an executable model from a fragment of a large network (:py:mod:`indra.tools.executable_subnetwork`) ---------------------------------------------------------------------------------------------------------- .. automodule:: indra.tools.executable_subnetwork :members: Build a model incrementally over time (:py:mod:`indra.tools.incremental_model`) ------------------------------------------------------------------------------- .. automodule:: indra.tools.incremental_model :members: The RAS Machine (:py:mod:`indra.tools.machine`) ----------------------------------------------- .. automodule:: indra.tools.machine :members: High-throughput Reading Tools (:py:mod:`indra.tools.reading`) ------------------------------------------------------------- .. toctree:: :maxdepth: 3 reading/pipelines reading/interfaces reading/tools reading/utils
{ "content_hash": "33adc1e486726ab828fb5ee750040cd0", "timestamp": "", "source": "github", "line_count": 51, "max_line_length": 106, "avg_line_length": 30.50980392156863, "alnum_prop": 0.47107969151670953, "repo_name": "pvtodorov/indra", "id": "6acb752bae4089c9d374fbae0e031aaaaa273ca3", "size": "1556", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "doc/modules/tools/index.rst", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "CSS", "bytes": "169" }, { "name": "HTML", "bytes": "17236" }, { "name": "JavaScript", "bytes": "72960" }, { "name": "Python", "bytes": "2660313" }, { "name": "Shell", "bytes": "381" } ], "symlink_target": "" }
'use strict' /* eslint-env mocha */ const chai = require('chai') const dirtyChai = require('dirty-chai') const expect = chai.expect chai.use(dirtyChai) const TCP = require('libp2p-tcp') const Connection = require('interface-connection').Connection const multiaddr = require('multiaddr') const pull = require('pull-stream') const parallel = require('run-parallel') const spdy = require('../src') describe('conn properties are propagated to each stream', () => { let lMuxer let dMuxer let dConn let listener before(() => { const dtcp = new TCP() const ltcp = new TCP() const ma = multiaddr('/ip4/127.0.0.1/tcp/9876') listener = ltcp.createListener((conn) => { lMuxer = spdy.listener(conn) lMuxer.on('stream', (conn) => { pull(conn, conn) }) }) listener.listen(ma) dConn = dtcp.dial(ma) dMuxer = spdy.dialer(dConn) }) after((done) => { listener.close(done) }) it('getObservedAddrs', (done) => { let oa1 let oa2 parallel([ (cb) => { const conn = dMuxer.newStream() conn.getObservedAddrs((err, addrs) => { expect(err).to.not.exist() oa1 = addrs pull(pull.empty(), conn, pull.onEnd(cb)) }) }, (cb) => { dConn.getObservedAddrs((err, addrs) => { expect(err).to.not.exist() oa2 = addrs cb() }) } ], () => { expect(oa1).to.deep.equal(oa2) done() }) }) it('getPeerInfo yields error', (done) => { const conn = dMuxer.newStream() conn.getPeerInfo((err, pInfo) => { expect(err).to.exist() pull(pull.empty(), conn, pull.onEnd(done)) }) }) it('setPeerInfo on muxedConn, verify that it is the same on conn', (done) => { const conn = dMuxer.newStream() conn.setPeerInfo('banana') parallel([ (cb) => { conn.getPeerInfo((err, pInfo) => { expect(err).to.not.exist() expect(pInfo).to.equal('banana') pull(pull.empty(), conn, pull.onEnd(cb)) }) }, (cb) => { dConn.getPeerInfo((err, pInfo) => { expect(err).to.not.exist() expect(pInfo).to.equal('banana') cb() }) } ], done) }) it('wrap the muxed stream in another Conn, see how everything still trickles', (done) => { const conn = dMuxer.newStream() const proxyConn = new Connection(conn) proxyConn.getPeerInfo((err, pInfo) => { expect(err).to.not.exist() expect(pInfo).to.equal('banana') pull(pull.empty(), conn, pull.onEnd(done)) }) }) it('open several streams, see how they all pack the same info', (done) => { const conn1 = dMuxer.newStream() const conn2 = dMuxer.newStream() const conn3 = dMuxer.newStream() const conn4 = dMuxer.newStream() parallel([ (cb) => { conn1.getPeerInfo((err, pInfo) => { expect(err).to.not.exist() expect(pInfo).to.equal('banana') pull(pull.empty(), conn1, pull.onEnd(cb)) }) }, (cb) => { conn2.getPeerInfo((err, pInfo) => { expect(err).to.not.exist() expect(pInfo).to.equal('banana') pull(pull.empty(), conn2, pull.onEnd(cb)) }) }, (cb) => { conn3.getPeerInfo((err, pInfo) => { expect(err).to.not.exist() expect(pInfo).to.equal('banana') pull(pull.empty(), conn3, pull.onEnd(cb)) }) }, (cb) => { conn4.getPeerInfo((err, pInfo) => { expect(err).to.not.exist() expect(pInfo).to.equal('banana') pull(pull.empty(), conn4, pull.onEnd(cb)) }) } ], done) }) it('setPeerInfo on conn, verify that it is the same on muxedConn', (done) => { const conn = dMuxer.newStream() dConn.setPeerInfo('pineapple') parallel([ (cb) => { conn.getPeerInfo((err, pInfo) => { expect(err).to.not.exist() expect(pInfo).to.equal('pineapple') pull(pull.empty(), conn, pull.onEnd(cb)) }) }, (cb) => { dConn.getPeerInfo((err, pInfo) => { expect(err).to.not.exist() expect(pInfo).to.equal('pineapple') cb() }) } ], done) }) })
{ "content_hash": "61740979f9455c052d25b4d25c13c13e", "timestamp": "", "source": "github", "line_count": 165, "max_line_length": 92, "avg_line_length": 26.072727272727274, "alnum_prop": 0.5364946536494654, "repo_name": "diasdavid/node-libp2p-spdy", "id": "b0a4efd30ce0c63000ec3c449b8099df97091d7d", "size": "4302", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "test/conn-properties.node.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "2289" } ], "symlink_target": "" }
package org.apache.flink.table.runtime.sort; import org.apache.flink.runtime.checkpoint.OperatorSubtaskState; import org.apache.flink.streaming.api.watermark.Watermark; import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness; import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness; import org.apache.flink.table.dataformat.BaseRow; import org.apache.flink.table.generated.GeneratedRecordComparator; import org.apache.flink.table.generated.RecordComparator; import org.apache.flink.table.runtime.keyselector.NullBinaryRowKeySelector; import org.apache.flink.table.runtime.util.BaseRowHarnessAssertor; import org.apache.flink.table.types.logical.BigIntType; import org.apache.flink.table.types.logical.IntType; import org.apache.flink.table.types.logical.VarCharType; import org.apache.flink.table.typeutils.BaseRowTypeInfo; import org.junit.Test; import java.util.ArrayList; import java.util.List; import static org.apache.flink.table.runtime.util.StreamRecordUtils.record; /** * Tests for {@link RowTimeSortOperator}. */ public class RowTimeSortOperatorTest { @Test public void testSortOnTwoFields() throws Exception { BaseRowTypeInfo inputRowType = new BaseRowTypeInfo( new IntType(), new BigIntType(), new VarCharType(VarCharType.MAX_LENGTH), new IntType()); // Note: RowTimeIdx must be 0 in product environment, the value is 1 here just for simplify the testing int rowTimeIdx = 1; GeneratedRecordComparator gComparator = new GeneratedRecordComparator("", "", new Object[0]) { private static final long serialVersionUID = -6067266199060901331L; @Override public RecordComparator newInstance(ClassLoader classLoader) { return IntRecordComparator.INSTANCE; } }; BaseRowHarnessAssertor assertor = new BaseRowHarnessAssertor(inputRowType.getFieldTypes()); RowTimeSortOperator operator = createSortOperator(inputRowType, rowTimeIdx, gComparator); OneInputStreamOperatorTestHarness<BaseRow, BaseRow> testHarness = createTestHarness(operator); testHarness.open(); testHarness.processElement(record(3, 3L, "Hello world", 3)); testHarness.processElement(record(2, 2L, "Hello", 2)); testHarness.processElement(record(6, 2L, "Luke Skywalker", 6)); testHarness.processElement(record(5, 3L, "I am fine.", 5)); testHarness.processElement(record(7, 1L, "Comment#1", 7)); testHarness.processElement(record(9, 4L, "Comment#3", 9)); testHarness.processElement(record(10, 4L, "Comment#4", 10)); testHarness.processElement(record(8, 4L, "Comment#2", 8)); testHarness.processElement(record(1, 1L, "Hi", 2)); testHarness.processElement(record(1, 1L, "Hi", 1)); testHarness.processElement(record(4, 3L, "Helloworld, how are you?", 4)); testHarness.processElement(record(4, 5L, "Hello, how are you?", 4)); testHarness.processWatermark(new Watermark(4L)); List<Object> expectedOutput = new ArrayList<>(); expectedOutput.add(record(1, 1L, "Hi", 2)); expectedOutput.add(record(1, 1L, "Hi", 1)); expectedOutput.add(record(7, 1L, "Comment#1", 7)); expectedOutput.add(record(2, 2L, "Hello", 2)); expectedOutput.add(record(6, 2L, "Luke Skywalker", 6)); expectedOutput.add(record(3, 3L, "Hello world", 3)); expectedOutput.add(record(4, 3L, "Helloworld, how are you?", 4)); expectedOutput.add(record(5, 3L, "I am fine.", 5)); expectedOutput.add(record(8, 4L, "Comment#2", 8)); expectedOutput.add(record(9, 4L, "Comment#3", 9)); expectedOutput.add(record(10, 4L, "Comment#4", 10)); expectedOutput.add(new Watermark(4L)); // do a snapshot, data could be recovered from state OperatorSubtaskState snapshot = testHarness.snapshot(0L, 0); assertor.assertOutputEquals("output wrong.", expectedOutput, testHarness.getOutput()); testHarness.close(); expectedOutput.clear(); operator = createSortOperator(inputRowType, rowTimeIdx, gComparator); testHarness = createTestHarness(operator); testHarness.initializeState(snapshot); testHarness.open(); // late data will be dropped testHarness.processElement(record(5, 3L, "I am fine.", 6)); testHarness.processWatermark(new Watermark(5L)); expectedOutput.add(record(4, 5L, "Hello, how are you?", 4)); expectedOutput.add(new Watermark(5L)); assertor.assertOutputEquals("output wrong.", expectedOutput, testHarness.getOutput()); // those watermark has no effect testHarness.processWatermark(new Watermark(11L)); testHarness.processWatermark(new Watermark(12L)); expectedOutput.add(new Watermark(11L)); expectedOutput.add(new Watermark(12L)); assertor.assertOutputEquals("output wrong.", expectedOutput, testHarness.getOutput()); } @Test public void testOnlySortOnRowTime() throws Exception { BaseRowTypeInfo inputRowType = new BaseRowTypeInfo( new BigIntType(), new BigIntType(), new VarCharType(VarCharType.MAX_LENGTH), new IntType()); int rowTimeIdx = 0; BaseRowHarnessAssertor assertor = new BaseRowHarnessAssertor(inputRowType.getFieldTypes()); RowTimeSortOperator operator = createSortOperator(inputRowType, rowTimeIdx, null); OneInputStreamOperatorTestHarness<BaseRow, BaseRow> testHarness = createTestHarness(operator); testHarness.open(); testHarness.processElement(record(3L, 2L, "Hello world", 3)); testHarness.processElement(record(2L, 2L, "Hello", 2)); testHarness.processElement(record(6L, 3L, "Luke Skywalker", 6)); testHarness.processElement(record(5L, 3L, "I am fine.", 5)); testHarness.processElement(record(7L, 4L, "Comment#1", 7)); testHarness.processElement(record(9L, 4L, "Comment#3", 9)); testHarness.processElement(record(10L, 4L, "Comment#4", 10)); testHarness.processElement(record(8L, 4L, "Comment#2", 8)); testHarness.processElement(record(1L, 1L, "Hi", 2)); testHarness.processElement(record(1L, 1L, "Hi", 1)); testHarness.processElement(record(4L, 3L, "Helloworld, how are you?", 4)); testHarness.processWatermark(new Watermark(9L)); List<Object> expectedOutput = new ArrayList<>(); expectedOutput.add(record(1L, 1L, "Hi", 2)); expectedOutput.add(record(1L, 1L, "Hi", 1)); expectedOutput.add(record(2L, 2L, "Hello", 2)); expectedOutput.add(record(3L, 2L, "Hello world", 3)); expectedOutput.add(record(4L, 3L, "Helloworld, how are you?", 4)); expectedOutput.add(record(5L, 3L, "I am fine.", 5)); expectedOutput.add(record(6L, 3L, "Luke Skywalker", 6)); expectedOutput.add(record(7L, 4L, "Comment#1", 7)); expectedOutput.add(record(8L, 4L, "Comment#2", 8)); expectedOutput.add(record(9L, 4L, "Comment#3", 9)); expectedOutput.add(new Watermark(9L)); // do a snapshot, data could be recovered from state OperatorSubtaskState snapshot = testHarness.snapshot(0L, 0); assertor.assertOutputEquals("output wrong.", expectedOutput, testHarness.getOutput()); testHarness.close(); expectedOutput.clear(); operator = createSortOperator(inputRowType, rowTimeIdx, null); testHarness = createTestHarness(operator); testHarness.initializeState(snapshot); testHarness.open(); // late data will be dropped testHarness.processElement(record(5L, 3L, "I am fine.", 6)); testHarness.processWatermark(new Watermark(10L)); expectedOutput.add(record(10L, 4L, "Comment#4", 10)); expectedOutput.add(new Watermark(10L)); assertor.assertOutputEquals("output wrong.", expectedOutput, testHarness.getOutput()); // those watermark has no effect testHarness.processWatermark(new Watermark(11L)); testHarness.processWatermark(new Watermark(12L)); expectedOutput.add(new Watermark(11L)); expectedOutput.add(new Watermark(12L)); assertor.assertOutputEquals("output wrong.", expectedOutput, testHarness.getOutput()); } private RowTimeSortOperator createSortOperator(BaseRowTypeInfo inputRowType, int rowTimeIdx, GeneratedRecordComparator gComparator) { return new RowTimeSortOperator(inputRowType, rowTimeIdx, gComparator); } private OneInputStreamOperatorTestHarness<BaseRow, BaseRow> createTestHarness(BaseTemporalSortOperator operator) throws Exception { OneInputStreamOperatorTestHarness testHarness = new KeyedOneInputStreamOperatorTestHarness<>( operator, NullBinaryRowKeySelector.INSTANCE, NullBinaryRowKeySelector.INSTANCE.getProducedType()); return testHarness; } }
{ "content_hash": "095e69cff6bfa5da8a0c4334ddf3a77d", "timestamp": "", "source": "github", "line_count": 193, "max_line_length": 113, "avg_line_length": 42.66321243523316, "alnum_prop": 0.7560116589749818, "repo_name": "shaoxuan-wang/flink", "id": "f94a1055912aeeebc293102afd1b5c73a8eca65e", "size": "9039", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "flink-table/flink-table-runtime-blink/src/test/java/org/apache/flink/table/runtime/sort/RowTimeSortOperatorTest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "4588" }, { "name": "CSS", "bytes": "57936" }, { "name": "Clojure", "bytes": "90539" }, { "name": "Dockerfile", "bytes": "10807" }, { "name": "FreeMarker", "bytes": "11851" }, { "name": "HTML", "bytes": "224454" }, { "name": "Java", "bytes": "46844396" }, { "name": "JavaScript", "bytes": "1829" }, { "name": "Makefile", "bytes": "5134" }, { "name": "Python", "bytes": "733285" }, { "name": "Scala", "bytes": "12596192" }, { "name": "Shell", "bytes": "461101" }, { "name": "TypeScript", "bytes": "243702" } ], "symlink_target": "" }
package nz.co.doltech.databind.apt.reflect.gwt.ast; public interface Compiler<I, O> { O compile(I unit); }
{ "content_hash": "8413a20a7f0b0e221735e1a7349bc7b4", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 51, "avg_line_length": 22.4, "alnum_prop": 0.7142857142857143, "repo_name": "BenDol/Databind", "id": "d04529b3fb27238883c93f7298019c63782496c1", "size": "112", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "apt/src/main/java/nz/co/doltech/databind/apt/reflect/gwt/ast/Compiler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "457313" } ], "symlink_target": "" }
// // ISNetworking.h // InventorySystemForiPhone // // Created by yangboshan on 16/4/28. // Copyright © 2016年 yangboshan. All rights reserved. // #ifndef ISNetworking_h #define ISNetworking_h #import "ISNetworkingConfiguration.h" #import "ISNetworkingContext.h" #import "ISNetworkingProxy.h" #import "ISNetworkingLogger.h" #import "ISNetworkingCache.h" #import "ISNetworkingResponse.h" #endif /* ISNetworking_h */
{ "content_hash": "7b607b8acd925e9a6ef3d3b09d397911", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 54, "avg_line_length": 21.1, "alnum_prop": 0.7535545023696683, "repo_name": "yangboshan/InventorySystemForiPhone", "id": "9fb6ef97119178f3277b2c55c31a8a1b293fc825", "size": "425", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "InventorySystemForiPhone/Networking/ISNetworking.h", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "388732" }, { "name": "Ruby", "bytes": "285" } ], "symlink_target": "" }
'use strict'; /** * Module dependencies. */ var mongoose = require('mongoose'), Schema = mongoose.Schema; /** * Product Schema */ var ProductSchema = new Schema({ name: { type: String, default: '', required: 'Please fill Product name', trim: true }, category: { type: String, default: '', required: 'Please choose a Category', trim: true }, created: { type: Date, default: Date.now }, user: { type: Schema.ObjectId, ref: 'User' } }); mongoose.model('Product', ProductSchema);
{ "content_hash": "9dd228028fe04e8d015e2a7bd760b3d6", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 41, "avg_line_length": 14.6, "alnum_prop": 0.6301369863013698, "repo_name": "perezvon/mean-tutorial", "id": "e51921160f22d7aa900a7c01e5e6fee33631eb27", "size": "511", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/models/product.server.model.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "500" }, { "name": "HTML", "bytes": "38247" }, { "name": "JavaScript", "bytes": "169705" }, { "name": "Shell", "bytes": "414" } ], "symlink_target": "" }
<VehiclePartSearchErrorResponse xmlns="http://ecs.amazonaws.com/doc/2011-08-01/"> <Error> <Code>Deprecated</Code> <Message>Feature VehiclePartSearch is deprecated.</Message> </Error> <RequestID>98a8fcfb-4c2d-4b7a-82fb-487c20083e03</RequestID> </VehiclePartSearchErrorResponse>
{ "content_hash": "009d15abba89c8fed2895ec8066189ef", "timestamp": "", "source": "github", "line_count": 7, "max_line_length": 81, "avg_line_length": 41.57142857142857, "alnum_prop": 0.7663230240549829, "repo_name": "redtoad/python-amazon-product-api", "id": "3d4e9d00e03a1d5fb0362709ac681ec4f641f79c", "size": "291", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "tests/2011-08-01/DeprecatedOperations-it-calling-deprecated-operations-using-call-fails-12.xml", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "HTML", "bytes": "664" }, { "name": "Python", "bytes": "295460" }, { "name": "Shell", "bytes": "1823" } ], "symlink_target": "" }
from __future__ import unicode_literals from ..connectivity import BuildConnectome def test_BuildConnectome_inputs(): input_map = dict(args=dict(argstr='%s', ), environ=dict(nohash=True, usedefault=True, ), ignore_exception=dict(nohash=True, usedefault=True, ), in_file=dict(argstr='%s', mandatory=True, position=-3, ), in_parc=dict(argstr='%s', position=-2, ), in_scalar=dict(argstr='-image %s', ), in_weights=dict(argstr='-tck_weights_in %s', ), keep_unassigned=dict(argstr='-keep_unassigned', ), metric=dict(argstr='-metric %s', ), nthreads=dict(argstr='-nthreads %d', nohash=True, ), out_file=dict(argstr='%s', mandatory=True, position=-1, usedefault=True, ), search_forward=dict(argstr='-assignment_forward_search %f', ), search_radius=dict(argstr='-assignment_radial_search %f', ), search_reverse=dict(argstr='-assignment_reverse_search %f', ), terminal_output=dict(deprecated='1.0.0', nohash=True, ), vox_lookup=dict(argstr='-assignment_voxel_lookup', ), zero_diagonal=dict(argstr='-zero_diagonal', ), ) inputs = BuildConnectome.input_spec() for key, metadata in list(input_map.items()): for metakey, value in list(metadata.items()): assert getattr(inputs.traits()[key], metakey) == value def test_BuildConnectome_outputs(): output_map = dict(out_file=dict(), ) outputs = BuildConnectome.output_spec() for key, metadata in list(output_map.items()): for metakey, value in list(metadata.items()): assert getattr(outputs.traits()[key], metakey) == value
{ "content_hash": "a2dfb8a3d41203a2046bd21eff32d7da", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 67, "avg_line_length": 26.276923076923076, "alnum_prop": 0.620023419203747, "repo_name": "mick-d/nipype", "id": "4f12e08cfc8dafa9dd7885e5e570ca051e9e0eeb", "size": "1762", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "nipype/interfaces/mrtrix3/tests/test_auto_BuildConnectome.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "HTML", "bytes": "9823" }, { "name": "KiCad", "bytes": "3797" }, { "name": "Makefile", "bytes": "1854" }, { "name": "Matlab", "bytes": "1999" }, { "name": "Python", "bytes": "4607773" }, { "name": "Shell", "bytes": "380" }, { "name": "Tcl", "bytes": "43408" } ], "symlink_target": "" }
require 'spec_helper' require 'heroku_buildpack_scale' module HerokuBuildpackScale describe Scale, :local do let(:scale) { Scale.new } let(:ruby_url) { 'https://github.com/heroku/heroku-buildpack-ruby.git' } let(:java_url) { 'https://github.com/heroku/heroku-buildpack-java.git' } describe '#weight_in_mb' do it 'returns an integer representing MB size' do expect(scale.weight_in_mb(java_url)).to eq(63) end it 'can run on the same url twice in a row' do pending 'me finishing this' expect(scale.weight_in_mb(ruby_url)).to eq(11) expect(scale.weight_in_mb(ruby_url)).to eq(11) end end end end
{ "content_hash": "44e67586b064a99b585ba32dac8b95da", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 76, "avg_line_length": 30.727272727272727, "alnum_prop": 0.650887573964497, "repo_name": "golmansax/heroku-buildpack-scale", "id": "39f67310dc51ad4945450d60795c4ab71bb8dc62", "size": "676", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "spec/lib/heroku_buildpack_scale/scale_spec.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "71" }, { "name": "JavaScript", "bytes": "11315" }, { "name": "Ruby", "bytes": "30098" } ], "symlink_target": "" }
sap.ui.define(['sap/ui/core/mvc/Controller'], function (Controller) { 'use strict'; var MainController = Controller.extend('appUnderTest.view.Main', { onFirstDialogPress: function () { if (this.dialogWithErrors) { this.dialogWithErrors.open(); } else { var dialog = new sap.m.Dialog({ id: 'dialogWithRuleErrors', endButton: new sap.m.Button({ id: 'dialogWithRuleErrorsCloseButton', text: 'Close', press: function () { dialog.close(); } }), content: [ new sap.m.Text({text: 'Hello'}), new sap.m.Button({icon: 'sap-icon://action'}), new sap.m.Input({id:"testInput2", placeholder:"Test input 2"}), new sap.m.Label({labelFor:"testInput2", text:"label for input"}) ] }); this.dialogWithErrors = dialog; this.dialogWithErrors.open(); } }, onSecondDialogPress: function () { if (this.dialogWithoutErrors) { this.dialogWithoutErrors.open(); } else { var dialogText = new sap.m.Text({text: 'Hello'}); var dialog = new sap.m.Dialog({ id: 'dialogWithNoRuleErrors', endButton: new sap.m.Button({ id: 'dialogWithNoRuleErrorsCloseButton', text: 'Close', press: function () { dialog.close(); } }), content: [ dialogText, new sap.m.Button({icon: 'sap-icon://action', tooltip: 'Action'}) ], ariaLabelledBy: dialogText.getId() }); this.dialogWithoutErrors = dialog; this.dialogWithoutErrors.open(); } } }); return MainController; });
{ "content_hash": "208b671c1633c055b79dc35affa3ef33", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 70, "avg_line_length": 26.203389830508474, "alnum_prop": 0.6060802069857697, "repo_name": "cschuff/openui5", "id": "5f0666422e9f470c1b8d3829b1966df3b5d6b0cf", "size": "1546", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "src/sap.ui.support/test/sap/ui/support/integration/applicationUnderTest/view/Main.controller.js", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "2918722" }, { "name": "Gherkin", "bytes": "17198" }, { "name": "HTML", "bytes": "18167339" }, { "name": "Java", "bytes": "84288" }, { "name": "JavaScript", "bytes": "49673115" } ], "symlink_target": "" }
<?php class MageTest_PHPUnit_Framework_TestCaseTest extends MageTest_PHPUnit_Framework_TestCase { public function testMocksModel() { $this->assertInstanceOf( 'Mage_Sales_Model_Order', $this->getModelMock('sales/order')); } public function testMocksResourceModel() { $this->assertInstanceOf( 'Mage_Sales_Model_Resource_Order', $this->getResourceModelMock('sales/order')); } public function testMocksHelper() { $this->assertInstanceOf( 'Mage_Catalog_Helper_Image', $this->getHelperMock('catalog/image')); } public function testMocksBlock() { $this->assertInstanceOf( 'Mage_Sales_Block_Order_View', $this->getBlockMock('sales/order_view')); } }
{ "content_hash": "e69c070eae35a91e64122b359d6e009d", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 56, "avg_line_length": 25.060606060606062, "alnum_prop": 0.5973397823458283, "repo_name": "MageTest/Mage-Test", "id": "8e9a14b10c98b7c5c8e462a35270489ae0882bf1", "size": "827", "binary": false, "copies": "1", "ref": "refs/heads/develop", "path": "tests/lib/MageTest/PHPUnit/Framework/TestCaseTest.php", "mode": "33188", "license": "mit", "language": [ { "name": "PHP", "bytes": "155274" }, { "name": "Shell", "bytes": "1057" } ], "symlink_target": "" }
package com.banadiga.caching.service; import lombok.extern.slf4j.Slf4j; import com.banadiga.caching.dto.Item; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import java.math.BigInteger; import java.security.SecureRandom; import javax.annotation.PostConstruct; @Service @Slf4j public class ScheduledService { private static final String ID = "a55f08fd-be35-442c-98c8-844619516e22"; private SecureRandom random = new SecureRandom(); @Autowired private ItemService itemService; private String nextString(int radix) { return new BigInteger(130, random).toString(radix); } @PostConstruct public void init() { itemService.add(ID, Item.builder().name(nextString(64)).code(nextString(32)).build()); log.info("Count : {}", itemService.list().size()); } @Scheduled(initialDelay = 30000, fixedDelay = 1000) public void createData() { for (int i = 0; i < random.nextInt(); i++) { itemService.add(Item.builder().name(nextString(64)).code(nextString(32)).build()); } } }
{ "content_hash": "81109a4c464423c03d0419ab92631e93", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 90, "avg_line_length": 26.558139534883722, "alnum_prop": 0.7373029772329247, "repo_name": "banadiga/sandbox", "id": "829f9ff3554c14b0b773f716b2c9f4659dd4d0cb", "size": "1142", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "caching/src/main/java/com/banadiga/caching/service/ScheduledService.java", "mode": "33188", "license": "mit", "language": [ { "name": "Groovy", "bytes": "665" }, { "name": "HTML", "bytes": "4387" }, { "name": "Java", "bytes": "108069" }, { "name": "JavaScript", "bytes": "344" }, { "name": "Shell", "bytes": "2731" } ], "symlink_target": "" }
using namespace std; using namespace boost; using namespace boost::assign; using namespace json_spirit; void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex) { txnouttype type; vector<CTxDestination> addresses; int nRequired; out.push_back(Pair("asm", scriptPubKey.ToString())); if (fIncludeHex) out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()))); if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) { out.push_back(Pair("type", GetTxnOutputType(TX_NONSTANDARD))); return; } out.push_back(Pair("reqSigs", nRequired)); out.push_back(Pair("type", GetTxnOutputType(type))); Array a; BOOST_FOREACH(const CTxDestination& addr, addresses) a.push_back(CBitcoinAddress(addr).ToString()); out.push_back(Pair("addresses", a)); } void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry) { entry.push_back(Pair("txid", tx.GetHash().GetHex())); entry.push_back(Pair("version", tx.nVersion)); entry.push_back(Pair("time", (boost::int64_t)tx.nTime)); entry.push_back(Pair("locktime", (boost::int64_t)tx.nLockTime)); Array vin; BOOST_FOREACH(const CTxIn& txin, tx.vin) { Object in; if (tx.IsCoinBase()) in.push_back(Pair("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); else { in.push_back(Pair("txid", txin.prevout.hash.GetHex())); in.push_back(Pair("vout", (boost::int64_t)txin.prevout.n)); Object o; o.push_back(Pair("asm", txin.scriptSig.ToString())); o.push_back(Pair("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); in.push_back(Pair("scriptSig", o)); } in.push_back(Pair("sequence", (boost::int64_t)txin.nSequence)); vin.push_back(in); } entry.push_back(Pair("vin", vin)); Array vout; for (unsigned int i = 0; i < tx.vout.size(); i++) { const CTxOut& txout = tx.vout[i]; Object out; out.push_back(Pair("value", ValueFromAmount(txout.nValue))); out.push_back(Pair("n", (boost::int64_t)i)); Object o; ScriptPubKeyToJSON(txout.scriptPubKey, o, false); out.push_back(Pair("scriptPubKey", o)); vout.push_back(out); } entry.push_back(Pair("vout", vout)); if (hashBlock != 0) { entry.push_back(Pair("blockhash", hashBlock.GetHex())); map<uint256, CBlockIndex*>::iterator mi = mapBlockIndex.find(hashBlock); if (mi != mapBlockIndex.end() && (*mi).second) { CBlockIndex* pindex = (*mi).second; if (pindex->IsInMainChain()) { entry.push_back(Pair("confirmations", 1 + nBestHeight - pindex->nHeight)); entry.push_back(Pair("time", (boost::int64_t)pindex->nTime)); entry.push_back(Pair("blocktime", (boost::int64_t)pindex->nTime)); } else entry.push_back(Pair("confirmations", 0)); } } } Value getrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "getrawtransaction <txid> [verbose=0]\n" "If verbose=0, returns a string that is\n" "serialized, hex-encoded data for <txid>.\n" "If verbose is non-zero, returns an Object\n" "with information about <txid>."); uint256 hash; hash.SetHex(params[0].get_str()); bool fVerbose = false; if (params.size() > 1) fVerbose = (params[1].get_int() != 0); CTransaction tx; uint256 hashBlock = 0; if (!GetTransaction(hash, tx, hashBlock)) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "No information available about transaction"); CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << tx; string strHex = HexStr(ssTx.begin(), ssTx.end()); if (!fVerbose) return strHex; Object result; result.push_back(Pair("hex", strHex)); TxToJSON(tx, hashBlock, result); return result; } Value listunspent(const Array& params, bool fHelp) { if (fHelp || params.size() > 3) throw runtime_error( "listunspent [minconf=1] [maxconf=9999999] [\"address\",...]\n" "Returns array of unspent transaction outputs\n" "with between minconf and maxconf (inclusive) confirmations.\n" "Optionally filtered to only include txouts paid to specified addresses.\n" "Results are an array of Objects, each of which has:\n" "{txid, vout, scriptPubKey, amount, confirmations}"); RPCTypeCheck(params, list_of(int_type)(int_type)(array_type)); int nMinDepth = 1; if (params.size() > 0) nMinDepth = params[0].get_int(); int nMaxDepth = 9999999; if (params.size() > 1) nMaxDepth = params[1].get_int(); set<CBitcoinAddress> setAddress; if (params.size() > 2) { Array inputs = params[2].get_array(); BOOST_FOREACH(Value& input, inputs) { CBitcoinAddress address(input.get_str()); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid CloakCoin address: ")+input.get_str()); if (setAddress.count(address)) throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+input.get_str()); setAddress.insert(address); } } Array results; vector<COutput> vecOutputs; pwalletMain->AvailableCoins(vecOutputs, false); BOOST_FOREACH(const COutput& out, vecOutputs) { if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth) continue; if(setAddress.size()) { CTxDestination address; if(!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) continue; if (!setAddress.count(address)) continue; } int64_t nValue = out.tx->vout[out.i].nValue; const CScript& pk = out.tx->vout[out.i].scriptPubKey; Object entry; entry.push_back(Pair("txid", out.tx->GetHash().GetHex())); entry.push_back(Pair("vout", out.i)); CTxDestination address; if (ExtractDestination(out.tx->vout[out.i].scriptPubKey, address)) { entry.push_back(Pair("address", CBitcoinAddress(address).ToString())); if (pwalletMain->mapAddressBook.count(address)) entry.push_back(Pair("account", pwalletMain->mapAddressBook[address])); } entry.push_back(Pair("scriptPubKey", HexStr(pk.begin(), pk.end()))); entry.push_back(Pair("amount",ValueFromAmount(nValue))); entry.push_back(Pair("confirmations",out.nDepth)); results.push_back(entry); } return results; } Value createrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() != 2) throw runtime_error( "createrawtransaction [{\"txid\":txid,\"vout\":n},...] {address:amount,...}\n" "Create a transaction spending given inputs\n" "(array of objects containing transaction id and output number),\n" "sending to given address(es).\n" "Returns hex-encoded raw transaction.\n" "Note that the transaction's inputs are not signed, and\n" "it is not stored in the wallet or transmitted to the network."); RPCTypeCheck(params, list_of(array_type)(obj_type)); Array inputs = params[0].get_array(); Object sendTo = params[1].get_obj(); CTransaction rawTx; BOOST_FOREACH(Value& input, inputs) { const Object& o = input.get_obj(); const Value& txid_v = find_value(o, "txid"); if (txid_v.type() != str_type) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing txid key"); string txid = txid_v.get_str(); if (!IsHex(txid)) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected hex txid"); const Value& vout_v = find_value(o, "vout"); if (vout_v.type() != int_type) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, missing vout key"); int nOutput = vout_v.get_int(); if (nOutput < 0) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, vout must be positive"); CTxIn in(COutPoint(uint256(txid), nOutput)); rawTx.vin.push_back(in); } set<CBitcoinAddress> setAddress; BOOST_FOREACH(const Pair& s, sendTo) { CBitcoinAddress address(s.name_); if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid CloakCoin address: ")+s.name_); if (setAddress.count(address)) throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+s.name_); setAddress.insert(address); CScript scriptPubKey; scriptPubKey.SetDestination(address.Get()); int64_t nAmount = AmountFromValue(s.value_); CTxOut out(nAmount, scriptPubKey); rawTx.vout.push_back(out); } CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); ss << rawTx; return HexStr(ss.begin(), ss.end()); } Value decoderawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "decoderawtransaction <hex string>\n" "Return a JSON object representing the serialized, hex-encoded transaction."); RPCTypeCheck(params, list_of(str_type)); vector<unsigned char> txData(ParseHex(params[0].get_str())); CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); CTransaction tx; try { ssData >> tx; } catch (std::exception &e) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); } Object result; TxToJSON(tx, 0, result); return result; } Value decodescript(const Array& params, bool fHelp) { if (fHelp || params.size() != 1) throw runtime_error( "decodescript <hex string>\n" "Decode a hex-encoded script."); RPCTypeCheck(params, list_of(str_type)); Object r; CScript script; if (params[0].get_str().size() > 0){ vector<unsigned char> scriptData(ParseHexV(params[0], "argument")); script = CScript(scriptData.begin(), scriptData.end()); } else { // Empty scripts are valid } ScriptPubKeyToJSON(script, r, false); r.push_back(Pair("p2sh", CBitcoinAddress(script.GetID()).ToString())); return r; } Value signrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 4) throw runtime_error( "signrawtransaction <hex string> [{\"txid\":txid,\"vout\":n,\"scriptPubKey\":hex},...] [<privatekey1>,...] [sighashtype=\"ALL\"]\n" "Sign inputs for raw transaction (serialized, hex-encoded).\n" "Second optional argument (may be null) is an array of previous transaction outputs that\n" "this transaction depends on but may not yet be in the blockchain.\n" "Third optional argument (may be null) is an array of base58-encoded private\n" "keys that, if given, will be the only keys used to sign the transaction.\n" "Fourth optional argument is a string that is one of six values; ALL, NONE, SINGLE or\n" "ALL|ANYONECANPAY, NONE|ANYONECANPAY, SINGLE|ANYONECANPAY.\n" "Returns json object with keys:\n" " hex : raw transaction with signature(s) (hex-encoded string)\n" " complete : 1 if transaction has a complete set of signature (0 if not)" + HelpRequiringPassphrase()); RPCTypeCheck(params, list_of(str_type)(array_type)(array_type)(str_type), true); vector<unsigned char> txData(ParseHex(params[0].get_str())); CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); vector<CTransaction> txVariants; while (!ssData.empty()) { try { CTransaction tx; ssData >> tx; txVariants.push_back(tx); } catch (std::exception &e) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); } } if (txVariants.empty()) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Missing transaction"); // mergedTx will end up with all the signatures; it // starts as a clone of the rawtx: CTransaction mergedTx(txVariants[0]); bool fComplete = true; // Fetch previous transactions (inputs): map<COutPoint, CScript> mapPrevOut; for (unsigned int i = 0; i < mergedTx.vin.size(); i++) { CTransaction tempTx; MapPrevTx mapPrevTx; CTxDB txdb("r"); map<uint256, CTxIndex> unused; bool fInvalid; // FetchInputs aborts on failure, so we go one at a time. tempTx.vin.push_back(mergedTx.vin[i]); tempTx.FetchInputs(txdb, unused, false, false, mapPrevTx, fInvalid); // Copy results into mapPrevOut: BOOST_FOREACH(const CTxIn& txin, tempTx.vin) { const uint256& prevHash = txin.prevout.hash; if (mapPrevTx.count(prevHash) && mapPrevTx[prevHash].second.vout.size()>txin.prevout.n) mapPrevOut[txin.prevout] = mapPrevTx[prevHash].second.vout[txin.prevout.n].scriptPubKey; } } // Add previous txouts given in the RPC call: if (params.size() > 1 && params[1].type() != null_type) { Array prevTxs = params[1].get_array(); BOOST_FOREACH(Value& p, prevTxs) { if (p.type() != obj_type) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "expected object with {\"txid'\",\"vout\",\"scriptPubKey\"}"); Object prevOut = p.get_obj(); RPCTypeCheck(prevOut, map_list_of("txid", str_type)("vout", int_type)("scriptPubKey", str_type)); string txidHex = find_value(prevOut, "txid").get_str(); if (!IsHex(txidHex)) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "txid must be hexadecimal"); uint256 txid; txid.SetHex(txidHex); int nOut = find_value(prevOut, "vout").get_int(); if (nOut < 0) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "vout must be positive"); string pkHex = find_value(prevOut, "scriptPubKey").get_str(); if (!IsHex(pkHex)) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "scriptPubKey must be hexadecimal"); vector<unsigned char> pkData(ParseHex(pkHex)); CScript scriptPubKey(pkData.begin(), pkData.end()); COutPoint outpoint(txid, nOut); if (mapPrevOut.count(outpoint)) { // Complain if scriptPubKey doesn't match if (mapPrevOut[outpoint] != scriptPubKey) { string err("Previous output scriptPubKey mismatch:\n"); err = err + mapPrevOut[outpoint].ToString() + "\nvs:\n"+ scriptPubKey.ToString(); throw JSONRPCError(RPC_DESERIALIZATION_ERROR, err); } } else mapPrevOut[outpoint] = scriptPubKey; } } bool fGivenKeys = false; CBasicKeyStore tempKeystore; if (params.size() > 2 && params[2].type() != null_type) { fGivenKeys = true; Array keys = params[2].get_array(); BOOST_FOREACH(Value k, keys) { CBitcoinSecret vchSecret; bool fGood = vchSecret.SetString(k.get_str()); if (!fGood) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY,"Invalid private key"); CKey key; bool fCompressed; CSecret secret = vchSecret.GetSecret(fCompressed); key.SetSecret(secret, fCompressed); tempKeystore.AddKey(key); } } else EnsureWalletIsUnlocked(); const CKeyStore& keystore = (fGivenKeys ? tempKeystore : *pwalletMain); int nHashType = SIGHASH_ALL; if (params.size() > 3 && params[3].type() != null_type) { static map<string, int> mapSigHashValues = boost::assign::map_list_of (string("ALL"), int(SIGHASH_ALL)) (string("ALL|ANYONECANPAY"), int(SIGHASH_ALL|SIGHASH_ANYONECANPAY)) (string("NONE"), int(SIGHASH_NONE)) (string("NONE|ANYONECANPAY"), int(SIGHASH_NONE|SIGHASH_ANYONECANPAY)) (string("SINGLE"), int(SIGHASH_SINGLE)) (string("SINGLE|ANYONECANPAY"), int(SIGHASH_SINGLE|SIGHASH_ANYONECANPAY)) ; string strHashType = params[3].get_str(); if (mapSigHashValues.count(strHashType)) nHashType = mapSigHashValues[strHashType]; else throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid sighash param"); } bool fHashSingle = ((nHashType & ~SIGHASH_ANYONECANPAY) == SIGHASH_SINGLE); // Sign what we can: for (unsigned int i = 0; i < mergedTx.vin.size(); i++) { CTxIn& txin = mergedTx.vin[i]; if (mapPrevOut.count(txin.prevout) == 0) { fComplete = false; continue; } const CScript& prevPubKey = mapPrevOut[txin.prevout]; txin.scriptSig.clear(); // Only sign SIGHASH_SINGLE if there's a corresponding output: if (!fHashSingle || (i < mergedTx.vout.size())) SignSignature(keystore, prevPubKey, mergedTx, i, nHashType); // ... and merge in other signatures: BOOST_FOREACH(const CTransaction& txv, txVariants) { txin.scriptSig = CombineSignatures(prevPubKey, mergedTx, i, txin.scriptSig, txv.vin[i].scriptSig); } if (!VerifyScript(txin.scriptSig, prevPubKey, mergedTx, i, 0)) fComplete = false; } Object result; CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << mergedTx; result.push_back(Pair("hex", HexStr(ssTx.begin(), ssTx.end()))); result.push_back(Pair("complete", fComplete)); return result; } Value sendrawtransaction(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 1) throw runtime_error( "sendrawtransaction <hex string>\n" "Submits raw transaction (serialized, hex-encoded) to local node and network."); RPCTypeCheck(params, list_of(str_type)); // parse hex string from parameter vector<unsigned char> txData(ParseHex(params[0].get_str())); CDataStream ssData(txData, SER_NETWORK, PROTOCOL_VERSION); CTransaction tx; // deserialize binary data stream try { ssData >> tx; } catch (std::exception &e) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed"); } uint256 hashTx = tx.GetHash(); // See if the transaction is already in a block // or in the memory pool: CTransaction existingTx; uint256 hashBlock = 0; if (GetTransaction(hashTx, existingTx, hashBlock)) { if (hashBlock != 0) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("transaction already in block ")+hashBlock.GetHex()); // Not in block, but already in the memory pool; will drop // through to re-relay it. } else { // push to local node CTxDB txdb("r"); if (!tx.AcceptToMemoryPool(txdb)) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); SyncWithWallets(tx, NULL, true); } RelayTransaction(tx, hashTx); return hashTx.GetHex(); }
{ "content_hash": "4a0d9ccbc16d8143b78aaa6992193bbc", "timestamp": "", "source": "github", "line_count": 549, "max_line_length": 143, "avg_line_length": 36.21493624772313, "alnum_prop": 0.6018509204305402, "repo_name": "darrenturn90/CloakCoin", "id": "66bb93b028b1a4065943d7b3144e5f17d80ecd88", "size": "20288", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/rpcrawtransaction.cpp", "mode": "33188", "license": "mit", "language": [ { "name": "Assembly", "bytes": "51312" }, { "name": "C", "bytes": "3074719" }, { "name": "C++", "bytes": "2480138" }, { "name": "CSS", "bytes": "1127" }, { "name": "IDL", "bytes": "14787" }, { "name": "Objective-C++", "bytes": "3537" }, { "name": "Python", "bytes": "11646" }, { "name": "Shell", "bytes": "1026" }, { "name": "TypeScript", "bytes": "7755715" } ], "symlink_target": "" }
@interface GVUserDefaults (Properties) @property (nonatomic) NSInteger highscore; @end
{ "content_hash": "4e6338244e98a433f1b1c348dfbabf0c", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 42, "avg_line_length": 17.8, "alnum_prop": 0.797752808988764, "repo_name": "luisfcofv/fly-butterfly", "id": "c7bc5a7cb392fd934540d8fcf686c11a4249b01a", "size": "271", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "fly-butterfly/Classes/Categories/GVUserDefaults+Properties.h", "mode": "33188", "license": "mit", "language": [ { "name": "Objective-C", "bytes": "59874" }, { "name": "Ruby", "bytes": "149" } ], "symlink_target": "" }
require 'minitest/autorun' require 'mocha/mini_test' require 'fakeweb' require 'ap' require File.expand_path('../../lib/sheet_mapper', __FILE__) Dir[File.expand_path("../test_helpers/*.rb", __FILE__)].each { |f| require f } FakeWeb.allow_net_connect = false Mocha::Configuration.prevent(:stubbing_non_existent_method)
{ "content_hash": "b3ec78186cb7cff58ffdd488d14ca4dc", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 78, "avg_line_length": 35.333333333333336, "alnum_prop": 0.7169811320754716, "repo_name": "nesquena/sheet_mapper", "id": "bbfd0d74e6b48b8496e90a7e8744600e142298a5", "size": "318", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/test_config.rb", "mode": "33188", "license": "mit", "language": [ { "name": "Ruby", "bytes": "34029" } ], "symlink_target": "" }
""" """ __docformat__ = 'restructuredtext' __version__ = '$Id: //depot/task/DEV-99/client/tests.py#13 $' import sys sys.path.insert(0, '../../') sys.path.insert(0, '../layout/') from pyglet.window import * from pyglet import clock from pyglet.gl import * from pyglet import media import layout from wydget import GUI from wydget import event, dialogs, dragndrop, anim, layouts, widgets, loadxml if len(sys.argv) > 1: if '--help' in sys.argv: print('%s [test_file.xml] [--dump] [--once]' % sys.argv[0]) print(' test_file.xml -- a single XML file to display (see tests/)') print(' --dump -- text dump of constructed GUI objects') print(' --once -- render the GUI exactly once and exit') sys.exit(0) print('-' * 75) print('To exit the test, hit <escape> or close the window') print('-' * 75) else: print('-' * 75) print('To move on to the next test, hit <escape>.') print('Close the window to exit the tests.') print('-' * 75) window = Window(width=800, height=600, vsync=False, resizable=True) # clock.set_fps_limit(10) fps = clock.ClockDisplay(color=(1, .5, .5, 1)) window.push_handlers(fps) class MyEscape: has_exit = False def on_key_press(self, symbol, modifiers): if symbol == key.ESCAPE: self.has_exit = True return event.EVENT_HANDLED my_escape = MyEscape() window.push_handlers(my_escape) def run(xml_file): gui = GUI(window) loadxml.fromFile(gui, xml_file) if '--dump' in sys.argv: print('-' * 75) gui.dump() print('-' * 75) window.push_handlers(gui) gui.push_handlers(dragndrop.DragHandler('.draggable')) @gui.select('#press-me') def on_click(widget, *args): print('on_click', widget) return event.EVENT_HANDLED @gui.select('#enable-other') def on_click(widget, *args): w = gui.get('#press-me') w.setEnabled(not w.isEnabled()) return event.EVENT_HANDLED @gui.select('button, text-button') def on_click(widget, *args): print('DEBUG', widget, 'PRESSED') return event.EVENT_UNHANDLED @gui.select('.show-value') def on_change(widget, value): print('DEBUG', widget, 'VALUE CHANGED', repr(value)) return event.EVENT_UNHANDLED @gui.select('frame#menu-test', 'on_click') def on_menu(w, x, y, button, modifiers, click_count): if not widgets.PopupMenu.isActivatingClick(button, modifiers): return event.EVENT_UNHANDLED gui.get('#test-menu').expose((x, y)) return event.EVENT_HANDLED @gui.select('.hover') def on_element_enter(widget, *args): print('ENTER ELEMENT', widget.id) return event.EVENT_HANDLED @gui.select('.hover') def on_element_leave(widget, *args): print('LEAVE ELEMENT', widget.id) return event.EVENT_HANDLED @gui.select('.drawer-control') def on_click(widget, *args): id = widget.id.replace('drawer-control', 'test-drawer') gui.get('#' + id).toggle_state() return event.EVENT_HANDLED @gui.select('#question-dialog-test') def on_click(widget, *args): def f(*args): print('DIALOG SAYS', args) dialogs.Question(widget.getGUI(), 'Did this appear correctly?', callback=f).run() return event.EVENT_HANDLED @gui.select('#message-dialog-test') def on_click(widget, *args): def f(*args): print('DIALOG SAYS', args) dialogs.Message(widget.getGUI(), 'Hello, World!', callback=f).run() return event.EVENT_HANDLED @gui.select('#music-test') def on_click(widget, x, y, button, modifiers, click_count): if not button & mouse.RIGHT: return event.EVENT_UNHANDLED def load_music(file=None): if not file: return gui.get('#music-test').delete() m = widgets.Music(gui, file, id='music-test', playing=True) m.gainFocus() dialogs.FileOpen(gui, callback=load_music).run() return event.EVENT_HANDLED @gui.select('#movie-test') def on_click(widget, x, y, button, modifiers, click_count): if not button & mouse.RIGHT: return event.EVENT_UNHANDLED def load_movie(file=None): print('DIALOG SELECTION:', file) if not file: return gui.get('#movie-test').delete() m = widgets.Movie(gui, file, id='movie-test', playing=True) m.gainFocus() dialogs.FileOpen(gui, callback=load_movie).run() return event.EVENT_HANDLED @gui.select('#movie-test') def on_text(widget, text): if text == 'f': gui.get('#movie-test').video.pause() anim.Delayed(gui.get('#movie-test').video.play, duration=10) window.set_fullscreen() return event.EVENT_HANDLED @gui.select('.droppable') def on_drop(widget, x, y, button, modifiers, element): element.reparent(widget) widget.bgcolor = (1, 1, 1, 1) return event.EVENT_HANDLED @gui.select('.droppable') def on_drag_enter(widget, x, y, element): widget.bgcolor = (.8, 1, .8, 1) return event.EVENT_HANDLED @gui.select('.droppable') def on_drag_leave(widget, x, y, element): widget.bgcolor = (1, 1, 1, 1) return event.EVENT_HANDLED try: sample = gui.get('#xhtml-sample') except KeyError: sample = None if sample: @layout.select('#click-me') def on_mouse_press(element, x, y, button, modifiers): print('CLICK ON', element) return event.EVENT_HANDLED sample.label.push_handlers(on_mouse_press) if gui.has('.progress-me'): class Progress: progress = 0 direction = 1 def animate(self, dt): self.progress += dt * self.direction if self.progress > 5: self.progress = 5 self.direction = -1 elif self.progress < 0: self.progress = 0 self.direction = 1 for e in gui.get('.progress-me'): e.value = self.progress / 5. animate_progress = Progress().animate clock.schedule(animate_progress) my_escape.has_exit = False while not (window.has_exit or my_escape.has_exit): clock.tick() window.dispatch_events() media.dispatch_events() glClearColor(.2, .2, .2, 1) glClear(GL_COLOR_BUFFER_BIT) gui.draw() fps.draw() window.flip() if '--once' in sys.argv: window.close() sys.exit() if '--dump' in sys.argv: print('-' * 75) gui.dump() print('-' * 75) if gui.has('.progress-me'): clock.unschedule(animate_progress) # reset everything window.pop_handlers() gui.delete() window.set_size(800, 600) return window.has_exit if len(sys.argv) > 1: run(sys.argv[1]) else: import os for file in os.listdir('tests'): if not file.endswith('.xml'): continue if not os.path.isfile(os.path.join('tests', file)): continue print('Running', file) if run(os.path.join('tests', file)): break window.close()
{ "content_hash": "ea2577e2ba23633644007198f96550ec", "timestamp": "", "source": "github", "line_count": 262, "max_line_length": 77, "avg_line_length": 28.46946564885496, "alnum_prop": 0.5707199356482102, "repo_name": "bitcraft/pyglet", "id": "ad17a7776d0fe148adf317db2f0a0deacbe4e80f", "size": "7482", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "contrib/wydget/run_tests.py", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "CSS", "bytes": "1828" }, { "name": "HTML", "bytes": "1652" }, { "name": "JavaScript", "bytes": "6745" }, { "name": "PHP", "bytes": "2192" }, { "name": "Python", "bytes": "6201398" }, { "name": "Shell", "bytes": "251" } ], "symlink_target": "" }
#ifndef __NMR_MODELREADERNODE_SLICE1507_VERTICES #define __NMR_MODELREADERNODE_SLICE1507_VERTICES #include "Model/Reader/NMR_ModelReaderNode.h" #include "Model/Classes/NMR_ModelComponent.h" #include "Model/Classes/NMR_ModelComponentsObject.h" #include "Model/Classes/NMR_ModelObject.h" #include "Model/Classes/NMR_ModelConstants_Slices.h" namespace NMR { class CModelReaderNode_Slices1507_Vertices : public CModelReaderNode { private: CSlice *m_pSlice; protected: virtual void OnAttribute(_In_z_ const nfChar * pAttributeName, _In_z_ const nfChar * pAttributeValue); virtual void OnNSChildElement(_In_z_ const nfChar * pChildName, _In_z_ const nfChar * pNameSpace, _In_ CXmlReader * pXMLReader); public: CModelReaderNode_Slices1507_Vertices() = delete; CModelReaderNode_Slices1507_Vertices(_In_ CSlice *pSlice, _In_ PModelWarnings pWarnings); virtual void parseXML(_In_ CXmlReader * pXMLReader); }; typedef std::shared_ptr<CModelReaderNode_Slices1507_Vertices> PModelReaderNode_Slices1507_Vertices; } #endif
{ "content_hash": "144292d75cfc5779dfe70a867163902e", "timestamp": "", "source": "github", "line_count": 31, "max_line_length": 130, "avg_line_length": 33.354838709677416, "alnum_prop": 0.7804642166344294, "repo_name": "3MFConsortium/lib3mf", "id": "3fbd90caf8b54e6d08c45c7523439668a93b2f54", "size": "2445", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Include/Model/Reader/Slice1507/NMR_ModelReader_Slice1507_Vertices.h", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "Batchfile", "bytes": "2916" }, { "name": "C", "bytes": "1897049" }, { "name": "C#", "bytes": "223473" }, { "name": "C++", "bytes": "5206845" }, { "name": "CMake", "bytes": "39876" }, { "name": "Dockerfile", "bytes": "120" }, { "name": "Go", "bytes": "550627" }, { "name": "JavaScript", "bytes": "495" }, { "name": "Pascal", "bytes": "595910" }, { "name": "Python", "bytes": "375625" }, { "name": "Shell", "bytes": "7190" } ], "symlink_target": "" }
Rails.application.routes.draw do resources :usuarios mount Tematica::Engine => '/tematica', as: 'engine_tematica' end
{ "content_hash": "8fd71f2f9babef6e3c976a206fa63589", "timestamp": "", "source": "github", "line_count": 6, "max_line_length": 62, "avg_line_length": 20.666666666666668, "alnum_prop": 0.7338709677419355, "repo_name": "Soluciones/tematica", "id": "a390628ee5a2009dab3b130be9615feece0cef33", "size": "124", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/dummy/config/routes.rb", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1616" }, { "name": "HTML", "bytes": "5819" }, { "name": "JavaScript", "bytes": "1062" }, { "name": "Ruby", "bytes": "36091" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in null #### Original name null ### Remarks null
{ "content_hash": "32033099398ba6ab16c640bd1d2993b9", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 10.307692307692308, "alnum_prop": 0.6940298507462687, "repo_name": "mdoering/backbone", "id": "d54a4ba8a78d9fc4f9f1a8ec9ae83075b6389cab", "size": "186", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Plantae/Magnoliophyta/Liliopsida/Asparagales/Orchidaceae/Dendrobium/Dendrobium catillare/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
#pragma once #ifndef _WIN32 #include <sys/file.h> #else #define LOCK_SH 1 #define LOCK_EX 2 #define LOCK_NB 4 #define LOCK_UN 8 extern "C" int flock(int fd, int operation); #endif
{ "content_hash": "63ff6d7cc2f9e3f8bb2adc1e93b8361a", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 44, "avg_line_length": 14.076923076923077, "alnum_prop": 0.7049180327868853, "repo_name": "facebook/folly", "id": "a622f459a21e883adbc25dff029c4bdda205d3ff", "size": "801", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "folly/portability/SysFile.h", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Assembly", "bytes": "21191" }, { "name": "Batchfile", "bytes": "989" }, { "name": "C", "bytes": "73316" }, { "name": "C++", "bytes": "16280936" }, { "name": "CMake", "bytes": "204978" }, { "name": "CSS", "bytes": "786" }, { "name": "Cython", "bytes": "41061" }, { "name": "GDB", "bytes": "2493" }, { "name": "Makefile", "bytes": "804" }, { "name": "Python", "bytes": "413397" }, { "name": "Ruby", "bytes": "2882" }, { "name": "Shell", "bytes": "12465" } ], "symlink_target": "" }
<!--This file is generated--> # remark-lint-ordered-list-marker-style [![Build][build-badge]][build] [![Coverage][coverage-badge]][coverage] [![Downloads][downloads-badge]][downloads] [![Size][size-badge]][size] [![Sponsors][sponsors-badge]][collective] [![Backers][backers-badge]][collective] [![Chat][chat-badge]][chat] [`remark-lint`][mono] rule to warn when ordered list markers are inconsistent. ## Contents * [What is this?](#what-is-this) * [When should I use this?](#when-should-i-use-this) * [Presets](#presets) * [Install](#install) * [Use](#use) * [API](#api) * [`unified().use(remarkLintOrderedListMarkerStyle[, config])`](#unifieduseremarklintorderedlistmarkerstyle-config) * [Recommendation](#recommendation) * [Fix](#fix) * [Examples](#examples) * [Compatibility](#compatibility) * [Contribute](#contribute) * [License](#license) ## What is this? This package is a [unified][] ([remark][]) plugin, specifically a `remark-lint` rule. Lint rules check markdown code style. ## When should I use this? You can use this package to check that ordered list markers are consistent. ## Presets This rule is included in the following presets: | Preset | Setting | | - | - | | [`remark-preset-lint-consistent`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent) | `'consistent'` | | [`remark-preset-lint-markdown-style-guide`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide) | `'.'` | | [`remark-preset-lint-recommended`](https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-recommended) | `'.'` | ## Install This package is [ESM only][esm]. In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]: ```sh npm install remark-lint-ordered-list-marker-style ``` In Deno with [Skypack][]: ```js import remarkLintOrderedListMarkerStyle from 'https://cdn.skypack.dev/remark-lint-ordered-list-marker-style@3?dts' ``` In browsers with [Skypack][]: ```html <script type="module"> import remarkLintOrderedListMarkerStyle from 'https://cdn.skypack.dev/remark-lint-ordered-list-marker-style@3?min' </script> ``` ## Use On the API: ```js import {read} from 'to-vfile' import {reporter} from 'vfile-reporter' import {remark} from 'remark' import remarkLint from 'remark-lint' import remarkLintOrderedListMarkerStyle from 'remark-lint-ordered-list-marker-style' main() async function main() { const file = await remark() .use(remarkLint) .use(remarkLintOrderedListMarkerStyle) .process(await read('example.md')) console.error(reporter(file)) } ``` On the CLI: ```sh remark --use remark-lint --use remark-lint-ordered-list-marker-style example.md ``` On the CLI in a config file (here a `package.json`): ```diff … "remarkConfig": { "plugins": [ … "remark-lint", + "remark-lint-ordered-list-marker-style", … ] } … ``` ## API This package exports no identifiers. The default export is `remarkLintOrderedListMarkerStyle`. ### `unified().use(remarkLintOrderedListMarkerStyle[, config])` This rule supports standard configuration that all remark lint rules accept (such as `false` to turn it off or `[1, options]` to configure it). The following options (default: `'consistent'`) are accepted: * `'.'` — prefer dots * `')'` — prefer parens * `'consistent'` — detect the first used style and warn when further markers differ ## Recommendation Parens for list markers were not supported in markdown before CommonMark. While they should work in most places now, not all markdown parsers follow CommonMark. Due to this, it’s recommended to prefer dots. ## Fix [`remark-stringify`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify) formats ordered lists with dots by default. Pass [`bulletOrdered: ')'`](https://github.com/remarkjs/remark/tree/main/packages/remark-stringify#optionsbulletordered) to always use parens. ## Examples ##### `ok.md` ###### In ```markdown 1. Foo 1. Bar Unordered lists are not affected by this rule. * Foo ``` ###### Out No messages. ##### `not-ok.md` ###### In ```markdown 1. Foo 2) Bar ``` ###### Out ```text 3:1-3:8: Marker style should be `.` ``` ##### `ok.md` When configured with `'.'`. ###### In ```markdown 1. Foo 2. Bar ``` ###### Out No messages. ##### `ok.md` When configured with `')'`. ###### In ```markdown 1) Foo 2) Bar ``` ###### Out No messages. ##### `not-ok.md` When configured with `'💩'`. ###### Out ```text 1:1: Incorrect ordered list item marker style `💩`: use either `'.'` or `')'` ``` ## Compatibility Projects maintained by the unified collective are compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, and 16.0+. Our projects sometimes work with older versions, but this is not guaranteed. ## Contribute See [`contributing.md`][contributing] in [`remarkjs/.github`][health] for ways to get started. See [`support.md`][support] for ways to get help. This project has a [code of conduct][coc]. By interacting with this repository, organization, or community you agree to abide by its terms. ## License [MIT][license] © [Titus Wormer][author] [build-badge]: https://github.com/remarkjs/remark-lint/workflows/main/badge.svg [build]: https://github.com/remarkjs/remark-lint/actions [coverage-badge]: https://img.shields.io/codecov/c/github/remarkjs/remark-lint.svg [coverage]: https://codecov.io/github/remarkjs/remark-lint [downloads-badge]: https://img.shields.io/npm/dm/remark-lint-ordered-list-marker-style.svg [downloads]: https://www.npmjs.com/package/remark-lint-ordered-list-marker-style [size-badge]: https://img.shields.io/bundlephobia/minzip/remark-lint-ordered-list-marker-style.svg [size]: https://bundlephobia.com/result?p=remark-lint-ordered-list-marker-style [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg [backers-badge]: https://opencollective.com/unified/backers/badge.svg [collective]: https://opencollective.com/unified [chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg [chat]: https://github.com/remarkjs/remark/discussions [unified]: https://github.com/unifiedjs/unified [remark]: https://github.com/remarkjs/remark [mono]: https://github.com/remarkjs/remark-lint [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c [skypack]: https://www.skypack.dev [npm]: https://docs.npmjs.com/cli/install [health]: https://github.com/remarkjs/.github [contributing]: https://github.com/remarkjs/.github/blob/main/contributing.md [support]: https://github.com/remarkjs/.github/blob/main/support.md [coc]: https://github.com/remarkjs/.github/blob/main/code-of-conduct.md [license]: https://github.com/remarkjs/remark-lint/blob/main/license [author]: https://wooorm.com
{ "content_hash": "1d77ed437059517a1f560c42182048a3", "timestamp": "", "source": "github", "line_count": 300, "max_line_length": 155, "avg_line_length": 22.923333333333332, "alnum_prop": 0.7059764432165189, "repo_name": "wooorm/mdast-lint", "id": "e790e9ca80d5c7dc81643c1399e1e3e6d064a25f", "size": "6900", "binary": false, "copies": "3", "ref": "refs/heads/main", "path": "packages/remark-lint-ordered-list-marker-style/readme.md", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "213121" } ], "symlink_target": "" }
import assert from "assert"; import React from "react"; import { ConfigRepository } from "repository/ConfigRepository"; describe("repository/ConfigRepository", () => { it("save/get", async () => { const database = new Map(); const repository = new ConfigRepository(database); const config = { oauth: { accessToken: "AccessToken" } }; repository.save(config); assert.deepEqual(repository.get(), config); assert.deepEqual(repository.get(), database.get("config")); }); it(`should throw error when don't save config`, () => { assert.throws( () => { const database = new Map(); const repository = new ConfigRepository(database); repository.get(); }, error => { assert(error.message === "no config"); return true; } ); }); });
{ "content_hash": "5bb31dfe980c0246643c198c7b12c64b", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 63, "avg_line_length": 26.625, "alnum_prop": 0.5903755868544601, "repo_name": "mkwtys/ghdash", "id": "cc0e3a4cde9f1f504fa2f166df6afaedef8cc720", "size": "852", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "test/repository/ConfigRepository.js", "mode": "33261", "license": "mit", "language": [ { "name": "HTML", "bytes": "176" }, { "name": "JavaScript", "bytes": "5826" } ], "symlink_target": "" }
This is a tool that reads the structure of an existing database and generates the appropriate SQLAlchemy model code, using the declarative style if possible. This tool was written as a replacement for `sqlautocode <http://code.google.com/p/sqlautocode/>`_, which was suffering from several issues (including, but not limited to, incompatibility with Python 3 and the latest SQLAlchemy version). Features ======== * Supports SQLAlchemy 0.6.x - 1.0.x * Produces declarative code that almost looks like it was hand written * Produces `PEP 8 <http://www.python.org/dev/peps/pep-0008/>`_ compliant code * Accurately determines relationships, including many-to-many, one-to-one * Automatically detects joined table inheritance * Excellent test coverage Usage instructions ================== Installation ------------ To install, do:: pip install sqlacodegen or, failing that:: easy_install sqlacodegen Example usage ------------- At the minimum, you have to give sqlacodegen a database URL. The URL is passed directly to SQLAlchemy's `create_engine() <http://docs.sqlalchemy.org/en/latest/core/engines.html?highlight=create_engine#sqlalchemy.create_engine>`_ method so please refer to `SQLAlchemy's documentation <http://docs.sqlalchemy.org/en/latest/core/engines.html>`_ for instructions on how to construct a proper URL. Examples:: sqlacodegen postgresql:///some_local_db sqlacodegen mysql+oursql://user:password@localhost/dbname sqlacodegen sqlite:///database.db To see the full list of options:: sqlacodegen --help Model class naming logic ------------------------ The table name (which is assumed to be in English) is converted to singular form using the "inflect" library. Then, every underscore is removed while transforming the next letter to upper case. For example, ``sales_invoices`` becomes ``SalesInvoice``. Relationship detection logic ---------------------------- Relationships are detected based on existing foreign key constraints as follows: * **many-to-one**: a foreign key constraint exists on the table * **one-to-one**: same as **many-to-one**, but a unique constraint exists on the column(s) involved * **many-to-many**: an association table is found to exist between two tables A table is considered an association table if it satisfies all of the following conditions: #. has exactly two foreign key constraints #. all its columns are involved in said constraints Relationship naming logic ------------------------- Relationships are typically named based on the opposite class name. For example, if an ``Employee`` class has a column named ``employer`` which has a foreign key to ``Company.id``, the relationship is named ``company``. A special case for single column many-to-one and one-to-one relationships, however, is if the column is named like ``employer_id``. Then the relationship is named ``employer`` due to that ``_id`` suffix. If more than one relationship would be created with the same name, the latter ones are appended numeric suffixes, starting from 1. Source code =========== The source can be browsed at `Bitbucket <http://bitbucket.org/agronholm/sqlacodegen/src/>`_. Reporting bugs ============== A `bug tracker <http://bitbucket.org/agronholm/sqlacodegen/issues/>`_ is provided by bitbucket.org. Getting help ============ If you have problems or other questions, you can either: * Ask on the `SQLAlchemy Google group <http://groups.google.com/group/sqlalchemy>`_, or * Ask on the ``#sqlalchemy`` channel on `Freenode IRC <http://freenode.net/irc_servers.shtml>`_
{ "content_hash": "3e96c6e0380bb53d9ef8687183cdaefd", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 124, "avg_line_length": 29.311475409836067, "alnum_prop": 0.7290268456375839, "repo_name": "rflynn/sqlacodegen", "id": "50f060409f6c888b819e2f3aa4f9f8a1b23b6914", "size": "3576", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.rst", "mode": "33188", "license": "mit", "language": [ { "name": "Python", "bytes": "66799" } ], "symlink_target": "" }
from zope.interface import implementer from twisted.internet.interfaces import IProtocol from minerstat.utils import Config from typing import Tuple, Union from urllib import parse import treq from typing import Dict, Optional import platform from twisted.logger import Logger from twisted.plugin import getPlugins from minerstat.miners.base import IMiner, MinerUtils from minerstat.miners.claymore import AlgoClaymoreMiner from twisted.internet import defer class Command: def __init__(self, command_name: str, coin: Optional[IMiner]) -> None: self.command_name = command_name self.coin = coin @implementer(IProtocol) class MinerStatRemoteProtocol: log = Logger() def __init__(self, config: Config, treq=treq) -> None: self.config = config self.treq = treq def make_full_url(self, component: str) -> str: return parse.urljoin( self.config.api_base, component + ".php" ) def make_url_params( self, params: Optional[Dict[str, str]] = None ) -> Dict[str, str]: new_params = { "token": self.config.accesskey, "worker": self.config.worker } if params: new_params.update(params) return new_params async def make_request( self, method: str, resource: str, params: Optional[Dict[str, str]] = None, headers: Optional[Dict[str, str]] = None, data: Optional[Union[str, Dict[str, str]]] = None ) -> str: """Make a request to the minerstat service.""" url = self.make_full_url(resource) params = self.make_url_params(params=params) self.log.debug( 'Fetching: {0}: {1} with params: {2}'.format( method, url, str(params.items()))) response = await self.treq.request( method=method, url=url, params=params, data=data, headers=headers, browser_like_redirects=True) content = await response.text() return content async def get_request( self, resource, params: Optional[Dict[str, str]] = None, ) -> str: """Make a get request to the minerstat service.""" content = await self.make_request("GET", resource, params) return content async def algoinfo(self) -> Tuple[str, str]: algoinfo = await self.get_request("bestquery") dualresponse = await self.get_request("dualresponse") return (algoinfo, dualresponse) async def dlconf(self, coin: IMiner) -> None: content = await self.get_request("getresponse", params={ "db": coin.db, "action": "config", "coin": coin.coin, "algo": "yes" if isinstance(coin, AlgoClaymoreMiner) else "no"}) self.log.debug("writing config path: {0}".format( MinerUtils(coin, self.config).config_path())) open(MinerUtils(coin, self.config).config_path(), 'w').write( coin.config_template.format(content)) async def send_log(self, res_data) -> None: if not res_data: self.log.warn("Logs for server are empty now.") return await self.make_request( "POST", "getstat", data={"mes": res_data}) self.log.info("Package sent.") self.log.debug("Package sent: {data}", data=repr(res_data)) async def algo_check(self) -> Tuple[str, str, str]: futs = [ self.get_request("bestquerytext"), self.get_request("bestquery"), self.get_request("dualresponse") ] bqt, bq, dr = await defer.DeferredList([ defer.ensureDeferred(f) for f in futs]) return (bqt, bq, dr) async def fetch_remote_command(self, coin: IMiner) -> Optional[Command]: content = await self.get_request( "control", params={ "worker": "{}.{}".format( self.config.accesskey, self.config.worker), "miner": coin.folder_name, "os": platform.system().lower()}, ) self.log.debug("remote command: {}".format(repr(content))) miner_coins = getPlugins(IMiner) # Type: List[IMiner] for coin in miner_coins: if coin.command in content: return Command(coin.command, coin) if "REBOOT" in content: return Command("REBOOT", None) return None async def announce(self, coin: IMiner) -> str: content = await self.make_request( "POST", "control", params={ "worker": "{}.{}".format( self.config.accesskey, self.config.worker), "miner": coin.folder_name, "os": platform.system().lower()}, data={"mes": ""} ) return content
{ "content_hash": "25fcecd7c067475306569a7761a0503d", "timestamp": "", "source": "github", "line_count": 147, "max_line_length": 76, "avg_line_length": 34.136054421768705, "alnum_prop": 0.5609804703068951, "repo_name": "dpnova/pynerstat", "id": "c0e145d03320b95584671e1c4e225a7fd9bd22e9", "size": "5018", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "minerstat/remote.py", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "C", "bytes": "3942705" }, { "name": "Python", "bytes": "32274" }, { "name": "Shell", "bytes": "6103" } ], "symlink_target": "" }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("_10.BinToDecHorner")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("_10.BinToDecHorner")] [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("b164153d-77ea-4c1a-a591-3865cb52fdef")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
{ "content_hash": "b992ec4e759124c2d4282a63b36e0906", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 84, "avg_line_length": 39.638888888888886, "alnum_prop": 0.7477224947442186, "repo_name": "YoTsenkov/TelerikSoftwareAcademyHomeworks", "id": "413d02d9bf8187d9050ae6ebf886e368b8ddbcd6", "size": "1430", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "C# part1/NumeralSys/10. BinToDecHorner/Properties/AssemblyInfo.cs", "mode": "33188", "license": "mit", "language": [ { "name": "ASP", "bytes": "45751" }, { "name": "C#", "bytes": "1437245" }, { "name": "CSS", "bytes": "50553" }, { "name": "CoffeeScript", "bytes": "387" }, { "name": "JavaScript", "bytes": "679958" }, { "name": "Python", "bytes": "30608" }, { "name": "Shell", "bytes": "195" }, { "name": "XSLT", "bytes": "988" } ], "symlink_target": "" }
import * as Common from "cubitt-common"; import {PropertySetEvent} from "./PropertySetEvent"; import {EventType} from "./../EventType"; /** * An event that was raised when a property of a model was set. */ export class ModelPropertySetEvent extends PropertySetEvent { /** * @param sourceId The RFC4122 v4 compliant ID of the command that caused this event. * @param version The new current version number. * @param timestamp The timestamp for the moment this event was created in milliseconds elapsed since 1 January 1970 00:00:00 UTC. * @param elementId The RFC4122 v4 compliant ID of the element for which the property was set. * @param propertyName The name of the property that was set. * @param propertyValue The value of the property that was set. */ constructor( sourceId: Common.Guid, version: number, timestamp: number, elementId: Common.Guid, propertyName: string, propertyValue: any ) { super( sourceId, version, EventType.ModelPropertySet, timestamp, elementId, propertyName, propertyValue); } }
{ "content_hash": "21e2e367e0dcf2d610aa6940dab7405a", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 131, "avg_line_length": 30.428571428571427, "alnum_prop": 0.7314553990610329, "repo_name": "uu-cubitt/events", "id": "e630093898eefadc5184e73a8026c49b08cf4b84", "size": "1065", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/events/ModelPropertySetEvent.ts", "mode": "33188", "license": "mit", "language": [ { "name": "TypeScript", "bytes": "57180" } ], "symlink_target": "" }
namespace test_runner { // Templetized wrapper around RenderFrameImpl objects, which implement // the WebFrameClient interface. template <class Base, typename P> class WebFrameTestProxy : public Base { public: explicit WebFrameTestProxy(P p) : Base(p), base_proxy_(NULL) {} virtual ~WebFrameTestProxy() {} void set_base_proxy(WebTestProxyBase* proxy) { base_proxy_ = proxy; } // WebFrameClient implementation. virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame, const blink::WebPluginParams& params) { blink::WebPlugin* plugin = base_proxy_->CreatePlugin(frame, params); if (plugin) return plugin; return Base::createPlugin(frame, params); } virtual blink::WebScreenOrientationClient* webScreenOrientationClient() { return base_proxy_->GetScreenOrientationClientMock(); } virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message, const blink::WebString& source_name, unsigned source_line, const blink::WebString& stack_trace) { base_proxy_->DidAddMessageToConsole(message, source_name, source_line); Base::didAddMessageToConsole( message, source_name, source_line, stack_trace); } virtual bool canCreatePluginWithoutRenderer( const blink::WebString& mime_type) { using blink::WebString; const CR_DEFINE_STATIC_LOCAL( WebString, suffix, ("-can-create-without-renderer")); return mime_type.utf8().find(suffix.utf8()) != std::string::npos; } virtual void loadURLExternally(blink::WebLocalFrame* frame, const blink::WebURLRequest& request, blink::WebNavigationPolicy policy, const blink::WebString& suggested_name) { base_proxy_->LoadURLExternally(frame, request, policy, suggested_name); Base::loadURLExternally(frame, request, policy, suggested_name); } virtual void didStartProvisionalLoad(blink::WebLocalFrame* frame, double triggeringEventTime) { base_proxy_->DidStartProvisionalLoad(frame); Base::didStartProvisionalLoad( frame, triggeringEventTime); } virtual void didReceiveServerRedirectForProvisionalLoad( blink::WebLocalFrame* frame) { base_proxy_->DidReceiveServerRedirectForProvisionalLoad(frame); Base::didReceiveServerRedirectForProvisionalLoad(frame); } virtual void didFailProvisionalLoad( blink::WebLocalFrame* frame, const blink::WebURLError& error, blink::WebHistoryCommitType commit_type) { // If the test finished, don't notify the embedder of the failed load, // as we already destroyed the document loader. if (base_proxy_->DidFailProvisionalLoad(frame, error, commit_type)) return; Base::didFailProvisionalLoad(frame, error, commit_type); } virtual void didCommitProvisionalLoad( blink::WebLocalFrame* frame, const blink::WebHistoryItem& item, blink::WebHistoryCommitType commit_type) { base_proxy_->DidCommitProvisionalLoad(frame, item, commit_type); Base::didCommitProvisionalLoad(frame, item, commit_type); } virtual void didReceiveTitle(blink::WebLocalFrame* frame, const blink::WebString& title, blink::WebTextDirection direction) { base_proxy_->DidReceiveTitle(frame, title, direction); Base::didReceiveTitle(frame, title, direction); } virtual void didChangeIcon(blink::WebLocalFrame* frame, blink::WebIconURL::Type icon_type) { base_proxy_->DidChangeIcon(frame, icon_type); Base::didChangeIcon(frame, icon_type); } virtual void didFinishDocumentLoad(blink::WebLocalFrame* frame) { base_proxy_->DidFinishDocumentLoad(frame); Base::didFinishDocumentLoad(frame); } virtual void didHandleOnloadEvents(blink::WebLocalFrame* frame) { base_proxy_->DidHandleOnloadEvents(frame); Base::didHandleOnloadEvents(frame); } virtual void didFailLoad(blink::WebLocalFrame* frame, const blink::WebURLError& error, blink::WebHistoryCommitType commit_type) { base_proxy_->DidFailLoad(frame, error, commit_type); Base::didFailLoad(frame, error, commit_type); } virtual void didFinishLoad(blink::WebLocalFrame* frame) { Base::didFinishLoad(frame); base_proxy_->DidFinishLoad(frame); } virtual void didChangeSelection(bool is_selection_empty) { base_proxy_->DidChangeSelection(is_selection_empty); Base::didChangeSelection(is_selection_empty); } virtual blink::WebColorChooser* createColorChooser( blink::WebColorChooserClient* client, const blink::WebColor& initial_color, const blink::WebVector<blink::WebColorSuggestion>& suggestions) { return base_proxy_->CreateColorChooser(client, initial_color, suggestions); } virtual void runModalAlertDialog(const blink::WebString& message) { base_proxy_->GetDelegate()->PrintMessage(std::string("ALERT: ") + message.utf8().data() + "\n"); } virtual bool runModalConfirmDialog(const blink::WebString& message) { base_proxy_->GetDelegate()->PrintMessage(std::string("CONFIRM: ") + message.utf8().data() + "\n"); return true; } virtual bool runModalPromptDialog(const blink::WebString& message, const blink::WebString& default_value, blink::WebString*) { base_proxy_->GetDelegate()->PrintMessage( std::string("PROMPT: ") + message.utf8().data() + ", default text: " + default_value.utf8().data() + "\n"); return true; } virtual bool runModalBeforeUnloadDialog(bool is_reload, const blink::WebString& message) { base_proxy_->GetDelegate()->PrintMessage( std::string("CONFIRM NAVIGATION: ") + message.utf8().data() + "\n"); return !base_proxy_->GetInterfaces() ->TestRunner() ->ShouldStayOnPageAfterHandlingBeforeUnload(); } virtual void showContextMenu( const blink::WebContextMenuData& context_menu_data) { base_proxy_->ShowContextMenu(context_menu_data); Base::showContextMenu(context_menu_data); } virtual void didDetectXSS(blink::WebLocalFrame* frame, const blink::WebURL& insecure_url, bool did_block_entire_page) { // This is not implemented in RenderFrameImpl, so need to explicitly call // into the base proxy. base_proxy_->DidDetectXSS(frame, insecure_url, did_block_entire_page); Base::didDetectXSS(frame, insecure_url, did_block_entire_page); } virtual void didDispatchPingLoader(blink::WebLocalFrame* frame, const blink::WebURL& url) { // This is not implemented in RenderFrameImpl, so need to explicitly call // into the base proxy. base_proxy_->DidDispatchPingLoader(frame, url); Base::didDispatchPingLoader(frame, url); } virtual void willRequestResource(blink::WebLocalFrame* frame, const blink::WebCachedURLRequest& request) { // This is not implemented in RenderFrameImpl, so need to explicitly call // into the base proxy. base_proxy_->WillRequestResource(frame, request); Base::willRequestResource(frame, request); } virtual void didCreateDataSource(blink::WebLocalFrame* frame, blink::WebDataSource* ds) { Base::didCreateDataSource(frame, ds); } virtual void willSendRequest(blink::WebLocalFrame* frame, unsigned identifier, blink::WebURLRequest& request, const blink::WebURLResponse& redirect_response) { Base::willSendRequest(frame, identifier, request, redirect_response); base_proxy_->WillSendRequest(frame, identifier, request, redirect_response); } virtual void didReceiveResponse(blink::WebLocalFrame* frame, unsigned identifier, const blink::WebURLResponse& response) { base_proxy_->DidReceiveResponse(frame, identifier, response); Base::didReceiveResponse(frame, identifier, response); } virtual void didChangeResourcePriority( blink::WebLocalFrame* frame, unsigned identifier, const blink::WebURLRequest::Priority& priority, int intra_priority_value) { // This is not implemented in RenderFrameImpl, so need to explicitly call // into the base proxy. base_proxy_->DidChangeResourcePriority( frame, identifier, priority, intra_priority_value); Base::didChangeResourcePriority( frame, identifier, priority, intra_priority_value); } virtual void didFinishResourceLoad(blink::WebLocalFrame* frame, unsigned identifier) { base_proxy_->DidFinishResourceLoad(frame, identifier); Base::didFinishResourceLoad(frame, identifier); } virtual blink::WebNavigationPolicy decidePolicyForNavigation( const blink::WebFrameClient::NavigationPolicyInfo& info) { blink::WebNavigationPolicy policy = base_proxy_->DecidePolicyForNavigation( info); if (policy == blink::WebNavigationPolicyIgnore) return policy; return Base::decidePolicyForNavigation(info); } virtual void willStartUsingPeerConnectionHandler( blink::WebLocalFrame* frame, blink::WebRTCPeerConnectionHandler* handler) { // RenderFrameImpl::willStartUsingPeerConnectionHandler can not be mocked. // See http://crbug/363285. } virtual blink::WebUserMediaClient* userMediaClient() { return base_proxy_->GetUserMediaClient(); } virtual bool willCheckAndDispatchMessageEvent( blink::WebLocalFrame* source_frame, blink::WebFrame* target_frame, blink::WebSecurityOrigin target, blink::WebDOMMessageEvent event) { if (base_proxy_->WillCheckAndDispatchMessageEvent( source_frame, target_frame, target, event)) return true; return Base::willCheckAndDispatchMessageEvent( source_frame, target_frame, target, event); } virtual void didStopLoading() { base_proxy_->DidStopLoading(); Base::didStopLoading(); } virtual void postAccessibilityEvent(const blink::WebAXObject& object, blink::WebAXEvent event) { base_proxy_->PostAccessibilityEvent(object, event); Base::postAccessibilityEvent(object, event); } private: WebTestProxyBase* base_proxy_; DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxy); }; } // namespace test_runner #endif // COMPONENTS_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_
{ "content_hash": "622d2fdef190043b7e8acf966f4f428a", "timestamp": "", "source": "github", "line_count": 283, "max_line_length": 80, "avg_line_length": 38.76678445229682, "alnum_prop": 0.6591012669765746, "repo_name": "hgl888/chromium-crosswalk", "id": "8f0336167d8455c376e83d4c6bc6d851979b8367", "size": "11616", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "components/test_runner/web_frame_test_proxy.h", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "AppleScript", "bytes": "6973" }, { "name": "Arduino", "bytes": "464" }, { "name": "Assembly", "bytes": "37073" }, { "name": "Batchfile", "bytes": "8451" }, { "name": "C", "bytes": "9404886" }, { "name": "C++", "bytes": "240720094" }, { "name": "CSS", "bytes": "938746" }, { "name": "DM", "bytes": "60" }, { "name": "Groff", "bytes": "2494" }, { "name": "HTML", "bytes": "27258863" }, { "name": "Java", "bytes": "14579982" }, { "name": "JavaScript", "bytes": "20509171" }, { "name": "Makefile", "bytes": "70992" }, { "name": "Objective-C", "bytes": "1956196" }, { "name": "Objective-C++", "bytes": "9967587" }, { "name": "PHP", "bytes": "97817" }, { "name": "PLpgSQL", "bytes": "178732" }, { "name": "Perl", "bytes": "63937" }, { "name": "Protocol Buffer", "bytes": "480579" }, { "name": "Python", "bytes": "8518320" }, { "name": "Shell", "bytes": "482077" }, { "name": "Standard ML", "bytes": "5034" }, { "name": "XSLT", "bytes": "418" }, { "name": "nesC", "bytes": "18347" } ], "symlink_target": "" }
![ci](https://github.com/Tecnativa/doodba/workflows/ci/badge.svg) [![](https://images.microbadger.com/badges/version/tecnativa/doodba:latest.svg)](https://microbadger.com/images/tecnativa/doodba:latest "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/image/tecnativa/doodba:latest.svg)](https://microbadger.com/images/tecnativa/doodba:latest "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/commit/tecnativa/doodba:latest.svg)](https://microbadger.com/images/tecnativa/doodba:latest "Get your own commit badge on microbadger.com") [![](https://images.microbadger.com/badges/license/tecnativa/doodba.svg)](https://microbadger.com/images/tecnativa/doodba "Get your own license badge on microbadger.com") **Doodba** stands for **Do**cker **Od**oo **Ba**se, and it is a highly opinionated image ready to put [Odoo](https://www.odoo.com) inside it, but **without Odoo**. ## What? Yes, the purpose of this is to serve as a base for you to build your own Odoo project, because most of them end up requiring a big amount of custom patches, merges, repositories, etc. With this image, you have a collection of good practices and tools to enable your team to have a standard Odoo project structure. BTW, we use [Debian][]. I hope you like that. [debian]: https://debian.org/ ## Why? Because developing Odoo is hard. You need lots of customizations, dependencies, and if you want to move from one version to another, it's a pain. Also because nobody wants Odoo as it comes from upstream, you most likely will need to add custom patches and addons, at least, so we need a way to put all together and make it work anywhere quickly. ## How? You can start working with this straight away with our [template][]. <!-- toc --> - [Image usage](#image-usage) - [`/opt/odoo/custom`: The important one](#optodoocustom-the-important-one) - [`/opt/odoo/custom/entrypoint.d`](#optodoocustomentrypointd) - [`/opt/odoo/custom/build.d`](#optodoocustombuildd) - [`/opt/odoo/custom/conf.d`](#optodoocustomconfd) - [`/opt/odoo/custom/ssh`](#optodoocustomssh) - [`/opt/odoo/custom/src`](#optodoocustomsrc) - [`/opt/odoo/custom/src/odoo`](#optodoocustomsrcodoo) - [`/opt/odoo/custom/src/private`](#optodoocustomsrcprivate) - [`/opt/odoo/custom/src/repos.yaml`](#optodoocustomsrcreposyaml) - [Automatic download of repos](#automatic-download-of-repos) - [`/opt/odoo/custom/src/addons.yaml`](#optodoocustomsrcaddonsyaml) - [`/opt/odoo/custom/dependencies/*.txt`](#optodoocustomdependenciestxt) - [`/opt/odoo/common`: The useful one](#optodoocommon-the-useful-one) - [`/opt/odoo/auto`: The automatic one](#optodooauto-the-automatic-one) - [`/opt/odoo/auto/addons`](#optodooautoaddons) - [`/opt/odoo/auto/odoo.conf`](#optodooautoodooconf) - [The `Dockerfile`](#the-dockerfile) - [Bundled tools](#bundled-tools) - [`addons`](#addons) - [`click-odoo` and related scripts](#click-odoo-and-related-scripts) - [`nano`](#nano) - [`log`](#log) - [`pot`](#pot) - [`psql`](#psql) - [`inotify`](#inotify) - [`debugpy`](#debugpy) - [`pudb`](#pudb) - [`git-aggregator`](#git-aggregator) - [`autoaggregate`](#autoaggregate) - [Example `repos.yaml` file](#example-reposyaml-file) - [`odoo`](#odoo) - [Subproject template](#subproject-template) - [FAQ](#faq) - [Will there be not retrocompatible changes on the image?](#will-there-be-not-retrocompatible-changes-on-the-image) - [This project is too opinionated, but can I question any of those opinions?](#this-project-is-too-opinionated-but-can-i-question-any-of-those-opinions) - [What's this `hooks` folder here?](#whats-this-hooks-folder-here) - [How can I pin an image version?](#how-can-i-pin-an-image-version) - [How can I help?](#how-can-i-help) - [Related Projects](#related-projects) <!-- tocstop --> ## Image usage Basically, every directory you have to worry about is found inside `/opt/odoo`. This is its structure: custom/ entrypoint.d/ build.d/ conf.d/ ssh/ config known_hosts id_rsa id_rsa.pub dependencies/ apt_build.txt apt.txt gem.txt npm.txt pip.txt src/ private/ odoo/ addons.yaml repos.yaml common/ entrypoint.sh build.sh entrypoint.d/ build.d/ conf.d/ auto addons/ odoo.conf Let's go one by one. ### `/opt/odoo/custom`: The important one Here you will put everything related to your project. #### `/opt/odoo/custom/entrypoint.d` Any executables found here will be run when you launch your container, before running the command you ask. #### `/opt/odoo/custom/build.d` Executables here will be aggregated with those in `/opt/odoo/common/build.d`. The resulting set of executables will then be sorted alphabetically (ascending) and then subsequently run. #### `/opt/odoo/custom/conf.d` Files here will be environment-variable-expanded and concatenated in `/opt/odoo/auto/odoo.conf` in the entrypoint. #### `/opt/odoo/custom/ssh` It must follow the same structure as a standard `~/.ssh` directory, including `config` and `known_hosts` files. In fact, it is completely equivalent to `~root/.ssh`. The `config` file can contain `IdentityFile` keys to represent the private key that should be used for that host. Unless specified otherwise, this defaults to `identity[.pub]`, `id_rsa[.pub]` or `id_dsa[.pub]` files found in this same directory. This is very useful **to use deployment keys** that grant git access to your private repositories. Example - a private key file in the `ssh` folder named `my_private_key` for the host `repo.example.com` would have a `config` entry similar to the below: ``` Host repo.example.com IdentityFile ~/.ssh/my_private_key ``` Or you could just drop the key in `id_rsa` and `id_rsa.pub` files and it should work by default without the need of adding a `config` file. Host key checking is enabled by default, which means that you also need to provide a `known_hosts` file for any repos that you wish to access via SSH. In order to disable host key checks for a repo, your config would look something like this: ``` Host repo.example.com StrictHostKeyChecking no ``` For additional information regarding this directory, take a look at this [Digital Ocean Article][ssh-conf]. #### `/opt/odoo/custom/src` Here you will put the actual source code for your project. When putting code here, you can either: - Use [`repos.yaml`][], that will fill anything at build time. - Directly copy all there. Recommendation: use [`repos.yaml`][] for everything except for [`private`][], and ignore in your `.gitignore` and `.dockerignore` files every folder here except [`private`][], with rules like these: odoo/custom/src/* !odoo/custom/src/private !odoo/custom/src/*.* ##### `/opt/odoo/custom/src/odoo` **REQUIRED.** The source code for your odoo project. You can choose your Odoo version, and even merge PRs from many of them using [`repos.yaml`][]. Some versions you might consider: - [Original Odoo][], by [Odoo S.A.][]. - [OCB][] (Odoo Community Backports), by [OCA][]. The original + some features - some stability strictness. - [OpenUpgrade][], by [OCA][]. The original, frozen at new version launch time + migration scripts. ##### `/opt/odoo/custom/src/private` **REQUIRED.** Folder with private addons for the project. ##### `/opt/odoo/custom/src/repos.yaml` A [git-aggregator](#git-aggregator) configuration file. It should look similar to this: ```yaml # Odoo must be in the `odoo` folder for Doodba to work odoo: defaults: # This will use git shallow clones. # $DEPTH_DEFAULT is 1 in test and prod, but 100 in devel. # $DEPTH_MERGE is always 100. # You can use any integer value, OTOH. depth: $DEPTH_MERGE remotes: origin: https://github.com/OCA/OCB.git odoo: https://github.com/odoo/odoo.git openupgrade: https://github.com/OCA/OpenUpgrade.git # $ODOO_VERSION is... the Odoo version! "11.0" or similar target: origin $ODOO_VERSION merges: - origin $ODOO_VERSION - odoo refs/pull/25594/head # Expose `Field` from search_filters.js web: defaults: depth: $DEPTH_MERGE remotes: origin: https://github.com/OCA/web.git tecnativa: https://github.com/Tecnativa/partner-contact.git target: origin $ODOO_VERSION merges: - origin $ODOO_VERSION - origin refs/pull/1007/head # web_responsive search - tecnativa 11.0-some_addon-custom # Branch for this customer only ``` ###### Automatic download of repos Doodba is smart enough to download automatically git repositories even if they are missing in `repos.yaml`. It will happen if it is used in [`addons.yaml`][], except for the special [`private`][] repo. This will help you keep your deployment definitions DRY. You can configure this behavior with these environment variables (default values shown): - `DEFAULT_REPO_PATTERN="https://github.com/OCA/{}.git"` - `DEFAULT_REPO_PATTERN_ODOO="https://github.com/OCA/OCB.git"` As you probably guessed, we use something like `str.format(repo_basename)` on top of those variables to compute the default remote origin. If, i.e., you want to use your own repositories as default remotes, just add these build arguments to your `docker-compose.yaml` file: ```yaml # [...] services: odoo: build: args: DEFAULT_REPO_PATTERN: &origin "https://github.com/Tecnativa/{}.git" DEFAULT_REPO_PATTERN_ODOO: *origin # [...] ``` So, for example, if your [`repos.yaml`][] file is empty and your [`addons.yaml`][] contains this: ```yaml server-tools: - module_auto_update ``` A `/opt/odoo/auto/repos.yaml` file with this will be generated and used to download git code: ```yaml /opt/odoo/custom/src/odoo: defaults: depth: $DEPTH_DEFAULT remotes: origin: https://github.com/OCA/OCB.git target: origin $ODOO_VERSION merges: - origin $ODOO_VERSION /opt/odoo/custom/src/server-tools: defaults: depth: $DEPTH_DEFAULT remotes: origin: https://github.com/OCA/server-tools.git target: origin $ODOO_VERSION merges: - origin $ODOO_VERSION ``` All of this means that, you only need to define the git aggregator spec in [`repos.yaml`][] if anything diverges from the standard: - You need special merges. - You need a special origin. - The folder name does not match the origin pattern. - The branch name does not match `$ODOO_VERSION`. - Etc. ##### `/opt/odoo/custom/src/addons.yaml` One entry per repo and addon you want to activate in your project. Like this: ```yaml website: - website_cookie_notice - website_legal_page web: - web_responsive ``` Advanced features: - You can bundle [several YAML documents][] if you want to logically group your addons and some repos are repeated among groups, by separating each document with `---`. - Addons under `private` and `odoo/addons` are linked automatically unless you specify them. - You can use `ONLY` to supply a dictionary of environment variables and a list of possible values to enable that document in the matching environments. - You can use `ENV` to supply a dictionary of environment variables to be used on downloading repositories. Following variables are supported: - `DEFAULT_REPO_PATTERN` - `DEFAULT_REPO_PATTERN_ODOO` - `DEPTH_DEFAULT` - `ODOO_VERSION` - can be used as repository branch - If an addon is found in several places at the same time, it will get linked according to this priority table: 1. Addons in [`private`][]. 2. Addons in other repositories (in case one is matched in several, it will be random, BEWARE!). Better have no duplicated names if possible. 3. Core Odoo addons from [`odoo/addons`][`odoo`]. - If an addon is specified but not available at runtime, it will fail silently. - You can use any wildcards supported by [Python's glob module][glob]. This example shows these advanced features: ```yaml # Spanish Localization l10n-spain: - l10n_es # Overrides built-in l10n_es under odoo/addons server-tools: - "*date*" # All modules that contain "date" in their name - auditlog web: - "*" # All web addons --- # Different YAML document to separate SEO Tools website: - website_blog_excertp_img server-tools: # Here we repeat server-tools, but no problem because it's a # different document - html_image_url_extractor - html_text --- # Enable demo ribbon only for devel and test environments ONLY: PGDATABASE: # This environment variable must exist and be in the list - devel - test web: - web_environment_ribbon --- # Enable special authentication methods only in production environment ONLY: PGDATABASE: - prod server-tools: - auth_* --- # Custom repositories ENV: DEFAULT_REPO_PATTERN: https://github.com/Tecnativa/{}.git ODOO_VERSION: 14.0-new-feature some-repo: # Cloned from https://github.com/Tecnativa/some-repo.git branch 14.0-new-feature - some_custom_module ``` ##### `/opt/odoo/custom/dependencies/*.txt` Files to indicate dependencies of your subimage, one for each of the supported package managers: - `apt_build.txt`: build-time dependencies, installed before any others and removed after all the others too. Usually these would include Debian packages such as `build-essential` or `python-dev`. From Doodba 11.0, this is most likely not needed, as build dependencies are shipped with the image, and local python develpment headers should be used instead of those downloaded from apt. - `apt.txt`: run-time dependencies installed by apt. - `gem.txt`: run-time dependencies installed by gem. - `npm.txt`: run-time dependencies installed by npm. - `pip.txt`: a normal [pip `requirements.txt`][] file, for run-time dependencies too. It will get executed with `--update` flag, just in case you want to overwrite any of the pre-bundled dependencies. ### `/opt/odoo/common`: The useful one This folder is full of magic. I'll document it some day. For now, just look at the code. Only some notes: - Will compile your code with [`PYTHONOPTIMIZE=1`][] by default. - Will remove all code not used from the image by default (not listed in `/opt/odoo/custom/src/addons.yaml`), to keep it thin. ### `/opt/odoo/auto`: The automatic one This directory will have things that are automatically generated at build time. #### `/opt/odoo/auto/addons` It will be full of symlinks to the addons you selected in [`addons.yaml`][]. #### `/opt/odoo/auto/odoo.conf` It will have the result of merging all configurations under `/opt/odoo/{common,custom}/conf.d/`, in that order. ## The `Dockerfile` I will document all build arguments and environment variables some day, but for now keep this in mind: - This is just a base image, full of tools. **You need to build your project subimage** from this one, even if your project's `Dockerfile` only contains these 2 lines: FROM tecnativa/doodba MAINTAINER Me <me@example.com> - The above sentence becomes true because we have a lot of `ONBUILD` sentences here, so at least **your project must have a `./custom` folder** along with its `Dockerfile` for it to work. - All should be magic if you adhere to our opinions here. Just put the code where it should go, and relax. ## Bundled tools There is a good collections of tools available in the image that help dealing with Odoo and its peculiarities: ### `addons` A handy CLI tool to automate addon management based on the current environment. It allows you to install, update, test and/or list private, extra and/or core addons available to current container, based on current [`addons.yaml`][] configuration. Call `addons --help` for usage instructions. ### `click-odoo` and related scripts The great [`click-odoo`][] scripting framework and the collection of scripts found in [`click-odoo-contrib`][] are included. Refer to their sites to know how to use them. \* Note: This replaces the deprecated `python-odoo-shell` binary. ### [`nano`](https://www.nano-editor.org/) The CLI text editor we all know, just in case you need to inspect some bug in hot deployments. ### `log` Just a little shell script that you can use to add logs to your build or entrypoint scripts: log INFO I'm informing ### `pot` Little shell shortcut for exporting a translation template from any addon(s). Usage: pot my_addon,my_other_addon ### [`psql`](https://www.postgresql.org/docs/current/app-psql.html) Environment variables are there so that if you need to connect with the database, you just need to execute: docker-compose run -l traefik.enable=false --rm odoo psql The same is true for any other [Postgres client applications][]. ### [`inotify`](https://github.com/dsoprea/PyInotify) Enables hot code reloading when odoo is started with `--dev` and passed `reload` or `all` as an argument. [copier template](https://github.com/Tecnativa/doodba-copier-template) enables this by default in the development environment. Doodba supports this feature under versions 11.0 and later. Check [CLI docs](https://www.odoo.com/documentation/13.0/reference/cmdline.html#developer-features) for details. ### [`debugpy`](https://github.com/microsoft/vscode-python) [VSCode][] debugger. If you use this editor with its python module, you will find it useful. To debug at a certain point of the code, add this Python code somewhere: ```python import debugpy debugpy.listen(6899) print("Waiting for debugger attach") debugpy.wait_for_client() debugpy.breakpoint() print('break on this line') ``` To start Odoo within a debugpy environment, which will obey the breakpoints established in your IDE (but will work slowly), just add `-e DEBUGPY_ENABLE=1` to your odoo container. If you use the official [template][], you can boot it in debugpy mode with: ```bash export DOODBA_DEBUGPY_ENABLE=1 docker-compose -f devel.yaml up -d ``` Of course, you need to have properly configured your [VSCode][]. To do so, make sure in your project there is a `.vscode/launch.json` file with these minimal contents: ```json { "version": "0.2.0", "configurations": [ { "name": "Attach to debug in devel.yaml", "type": "python", "request": "attach", "pathMappings": [ { "localRoot": "${workspaceRoot}/odoo", "remoteRoot": "/opt/odoo" } ], "port": 6899, "host": "localhost" } ] } ``` Then, execute that configuration as usual. ### [`pudb`](https://github.com/inducer/pudb) This is another great debugger that includes remote debugging via telnet, which can be useful for some cases, or for people that prefer it over [wdb](#wdb). To use it, inject this in any Python script: ```python import pudb.remote pudb.remote.set_trace(term_size=(80, 24)) ``` Then open a telnet connection to it (running in `0.0.0.0:6899` by default). It is safe to use in [production][] environments **if you know what you are doing and do not expose the debugging port to attackers**. Usage: docker-compose exec odoo telnet localhost 6899 ### [`git-aggregator`](https://pypi.python.org/pypi/git-aggregator) We found this one to be the most useful tool for downlading code, merging it and placing it somewhere. ### `autoaggregate` This little script wraps `git-aggregator` to make it work fine and automatically with this image. Used in the [template][]'s `setup-devel.yaml` step. #### Example `repos.yaml` file This [`repos.yaml`][] example merges [several sources][`odoo`]: ```yaml ./odoo: defaults: # Shallow repositores are faster & thinner. You better use # $DEPTH_DEFAULT here when you need no merges. depth: $DEPTH_MERGE remotes: ocb: https://github.com/OCA/OCB.git odoo: https://github.com/odoo/odoo.git target: ocb $ODOO_VERSION merges: - ocb $ODOO_VERSION - odoo refs/pull/13635/head shell_command_after: # Useful to merge a diff when there's no git history correlation - curl -sSL https://github.com/odoo/odoo/pull/37187.diff | patch -fp1 ``` ### [`odoo`](https://www.odoo.com/documentation/10.0/reference/cmdline.html) We set an `$OPENERP_SERVER` environment variable pointing to [the autogenerated configuration file](#optodooautoodooconf) so you don't have to worry about it. Just execute `odoo` and it will work fine. Note that version 9.0 has an `odoo` binary to provide forward compatibility (but it has the `odoo.py` one too). ## Subproject template That's a big structure! Get it up and running quickly using the [copier template](https://github.com/Tecnativa/doodba-copier-template) we provide to help you generate your subproject. Check its docs to know how to use it. ## FAQ ### Will there be not retrocompatible changes on the image? This image is production-ready, but it is constantly evolving too, so some new features can break some old ones, or conflict with them, and some old features might get deprecated and removed at some point. The best you can do is to [subscribe to the compatibility breakage announcements issue][retrobreak]. ### This project is too opinionated, but can I question any of those opinions? Of course. There's no guarantee that we will like it, but please do it. :wink: ### What's this `hooks` folder here? It runs triggers when doing the automatic build in the Docker Hub. [Check this](https://hub.docker.com/r/thibaultdelor/testautobuildhooks/). ### How can I pin an image version? Version-pinning is a good idea to keep your code from differing among image updates. It's the best way to ensure no updates got in between the last time you checked the image and the time you deploy it to production. You can do it through **its sha256 code**. Get any image's code through inspect, running from a computer where the correct image version is downloaded: docker image inspect --format='{{.RepoDigests}}' tecnativa/doodba:10.0-onbuild Alternatively, you can browse [this image's builds][builds], click on the one you know it works fine for you, and search for the `digest` word using your browser's _search in page_ system (Ctrl+F usually). You will find lines similar to: [...] 10.0: digest: sha256:fba69478f9b0616561aa3aba4d18e4bcc2f728c9568057946c98d5d3817699e1 size: 4508 [...] 8.0: digest: sha256:27a3dd3a32ce6c4c259b4a184d8db0c6d94415696bec6c2668caafe755c6445e size: 4508 [...] 9.0: digest: sha256:33a540eca6441b950d633d3edc77d2cc46586717410f03d51c054ce348b2e977 size: 4508 [...] Once you find them, you can use that pinned version in your builds, using a Dockerfile similar to this one: ```Dockerfile # Hash-pinned version of tecnativa/doodba:10.0-onbuild FROM tecnativa/doodba@sha256:fba69478f9b0616561aa3aba4d18e4bcc2f728c9568057946c98d5d3817699e1 ``` ### How can I help? Just [head to our project](https://github.com/Tecnativa/doodba) and open a discussion, issue or pull request. ## Related Projects - Of course, [the Doodba Copier Template](https://github.com/Tecnativa/doodba-copier-template). - [QA tools for Doodba-based projects][doodba-qa] - [Ansible role for automated deployment / update from Le Filament](https://github.com/remi-filament/ansible_role_odoo_docker) - Find others by searching [GitHub projects tagged with `#doodba`](https://github.com/topics/doodba) [`/opt/odoo/auto/addons`]: #optodooautoaddons [`addons.yaml`]: #optodoocustomsrcaddonsyaml [`compose_file` environment variable]: https://docs.docker.com/compose/reference/envvars/#/composefile [`odoo.conf`]: #optodooautoodooconf [`odoo`]: #optodoocustomsrcodoo [`private`]: #optodoocustomsrcprivate [`pythonoptimize=1`]: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONOPTIMIZE [`repos.yaml`]: #optodoocustomsrcreposyaml [`click-odoo`]: https://github.com/acsone/click-odoo [`click-odoo-contrib`]: https://github.com/acsone/click-odoo-contrib [build.d]: #optodoocustombuildd [builds]: https://hub.docker.com/r/tecnativa/doodba/builds/ [dependencies]: #optodoocustomdependenciestxt [development]: #development [doodba-qa]: https://github.com/Tecnativa/doodba-qa [fish]: http://fishshell.com/ [glob]: https://docs.python.org/3/library/glob.html [mailhog]: #mailhog [oca]: https://odoo-community.org/ [ocb]: https://github.com/OCA/OCB [odoo s.a.]: https://www.odoo.com [openupgrade]: https://github.com/OCA/OpenUpgrade/ [original odoo]: https://github.com/odoo/odoo [pip `requirements.txt`]: https://pip.readthedocs.io/en/latest/user_guide/#requirements-files [postgres client applications]: https://www.postgresql.org/docs/current/static/reference-client.html [production]: #production [retrobreak]: https://github.com/Tecnativa/doodba/issues/67 [template]: #subproject-template [several yaml documents]: http://www.yaml.org/spec/1.2/spec.html#id2760395 [ssh-conf]: https://www.digitalocean.com/community/tutorials/how-to-configure-custom-connection-options-for-your-ssh-client [testing]: #testing [traefik]: https://traefik.io/ [vscode]: https://code.visualstudio.com/
{ "content_hash": "0f2c77eee9344639b1e2db9290540779", "timestamp": "", "source": "github", "line_count": 744, "max_line_length": 184, "avg_line_length": 33.77150537634409, "alnum_prop": 0.7196927485473215, "repo_name": "Tecnativa/docker-odoo-base", "id": "bd164c3013c1b4d4c52eb087a2caf79e44b4575b", "size": "25181", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "README.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Python", "bytes": "33853" }, { "name": "Shell", "bytes": "6434" } ], "symlink_target": "" }
package main; import appstates.EntityDataState; import appstates.GameplayAppState; import appstates.VisualAppState; import com.jme3.app.SimpleApplication; import com.jme3.input.KeyInput; import com.jme3.input.controls.AnalogListener; import com.jme3.input.controls.KeyTrigger; import com.jme3.math.ColorRGBA; import com.jme3.renderer.RenderManager; public class Main extends SimpleApplication { public static void main(String[] args) { Main app = new Main(); app.start(); } @Override public void simpleInitApp() { // Initializes the appstates stateManager.attachAll(new VisualAppState(), new GameplayAppState(), // FIXME: This feature is still not totally funcional // and is causing weird behaviour. Don't uncomment /*new BillboardAppState(),*/ new EntityDataState()); viewPort.setBackgroundColor(ColorRGBA.Cyan); inputManager.addMapping("+", new KeyTrigger(KeyInput.KEY_I)); inputManager.addMapping("-", new KeyTrigger(KeyInput.KEY_O)); inputManager.addListener(analogListener, "+", "-"); } private final AnalogListener analogListener = new AnalogListener() { @Override public void onAnalog(String name, float intensity, float tpf) { if(name.equals("+")) { cam.setFrustumFar(cam.getFrustumFar() + 100*tpf); } else if(name.equals("-")) { cam.setFrustumFar(cam.getFrustumFar() - 100*tpf); } } }; @Override public void simpleUpdate(float tpf) { } @Override public void simpleRender(RenderManager rm) { //TODO: add render code } }
{ "content_hash": "6ed7c9ea4ff14053365b5354495d91e8", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 88, "avg_line_length": 33.421052631578945, "alnum_prop": 0.5805774278215223, "repo_name": "Ev1lbl0w/zombie-survival", "id": "ef1d89df17fe2d6d1d95273d481b149b09d24a0b", "size": "1905", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/Main.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "13248" } ], "symlink_target": "" }
var path = require('path'); var webpack = require('webpack'); module.exports = { entry: { popover_defaultfunctionality: __dirname + '/app/popover/defaultfunctionality/app.js', popover_positioning: __dirname + '/app/popover/positioning/app.js', popover_bottompositioning: __dirname + '/app/popover/bottompositioning/app.js', popover_modalpopover: __dirname + '/app/popover/modalpopover/app.js', popover_righttoleftlayout: __dirname + '/app/popover/righttoleftlayout/app.js', progressbar_defaultfunctionality: __dirname + '/app/progressbar/defaultfunctionality/app.js', progressbar_colorranges: __dirname + '/app/progressbar/colorranges/app.js', progressbar_templates: __dirname + '/app/progressbar/templates/app.js', progressbar_layout: __dirname + '/app/progressbar/layout/app.js', progressbar_righttoleftlayout: __dirname + '/app/progressbar/righttoleftlayout/app.js', rangeselector_defaultfunctionality: __dirname + '/app/rangeselector/defaultfunctionality/app.js', rangeselector_datascale: __dirname + '/app/rangeselector/datascale/app.js', rangeselector_timescale: __dirname + '/app/rangeselector/timescale/app.js', rangeselector_numericscale: __dirname + '/app/rangeselector/numericscale/app.js', rangeselector_negativescale: __dirname + '/app/rangeselector/negativescale/app.js', rangeselector_decimalscale: __dirname + '/app/rangeselector/decimalscale/app.js', rangeselector_backgroundimage: __dirname + '/app/rangeselector/backgroundimage/app.js', rangeselector_chartonbackground: __dirname + '/app/rangeselector/chartonbackground/app.js', rangeselector_rangeselectorasafilter: __dirname + '/app/rangeselector/rangeselectorasafilter/app.js', rangeselector_fluidsize: __dirname + '/app/rangeselector/fluidsize/app.js', rangeselector_customizedmarkers: __dirname + '/app/rangeselector/customizedmarkers/app.js', rangeselector_righttoleftlayout: __dirname + '/app/rangeselector/righttoleftlayout/app.js', rating_defaultfunctionality: __dirname + '/app/rating/defaultfunctionality/app.js', responsivepanel_defaultfunctionality: __dirname + '/app/responsivepanel/defaultfunctionality/app.js', responsivepanel_integrationwithjqxmenu: __dirname + '/app/responsivepanel/integrationwithjqxmenu/app.js', responsivepanel_fluidsize: __dirname + '/app/responsivepanel/fluidsize/app.js', responsivepanel_righttoleftlayout: __dirname + '/app/responsivepanel/righttoleftlayout/app.js', ribbon_defaultfunctionality: __dirname + '/app/ribbon/defaultfunctionality/app.js', ribbon_collapsible: __dirname + '/app/ribbon/collapsible/app.js', ribbon_ribbonatthebottom: __dirname + '/app/ribbon/ribbonatthebottom/app.js', ribbon_verticalribbon: __dirname + '/app/ribbon/verticalribbon/app.js', ribbon_verticalrightposition: __dirname + '/app/ribbon/verticalrightposition/app.js', ribbon_popuplayout: __dirname + '/app/ribbon/popuplayout/app.js', ribbon_integrationwithotherwidgets: __dirname + '/app/ribbon/integrationwithotherwidgets/app.js', ribbon_scrolling: __dirname + '/app/ribbon/scrolling/app.js', ribbon_events: __dirname + '/app/ribbon/events/app.js', ribbon_fluidsize: __dirname + '/app/ribbon/fluidsize/app.js', ribbon_righttoleftlayout: __dirname + '/app/ribbon/righttoleftlayout/app.js', scheduler_defaultfunctionality: __dirname + '/app/scheduler/defaultfunctionality/app.js', scheduler_resources: __dirname + '/app/scheduler/resources/app.js', scheduler_timelineviews: __dirname + '/app/scheduler/timelineviews/app.js', scheduler_agendaview: __dirname + '/app/scheduler/agendaview/app.js', scheduler_bindingtojson: __dirname + '/app/scheduler/bindingtojson/app.js', scheduler_bindingtoicalendar: __dirname + '/app/scheduler/bindingtoicalendar/app.js', scheduler_appointmentstatuses: __dirname + '/app/scheduler/appointmentstatuses/app.js', scheduler_appointmentrestrictions: __dirname + '/app/scheduler/appointmentrestrictions/app.js', scheduler_appointmentcustomization: __dirname + '/app/scheduler/appointmentcustomization/app.js', scheduler_appointmentsexacttimerendering: __dirname + '/app/scheduler/appointmentsexacttimerendering/app.js', scheduler_recurringappointments: __dirname + '/app/scheduler/recurringappointments/app.js', scheduler_timezones: __dirname + '/app/scheduler/timezones/app.js', scheduler_timescaleszooming: __dirname + '/app/scheduler/timescaleszooming/app.js', scheduler_timescalesconfiguration: __dirname + '/app/scheduler/timescalesconfiguration/app.js', scheduler_timelineviewswithcustomslotwidth: __dirname + '/app/scheduler/timelineviewswithcustomslotwidth/app.js', scheduler_rowheight: __dirname + '/app/scheduler/rowheight/app.js', scheduler_hidetimeruler: __dirname + '/app/scheduler/hidetimeruler/app.js', scheduler_hideweekends: __dirname + '/app/scheduler/hideweekends/app.js', scheduler_contextmenu: __dirname + '/app/scheduler/contextmenu/app.js', scheduler_editdialog: __dirname + '/app/scheduler/editdialog/app.js', scheduler_worktime: __dirname + '/app/scheduler/worktime/app.js', scheduler_rowheightconfiguration: __dirname + '/app/scheduler/rowheightconfiguration/app.js', scheduler_monthviewwithautorowheight: __dirname + '/app/scheduler/monthviewwithautorowheight/app.js', scheduler_monthviewweeknumbers: __dirname + '/app/scheduler/monthviewweeknumbers/app.js', scheduler_events: __dirname + '/app/scheduler/events/app.js', scheduler_keyboardnavigation: __dirname + '/app/scheduler/keyboardnavigation/app.js', scheduler_resourceswithcustomcolumnwidths: __dirname + '/app/scheduler/resourceswithcustomcolumnwidths/app.js', scheduler_verticalresources: __dirname + '/app/scheduler/verticalresources/app.js', scheduler_timelineviewswithresources: __dirname + '/app/scheduler/timelineviewswithresources/app.js', scheduler_dataexport: __dirname + '/app/scheduler/dataexport/app.js', scheduler_dataprinting: __dirname + '/app/scheduler/dataprinting/app.js', scheduler_localization: __dirname + '/app/scheduler/localization/app.js', scheduler_fluidsize: __dirname + '/app/scheduler/fluidsize/app.js', scheduler_righttoleft: __dirname + '/app/scheduler/righttoleft/app.js', scrollbar_defaultfunctionality: __dirname + '/app/scrollbar/defaultfunctionality/app.js', scrollbar_righttoleft: __dirname + '/app/scrollbar/righttoleft/app.js', scrollview_defaultfunctionality: __dirname + '/app/scrollview/defaultfunctionality/app.js', slider_defaultfunctionality: __dirname + '/app/slider/defaultfunctionality/app.js', slider_rangeslider: __dirname + '/app/slider/rangeslider/app.js', slider_verticalslider: __dirname + '/app/slider/verticalslider/app.js', slider_fluidsize: __dirname + '/app/slider/fluidsize/app.js', slider_events: __dirname + '/app/slider/events/app.js', slider_templates: __dirname + '/app/slider/templates/app.js', slider_layout: __dirname + '/app/slider/layout/app.js', slider_slidertooltip: __dirname + '/app/slider/slidertooltip/app.js', slider_sliderlabels: __dirname + '/app/slider/sliderlabels/app.js', slider_keyboardnavigation: __dirname + '/app/slider/keyboardnavigation/app.js', slider_righttoleft: __dirname + '/app/slider/righttoleft/app.js', sortable_defaultfunctionality: __dirname + '/app/sortable/defaultfunctionality/app.js', sortable_events: __dirname + '/app/sortable/events/app.js', sortable_connectedlist: __dirname + '/app/sortable/connectedlist/app.js', sortable_displayastable: __dirname + '/app/sortable/displayastable/app.js', splitter_defaultfunctionality: __dirname + '/app/splitter/defaultfunctionality/app.js', splitter_nestedsplitter: __dirname + '/app/splitter/nestedsplitter/app.js', splitter_horizontalsplitter: __dirname + '/app/splitter/horizontalsplitter/app.js', splitter_verticalsplitter: __dirname + '/app/splitter/verticalsplitter/app.js', splitter_togglebottompanel: __dirname + '/app/splitter/togglebottompanel/app.js', splitter_togglerightpanel: __dirname + '/app/splitter/togglerightpanel/app.js', splitter_integrationwithjqxtabs: __dirname + '/app/splitter/integrationwithjqxtabs/app.js', splitter_integrationwithjqxtree: __dirname + '/app/splitter/integrationwithjqxtree/app.js', splitter_integrationwithjqxgrid: __dirname + '/app/splitter/integrationwithjqxgrid/app.js', splitter_multiplesplitpanelswithjqxtabs: __dirname + '/app/splitter/multiplesplitpanelswithjqxtabs/app.js', splitter_splitterwithinjqxtabs: __dirname + '/app/splitter/splitterwithinjqxtabs/app.js', splitter_simplecontainer: __dirname + '/app/splitter/simplecontainer/app.js', splitter_nestedsidesplitters: __dirname + '/app/splitter/nestedsidesplitters/app.js', splitter_loadingsplitpanelswithxhr: __dirname + '/app/splitter/loadingsplitpanelswithxhr/app.js', splitter_fluidsize: __dirname + '/app/splitter/fluidsize/app.js', splitter_api: __dirname + '/app/splitter/api/app.js', splitter_events: __dirname + '/app/splitter/events/app.js', }, output: { path: __dirname + '/build', filename: '[name].bundle.js' }, module: { loaders: [{ test: /.js?$/, loader: 'babel-loader', exclude: /node_modules/, query: { presets: ['es2015', 'react'] } }] }, plugins: [ new webpack.DefinePlugin ({ 'process.env': { 'NODE_ENV': JSON.stringify('production') } }), new webpack.optimize.UglifyJsPlugin ({ mangle: true, sourcemap: false, compress: { warnings: false } }) ] };
{ "content_hash": "df6de0dd691c7fd456378d5ab8ebc033", "timestamp": "", "source": "github", "line_count": 161, "max_line_length": 125, "avg_line_length": 67.94409937888199, "alnum_prop": 0.6517963250754182, "repo_name": "juannelisalde/holter", "id": "fa8a09efa4f49add0272d07296282a5e8dd3a03f", "size": "10939", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "assets/jqwidgets/demos/react/webpack.config5.js", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "1327" }, { "name": "Batchfile", "bytes": "802" }, { "name": "C#", "bytes": "374733" }, { "name": "CSS", "bytes": "882785" }, { "name": "HTML", "bytes": "18898187" }, { "name": "Java", "bytes": "12788" }, { "name": "JavaScript", "bytes": "9712220" }, { "name": "PHP", "bytes": "2051144" }, { "name": "TypeScript", "bytes": "3437214" } ], "symlink_target": "" }
'use strict' /* application libraries */ var db = require('../lib/database.js') var immutable = require('../lib/immutable') var jsonParseMulti = require('../lib/json-parse-multi') var setId = require('../lib/set-id') var stringifyObject = require('../lib/stringify-object') /* public functions */ module.exports = immutable.model('Auth', { createAuth: createAuth, getAuthByAccountId: getAuthByAccountId, getAuthByProviderNameAndAccountId: getAuthByProviderNameAndAccountId, }) /** * @function createAuth * * @param {string} authProviderAccountId - user id of account with auth provider * @param {object} authProviderData * @param {string} authProviderName - name of auth provider * @param {string} accountId - hex id of account * @param {string} originalAuthId - hex id * @param {string} parentAuthId - hex id * @param {object} session - request session * * @returns {Promise} */ function createAuth (args) { // build data var auth = { authCreateTime: args.session.requestTimestamp, authProviderAccountId: args.authProviderAccountId, authProviderData: stringifyObject(args.authProviderData), authProviderName: args.authProviderName, accountId: args.accountId, originalAuthId: args.originalAuthId, parentAuthId: args.parentAuthId, } // get id setId(auth, 'authId', 'originalAuthId') // insert return db('immutable').query( 'INSERT INTO auth VALUES(UNHEX(:authId), UNHEX(:originalAuthId), UNHEX(:parentAuthId), UNHEX(:accountId), :authProviderName, :authProviderAccountId, :authProviderData, :authCreateTime)', auth, undefined, args.session ) // success .then(function (res) { // unpack JSON encoded data return jsonParseMulti(auth, ['authProviderData']) }) } /** * @function getAuthByAccountId * * @param {string} accountId - hex id * * @returns {Promise} */ function getAuthByAccountId (args) { // select return db('immutable').query( 'SELECT HEX(a.authId) AS authId, HEX(a.originalAuthId) AS originalAuthId, HEX(a.parentAuthId) AS parentAuthId, HEX(a.accountId) AS accountId, a.authProviderName, a.authProviderAccountId, a.authProviderData, a.authCreateTime FROM auth a LEFT JOIN auth a2 ON a2.parentAuthId = a.authId WHERE a.accountId = UNHEX(:accountId) AND a2.authId IS NULL', args, undefined, args.session ) // success .then(function (res) { // unpack JSON encoded data return res.length ? jsonParseMulti(res, ['authProviderData']) : [] }) } /** * @function getAuthByProviderNameAndAccountId * * @param {string} authProviderName - name of auth provider * @param {string} authProviderAccountId - user id of account with auth provider * * @returns {Promise} */ function getAuthByProviderNameAndAccountId (args) { // select return db('immutable').query( 'SELECT HEX(a.authId) AS authId, HEX(a.originalAuthId) AS originalAuthId, HEX(a.parentAuthId) AS parentAuthId, HEX(a.accountId) AS accountId, a.authProviderName, a.authProviderAccountId, a.authProviderData, a.authCreateTime FROM auth a LEFT JOIN auth a2 ON a2.parentAuthId = a.authId WHERE a.authProviderName = :authProviderName AND a.authProviderAccountId = :authProviderAccountId AND a2.authId IS NULL', args, undefined, args.session ) // success .then(function (res) { // unpack JSON encoded data return res.length ? jsonParseMulti(res[0], ['authProviderData']) : undefined }) }
{ "content_hash": "1445dea49942480ac3118e7bafdf40b7", "timestamp": "", "source": "github", "line_count": 100, "max_line_length": 413, "avg_line_length": 35.58, "alnum_prop": 0.6930860033726813, "repo_name": "warncke/immutable-commerce", "id": "79d793c305de8e3fe42e57d6db98e89026ab65e4", "size": "3558", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "models/auth.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1440" }, { "name": "HTML", "bytes": "11003" }, { "name": "JavaScript", "bytes": "436067" } ], "symlink_target": "" }
<?php namespace OpenPasswd\Application; use OpenPasswd\Core\Security; use Symfony\Component\HttpFoundation\JsonResponse; use OpenPasswd\Core\ErrorResponse; class User extends AbstractApp implements ApplicationInterface { public function __construct(\Silex\Application $app) { parent::__construct($app); $this->table = 'user'; $this->fields = 'id, slug, username, name, created_at, updated_at, last_connection'; $this->order = 'name ASC'; $this->criteria = null; $this->criteria_values = array(); $this->search = array('slug', 'username', 'name'); } /** * Get an iten in the model by slug */ public function getAction($slug) { $object = $this->retrieveBySlug($slug); if ($object === false) { return new ErrorResponse('Impossible to find object '.$slug, 404); } // Get the groups enable for the user $sql = 'SELECT g.id, g.slug, g.name, g.description FROM '.$this->db->quoteIdentifier('group').' g INNER JOIN '.$this->db->quoteIdentifier('user_has_group').' ug ON g.id = ug.group_id WHERE ug.user_id = :user_id ORDER BY g.name'; $fields = $this->db->fetchAll($sql, array(':user_id' => $object['id'])); $object['enable_groups'] = $fields; // Get the groups always available for the user $sql = 'SELECT DISTINCT g.id, g.slug, g.name, g.description FROM '.$this->db->quoteIdentifier('group').' g WHERE g.id NOT IN ( SELECT ug.group_id FROM '.$this->db->quoteIdentifier('user_has_group').' ug WHERE ug.user_id = :user_id ) ORDER BY g.name'; $fields = $this->db->fetchAll($sql, array(':user_id' => $object['id'])); $object['available_groups'] = $fields; return new JsonResponse($object); } /** * Save the data in the model */ public function saveAction($slug = null) { try { if ($slug === null) { return $this->insert(); } else { return $this->update($slug); } } catch (\Exception $e) { return new ErrorResponse($e->getMessage(), $e->getCode() !== 0 ? $e->getCode() : 500); } } /** * Remove the data in the model */ public function deleteAction($slug) { try { $object = $this->retrieveBySlug($slug); if ($object === false) { return new ErrorResponse('Impossible to find object '.$slug, 404); } $this->db->delete('user_has_group', array('user_id' => $object['id'])); $this->db->delete($this->db->quoteIdentifier($this->table), array('id' => $object['id'])); return new JsonResponse(array('message' => 'The user is deleted', 'object' => $object), 200); } catch (\Exception $e) { return new ErrorResponse($e->getMessage(), $e->getCode() !== 0 ? $e->getCode() : 500); } } /** * Insert a new user */ private function insert() { list($name, $username, $password, $groups) = $this->getDataFromForm(false); $slug = $this->getSlug($name); try { $now = date('Y-m-d H:i:s'); $this->db->insert($this->db->quoteIdentifier($this->table), array( 'slug' => $slug, 'name' => $name, 'username' => $username, 'passwd' => Security::hash($password), 'created_at' => $now, 'updated_at' => $now, )); $object = $this->retrieveBySlug($slug); // Save groups foreach ($groups as $group) { $this->db->insert('user_has_group', array( 'user_id' => $object['id'], 'group_id' => $group, )); } return new JsonResponse(array('message' => 'The user is save', 'object' => $object), 201); } catch (\Exception $e) { return new ErrorResponse('Error while save the user'); } } /** * Update an existing user */ private function update($slug) { $object = $this->retrieveBySlug($slug); if ($object === false) { return new ErrorResponse('Impossible to find object '.$slug, 404); } list($name, $username, $password, $groups) = $this->getDataFromForm(true); try { $update_data = array('name' => $name, 'username' => $username, 'updated_at' => date('Y-m-d H:i:s')); if (empty($password) === false) { $update_data['passwd'] = Security::hash($password); } $this->db->update($this->db->quoteIdentifier($this->table), $update_data, array('id' => $object['id'])); // Save fields $this->db->delete('user_has_group', array('user_id' => $object['id'])); foreach ($groups as $group) { $this->db->insert('user_has_group', array( 'user_id' => $object['id'], 'group_id' => $group, )); } return new JsonResponse(array('message' => 'The user is save'), 200); } catch (\Exception $e) { return new ErrorResponse('Error while save the user'); } } /** * Extract all parameters from the HTTP request * * @param bool $allow_empty_password True : allow empty password from the HTTP request, false else * @return array<name, username, password, groups> The datas of the request */ private function getDataFromForm($allow_empty_password) { $name = $this->request->get('name', ''); $username = $this->request->get('username', ''); $password = $this->request->get('password', ''); $groups = $this->request->get('groups', '[]'); if (is_string($name) === false || empty($name) === true) { throw new \Exception('Name can\'t be empty', 400); } if (is_string($username) === false || empty($username) === true) { throw new \Exception('Username must be a string', 400); } if (is_string($password) === false) { throw new \Exception('Password must be a string', 400); } if ($allow_empty_password === false && empty($password) === true) { throw new \Exception('Password can\'t be empty', 400); } if (is_string($groups) === false || ($groups = json_decode($groups)) === false || is_array($groups) === false) { throw new \Exception('Groups must be a JSON array', 400); } return array(trim((string)$name), trim((string)$username), trim((string)$password), $groups); } }
{ "content_hash": "2d9cf2a376f488599745158d17911cff", "timestamp": "", "source": "github", "line_count": 208, "max_line_length": 121, "avg_line_length": 34.02884615384615, "alnum_prop": 0.5012715456343599, "repo_name": "leblanc-simon/openpasswd", "id": "ce5b33e3ee6c39676f4d7914eb1a26e5bb4ec914", "size": "7314", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/OpenPasswd/Application/User.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "5309" }, { "name": "JavaScript", "bytes": "34161" }, { "name": "PHP", "bytes": "132467" } ], "symlink_target": "" }
begin gem 'dm-core', '=0.9.5' require 'dm-core' rescue LoadError => e require 'data_mapper' end require 'base64' module Merb module SessionMixin def setup_session before_value = cookies[_session_id_key] request.session, cookies[_session_id_key] = Merb::DataMapperSession.persist(cookies[_session_id_key]) @_fingerprint = Marshal.dump(request.session.data).hash @_new_cookie = cookies[_session_id_key] != before_value end def finalize_session request.session.save if @_fingerprint != Marshal.dump(request.session.data).hash set_cookie(_session_id_key, request.session.session_id, Time.now + _session_expiry) if (@_new_cookie || request.session.needs_new_cookie) end def session_store_type "datamapper" end end table_name = (Merb::Plugins.config[:merb_datamapper][:session_table_name] || "sessions") class DataMapperSession include DataMapper::Resource storage_names[:default] = "sessions" property :session_id, String, :length => 255, :lazy => false, :key => true property :data, Text, :lazy => false property :updated_at, DateTime attr_accessor :needs_new_cookie class << self # Generates a new session ID and creates a row for the new session in the database. def generate new_session = self.new(:data =>{}) new_session.session_id = Merb::SessionMixin::rand_uuid new_session.save new_session end # Gets the existing session based on the <tt>session_id</tt> available in cookies. # If none is found, generates a new session. def persist(session_id) if !session_id.blank? session = self.first :session_id => session_id end unless session session = generate end [session, session.session_id] end def marshal(data) Base64.encode64(Marshal.dump(data)) if data end def unmarshal(data) Marshal.load(Base64.decode64(data)) if data end end # Regenerate the Session ID def regenerate self.session_id = Merb::SessionMixin::rand_uuid self.needs_new_cookie = true self.save end # Recreates the cookie with the default expiration time # Useful during log in for pushing back the expiration date def refresh_expiration self.needs_new_cookie = true end # Lazy-delete of session data def delete(key = nil) key ? self.data.delete(key) : self.data.clear end def empty? data.empty? end def each(&b) data.each(&b) end def each_with_index(&b) data.each_with_index(&b) end def [](key) data[key] end def []=(key, val) data[key] = val end def data @unmarshalled_data ||= self.class.unmarshal(@data) || {} end def data=(data) @data, @unmarshalled_data = data, data end private before :save, :serialize_data def serialize_data attribute_set :data, self.class.marshal(self.data) end end end
{ "content_hash": "6667baef18c36daab7e79a4cbf785bc4", "timestamp": "", "source": "github", "line_count": 119, "max_line_length": 143, "avg_line_length": 25.554621848739497, "alnum_prop": 0.6353173298257152, "repo_name": "kad3nce/collective", "id": "7a0eb0a2cec92cf7c59c5e84838f99dfc4b08c2a", "size": "3041", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "gems/gems/merb_datamapper-0.9.5/lib/merb/session/data_mapper_session.rb", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "76955" }, { "name": "JavaScript", "bytes": "300643" }, { "name": "PHP", "bytes": "857" }, { "name": "Ruby", "bytes": "5838818" } ], "symlink_target": "" }
package org.unitils.easymock.util; import org.easymock.internal.matchers.Equals; import org.unitils.reflectionassert.ReflectionComparator; import org.unitils.reflectionassert.ReflectionComparatorFactory; import org.unitils.reflectionassert.ReflectionComparatorMode; /** * An easy mock argument matcher to check whether 2 objects are equal by comparing all fields of the objects using * reflection. * <p/> * The (combination of) comparator modes specify how strict the comparison must be:<ul> * <li>ignore defaults: compare only arguments (and inner values) that have a non default value (eg null) as exepected value</li> * <li>lenient dates: do not compare actual date values, just that they both have a value or not</li> * <li>lenient order: order is not important when comparing collections or arrays</li> * </ul> * * @author Tim Ducheyne * @author Filip Neven * @see ReflectionComparator * @see ReflectionComparatorMode */ public class ReflectionArgumentMatcher<T> extends Equals { /* The comparator for lenient comparing expected and actual argument values */ private ReflectionComparator reflectionComparator; /** * Creates a matcher for the expected argument value. * The modes specify how to compare the expected value with the actual value. * * @param expected the argument value, not null * @param modes the comparator modes */ public ReflectionArgumentMatcher(T expected, ReflectionComparatorMode... modes) { super(expected); this.reflectionComparator = ReflectionComparatorFactory.createRefectionComparator(modes); } /** * Checks whether the given actual value is equal to the expected value. * A reflection comparator is used to compare both values. The modes determine how * strict this comparison will be. * <p/> * An assertion error is thrown if expected and actual did not match. This way, a more * detailed message can be provided. * * @param actual the actual argument value * @return true * @throws AssertionError in case expected and actual did not match */ @Override public boolean matches(Object actual) { return reflectionComparator.isEqual(getExpected(), actual); } }
{ "content_hash": "3b0c26441ecf3b8cf6906ec14bebb6b2", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 129, "avg_line_length": 36.96825396825397, "alnum_prop": 0.7093173035637613, "repo_name": "arteam/unitils", "id": "161b3b41a819c7da5976f36deffb54373e47e7af", "size": "2939", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "unitils-easymock/src/main/java/org/unitils/easymock/util/ReflectionArgumentMatcher.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "951" }, { "name": "CSS", "bytes": "5346" }, { "name": "HTML", "bytes": "16332" }, { "name": "Java", "bytes": "3029503" }, { "name": "JavaScript", "bytes": "3555" }, { "name": "PLSQL", "bytes": "1864" } ], "symlink_target": "" }
<?php namespace PhpSpec\Runner; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use PhpSpec\Event; use PhpSpec\Loader\Node\SpecificationNode; /** * Class SpecificationRunner * @package PhpSpec\Runner */ class SpecificationRunner { /** * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ private $dispatcher; /** * @var ExampleRunner */ private $exampleRunner; /** * @param EventDispatcherInterface $dispatcher * @param ExampleRunner $exampleRunner */ public function __construct(EventDispatcherInterface $dispatcher, ExampleRunner $exampleRunner) { $this->dispatcher = $dispatcher; $this->exampleRunner = $exampleRunner; } /** * @param SpecificationNode $specification * @return int|mixed */ public function run(SpecificationNode $specification) { $startTime = microtime(true); $this->dispatcher->dispatch('beforeSpecification', new Event\SpecificationEvent($specification) ); $result = Event\ExampleEvent::PASSED; foreach ($specification->getExamples() as $example) { $result = max($result, $this->exampleRunner->run($example)); } $this->dispatcher->dispatch('afterSpecification', new Event\SpecificationEvent($specification, microtime(true) - $startTime, $result) ); return $result; } }
{ "content_hash": "9acf6f7b0945f79dfa1d1908df4db02b", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 99, "avg_line_length": 24.983050847457626, "alnum_prop": 0.6438263229308006, "repo_name": "abdesselem/TestProject", "id": "86ed97f65a1ccbfb88216d16e146ab9f0320a42c", "size": "1807", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "vendor/phpspec/phpspec/src/PhpSpec/Runner/SpecificationRunner.php", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "158209" }, { "name": "JavaScript", "bytes": "207240" }, { "name": "PHP", "bytes": "2336364" }, { "name": "Shell", "bytes": "763" } ], "symlink_target": "" }
var models = require('../models'); var express = require('express'); module.exports = function(app) { /** * @api {get} /region Region list * @apiName getRegion * @apiGroup Region * * * @apiSuccess {JSON} field title,region,status * @apiError {JSON} field title,messages,errors,status */ app.get('/region', function (req, res) { models.Region.findAll({ include: [ {model: models.City, include: [ {model: models.Area}, ] }, ] }) .then(function (region) { res.statusCode = 200; res.json({ title: 'Get list of region', region: region, status: 'success' }); }) .catch(function (error) { res.statusCode = 400; res.json({ title: 'Cant get list of region', citys: error, status: 'error' }); }) }); /** * @api {post} /region Create new region * @apiName createRegion * @apiGroup Region * * @apiParam {String} name * @apiParam {Integer} CountryId - parent * * @apiSuccess {JSON} field title,region,status * @apiSuccess {JSON} field title,messages,errors,status */ app.post('/region', function(req, res) { var region = { name: req.query.name ? req.query.name : '', CountryId: req.query.CountryId ? req.query.CountryId : '', } models.Region.create(region) .then(function (data) { res.statusCode = 200; res.json({ title: 'Create region success', region: data, status: 'success' }) }) .catch(function (error) { res.statusCode = 400; res.json({ title: 'Cant create region success', region: error, status: 'error' }) }); }); /** * @api {get} /region/:id Region name * @apiName getRegionById * @apiGroup Region * * @apiParam {Number} id Region unique ID. * * @apiSuccess {JSON} field title,region,status * @apiSuccess {JSON} field title,messages,errors,status */ app.get('/region/:id', function(req, res) { var id = req.params.id; req.assert('id', 'id is required').isInt(); var errors = req.validationErrors(); if( !errors){ models.Region.find( { include: [ {model: models.City, include: [ {model: models.Area}, ] }, ], where: { id: id } }) .then(function (region) { res.statusCode = 200; res.json({ title: 'Get data by id ' + id, region: region, status: 'success' }); }); }else { res.statusCode = 400; res.json({ title: 'cant get data from this id', message: 'cant get data from this id', errors: errors, status: 'error' }); } }); /** * @api {put} /region/:id Update region * @apiName putRegion * @apiGroup Region * * @apiParam {Integer} id * @apiParam {Integer} CountryId - parent * * @apiSuccess {JSON} field title,region,status * @apiSuccess {JSON} field title,messages,errors,status */ app.put('/region/:id', function (req, res){ var id = req.params.id; req.assert('id', 'id is required').isInt(); var errors = req.validationErrors(); if( !errors){ models.Region.find( {where: { id: id }}) .then(function (region) { region.updateAttributes(req.query) .then(function (update_city) { res.statusCode = 200; res.json({ title: 'region id -' + id + ' update', region: update_city, status: 'success' }); }).catch(function (error) { res.statusCode = 404; res.json({ title: error, region: '', status: 'error' }); }) }); }else { res.statusCode = 400; res.json({ title: 'cant update region from this id', message: 'cant update region from this id', errors: errors, status: 'error' }); } }); /** * @api {delete} /region/:id Delete region * @apiName deleteRegion * @apiGroup Region * * @apiParam {Number} id Region unique ID. * * @apiSuccess {JSON} field title,region,status * @apiError {JSON} field title,messages,errors,status */ app.delete('/region/:id', function (req, res){ var id = req.params.id; req.assert('id', 'id is required').isInt(); var errors = req.validationErrors(); if( !errors){ models.Region.destroy({id: id}) .then(function (deletedRecord) { if(deletedRecord === 1){ res.statusCode = 200; res.json({ title: 'region id -' + id + ' deleted', region: '', status: 'success' }); } else { res.statusCode = 404; res.json({ title: 'record not found', region: '', status: 'error' }); } }) .catch(function (error) { res.statusCode = 404; res.json({ title: error, region: '', status: 'error' }); }); }else { res.statusCode = 400; res.json({ title: 'cant delete region from this id', message: 'cant delete region from this id', errors: errors, status: 'error' }); } }); }
{ "content_hash": "40f785466d60c31cd8d0c8095a1bc2a7", "timestamp": "", "source": "github", "line_count": 225, "max_line_length": 70, "avg_line_length": 32.12, "alnum_prop": 0.38549882385498824, "repo_name": "zablon/BE-for-Gport", "id": "f474e26aea29cdd5616dd7a6dbc4cea6158df7d4", "size": "7227", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/routes/region.js", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "23030" }, { "name": "HTML", "bytes": "64809" }, { "name": "JavaScript", "bytes": "401643" }, { "name": "TypeScript", "bytes": "44345" } ], "symlink_target": "" }
class if2k_generator_textedit : public jdk_http_server_generator_html { public: if2k_generator_textedit( const char *prefix_, jdk_html_style *style_, const jdk_settings &settings_, const char *settingname_of_file_to_edit, const char *settingname_of_title ) : jdk_http_server_generator_html( prefix_, style_ ), settings(settings_), filename( settings_, settingname_of_file_to_edit ), title( settings_, settingname_of_title ) { } protected: jdk_html_chunk * create_html( const char *fname, const jdk_http_request_header &request, const jdk_dynbuf &request_data, jdk_http_response_header &response, const jdk_string &connection_id ); const jdk_settings &settings; jdk_live_string< jdk_str<1024> > filename; jdk_live_string< jdk_str<1024> > title; }; class if2k_generator_textedit_set : public jdk_http_server_generator_html { public: if2k_generator_textedit_set( const char *prefix_, jdk_html_style *style_, const jdk_settings &settings_, const char *settingname_of_file_to_edit, const char *settingname_of_title ) : jdk_http_server_generator_html( prefix_, style_ ), settings(settings_), filename( settings_, settingname_of_file_to_edit ), title( settings_, settingname_of_title ) { } protected: jdk_html_chunk * create_html( const char *fname, const jdk_http_request_header &request, const jdk_dynbuf &request_data, jdk_http_response_header &response, const jdk_string &connection_id ); const jdk_settings &settings; jdk_live_string< jdk_str<1024> > filename; jdk_live_string< jdk_str<1024> > title; }; #endif
{ "content_hash": "4e992d48651c9980c08889fbfc92001d", "timestamp": "", "source": "github", "line_count": 71, "max_line_length": 73, "avg_line_length": 23.859154929577464, "alnum_prop": 0.6711924439197167, "repo_name": "jdkoftinoff/if2kv2", "id": "8d3bbe124f446305b1571ff86a539bb941da6fc4", "size": "1906", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "libif2k/old/if2k_admin_textedit.h", "mode": "33261", "license": "bsd-2-clause", "language": [ { "name": "C", "bytes": "764466" }, { "name": "C++", "bytes": "3731234" }, { "name": "HTML", "bytes": "60269" }, { "name": "JavaScript", "bytes": "22354" }, { "name": "Makefile", "bytes": "4869" }, { "name": "Objective-C", "bytes": "43490" }, { "name": "Objective-C++", "bytes": "26826" }, { "name": "PHP", "bytes": "240" }, { "name": "Prolog", "bytes": "3773" }, { "name": "QMake", "bytes": "64" }, { "name": "Shell", "bytes": "31729" } ], "symlink_target": "" }
package apiserversource import ( "context" "github.com/stretchr/testify/assert" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" v1 "knative.dev/eventing/pkg/apis/sources/v1" "knative.dev/eventing/test/rekt/resources/apiserversource" duckv1 "knative.dev/pkg/apis/duck/v1" "knative.dev/reconciler-test/pkg/feature" ) func CreateWithInvalidSpec() *feature.Feature { srcname := feature.MakeRandomK8sName("apiserversource") f := feature.NewFeatureNamed("ApiServerSource webhook is configured correctly.") f.Stable("ApiServerSource webhook"). Must("reject invalid spec on resource creation", createApiServerSourceWithInvalidSpec(srcname)) return f } func UpdateWithInvalidSpec(name string) *feature.Feature { f := feature.NewFeatureNamed("ApiServerSource webhook is configured correctly.") f.Setup("Set ApiServerSource Name", setApiServerSourceName(name)) f.Stable("ApiServerSource webhook"). Must("reject invalid spec", updateApiServerSourceWithInvalidSpec()) return f } func createApiServerSourceWithInvalidSpec(name string) func(ctx context.Context, t feature.T) { return func(ctx context.Context, t feature.T) { _, err := apiserversource.InstallLocalYaml(ctx, name, apiserversource.WithSink(&duckv1.KReference{ Kind: "Service", Name: "foo-svc", APIVersion: "v1", }, ""), apiserversource.WithResources(v1.APIVersionKindSelector{ APIVersion: "v1", Kind: "Event", }), apiserversource.WithServiceAccountName("foo-sa"), // invalid event mode apiserversource.WithEventMode("Unknown")) if err != nil { // all good, error is expected assert.EqualError(t, err, `admission webhook "validation.webhook.eventing.knative.dev" denied the request: validation failed: invalid value: Unknown: spec.mode`) } else { t.Error("expected ApiServerResource to reject invalid spec.") } } } func updateApiServerSourceWithInvalidSpec() func(ctx context.Context, t feature.T) { return func(ctx context.Context, t feature.T) { apiServerSource := getApiServerSource(ctx, t) apiServerSource.Spec.EventMode = "Unknown" _, err := Client(ctx).ApiServerSources.Update(ctx, apiServerSource, metav1.UpdateOptions{}) if err != nil { // all good, error is expected assert.EqualError(t, err, `admission webhook "validation.webhook.eventing.knative.dev" denied the request: validation failed: invalid value: Unknown: spec.mode`) } else { t.Error("expected ApiServerResource to reject invalid spec.") } } }
{ "content_hash": "9479f00a2d54193cde7cfd1e9c1cd84c", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 164, "avg_line_length": 31.645569620253166, "alnum_prop": 0.7412, "repo_name": "knative/eventing", "id": "89119b00caf6be277b47319056cbff1157604aa4", "size": "3065", "binary": false, "copies": "1", "ref": "refs/heads/main", "path": "test/rekt/features/apiserversource/webhook_validation_smoke.go", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Go", "bytes": "3696443" }, { "name": "Shell", "bytes": "45068" } ], "symlink_target": "" }
namespace pdalboost {} namespace boost = pdalboost; namespace pdalboost { ////////////////////////////////////////////////////////////////////////// // default ////////////////////////////////////////////////////////////////////////// namespace range_detail { BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( iterator ) } template< typename C > struct range_mutable_iterator : range_detail::extract_iterator<C> {}; ////////////////////////////////////////////////////////////////////////// // pair ////////////////////////////////////////////////////////////////////////// template< typename Iterator > struct range_mutable_iterator< std::pair<Iterator,Iterator> > { typedef Iterator type; }; ////////////////////////////////////////////////////////////////////////// // array ////////////////////////////////////////////////////////////////////////// template< typename T, std::size_t sz > struct range_mutable_iterator< T[sz] > { typedef T* type; }; } // namespace pdalboost #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #endif
{ "content_hash": "96ec85579d1fd59acc1697166e3ee979", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 78, "avg_line_length": 29.487179487179485, "alnum_prop": 0.37043478260869567, "repo_name": "verma/PDAL", "id": "3211a48e99920ef18585dee07cc2197fe407fe7a", "size": "1900", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "boost/boost/range/mutable_iterator.hpp", "mode": "33188", "license": "bsd-3-clause", "language": [ { "name": "C", "bytes": "755744" }, { "name": "C#", "bytes": "51165" }, { "name": "C++", "bytes": "58234219" }, { "name": "CSS", "bytes": "65128" }, { "name": "JavaScript", "bytes": "81726" }, { "name": "Lasso", "bytes": "1053782" }, { "name": "Perl", "bytes": "4925" }, { "name": "Python", "bytes": "12600" }, { "name": "Shell", "bytes": "40033" }, { "name": "XSLT", "bytes": "7284" } ], "symlink_target": "" }
package br.com.caelum.vraptor.blank; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; @Entity public class Pedido { @Id @GeneratedValue private Long id; private String nome_cliente; private String data = datadehoje(); private double valor_total = 0; private int total_itens = 0; @OneToMany (mappedBy = "pedido", cascade = CascadeType.ALL) public List<Item> lista = new ArrayList<Item>(); public Pedido() { } private String datadehoje() { Calendar calendario = Calendar.getInstance(); String retorna = "dd/MM/yyyy"; SimpleDateFormat Data = new SimpleDateFormat(retorna); return Data.format(calendario.getTime()); } public double CalculaValorTotal() { double total = 0; for(Item i : lista) total += i.Valor_Item(); return total; } public void AdicionaItem (String nome, int quant, double valor) { Item item = new Item(); item.setNome(nome); item.setquantidade(quant); item.setvalor_unitario(valor); item.setPedido(this); item.setValor_total(item.Valor_Item()); lista.add(item); this.valor_total = CalculaValorTotal(); total_itens += quant; } public int getTotal_itens() { return total_itens; } public void setTotal_itens(int total_itens) { this.total_itens = total_itens; } public double getValor_total() { return valor_total; } public void setValor_total(double valor_total) { this.valor_total = valor_total; } public String getData() { return data; } public void setData(String data) { this.data = data; } public void setNome_cliente(String nome_cliente) { this.nome_cliente = nome_cliente; } public String getNome_cliente() { return nome_cliente; } public List<Item> getLista() { return lista; } public void setLista(List<Item> lista) { this.lista = lista; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } }
{ "content_hash": "b3a51efab6793f84259404e9001d076d", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 66, "avg_line_length": 20.794117647058822, "alnum_prop": 0.7057991513437057, "repo_name": "cccarmo/engsoft", "id": "deacae2471ff59b6b77c748887fef9dd6ce69df9", "size": "2121", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/br/com/caelum/vraptor/blank/Pedido.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "9672" }, { "name": "JavaScript", "bytes": "17092" } ], "symlink_target": "" }
/** * Command line tools for Asakusa flow DSL compiler. */ package com.asakusafw.lang.compiler.cli;
{ "content_hash": "34b713e72284cb1a70672130f5d1e776", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 52, "avg_line_length": 20.6, "alnum_prop": 0.7281553398058253, "repo_name": "akirakw/asakusafw-compiler", "id": "6ad4db73cab08477e582735283d521d14a5ae274", "size": "715", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "compiler-project/cli/src/main/java/com/asakusafw/lang/compiler/cli/package-info.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "5186" }, { "name": "Java", "bytes": "3295484" }, { "name": "Shell", "bytes": "7112" } ], "symlink_target": "" }
ACCEPTED #### According to The Catalogue of Life, 3rd January 2011 #### Published in Can. J. Bot. 45(3): 367 (1967) #### Original name Torula terrestris P.C. Misra, 1967 ### Remarks null
{ "content_hash": "843724e58a709ae766d359f007fe1bcf", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 39, "avg_line_length": 14.615384615384615, "alnum_prop": 0.6789473684210526, "repo_name": "mdoering/backbone", "id": "748da4f8a38cb05f755d0e4ad7ec0c77d56f9c04", "size": "248", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "life/Fungi/Ascomycota/Sordariomycetes/Hypocreales/Torula/Torula terrestris/README.md", "mode": "33188", "license": "apache-2.0", "language": [], "symlink_target": "" }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading; namespace Ghostly { internal class PhantomjsWrapper : IDisposable { private readonly string _exeName; private readonly string _jsBootName; private Process _process; private HttpServer _server; private int _timeOut; private int _timeOutCountDown; private bool _stopCountDown = true; public bool IsCallbackFinish { get; set; } public PhantomjsWrapper() { IsCallbackFinish = true; var guid = Guid.NewGuid().ToString(); _exeName = guid + ".exe"; _jsBootName = guid + ".js"; } private void CreatePhantomJsExe() { Util.CreateTempFile("Ghostly.phantomjs.exe", _exeName); } private void CreateJsBoot(string url, int port) { using (var sw = new StreamWriter(_jsBootName)) { sw.Write(Util.GetResource("/js_boot.js").Replace("###=URL=###", url).Replace("###=PORT=###", port.ToString())); } } public void Run(int timeOut, bool showPh, string args, int port, string url, Action acion) { _timeOut = timeOut; _server = new HttpServer(acion, url, this); _server.Start(string.Format("http://localhost:{0}/", port)); CreatePhantomJsExe(); CreateJsBoot(url, port); _process = ProcessHelper.CreateAndStartProcess(showPh, _exeName, string.Format("{0} {1}", args, _jsBootName)); } public string Script(string code) { var script = new Script(code); _server.AddScript(script); _timeOutCountDown = _timeOut; _stopCountDown = false; while (!script.Resolved) { Thread.Sleep(500); } _stopCountDown = true; return script.Result; } public void Dispose() { while (IsCallbackFinish) { if (_timeOutCountDown < 0) { _server.Scripts.ForEach(s => { s.Result = "# TIME OUT EXCEPTION!"; s.Resolved = true; }); throw new Exception("TimeOut Exception."); } Thread.Sleep(1000); if (!_stopCountDown) _timeOutCountDown--; } _process.Kill(); _process.Dispose(); Thread.Sleep(100); _server.Stop(); File.Delete(_exeName); File.Delete(_jsBootName); } } }
{ "content_hash": "0e51ca23846025f9bdb27519b4e40a2d", "timestamp": "", "source": "github", "line_count": 103, "max_line_length": 127, "avg_line_length": 29.04854368932039, "alnum_prop": 0.48963903743315507, "repo_name": "Diullei/Ghostly", "id": "549fbfc7dc55dfb9bd07d222ce271036ff7dfac8", "size": "2994", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Ghostly/PhantomjsWrapper.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "17784" }, { "name": "JavaScript", "bytes": "1926" } ], "symlink_target": "" }
<!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Gerta Scharffenorth Stiftung</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> <link rel="stylesheet" href="css/main.css"> <script src="js/vendor/modernizr-2.6.2.min.js"></script> <!-- Respond.js for IE 8 or less only --> <!--[if (lt IE 9) & (!IEMobile)]> <script src="js/vendor/respond.min.js"></script> <![endif]--> </head> <body> <!--[if lte IE 7]> <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> <![endif]--> <!-- Add your site or application content here --> <header role="banner"> <nav role="navigation" class="navbar navbar-static-top navbar-default"> <div class"container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="index.html"><img src="img/logo_neu.jpg" width="160" alt="Gerta Scharffenorth Stiftung"></a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li class"active"> <a href="index.html"> <span class="icon fa fa-home"></span> Home </a> </li> <li><a href="#"> <span class="icon fa fa-user"> Über uns</a> </li> <li><a href="#"> <span class="icon fa fa-group"> Vorstand</a> </li> <li><a href="#"> <span class="icon fa fa-envelope"> Kontakt</a> </li> </ul> </div> </div> </nav> </header> <main role="main"> <div id="homepage-feature" class="carousel slide"> <ol class="carousel-indicators"> <li data-target="#homepage-feature" data-slide-to="0" class="active"></li> <li data-target="#homepage-feature" data-slide-to="1"></li> <li data-target="#homepage-feature" data-slide-to="2"></li> <li data-target="#homepage-feature" data-slide-to="3"></li> <li data-target="#homepage-feature" data-slide-to="4"></li> </ol> <!-- Wrapper for slides --> <div class="carousel-inner"> <div class="item"> <img src="img/3er-Foto.jpg" alt="Dr. Gerta Scharffenorth im Jahr 1928 mit 2 Freundinnnen in Heiligengrabe"> </div> <div class="item active"> <img src="img/abtei_herbst_gross.jpg" alt="Klosterstift Heiligengrabe"> </div> <div class="item"> <img src="img/Abgang_1Foto.jpg" alt="Dr. Gerta Scharffenorth Abgangsjahrgang 1928"> </div> <div class="item"> <img src="img/abtei_front_frabrFoto.jpg" alt="Frontseite der Stiftskirche zu Heiligengrabe"> </div> <div class="item"> <img src="img/Abgang_2Foto.jpg" alt="Dr. Gerta Scharffenorth Abgangsjahrgang 1928"> </div> </div> <!-- Controls --> <a class="left carousel-control" href="#homepage-feature" data-slide="prev"> <span class="icon fa fa-chevron-left"></span> </a> <a class="right carousel-control" href="#homepage-feature" data-slide="next"> <span class="icon fa fa-chevron-right"></span> </a> </div> <!-- /#hompage-feature.carousel --> <div class="page-contents container"> </div class="row"> <div class="page-contents container"> <div class="row"> <div class="col-sm-12"> <h2>Willkommen</h2> <p>Willkommen bei der Gerta Scharffenorth Stiftung. Als gemeinnützige Stiftung öffentlichen Rechtes unterstützen wir Einzelpersonen und Projekte zur Förderung der Verständigung des deutschen und polnischen Volkes.</p> <p><a class="btn btn-primary pull-right" href="#">Die Stiftung <span class="icon fa fa-arrow-circle-right"></span></a> </div> </div> <div class="row"> <div class="col-sm-12"> <h2>Projekte</h2> <p>Willkommen bei der Gerta Scharffenorth Stiftung. Als gemeinnützige Stiftung öffentlichen Rechtes unterstützen wir Einzelpersonen und Projekte zur Förderung der Verständigung des deutschen und polnischen Volkes.</p> <p><a class="btn btn-primary pull-right" href="#">Projekte <span class="icon fa fa-arrow-circle-right"></span></a> </div> </div> <div class="row"> <div class="col-sm-12"> <h2>Beirat und Vorstand</h2> <p>Willkommen bei der Gerta Scharffenorth Stiftung. Als gemeinnützige Stiftung öffentlichen Rechtes unterstützen wir Einzelpersonen und Projekte zur Förderung der Verständigung des deutschen und polnischen Volkes.</p> <p><a class="btn btn-primary pull-right" href="#">Gremien <span class="icon fa fa-arrow-circle-right"></span></a> </div> </div> </div> </div> </main> <footer role="contentinfo"> <div class="container"> <p><a href="index.html"><img src="img/logo_neu.jpg" width="120" alt="Gerta Scharffenorth Stiftung"></a></p> <ul class="social"> <li><a href="#" title="Twitter Profile"><span class="icon fa fa-twitter"></span></a></li> <li><a href="#" title="Facebook Profile"><span class="icon fa fa-facebook"></span></a></li> <li><a href="#" title="Google+ Profile"><span class="icon fa fa-google-plus"></span></a></li> </ul> </div> <div class="container"> <p><small>Copyright &copy; Gerta-Scharffenorth Stiftung</small></p> </div> </footer> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.10.2.min.js"><\/script>')</script> <script src="js/plugins.js"></script> <script src="js/main.js"></script> <!-- Google Analytics: change UA-XXXXX-X to be your site's ID. --> <script> (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]= function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date; e=o.createElement(i);r=o.getElementsByTagName(i)[0]; e.src='//www.google-analytics.com/analytics.js'; r.parentNode.insertBefore(e,r)}(window,document,'script','ga')); ga('create','UA-XXXXX-X');ga('send','pageview'); </script> </body> </html>
{ "content_hash": "34c77baeba2a8b9ae5ea5049a59ec078", "timestamp": "", "source": "github", "line_count": 160, "max_line_length": 223, "avg_line_length": 42.975, "alnum_prop": 0.6013670738801629, "repo_name": "geksgmbh/Project_Stiftung", "id": "3784dc9506ac5f11836d930a6d9130f5c706c1e1", "size": "6892", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "content/about_us.html", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "24737" }, { "name": "CSS", "bytes": "106026" }, { "name": "HTML", "bytes": "195667" }, { "name": "JavaScript", "bytes": "86" } ], "symlink_target": "" }
USE SyncServer_SharedImages; # USE syncserver; UPDATE FileIndex SET creationDate = Now() - INTERVAL 10 DAY + INTERVAL fileIndexId HOUR; UPDATE FileIndex SET updateDate = creationDate;
{ "content_hash": "c75ada37056a86ecef65063114251d35", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 88, "avg_line_length": 46, "alnum_prop": 0.7989130434782609, "repo_name": "crspybits/SyncServerII", "id": "9eac4efae254fc0630b435fef7b2cee29cd5737e", "size": "184", "binary": false, "copies": "1", "ref": "refs/heads/dev", "path": "Migrations/1.sql", "mode": "33188", "license": "mit", "language": [ { "name": "Dockerfile", "bytes": "3170" }, { "name": "PLpgSQL", "bytes": "8915" }, { "name": "Python", "bytes": "17636" }, { "name": "Ruby", "bytes": "2898" }, { "name": "SQLPL", "bytes": "2049" }, { "name": "Shell", "bytes": "34143" }, { "name": "Swift", "bytes": "1056013" }, { "name": "TSQL", "bytes": "11403" } ], "symlink_target": "" }
import { Component, OnInit } from '@angular/core'; import { GameService } from '../game.service'; import { Router } from '@angular/router'; @Component({ selector: 'app-new-game', templateUrl: './new-game.component.html', styleUrls: ['./new-game.component.scss'] }) export class NewGameComponent implements OnInit { wordPool: string[] = []; size = 5; constructor(private gameService: GameService, private router: Router) { } ngOnInit() { this.gameService.loadWordPool().subscribe(wordPool => { this.wordPool = wordPool; }); } addToWordPool(word: string) { this.wordPool.push(word); } createGame() { this.gameService.createGame(this.wordPool, this.size); this.router.navigate(['bingo/game']); } isValid(): boolean { return this.size * this.size <= this.wordPool.length; } }
{ "content_hash": "037af6ba18fbbb097388d7cf23d2ee0f", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 59, "avg_line_length": 22.473684210526315, "alnum_prop": 0.6510538641686182, "repo_name": "dhcode/angular-bingo-game", "id": "63bc3465f42e8b323e4688cc7d206393e7b664f4", "size": "854", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/app/bingo/new-game/new-game.component.ts", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "551" }, { "name": "HTML", "bytes": "3708" }, { "name": "JavaScript", "bytes": "1996" }, { "name": "TypeScript", "bytes": "22612" } ], "symlink_target": "" }
using UnityEngine; using System.Collections; public class CitizenInventory : MonoBehaviour { private Resource resourceCarried; private Warehouse warehouse; private CitizenWork work; public Resource resource{ get{ return resourceCarried; } set{ resourceCarried = value; } } public Warehouse citWarehouse{ get{ return warehouse; } } void Awake(){ work = GetComponent<CitizenWork>(); Warehouse[] warehouses = GameObject.FindObjectsOfType<Warehouse>(); warehouse = warehouses[0]; if(warehouses.Length > 1){ foreach(Warehouse wh in warehouses){ float newDist = Vector3.Distance(wh.transform.position, work.job.transform.position); float oldDist = Vector3.Distance(warehouse.transform.position, work.job.transform.position); if(newDist < oldDist){ warehouse = wh; } } } } }
{ "content_hash": "2d9a3a8756ac4daa39ccc8af0b7ab1ee", "timestamp": "", "source": "github", "line_count": 41, "max_line_length": 96, "avg_line_length": 20.5609756097561, "alnum_prop": 0.7153024911032029, "repo_name": "arturnista/buildergame", "id": "1834dfeaaf79f24d21859705b129e12a515dad57", "size": "845", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Assets/Entities/Citizen/CitizenInventory.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "50688" }, { "name": "GLSL", "bytes": "30751" } ], "symlink_target": "" }
all: convert irdebug_bb.png -geometry 500 irdebug_bb_lo.png convert irdebug_schem.png -geometry 500 irdebug_schem_lo.png
{ "content_hash": "58ec10c94a77e81d243ddb41988e33ba", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 61, "avg_line_length": 41, "alnum_prop": 0.7886178861788617, "repo_name": "ScottDungan/arduino_irdump_example", "id": "cfd025c53df269e8ea09c9bb990599edd0509b3d", "size": "123", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "res/Makefile", "mode": "33188", "license": "mit", "language": [ { "name": "Arduino", "bytes": "2559" }, { "name": "Makefile", "bytes": "123" } ], "symlink_target": "" }
using System; using System.Text; using System.Collections; using System.Collections.Generic; namespace Com.Aspose.Cells.Model { public class Legend { public string Position { get; set; } public LinkElement LegendEntries { get; set; } public Area Area { get; set; } public bool? AutoScaleFont { get; set; } public string BackgroundMode { get; set; } public Line Border { get; set; } public Font Font { get; set; } public bool? IsAutomaticSize { get; set; } public bool? IsInnerMode { get; set; } public bool? Shadow { get; set; } public List<LinkElement> ShapeProperties { get; set; } public int? Width { get; set; } public int? Height { get; set; } public int? X { get; set; } public int? Y { get; set; } public Link link { get; set; } public override string ToString() { var sb = new StringBuilder(); sb.Append("class Legend {\n"); sb.Append(" Position: ").Append(Position).Append("\n"); sb.Append(" LegendEntries: ").Append(LegendEntries).Append("\n"); sb.Append(" Area: ").Append(Area).Append("\n"); sb.Append(" AutoScaleFont: ").Append(AutoScaleFont).Append("\n"); sb.Append(" BackgroundMode: ").Append(BackgroundMode).Append("\n"); sb.Append(" Border: ").Append(Border).Append("\n"); sb.Append(" Font: ").Append(Font).Append("\n"); sb.Append(" IsAutomaticSize: ").Append(IsAutomaticSize).Append("\n"); sb.Append(" IsInnerMode: ").Append(IsInnerMode).Append("\n"); sb.Append(" Shadow: ").Append(Shadow).Append("\n"); sb.Append(" ShapeProperties: ").Append(ShapeProperties).Append("\n"); sb.Append(" Width: ").Append(Width).Append("\n"); sb.Append(" Height: ").Append(Height).Append("\n"); sb.Append(" X: ").Append(X).Append("\n"); sb.Append(" Y: ").Append(Y).Append("\n"); sb.Append(" link: ").Append(link).Append("\n"); sb.Append("}\n"); return sb.ToString(); } } }
{ "content_hash": "93ae48f17573968cd86ca5232a8111c1", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 76, "avg_line_length": 31.793650793650794, "alnum_prop": 0.6010983524712931, "repo_name": "farooqsheikhpk/Aspose_Cells_Cloud", "id": "d50367790f038b4bc460dcbc7619e2059b795f36", "size": "2003", "binary": false, "copies": "4", "ref": "refs/heads/master", "path": "SDKs/Aspose.Cells-Cloud-SDK-for-.NET/src/Com/Aspose/cells/Model/Legend.cs", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "55" }, { "name": "Java", "bytes": "900042" }, { "name": "JavaScript", "bytes": "664643" }, { "name": "Objective-C", "bytes": "1142099" }, { "name": "PHP", "bytes": "626745" }, { "name": "Python", "bytes": "833397" }, { "name": "Ruby", "bytes": "2354" } ], "symlink_target": "" }
<HTML><HEAD> <TITLE>Review for Walking Dead, The (1995)</TITLE> <LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css"> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1 ALIGN="CENTER" CLASS="title"><A HREF="/Title?0114888">Walking Dead, The (1995)</A></H1><H3 ALIGN=CENTER>reviewed by<BR><A HREF="/ReviewsBy?James+Berardinelli">James Berardinelli</A></H3><HR WIDTH="40%" SIZE="4"> <PRE> THE WALKING DEAD A film review by James Berardinelli Copyright 1995 James Berardinelli</PRE> <PRE>RATING (0 TO 10): 6.2 </PRE> <P>U.S. Availability: general release on 2/24/95 Running Length: 1:29 MPAA Classification: R (Violence, language, mature themes) </P> <P>Starring: Joe Morton, Allen Payne, Eddie Griffin, Vonte Sweet, Roger Floyd Director: Preston A. Whitmore II Producers: George Jackson, Frank Price, and Douglas McHenry Screenplay: Preston A. Whitmore II Cinematography: John L. Demps, Jr. Music: Gary Chang Released by Savoy Pictures </P> <P> As is true of almost any historical event of social or cultural significance, the war in Vietnam has spawned numerous motion pictures. >From the juvenile exploitation of Chuck Norris' MISSING IN ACTION flicks to the powerhouse dramas PLATOON and APOCALYPSE NOW, almost every genre has had its Vietnam War representative. For the most part, however, the role of the black soldier has been overlooked or ignored--at least until now. Though no one will confuse Preston Whitmore's sporadically effective THE WALKING DEAD with the emotionally-bruising GLORY, this film does for Vietnam what Edward Zwick's epic did for the Civil War. </P> <P> The most apparent weakness in Whitmore's film is its forced structure, which incorporates character-building flashbacks into a fairly routine war story. With its unfortunate need to meticulously set up every scene, the screenplay has an overplotted feel that seems like the byproduct of a script-by-numbers design. And, while it's critical to learn the protagonists' backgrounds, the manner in which their stories are presented comes across as a writer's artifice. </P> <P> The film centers around five Marines who are all-but-abandoned on a suicide rescue mission. In fact, they are decoys, not really expected to survive. In command is Sergeant "Rev" Barkley (Joe Morton), a tough-talking, no-nonsense, ex-preacher whose past harbors a dark secret. Despite his superior rank, however, Barkley doesn't go unchallenged in his authority, and most of the insubordination comes from Pvt. Hoover Branche (Eddie Griffin), an angry young man who professes an unwillingness to make any friends in 'Nam. A frequent object of dissention is Cpl. Pippins (Roger Floyd), a veteran soldier driven over the brink by the horrors of combat. Pfcs. Brooks (Vonte Sweet) and Evans (Allen Payne), a pair of relatively "normal" guys, round out the group.</P> <P> THE WALKING DEAD has moments of emotional candor, but much of what's on screen is derivative. The internal conflicts, petty jealousies, and inevitable bonding are all familiar plot devices. And the method of unwrapping personalities one-by-one is more intrusive than effective. Once the shooting starts, we want to stay "in country" with the protagonists, not go wandering through old memories.</P> <P> Although Allen Payne gets top billing, Joe Morton and Eddie Griffin anchor the viewer's perspective. The tension between Branche and Barkley crackles, in large part due to strong performances. If there's a weak link, it's Vonte Sweet, who doesn't have the screen presence to engender any real sympathy for his character. In the end, Brooks is just another potential corpse waiting to be cut down.</P> <P> The ultimate message of THE WALKING DEAD--that war is about survival, not glory--is a theme that filmmakers have constantly turned to the Vietnam War for. This time, however, it's not whites facing the front lines, but blacks, and this movie's willingness to examine the issue of race in the war lends a measure of significance to an otherwise mundane picture. It's not an exaggeration to state that the most provocative elements of Whitmore's film have less to do with what the soldiers face in Vietnam than why these particular men are there in the first place.</P> <P>- James Berardinelli (<A HREF="mailto:jberardinell@delphi.com">jberardinell@delphi.com</A>)</P> <HR><P CLASS=flush><SMALL>The review above was posted to the <A HREF="news:rec.arts.movies.reviews">rec.arts.movies.reviews</A> newsgroup (<A HREF="news:de.rec.film.kritiken">de.rec.film.kritiken</A> for German reviews).<BR> The Internet Movie Database accepts no responsibility for the contents of the review and has no editorial control. Unless stated otherwise, the copyright belongs to the author.<BR> Please direct comments/criticisms of the review to relevant newsgroups.<BR> Broken URLs inthe reviews are the responsibility of the author.<BR> The formatting of the review is likely to differ from the original due to ASCII to HTML conversion. </SMALL></P> <P ALIGN=CENTER>Related links: <A HREF="/Reviews/">index of all rec.arts.movies.reviews reviews</A></P> </P></BODY></HTML>
{ "content_hash": "3ba01f6e5699df00175d186c6ea68088", "timestamp": "", "source": "github", "line_count": 87, "max_line_length": 215, "avg_line_length": 61.45977011494253, "alnum_prop": 0.7420983729193941, "repo_name": "xianjunzhengbackup/code", "id": "3e89d8dc219807baf456d0d1541205f76c902174", "size": "5347", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "data science/machine_learning_for_the_web/chapter_4/movie/3336.html", "mode": "33261", "license": "mit", "language": [ { "name": "BitBake", "bytes": "113" }, { "name": "BlitzBasic", "bytes": "256" }, { "name": "CSS", "bytes": "49827" }, { "name": "HTML", "bytes": "157006325" }, { "name": "JavaScript", "bytes": "14029" }, { "name": "Jupyter Notebook", "bytes": "4875399" }, { "name": "Mako", "bytes": "2060" }, { "name": "Perl", "bytes": "716" }, { "name": "Python", "bytes": "874414" }, { "name": "R", "bytes": "454" }, { "name": "Shell", "bytes": "3984" } ], "symlink_target": "" }
package com.linkedin.thirdeye.dashboard.views.heatmap; import com.linkedin.thirdeye.dashboard.views.CompareViewRequest; public class HeatMapViewRequest extends CompareViewRequest { }
{ "content_hash": "d04e4fbb32032115bb0d5c3d942814c4", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 64, "avg_line_length": 20.88888888888889, "alnum_prop": 0.8404255319148937, "repo_name": "fx19880617/pinot-1", "id": "8be1fb4c3946aefe88888cbe514724ba98f58680", "size": "825", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/dashboard/views/heatmap/HeatMapViewRequest.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "ANTLR", "bytes": "4620" }, { "name": "Batchfile", "bytes": "7738" }, { "name": "CSS", "bytes": "925082" }, { "name": "FreeMarker", "bytes": "243834" }, { "name": "HTML", "bytes": "275258" }, { "name": "Java", "bytes": "14422749" }, { "name": "JavaScript", "bytes": "5194066" }, { "name": "Makefile", "bytes": "8076" }, { "name": "Python", "bytes": "36574" }, { "name": "Shell", "bytes": "51677" }, { "name": "Thrift", "bytes": "5028" } ], "symlink_target": "" }
/usr/local/hadoop/bin/hdfs dfs -put /usr/local/spark/lib /spark
{ "content_hash": "363995b4c0b08c0fa94b946065e95501", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 63, "avg_line_length": 64, "alnum_prop": 0.75, "repo_name": "sk413025/dockerfiles", "id": "f6af1c9e7bd4e476d466ecef88465c27e72dda80", "size": "77", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "centos6-hdw/init-spark.sh", "mode": "33261", "license": "apache-2.0", "language": [ { "name": "Shell", "bytes": "7529" } ], "symlink_target": "" }
.class Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver; .super Landroid/content/BroadcastReceiver; .source "KeyguardUpdateMonitor.java" # annotations .annotation system Ldalvik/annotation/EnclosingClass; value = Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; .end annotation .annotation system Ldalvik/annotation/InnerClass; accessFlags = 0x0 name = "BaiduBroadcastReceiver" .end annotation # instance fields .field final synthetic this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; # direct methods .method constructor <init>(Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;)V .locals 0 .parameter .prologue .line 850 iput-object p1, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V return-void .end method # virtual methods .method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V .locals 6 .parameter "context" .parameter "intent" .prologue const/4 v2, 0x1 const/4 v4, 0x0 const/16 v5, 0x142 .line 854 invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String; move-result-object v0 .line 855 .local v0, action:Ljava/lang/String; const-string v3, "android.intent.action.USER_PRESENT" invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v3 if-eqz v3, :cond_1 .line 856 invoke-static {}, Lcom/android/internal/policy/impl/keyguard/BaiduKeyguardManager;->initDefaultLockMode()J .line 883 :cond_0 :goto_0 return-void .line 857 :cond_1 const-string v3, "theme.lockscreen.action.apply_theme_water" invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v3 if-eqz v3, :cond_2 .line 859 iget-object v2, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->mBaiduHandler:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler; invoke-static {v2}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->access$iget-mBaiduHandler-cf8d20(Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;)Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler; move-result-object v2 iget-object v3, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->mHandler:Landroid/os/Handler; invoke-static {v3}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->access$900(Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;)Landroid/os/Handler; move-result-object v3 const/4 v4, 0x4 invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v4 invoke-virtual {v3, v5, v4}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v3 invoke-virtual {v2, v3}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler;->sendMessage(Landroid/os/Message;)Z goto :goto_0 .line 862 :cond_2 const-string v3, "theme.lockscreen.action.apply_theme" invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v3 if-eqz v3, :cond_4 .line 863 const-string v3, "isApplyWallPaper" invoke-virtual {p2, v3, v4}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z move-result v3 if-eqz v3, :cond_3 const/4 v2, 0x2 :cond_3 invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v1 .line 866 .local v1, state:Ljava/lang/Integer; iget-object v2, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->mBaiduHandler:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler; invoke-static {v2}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->access$iget-mBaiduHandler-cf8d20(Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;)Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler; move-result-object v2 iget-object v3, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->mHandler:Landroid/os/Handler; invoke-static {v3}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->access$900(Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;)Landroid/os/Handler; move-result-object v3 invoke-virtual {v3, v5, v1}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v3 invoke-virtual {v2, v3}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler;->sendMessage(Landroid/os/Message;)Z goto :goto_0 .line 868 .end local v1 #state:Ljava/lang/Integer; :cond_4 const-string v3, "theme.lockscreen.action.reduce_theme" invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v3 if-eqz v3, :cond_5 .line 869 invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v1 .line 870 .restart local v1 #state:Ljava/lang/Integer; iget-object v2, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->mBaiduHandler:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler; invoke-static {v2}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->access$iget-mBaiduHandler-cf8d20(Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;)Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler; move-result-object v2 iget-object v3, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->mHandler:Landroid/os/Handler; invoke-static {v3}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->access$900(Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;)Landroid/os/Handler; move-result-object v3 invoke-virtual {v3, v5, v1}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v3 invoke-virtual {v2, v3}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler;->sendMessage(Landroid/os/Message;)Z goto :goto_0 .line 872 .end local v1 #state:Ljava/lang/Integer; :cond_5 const-string v3, "com.baidu.lockscreen.action.reduce_theme_settings" invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v3 if-eqz v3, :cond_6 .line 874 const/4 v2, 0x3 invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer; move-result-object v1 .line 875 .restart local v1 #state:Ljava/lang/Integer; iget-object v2, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->mBaiduHandler:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler; invoke-static {v2}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->access$iget-mBaiduHandler-cf8d20(Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;)Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler; move-result-object v2 iget-object v3, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->mHandler:Landroid/os/Handler; invoke-static {v3}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->access$900(Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;)Landroid/os/Handler; move-result-object v3 invoke-virtual {v3, v5, v1}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v3 invoke-virtual {v2, v3}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler;->sendMessage(Landroid/os/Message;)Z goto/16 :goto_0 .line 877 .end local v1 #state:Ljava/lang/Integer; :cond_6 const-string v3, "com.baidu.lockscreen.statusbar.expand" invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z move-result v3 if-eqz v3, :cond_0 .line 878 const-string v3, "statusbar_expand_enable" invoke-virtual {p2, v3, v2}, Landroid/content/Intent;->getBooleanExtra(Ljava/lang/String;Z)Z move-result v2 invoke-static {v2}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean; move-result-object v1 .line 879 .local v1, state:Ljava/lang/Boolean; iget-object v2, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->mBaiduHandler:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler; invoke-static {v2}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->access$iget-mBaiduHandler-cf8d20(Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;)Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler; move-result-object v2 iget-object v3, p0, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver;->this$0:Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor; #getter for: Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->mHandler:Landroid/os/Handler; invoke-static {v3}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;->access$900(Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor;)Landroid/os/Handler; move-result-object v3 const/16 v4, 0x1f5 invoke-virtual {v3, v4, v1}, Landroid/os/Handler;->obtainMessage(ILjava/lang/Object;)Landroid/os/Message; move-result-object v3 invoke-virtual {v2, v3}, Lcom/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduHandler;->sendMessage(Landroid/os/Message;)Z goto/16 :goto_0 .end method
{ "content_hash": "cfe629d93b1ec49f68b0570381686e7f", "timestamp": "", "source": "github", "line_count": 290, "max_line_length": 268, "avg_line_length": 40.5448275862069, "alnum_prop": 0.7658615410784146, "repo_name": "baidurom/devices-Coolpad8720L", "id": "8e3517dc88033935951cf8cfaac7e28d1fd37e7f", "size": "11758", "binary": false, "copies": "1", "ref": "refs/heads/coron-4.3", "path": "android.policy.jar.out/smali/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor$BaiduBroadcastReceiver.smali", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Makefile", "bytes": "13619" }, { "name": "Shell", "bytes": "1917" } ], "symlink_target": "" }
import sys import pytest from mitmproxy.addons import termlog from mitmproxy import log from mitmproxy.tools.dump import Options from mitmproxy.test import taddons class TestTermLog: @pytest.mark.usefixtures('capfd') @pytest.mark.parametrize('outfile, expected_out, expected_err', [ (None, ['one', 'three'], ['four']), (sys.stdout, ['one', 'three', 'four'], []), (sys.stderr, [], ['one', 'three', 'four']), ]) def test_output(self, outfile, expected_out, expected_err, capfd): t = termlog.TermLog(outfile=outfile) with taddons.context(options=Options(verbosity=2)) as tctx: tctx.configure(t) t.log(log.LogEntry("one", "info")) t.log(log.LogEntry("two", "debug")) t.log(log.LogEntry("three", "warn")) t.log(log.LogEntry("four", "error")) out, err = capfd.readouterr() assert out.strip().splitlines() == expected_out assert err.strip().splitlines() == expected_err
{ "content_hash": "7482c0c48fc23830946d583bd18f5593", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 70, "avg_line_length": 37.25925925925926, "alnum_prop": 0.6123260437375746, "repo_name": "laurmurclar/mitmproxy", "id": "70c3a7f2c49a42dcf9b01766f26317dd05964a65", "size": "1006", "binary": false, "copies": "3", "ref": "refs/heads/master", "path": "test/mitmproxy/addons/test_termlog.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "17430" }, { "name": "HTML", "bytes": "4270" }, { "name": "JavaScript", "bytes": "149386" }, { "name": "PowerShell", "bytes": "494" }, { "name": "Python", "bytes": "1520806" }, { "name": "Shell", "bytes": "3660" } ], "symlink_target": "" }
This section describes the life of a REST call. Developer should have knownledge of * [Django's URL Dispatcher](https://docs.djangoproject.com/es/1.9/topics/http/urls/) * [Django Rest Framework's Viewsets](http://www.django-rest-framework.org/api-guide/viewsets/) * [Django Rest Framework's Serializer](http://www.django-rest-framework.org/api-guide/serializers/) Example trace for a GET Request for getting a user's profile for an authenticated user `GET /api/self/profile` * Entry Point for all REST Calls - ozp/urls.py. All /api/* calls get re-routed to ozpcenter/urls.py file * ozpcenter/urls.py add REST access points for all the views for the resources (agency, category, etc...) * This line of code `url(r'', include('ozpcenter.api.profile.urls'))` adds endpoints related to profile REST Calls * ozpcenter/api/profile/user.py - 'self/profile/' route points to current user's profile (Using CurrentUserViewSet in ozpcenter/api/profile/views.py) * ozpcenter/api/profile/views.py - For GET Request for this route it will call the 'retrieve' method * Before allowing user to access the endpoint it will make sure user is authenticated and has the correct role using 'permission_classes = (permissions.IsUser,)' ## Performance Debugging We check the performance of a Database model using shell_plus command for manage.py. ````shell python manage.py shell_plus --print-sql ```` ````python # Shell Plus Model Imports from corsheaders.models import CorsModel from django.contrib.admin.models import LogEntry from django.contrib.auth.models import Group, Permission, User from django.contrib.contenttypes.models import ContentType from django.contrib.sessions.models import Session from ozpcenter.models import Agency, ApplicationLibraryEntry, Category, ChangeDetail, Contact, ContactType, DocUrl, Image, ImageType, Intent, Listing, ListingActivity, ListingType, Notification, Profile, Review, Screenshot, Tag from ozpiwc.models import DataResource # Shell Plus Django Imports from django.utils import timezone from django.conf import settings from django.core.cache import cache from django.core.urlresolvers import reverse from django.db.models import Avg, Count, F, Max, Min, Sum, Q, Prefetch from django.db import transaction Python 3.4.3 (default, Feb 25 2016, 10:08:19) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> ```` ## Getting all Profiles (without any optimizations) ````python >>> Profile.objects.all() QUERY = 'SELECT "ozpcenter_profile"."id", "ozpcenter_profile"."display_name", "ozpcenter_profile"."bio", "ozpcenter_profile"."center_tour_flag", "ozpcenter_profile"."hud_tour_flag", "ozpcenter_profile"."webtop_tour_flag", "ozpcenter_profile"."dn", "ozpcenter_profile"."issuer_dn", "ozpcenter_profile"."auth_expires", "ozpcenter_profile"."access_control", "ozpcenter_profile"."user_id" FROM "ozpcenter_profile" LIMIT 21' - PARAMS = () Execution time: 0.000324s [Database: default] QUERY = 'SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = %s' - PARAMS = (1,) Execution time: 0.000207s [Database: default] QUERY = 'SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = %s' - PARAMS = (2,) Execution time: 0.000203s [Database: default] QUERY = 'SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = %s' - PARAMS = (3,) Execution time: 0.000202s [Database: default] QUERY = 'SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = %s' - PARAMS = (4,) Execution time: 0.000124s [Database: default] QUERY = 'SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = %s' - PARAMS = (5,) Execution time: 0.000101s [Database: default] QUERY = 'SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = %s' - PARAMS = (6,) Execution time: 0.000145s [Database: default] QUERY = 'SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = %s' - PARAMS = (7,) Execution time: 0.000145s [Database: default] QUERY = 'SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = %s' - PARAMS = (8,) Execution time: 0.000131s [Database: default] QUERY = 'SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = %s' - PARAMS = (9,) Execution time: 0.000099s [Database: default] QUERY = 'SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = %s' - PARAMS = (10,) Execution time: 0.000098s [Database: default] QUERY = 'SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = %s' - PARAMS = (11,) Execution time: 0.000096s [Database: default] [Profile: wsmith, Profile: julia, Profile: obrien, Profile: bigbrother, Profile: bigbrother2, Profile: aaronson, Profile: jones, Profile: rutherford, Profile: syme, Profile: tparsons, Profile: charrington] ```` Results: 12 database calls ( 1 + num of user = Database calls) ## Getting all Profiles (with join) ````python >>> Profile.objects.all().select_related('user') QUERY = 'SELECT "ozpcenter_profile"."id", "ozpcenter_profile"."display_name", "ozpcenter_profile"."bio", "ozpcenter_profile"."center_tour_flag", "ozpcenter_profile"."hud_tour_flag", "ozpcenter_profile"."webtop_tour_flag", "ozpcenter_profile"."dn", "ozpcenter_profile"."issuer_dn", "ozpcenter_profile"."auth_expires", "ozpcenter_profile"."access_control", "ozpcenter_profile"."user_id", "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "ozpcenter_profile" LEFT OUTER JOIN "auth_user" ON ( "ozpcenter_profile"."user_id" = "auth_user"."id" ) LIMIT 21' - PARAMS = () Execution time: 0.000472s [Database: default] [Profile: wsmith, Profile: julia, Profile: obrien, Profile: bigbrother, Profile: bigbrother2, Profile: aaronson, Profile: jones, Profile: rutherford, Profile: syme, Profile: tparsons, Profile: charrington] ```` Results: 1 database call ## Debugging Storefront Serializer ````python from rest_framework.response import Response import ozpcenter.api.storefront.model_access as ma import ozpcenter.api.storefront.serializers as se import timeit from django.test.client import RequestFactory rf = RequestFactory() get_request = rf.get('/hello/') data = ma.get_storefront('bigbrother') # Database calls sea = se.StorefrontSerializer(data,context={'request':get_request}) start = timeit.timeit(); r= Response(sea.data) ; end = timeit.timeit() # Database calls print('Time: %s' % end) ```` ## Improving `put_counts_in_listings_endpoint` database example ``` import time from django.db import transaction def show_db_calls(): db_connection = transaction.get_connection() number_of_calls = len(db_connection.queries) db_connection.queries_log.clear() return number_of_calls def group_by_sum(count_data_list, group_key, count_key='agency_count'): """ { "agency__id": 1, "agency_count": 39, "approval_status": "APPROVED", "is_enabled": true}, returns dict """ count_dict = {} for record_dict in count_data_list: group_key_in_record = group_key in record_dict if group_key_in_record: group_key_value = record_dict[group_key] group_key_count_value = record_dict[count_key] group_key_value_in_count_dict = group_key_value in count_dict if group_key_value_in_count_dict: count_dict[group_key_value] = count_dict[group_key_value] + group_key_count_value else: count_dict[group_key_value] = group_key_count_value total_count = 0 for key in count_dict: value = count_dict[key] total_count = total_count + value count_dict['_total_count'] = total_count return count_dict def put_counts_in_listings_endpoint_new(queryset): """ Add counts to the listing/ endpoint Args: querset: models.Listing queryset Returns: { total": <total listings>, organizations: { <org_id>: <int>, ... }, enabled: <enabled listings>, IN_PROGRESS: <int>, PENDING: <int>, PENDING_DELETION: <int>" REJECTED: <int>, APPROVED_ORG: <int>, APPROVED: <int>, DELETED: <int> } """ show_db_calls() start_time = int(round(time.time() * 1000)) data = {} count_data = (models.Listing .objects.filter(pk__in=queryset) .values('agency__id','is_enabled', 'approval_status') .annotate(agency_count=Count('agency__id'))) enabled_count = group_by_sum(count_data, 'is_enabled') data['total'] = enabled_count.get('_total_count', 0) data['enabled'] = enabled_count.get(True, 0) agency_count = group_by_sum(count_data, 'agency__id') data['organizations'] = {} agency_ids = list(models.Agency.objects.values_list('id', flat=True)) for agency_id in agency_ids: agency_id_str = str(agency_id) if agency_id in agency_count: data['organizations'][agency_id_str] = agency_count[agency_id] else: data['organizations'][agency_id_str] = '0' approval_status_count = group_by_sum(count_data, 'approval_status') approval_status_list = [ models.Listing.IN_PROGRESS, models.Listing.PENDING, models.Listing.REJECTED, models.Listing.APPROVED_ORG, models.Listing.APPROVED, models.Listing.DELETED, models.Listing.PENDING_DELETION ] for current_approval_status in approval_status_list: data[current_approval_status] = approval_status_count.get(current_approval_status, 0) data['_time'] = int(round(time.time() * 1000)) - start_time data['_db_calls'] = show_db_calls() return data def put_counts_in_listings_endpoint(queryset): """ Add counts to the listing/ endpoint Args: querset: models.Listing queryset Returns: { total": <total listings>, organizations: { <org_id>: <int>, ... }, enabled: <enabled listings>, IN_PROGRESS: <int>, PENDING: <int>, PENDING_DELETION: <int>" REJECTED: <int>, APPROVED_ORG: <int>, APPROVED: <int>, DELETED: <int> } """ show_db_calls() start_time = int(round(time.time() * 1000)) # TODO: Take in account 2pki user (rivera-20160908) data = {} # Number of total listings num_total = queryset.count() # Number of listing that is Enabled num_enabled = queryset.filter(is_enabled=True).count() # Number of listing that is IN_PROGRESS num_in_progress = queryset.filter( approval_status=models.Listing.IN_PROGRESS).count() # Number of listing that is PENDING num_pending = queryset.filter( approval_status=models.Listing.PENDING).count() # Number of listing that is REJECTED num_rejected = queryset.filter( approval_status=models.Listing.REJECTED).count() # Number of listing that is APPROVED_ORG num_approved_org = queryset.filter( approval_status=models.Listing.APPROVED_ORG).count() # Number of listing that is APPROVED num_approved = queryset.filter( approval_status=models.Listing.APPROVED).count() # Number of listing that is DELETED num_deleted = queryset.filter( approval_status=models.Listing.DELETED).count() # Number of listing that is PENDING_DELETION num_pending_deletion = queryset.filter( approval_status=models.Listing.PENDING_DELETION).count() data['total'] = num_total data['enabled'] = num_enabled data['organizations'] = {} data[models.Listing.IN_PROGRESS] = num_in_progress data[models.Listing.PENDING] = num_pending data[models.Listing.REJECTED] = num_rejected data[models.Listing.APPROVED_ORG] = num_approved_org data[models.Listing.APPROVED] = num_approved data[models.Listing.DELETED] = num_deleted data[models.Listing.PENDING_DELETION] = num_pending_deletion orgs = models.Agency.objects.all() for i in orgs: data['organizations'][str(i.id)] = queryset.filter( agency__id=i.id).count() data['_time'] = int(round(time.time() * 1000)) - start_time data['_db_calls'] = show_db_calls() return data ``` **`put_counts_in_listings_endpoint` function results** This function took 97 milliseconds and took 19 database calls ``` { "APPROVED_ORG": 0, "IN_PROGRESS": 0, "DELETED": 0, "PENDING": 0, "organizations": { "1": 2, "2": 1, "3": 0, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0, "9": 0 }, "total": 3, "_time": 97, "enabled": 3, "PENDING_DELETION": 0, "REJECTED": 0, "_db_calls": 19, "APPROVED": 3 } ``` **`put_counts_in_listings_endpoint_new` function results** This function took 7 milliseconds and took 2 database calls ``` { "APPROVED_ORG": 0, "IN_PROGRESS": 0, "DELETED": 0, "PENDING": 0, "organizations": { "1": 2, "2": 1, "3": 0, "4": 0, "5": 0, "6": 0, "7": 0, "8": 0, "9": 0 }, "total": 3, "_time": 7, "enabled": 3, "PENDING_DELETION": 0, "REJECTED": 0, "_db_calls": 2, "APPROVED": 3 } ``` ## Improving `put_counts_in_listings_endpoint` database example **`_update_rating` original code** ``` def _update_rating(username, listing): """ Invoked each time a review is created, deleted, or updated """ reviews = models.Review.objects.filter(listing=listing, review_parent__isnull=True) rate1 = reviews.filter(rate=1).count() rate2 = reviews.filter(rate=2).count() rate3 = reviews.filter(rate=3).count() rate4 = reviews.filter(rate=4).count() rate5 = reviews.filter(rate=5).count() total_votes = reviews.count() total_reviews = total_votes - reviews.filter(text=None).count() review_responses = models.Review.objects.filter(listing=listing, review_parent__isnull=False) total_review_responses = review_responses.count() # calculate weighted average if total_votes == 0: avg_rate = 0 else: avg_rate = (5 * rate5 + 4 * rate4 + 3 * rate3 + 2 * rate2 + rate1) / total_votes avg_rate = float('{0:.1f}'.format(avg_rate)) # update listing listing.total_rate1 = rate1 listing.total_rate2 = rate2 listing.total_rate3 = rate3 listing.total_rate4 = rate4 listing.total_rate5 = rate5 listing.total_votes = total_votes listing.total_reviews = total_reviews listing.total_review_responses = total_review_responses listing.avg_rate = avg_rate listing.edited_date = utils.get_now_utc() listing.save() return listing ``` Code for benchmark (running user `make shell`) ``` import time def show_db_calls(): db_connection = transaction.get_connection() number_of_calls = len(db_connection.queries) db_connection.queries_log.clear() return number_of_calls show_db_calls() start_time = int(round(time.time() * 1000)) from ozpcenter.api.listing.model_access import _update_rating l = Listing.objects.all() [_update_rating('bigbrother', la) for la in l] print(int(round(time.time() * 1000)) - start_time) print(show_db_calls()) # Not working print('') # 1434 Comment # 3492 with counts() ``` **`_update_rating new code` function results** ``` from django.db.models.expressions import RawSQL l=Listing.objects.get(id=2); Review.objects.filter(listing=l).values('rate').annotate(review_parent_isnull=RawSQL('"review_parent_id" is %s ', (None,)), rate_count=Count('rate')) SQLITE3: <QuerySet [{'rate_count': 1, 'rate': 1, 'review_parent_isnull': 0}, {'rate_count': 1, 'rate': 1, 'review_parent_isnull': 1}, {'rate_count': 1, 'rate': 3, 'review_parent_isnull': 1}, {'rate_count': 1, 'rate': 4, 'review_parent_isnull': 1}, {'rate_count': 1, 'rate': 5, 'review_parent_isnull': 1}]> Postgresql <QuerySet [{'rate': 3, 'rate_count': 1, 'review_parent_isnull': True}, {'rate': 4, 'rate_count': 1, 'review_parent_isnull': True}, {'rate': 1, 'rate_count': 1, 'review_parent_isnull': False}, {'rate': 5, 'rate_count': 1, 'review_parent_isnull': True}, {'rate': 1, 'rate_count': 1, 'review_parent_isnull': True}]> ``` SELECT "ozpcenter_review"."rate", COUNT("ozpcenter_review"."rate") AS "rate_count", ("review_parent_id" is NULL ) AS "review_parent_isnull" FROM "ozpcenter_review" WHERE "ozpcenter_review"."listing_id" = 2 GROUP BY "ozpcenter_review"."rate", ("review_parent_id" is NULL ) ```
{ "content_hash": "afc8f3abb96ac3d53737c907220f6977", "timestamp": "", "source": "github", "line_count": 490, "max_line_length": 785, "avg_line_length": 40.083673469387755, "alnum_prop": 0.6506287867216537, "repo_name": "aml-development/ozp-backend", "id": "6292be6f60986a2d6a54c25d158ffc498821efc6", "size": "19662", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "docs/debugging.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Jupyter Notebook", "bytes": "213236" }, { "name": "Makefile", "bytes": "6631" }, { "name": "PLpgSQL", "bytes": "1187565" }, { "name": "Python", "bytes": "1533401" }, { "name": "Shell", "bytes": "4160" } ], "symlink_target": "" }
package com.jenkov.iap.tcp; /** * Created by jjenkov on 01-02-2016. */ public class TCPSocketPool { private TCPSocket[] pooledSockets = null; private int pooledSocketCount = 0; public TCPSocketPool(int maxPooledSockets) { this.pooledSockets = new TCPSocket[maxPooledSockets]; } public TCPSocket getTCPSocket(){ if(this.pooledSocketCount > 0){ this.pooledSocketCount--; return this.pooledSockets[this.pooledSocketCount]; } return new TCPSocket(this); } public void free(TCPSocket socket){ //pool message if space if(this.pooledSocketCount < this.pooledSockets.length){ this.pooledSockets[this.pooledSocketCount] = socket; this.pooledSocketCount++; } } }
{ "content_hash": "be297757a7c142297879143d1df6a634", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 64, "avg_line_length": 23.558823529411764, "alnum_prop": 0.6392009987515606, "repo_name": "jjenkov/iap-tools-java", "id": "3cda7b2635da100c2b24cb8ffcfb2ad57d74cca5", "size": "801", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/main/java/com/jenkov/iap/tcp/TCPSocketPool.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "472612" } ], "symlink_target": "" }
from __future__ import unicode_literals from django.db import models, migrations import uuid import django.utils.timezone import jsonfield.fields class Migration(migrations.Migration): dependencies = [ ('backend', '0001_initial'), ] operations = [ migrations.CreateModel( name='Score', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, primary_key=True, auto_created=True)), ('score_id', models.UUIDField(unique=True, default=uuid.uuid4, editable=False)), ('created_at', models.DateTimeField(default=django.utils.timezone.now, editable=False)), ('is_valid', models.BooleanField(default=True)), ('score', models.DecimalField(default=0.0, decimal_places=12, max_digits=20)), ('duration', models.DecimalField(default=0.0, max_digits=14, decimal_places=6, blank=True)), ('params', jsonfield.fields.JSONField(default={}, blank=True)), ('run', models.ForeignKey(to='backend.Run')), ], ), migrations.RemoveField( model_name='result', name='run', ), migrations.DeleteModel( name='Result', ), ]
{ "content_hash": "e14c5c91a7707fa1da59acd8ee894b7a", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 114, "avg_line_length": 35.611111111111114, "alnum_prop": 0.5834633385335414, "repo_name": "chaosmail/scoggle-web", "id": "72b186857824c40acb53cc3ce84b52ca46ef3679", "size": "1306", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "backend/migrations/0002_auto_20150512_1948.py", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "3638" }, { "name": "HTML", "bytes": "35722" }, { "name": "JavaScript", "bytes": "981" }, { "name": "Python", "bytes": "30920" } ], "symlink_target": "" }
@protocol userbuildVideo -(void)userSelected; -(void)videoSelected; -(void)enableLoader; -(void)disableLoader; -(void)refreshList; @end @interface userBuildVideos : UIView <UIScrollViewDelegate,mediadetailDelegate> { UIScrollView *vl_scrollView; SingleVideo *_SingleVideo; int videoCount, contentSize, curSW, curSH; int currentPage; NSString *urlStr; int vY; NSString *strVideoId; avloader *_avloader; int pageOffset; int pageCheck; UIView *refreshHeaderView; UILabel *refreshLabel; UIImageView *refreshArrow; UIActivityIndicatorView *refreshSpinner; BOOL isDragging; BOOL isLoading; NSString *textPull; NSString *textRelease; NSString *textLoading; } @property(assign)id<userbuildVideo>_delegate; @property (assign) int currentPage; @property(assign) int videoCount; @property (nonatomic,retain) NSString *urlStr; @property (nonatomic, retain) UIView *refreshHeaderView; @property (nonatomic, retain) UILabel *refreshLabel; @property (nonatomic, retain) UIImageView *refreshArrow; @property (nonatomic, retain) UIActivityIndicatorView *refreshSpinner; @property (nonatomic, copy) NSString *textPull; @property (nonatomic, copy) NSString *textRelease; @property (nonatomic, copy) NSString *textLoading; - (void)setupStrings; - (void)addPullToRefreshHeader; - (void)startLoading; - (void)stopLoading; - (void)refresh; -(void)buildVideos; -(void)loadDatas; -(void)enableLoader; -(void)disableLoader; @end
{ "content_hash": "26cb6f1a7dae948711723b31317ddba2", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 78, "avg_line_length": 19.78205128205128, "alnum_prop": 0.7252106286454958, "repo_name": "KurianSaji/DASHBOARD---GSC", "id": "a039acb2431ac92d4b6be4dbdc100c07038f87b2", "size": "1762", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Mass wave project/maximSocialVideo/userBuildVideos.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "167662" }, { "name": "C++", "bytes": "735" }, { "name": "Objective-C", "bytes": "2505278" }, { "name": "Perl", "bytes": "54" } ], "symlink_target": "" }
@class FLEXProperty, FLEXMethodDescription; NS_ASSUME_NONNULL_BEGIN #pragma mark FLEXProtocol @interface FLEXProtocol : NSObject /// Every protocol registered with the runtime. + (NSArray<FLEXProtocol *> *)allProtocols; + (instancetype)protocol:(Protocol *)protocol; /// The underlying protocol data structure. @property (nonatomic, readonly) Protocol *objc_protocol; /// The name of the protocol. @property (nonatomic, readonly) NSString *name; /// The required methods of the protocol, if any. This includes property getters and setters. @property (nonatomic, readonly) NSArray<FLEXMethodDescription *> *requiredMethods; /// The optional methods of the protocol, if any. This includes property getters and setters. @property (nonatomic, readonly) NSArray<FLEXMethodDescription *> *optionalMethods; /// All protocols that this protocol conforms to, if any. @property (nonatomic, readonly) NSArray<FLEXProtocol *> *protocols; /// The full path of the image that contains this protocol definition, /// or \c nil if this protocol was probably defined at runtime. @property (nonatomic, readonly, nullable) NSString *imagePath; /// The properties in the protocol, if any. \c nil on iOS 10+ @property (nonatomic, readonly, nullable) NSArray<FLEXProperty *> *properties API_DEPRECATED("Use the more specific accessors below", ios(2.0, 10.0)); /// The required properties in the protocol, if any. @property (nonatomic, readonly) NSArray<FLEXProperty *> *requiredProperties API_AVAILABLE(ios(10.0)); /// The optional properties in the protocol, if any. @property (nonatomic, readonly) NSArray<FLEXProperty *> *optionalProperties API_AVAILABLE(ios(10.0)); /// For internal use @property (nonatomic) id tag; /// Not to be confused with \c -conformsToProtocol:, which refers to the current /// \c FLEXProtocol instance and not the underlying \c Protocol object. - (BOOL)conformsTo:(Protocol *)protocol; @end #pragma mark Method descriptions @interface FLEXMethodDescription : NSObject + (instancetype)description:(struct objc_method_description)description; + (instancetype)description:(struct objc_method_description)description instance:(BOOL)isInstance; /// The underlying method description data structure. @property (nonatomic, readonly) struct objc_method_description objc_description; /// The method's selector. @property (nonatomic, readonly) SEL selector; /// The method's type encoding. @property (nonatomic, readonly) NSString *typeEncoding; /// The method's return type. @property (nonatomic, readonly) FLEXTypeEncoding returnType; /// \c YES if this is an instance method, \c NO if it is a class method, or \c nil if unspecified @property (nonatomic, readonly) NSNumber *instance; @end NS_ASSUME_NONNULL_END
{ "content_hash": "644cc8af81fe554993e714e83d6bd4ce", "timestamp": "", "source": "github", "line_count": 63, "max_line_length": 150, "avg_line_length": 43.26984126984127, "alnum_prop": 0.7707263389581804, "repo_name": "crazypoo/PTools", "id": "30855358fe5f3abc8f15e824c700042085d688fe", "size": "2914", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "Pods/FLEX/Classes/Utility/Runtime/Objc/Reflection/FLEXProtocol.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "3586" }, { "name": "Objective-C", "bytes": "577848" }, { "name": "Ruby", "bytes": "31125" }, { "name": "Swift", "bytes": "841121" } ], "symlink_target": "" }
package org.apache.hadoop.hbase.replication.regionserver; import static org.apache.hadoop.hbase.wal.AbstractFSWALProvider.getArchivedLogPath; import java.io.FileNotFoundException; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Collection; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.PriorityBlockingQueue; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicLong; import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.Server; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.TableDescriptors; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.regionserver.HRegionServer; import org.apache.hadoop.hbase.regionserver.RSRpcServices; import org.apache.hadoop.hbase.regionserver.RegionServerCoprocessorHost; import org.apache.hadoop.hbase.replication.ChainWALEntryFilter; import org.apache.hadoop.hbase.replication.ClusterMarkingEntryFilter; import org.apache.hadoop.hbase.replication.ReplicationEndpoint; import org.apache.hadoop.hbase.replication.ReplicationException; import org.apache.hadoop.hbase.replication.ReplicationPeer; import org.apache.hadoop.hbase.replication.ReplicationQueueInfo; import org.apache.hadoop.hbase.replication.ReplicationQueueStorage; import org.apache.hadoop.hbase.replication.SystemTableWALEntryFilter; import org.apache.hadoop.hbase.replication.WALEntryFilter; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.hbase.wal.AbstractFSWALProvider; import org.apache.hadoop.hbase.wal.WAL.Entry; import org.apache.yetus.audience.InterfaceAudience; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting; import org.apache.hbase.thirdparty.com.google.common.collect.Lists; /** * Class that handles the source of a replication stream. * Currently does not handle more than 1 slave * For each slave cluster it selects a random number of peers * using a replication ratio. For example, if replication ration = 0.1 * and slave cluster has 100 region servers, 10 will be selected. * <p> * A stream is considered down when we cannot contact a region server on the * peer cluster for more than 55 seconds by default. * </p> */ @InterfaceAudience.Private public class ReplicationSource implements ReplicationSourceInterface { private static final Logger LOG = LoggerFactory.getLogger(ReplicationSource.class); // Queues of logs to process, entry in format of walGroupId->queue, // each presents a queue for one wal group private Map<String, PriorityBlockingQueue<Path>> queues = new HashMap<>(); // per group queue size, keep no more than this number of logs in each wal group protected int queueSizePerGroup; protected ReplicationQueueStorage queueStorage; protected ReplicationPeer replicationPeer; protected Configuration conf; protected ReplicationQueueInfo replicationQueueInfo; // The manager of all sources to which we ping back our progress protected ReplicationSourceManager manager; // Should we stop everything? protected Server server; // How long should we sleep for each retry private long sleepForRetries; protected FileSystem fs; // id of this cluster private UUID clusterId; // total number of edits we replicated private AtomicLong totalReplicatedEdits = new AtomicLong(0); // The znode we currently play with protected String queueId; // Maximum number of retries before taking bold actions private int maxRetriesMultiplier; // Indicates if this particular source is running private volatile boolean sourceRunning = false; // Metrics for this source private MetricsSource metrics; // WARN threshold for the number of queued logs, defaults to 2 private int logQueueWarnThreshold; // ReplicationEndpoint which will handle the actual replication private volatile ReplicationEndpoint replicationEndpoint; // A filter (or a chain of filters) for the WAL entries. protected volatile WALEntryFilter walEntryFilter; // throttler private ReplicationThrottler throttler; private long defaultBandwidth; private long currentBandwidth; private WALFileLengthProvider walFileLengthProvider; @VisibleForTesting protected final ConcurrentHashMap<String, ReplicationSourceShipper> workerThreads = new ConcurrentHashMap<>(); private AtomicLong totalBufferUsed; public static final String WAIT_ON_ENDPOINT_SECONDS = "hbase.replication.wait.on.endpoint.seconds"; public static final int DEFAULT_WAIT_ON_ENDPOINT_SECONDS = 30; private int waitOnEndpointSeconds = -1; private Thread initThread; /** * Instantiation method used by region servers * @param conf configuration to use * @param fs file system to use * @param manager replication manager to ping to * @param server the server for this region server * @param queueId the id of our replication queue * @param clusterId unique UUID for the cluster * @param metrics metrics for replication source */ @Override public void init(Configuration conf, FileSystem fs, ReplicationSourceManager manager, ReplicationQueueStorage queueStorage, ReplicationPeer replicationPeer, Server server, String queueId, UUID clusterId, WALFileLengthProvider walFileLengthProvider, MetricsSource metrics) throws IOException { this.server = server; this.conf = HBaseConfiguration.create(conf); this.waitOnEndpointSeconds = this.conf.getInt(WAIT_ON_ENDPOINT_SECONDS, DEFAULT_WAIT_ON_ENDPOINT_SECONDS); decorateConf(); this.sleepForRetries = this.conf.getLong("replication.source.sleepforretries", 1000); // 1 second this.maxRetriesMultiplier = this.conf.getInt("replication.source.maxretriesmultiplier", 300); // 5 minutes @ 1 sec per this.queueSizePerGroup = this.conf.getInt("hbase.regionserver.maxlogs", 32); this.queueStorage = queueStorage; this.replicationPeer = replicationPeer; this.manager = manager; this.fs = fs; this.metrics = metrics; this.clusterId = clusterId; this.queueId = queueId; this.replicationQueueInfo = new ReplicationQueueInfo(queueId); this.logQueueWarnThreshold = this.conf.getInt("replication.source.log.queue.warn", 2); defaultBandwidth = this.conf.getLong("replication.source.per.peer.node.bandwidth", 0); currentBandwidth = getCurrentBandwidth(); this.throttler = new ReplicationThrottler((double) currentBandwidth / 10.0); this.totalBufferUsed = manager.getTotalBufferUsed(); this.walFileLengthProvider = walFileLengthProvider; LOG.info("queueId={}, ReplicationSource: {}, currentBandwidth={}", queueId, replicationPeer.getId(), this.currentBandwidth); } private void decorateConf() { String replicationCodec = this.conf.get(HConstants.REPLICATION_CODEC_CONF_KEY); if (StringUtils.isNotEmpty(replicationCodec)) { this.conf.set(HConstants.RPC_CODEC_CONF_KEY, replicationCodec); } } @Override public void enqueueLog(Path log) { String logPrefix = AbstractFSWALProvider.getWALPrefixFromWALName(log.getName()); PriorityBlockingQueue<Path> queue = queues.get(logPrefix); if (queue == null) { queue = new PriorityBlockingQueue<>(queueSizePerGroup, new LogsComparator()); // make sure that we do not use an empty queue when setting up a ReplicationSource, otherwise // the shipper may quit immediately queue.put(log); queues.put(logPrefix, queue); if (this.isSourceActive() && this.walEntryFilter != null) { // new wal group observed after source startup, start a new worker thread to track it // notice: it's possible that log enqueued when this.running is set but worker thread // still not launched, so it's necessary to check workerThreads before start the worker tryStartNewShipper(logPrefix, queue); } } else { queue.put(log); } if (LOG.isTraceEnabled()) { LOG.trace("{} Added log file {} to queue of source {}.", logPeerId(), logPrefix, this.replicationQueueInfo.getQueueId()); } this.metrics.incrSizeOfLogQueue(); // This will log a warning for each new log that gets created above the warn threshold int queueSize = queue.size(); if (queueSize > this.logQueueWarnThreshold) { LOG.warn("{} WAL group {} queue size: {} exceeds value of " + "replication.source.log.queue.warn: {}", logPeerId(), logPrefix, queueSize, logQueueWarnThreshold); } } @Override public void addHFileRefs(TableName tableName, byte[] family, List<Pair<Path, Path>> pairs) throws ReplicationException { String peerId = replicationPeer.getId(); Set<String> namespaces = replicationPeer.getNamespaces(); Map<TableName, List<String>> tableCFMap = replicationPeer.getTableCFs(); if (tableCFMap != null) { // All peers with TableCFs List<String> tableCfs = tableCFMap.get(tableName); if (tableCFMap.containsKey(tableName) && (tableCfs == null || tableCfs.contains(Bytes.toString(family)))) { this.queueStorage.addHFileRefs(peerId, pairs); metrics.incrSizeOfHFileRefsQueue(pairs.size()); } else { LOG.debug("HFiles will not be replicated belonging to the table {} family {} to peer id {}", tableName, Bytes.toString(family), peerId); } } else if (namespaces != null) { // Only for set NAMESPACES peers if (namespaces.contains(tableName.getNamespaceAsString())) { this.queueStorage.addHFileRefs(peerId, pairs); metrics.incrSizeOfHFileRefsQueue(pairs.size()); } else { LOG.debug("HFiles will not be replicated belonging to the table {} family {} to peer id {}", tableName, Bytes.toString(family), peerId); } } else { // user has explicitly not defined any table cfs for replication, means replicate all the // data this.queueStorage.addHFileRefs(peerId, pairs); metrics.incrSizeOfHFileRefsQueue(pairs.size()); } } private ReplicationEndpoint createReplicationEndpoint() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { RegionServerCoprocessorHost rsServerHost = null; if (server instanceof HRegionServer) { rsServerHost = ((HRegionServer) server).getRegionServerCoprocessorHost(); } String replicationEndpointImpl = replicationPeer.getPeerConfig().getReplicationEndpointImpl(); ReplicationEndpoint replicationEndpoint; if (replicationEndpointImpl == null) { // Default to HBase inter-cluster replication endpoint; skip reflection replicationEndpoint = new HBaseInterClusterReplicationEndpoint(); } else { try { replicationEndpoint = Class.forName(replicationEndpointImpl) .asSubclass(ReplicationEndpoint.class) .getDeclaredConstructor() .newInstance(); } catch (NoSuchMethodException | InvocationTargetException e) { throw new IllegalArgumentException(e); } } if (rsServerHost != null) { ReplicationEndpoint newReplicationEndPoint = rsServerHost.postCreateReplicationEndPoint(replicationEndpoint); if (newReplicationEndPoint != null) { // Override the newly created endpoint from the hook with configured end point replicationEndpoint = newReplicationEndPoint; } } return replicationEndpoint; } private void initAndStartReplicationEndpoint(ReplicationEndpoint replicationEndpoint) throws IOException, TimeoutException { TableDescriptors tableDescriptors = null; if (server instanceof HRegionServer) { tableDescriptors = ((HRegionServer) server).getTableDescriptors(); } replicationEndpoint .init(new ReplicationEndpoint.Context(server, conf, replicationPeer.getConfiguration(), fs, replicationPeer.getId(), clusterId, replicationPeer, metrics, tableDescriptors, server)); replicationEndpoint.start(); replicationEndpoint.awaitRunning(waitOnEndpointSeconds, TimeUnit.SECONDS); } private void initializeWALEntryFilter(UUID peerClusterId) { // get the WALEntryFilter from ReplicationEndpoint and add it to default filters ArrayList<WALEntryFilter> filters = Lists.<WALEntryFilter> newArrayList(new SystemTableWALEntryFilter()); WALEntryFilter filterFromEndpoint = this.replicationEndpoint.getWALEntryfilter(); if (filterFromEndpoint != null) { filters.add(filterFromEndpoint); } filters.add(new ClusterMarkingEntryFilter(clusterId, peerClusterId, replicationEndpoint)); this.walEntryFilter = new ChainWALEntryFilter(filters); } private void tryStartNewShipper(String walGroupId, PriorityBlockingQueue<Path> queue) { workerThreads.compute(walGroupId, (key, value) -> { if (value != null) { if (LOG.isDebugEnabled()) { LOG.debug( "{} Someone has beat us to start a worker thread for wal group {}", logPeerId(), key); } return value; } else { if (LOG.isDebugEnabled()) { LOG.debug("{} Starting up worker for wal group {}", logPeerId(), key); } ReplicationSourceShipper worker = createNewShipper(walGroupId, queue); ReplicationSourceWALReader walReader = createNewWALReader(walGroupId, queue, worker.getStartPosition()); Threads.setDaemonThreadRunning( walReader, Thread.currentThread().getName() + ".replicationSource.wal-reader." + walGroupId + "," + queueId, this::uncaughtException); worker.setWALReader(walReader); worker.startup(this::uncaughtException); return worker; } }); } @Override public Map<String, ReplicationStatus> getWalGroupStatus() { Map<String, ReplicationStatus> sourceReplicationStatus = new TreeMap<>(); long ageOfLastShippedOp, replicationDelay, fileSize; for (Map.Entry<String, ReplicationSourceShipper> walGroupShipper : workerThreads.entrySet()) { String walGroupId = walGroupShipper.getKey(); ReplicationSourceShipper shipper = walGroupShipper.getValue(); ageOfLastShippedOp = metrics.getAgeofLastShippedOp(walGroupId); int queueSize = queues.get(walGroupId).size(); replicationDelay = metrics.getReplicationDelay(); Path currentPath = shipper.getCurrentPath(); fileSize = -1; if (currentPath != null) { try { fileSize = getFileSize(currentPath); } catch (IOException e) { LOG.warn("Ignore the exception as the file size of HLog only affects the web ui", e); } } else { currentPath = new Path("NO_LOGS_IN_QUEUE"); LOG.warn("{} No replication ongoing, waiting for new log", logPeerId()); } ReplicationStatus.ReplicationStatusBuilder statusBuilder = ReplicationStatus.newBuilder(); statusBuilder.withPeerId(this.getPeerId()) .withQueueSize(queueSize) .withWalGroup(walGroupId) .withCurrentPath(currentPath) .withCurrentPosition(shipper.getCurrentPosition()) .withFileSize(fileSize) .withAgeOfLastShippedOp(ageOfLastShippedOp) .withReplicationDelay(replicationDelay); sourceReplicationStatus.put(this.getPeerId() + "=>" + walGroupId, statusBuilder.build()); } return sourceReplicationStatus; } private long getFileSize(Path currentPath) throws IOException { long fileSize; try { fileSize = fs.getContentSummary(currentPath).getLength(); } catch (FileNotFoundException e) { currentPath = getArchivedLogPath(currentPath, conf); fileSize = fs.getContentSummary(currentPath).getLength(); } return fileSize; } protected ReplicationSourceShipper createNewShipper(String walGroupId, PriorityBlockingQueue<Path> queue) { return new ReplicationSourceShipper(conf, walGroupId, queue, this); } private ReplicationSourceWALReader createNewWALReader(String walGroupId, PriorityBlockingQueue<Path> queue, long startPosition) { return replicationPeer.getPeerConfig().isSerial() ? new SerialReplicationSourceWALReader(fs, conf, queue, startPosition, walEntryFilter, this) : new ReplicationSourceWALReader(fs, conf, queue, startPosition, walEntryFilter, this); } protected final void uncaughtException(Thread t, Throwable e) { RSRpcServices.exitIfOOME(e); LOG.error("Unexpected exception in {} currentPath={}", t.getName(), getCurrentPath(), e); server.abort("Unexpected exception in " + t.getName(), e); } @Override public ReplicationEndpoint getReplicationEndpoint() { return this.replicationEndpoint; } @Override public ReplicationSourceManager getSourceManager() { return this.manager; } @Override public void tryThrottle(int batchSize) throws InterruptedException { checkBandwidthChangeAndResetThrottler(); if (throttler.isEnabled()) { long sleepTicks = throttler.getNextSleepInterval(batchSize); if (sleepTicks > 0) { if (LOG.isTraceEnabled()) { LOG.trace("{} To sleep {}ms for throttling control", logPeerId(), sleepTicks); } Thread.sleep(sleepTicks); // reset throttler's cycle start tick when sleep for throttling occurs throttler.resetStartTick(); } } } private void checkBandwidthChangeAndResetThrottler() { long peerBandwidth = getCurrentBandwidth(); if (peerBandwidth != currentBandwidth) { currentBandwidth = peerBandwidth; throttler.setBandwidth((double) currentBandwidth / 10.0); LOG.info("ReplicationSource : {} bandwidth throttling changed, currentBandWidth={}", replicationPeer.getId(), currentBandwidth); } } private long getCurrentBandwidth() { long peerBandwidth = replicationPeer.getPeerBandwidth(); // user can set peer bandwidth to 0 to use default bandwidth return peerBandwidth != 0 ? peerBandwidth : defaultBandwidth; } /** * Do the sleeping logic * @param msg Why we sleep * @param sleepMultiplier by how many times the default sleeping time is augmented * @return True if <code>sleepMultiplier</code> is &lt; <code>maxRetriesMultiplier</code> */ protected boolean sleepForRetries(String msg, int sleepMultiplier) { try { if (LOG.isTraceEnabled()) { LOG.trace("{} {}, sleeping {} times {}", logPeerId(), msg, sleepForRetries, sleepMultiplier); } Thread.sleep(this.sleepForRetries * sleepMultiplier); } catch (InterruptedException e) { if(LOG.isDebugEnabled()) { LOG.debug("{} Interrupted while sleeping between retries", logPeerId()); } Thread.currentThread().interrupt(); } return sleepMultiplier < maxRetriesMultiplier; } private void initialize() { int sleepMultiplier = 1; while (this.isSourceActive()) { ReplicationEndpoint replicationEndpoint; try { replicationEndpoint = createReplicationEndpoint(); } catch (Exception e) { LOG.warn("{} error creating ReplicationEndpoint, retry", logPeerId(), e); if (sleepForRetries("Error creating ReplicationEndpoint", sleepMultiplier)) { sleepMultiplier++; } continue; } try { initAndStartReplicationEndpoint(replicationEndpoint); this.replicationEndpoint = replicationEndpoint; break; } catch (Exception e) { LOG.warn("{} Error starting ReplicationEndpoint, retry", logPeerId(), e); replicationEndpoint.stop(); if (sleepForRetries("Error starting ReplicationEndpoint", sleepMultiplier)) { sleepMultiplier++; } } } if (!this.isSourceActive()) { return; } sleepMultiplier = 1; UUID peerClusterId; // delay this until we are in an asynchronous thread for (;;) { peerClusterId = replicationEndpoint.getPeerUUID(); if (this.isSourceActive() && peerClusterId == null) { if(LOG.isDebugEnabled()) { LOG.debug("{} Could not connect to Peer ZK. Sleeping for {} millis", logPeerId(), (this.sleepForRetries * sleepMultiplier)); } if (sleepForRetries("Cannot contact the peer's zk ensemble", sleepMultiplier)) { sleepMultiplier++; } } else { break; } } if(!this.isSourceActive()) { return; } // In rare case, zookeeper setting may be messed up. That leads to the incorrect // peerClusterId value, which is the same as the source clusterId if (clusterId.equals(peerClusterId) && !replicationEndpoint.canReplicateToSameCluster()) { this.terminate("ClusterId " + clusterId + " is replicating to itself: peerClusterId " + peerClusterId + " which is not allowed by ReplicationEndpoint:" + replicationEndpoint.getClass().getName(), null, false); this.manager.removeSource(this); return; } LOG.info("{} Source: {}, is now replicating from cluster: {}; to peer cluster: {};", logPeerId(), this.replicationQueueInfo.getQueueId(), clusterId, peerClusterId); initializeWALEntryFilter(peerClusterId); // start workers for (Map.Entry<String, PriorityBlockingQueue<Path>> entry : queues.entrySet()) { String walGroupId = entry.getKey(); PriorityBlockingQueue<Path> queue = entry.getValue(); tryStartNewShipper(walGroupId, queue); } } @Override public void startup() { // mark we are running now this.sourceRunning = true; initThread = new Thread(this::initialize); Threads.setDaemonThreadRunning(initThread, Thread.currentThread().getName() + ".replicationSource," + this.queueId, this::uncaughtException); } @Override public void terminate(String reason) { terminate(reason, null); } @Override public void terminate(String reason, Exception cause) { terminate(reason, cause, true); } @Override public void terminate(String reason, Exception cause, boolean clearMetrics) { terminate(reason, cause, clearMetrics, true); } public void terminate(String reason, Exception cause, boolean clearMetrics, boolean join) { if (cause == null) { LOG.info("{} Closing source {} because: {}", logPeerId(), this.queueId, reason); } else { LOG.error("{} Closing source {} because an error occurred: {}", logPeerId(), this.queueId, reason, cause); } this.sourceRunning = false; if (initThread != null && Thread.currentThread() != initThread) { // This usually won't happen but anyway, let's wait until the initialization thread exits. // And notice that we may call terminate directly from the initThread so here we need to // avoid join on ourselves. initThread.interrupt(); Threads.shutdown(initThread, this.sleepForRetries); } Collection<ReplicationSourceShipper> workers = workerThreads.values(); for (ReplicationSourceShipper worker : workers) { worker.stopWorker(); if(worker.entryReader != null) { worker.entryReader.setReaderRunning(false); } } for (ReplicationSourceShipper worker : workers) { if (worker.isAlive() || worker.entryReader.isAlive()) { try { // Wait worker to stop Thread.sleep(this.sleepForRetries); } catch (InterruptedException e) { LOG.info("{} Interrupted while waiting {} to stop", logPeerId(), worker.getName()); Thread.currentThread().interrupt(); } // If worker still is alive after waiting, interrupt it if (worker.isAlive()) { worker.interrupt(); } // If entry reader is alive after waiting, interrupt it if (worker.entryReader.isAlive()) { worker.entryReader.interrupt(); } } } if (this.replicationEndpoint != null) { this.replicationEndpoint.stop(); } if (join) { for (ReplicationSourceShipper worker : workers) { Threads.shutdown(worker, this.sleepForRetries); LOG.info("{} ReplicationSourceWorker {} terminated", logPeerId(), worker.getName()); } if (this.replicationEndpoint != null) { try { this.replicationEndpoint.awaitTerminated(sleepForRetries * maxRetriesMultiplier, TimeUnit.MILLISECONDS); } catch (TimeoutException te) { LOG.warn("{} Got exception while waiting for endpoint to shutdown " + "for replication source : {}", logPeerId(), this.queueId, te); } } } if (clearMetrics) { this.metrics.clear(); } } @Override public String getQueueId() { return this.queueId; } @Override public Path getCurrentPath() { // only for testing for (ReplicationSourceShipper worker : workerThreads.values()) { if (worker.getCurrentPath() != null) { return worker.getCurrentPath(); } } return null; } @Override public boolean isSourceActive() { return !this.server.isStopped() && this.sourceRunning; } public UUID getPeerClusterUUID(){ return this.clusterId; } /** * Comparator used to compare logs together based on their start time */ public static class LogsComparator implements Comparator<Path> { @Override public int compare(Path o1, Path o2) { return Long.compare(getTS(o1), getTS(o2)); } /** * <p> * Split a path to get the start time * </p> * <p> * For example: 10.20.20.171%3A60020.1277499063250 * </p> * @param p path to split * @return start time */ private static long getTS(Path p) { return AbstractFSWALProvider.getWALStartTimeFromWALName(p.getName()); } } public ReplicationQueueInfo getReplicationQueueInfo() { return replicationQueueInfo; } public boolean isWorkerRunning(){ for(ReplicationSourceShipper worker : this.workerThreads.values()){ if(worker.isActive()){ return worker.isActive(); } } return false; } @Override public String getStats() { StringBuilder sb = new StringBuilder(); sb.append("Total replicated edits: ").append(totalReplicatedEdits) .append(", current progress: \n"); for (Map.Entry<String, ReplicationSourceShipper> entry : workerThreads.entrySet()) { String walGroupId = entry.getKey(); ReplicationSourceShipper worker = entry.getValue(); long position = worker.getCurrentPosition(); Path currentPath = worker.getCurrentPath(); sb.append("walGroup [").append(walGroupId).append("]: "); if (currentPath != null) { sb.append("currently replicating from: ").append(currentPath).append(" at position: ") .append(position).append("\n"); } else { sb.append("no replication ongoing, waiting for new log"); } } return sb.toString(); } @Override public MetricsSource getSourceMetrics() { return this.metrics; } @Override //offsets totalBufferUsed by deducting shipped batchSize. public void postShipEdits(List<Entry> entries, int batchSize) { if (throttler.isEnabled()) { throttler.addPushSize(batchSize); } totalReplicatedEdits.addAndGet(entries.size()); totalBufferUsed.addAndGet(-batchSize); } @Override public WALFileLengthProvider getWALFileLengthProvider() { return walFileLengthProvider; } @Override public ServerName getServerWALsBelongTo() { return server.getServerName(); } @Override public ReplicationPeer getPeer() { return replicationPeer; } Server getServer() { return server; } ReplicationQueueStorage getQueueStorage() { return queueStorage; } void removeWorker(ReplicationSourceShipper worker) { workerThreads.remove(worker.walGroupId, worker); } private String logPeerId(){ return "[Source for peer " + this.getPeer().getId() + "]:"; } }
{ "content_hash": "bd628ee06f634cc1dab2c6088d927883", "timestamp": "", "source": "github", "line_count": 752, "max_line_length": 100, "avg_line_length": 38.035904255319146, "alnum_prop": 0.7028633360137049, "repo_name": "francisliu/hbase", "id": "b6f2ee1e73133180ebfaee36ec6cd8952c9b15d9", "size": "29409", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Batchfile", "bytes": "25343" }, { "name": "C", "bytes": "28534" }, { "name": "C++", "bytes": "56085" }, { "name": "CMake", "bytes": "13186" }, { "name": "CSS", "bytes": "37063" }, { "name": "Dockerfile", "bytes": "15673" }, { "name": "Groovy", "bytes": "42572" }, { "name": "HTML", "bytes": "17275" }, { "name": "Java", "bytes": "36671577" }, { "name": "JavaScript", "bytes": "9342" }, { "name": "Makefile", "bytes": "1359" }, { "name": "PHP", "bytes": "8385" }, { "name": "Perl", "bytes": "383739" }, { "name": "Python", "bytes": "127994" }, { "name": "Ruby", "bytes": "696921" }, { "name": "Shell", "bytes": "305875" }, { "name": "Thrift", "bytes": "55223" }, { "name": "XSLT", "bytes": "6764" } ], "symlink_target": "" }
package txtfnnl.tika.sax; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import java.util.Collections; import java.util.HashSet; import java.util.Set; /** * Extracts structured content from XML files following the NLM's arcive DTD 3.0 specification. The * handler adds in newlines where appropriate and removes consecutive white-spaces/newlines/tabs to * make the input more compact. Its inner workings are similar to the HTML parser's. * * @author Florian Leitner */ public class PubMedCentralXMLContentHandler extends HTMLContentHandler { /* === CONFIGURATION === */ /** * Block elements that should be followed by one newline. In addition, if the CDATA did not have * a line-break (followed by any number of space characters) just before opening the element, a * single newline is added before handling the next content. */ @SuppressWarnings({ "serial", "hiding" }) static final Set<String> ADD_LINEBREAK = Collections.unmodifiableSet(new HashSet<String>() { { add("abbrev-journal-title"); add("addr-line"); add("aff"); // iliation add("alt-title"); add("article-categories"); add("article-id"); add("article-title"); add("compound-kwd"); add("conference"); add("country"); add("custom-meta"); add("def-head"); add("def-item"); add("disp-formula"); add("disp-quote"); add("fn"); // footnote add("institution"); add("issn"); add("isbn"); add("journal-id"); add("journal-subtitle"); add("journal-title"); add("kwd"); add("product"); add("pub-date"); add("publisher"); add("related-article"); add("related-object"); add("series-title"); add("series-text"); add("speech"); add("subject"); add("subtitle"); add("term-head"); add("tr"); add("trans-subtitle"); add("trans-title"); add("unstructured-kwd-group"); add("verse-line"); } }); /** * Block elements that should be followed by two newlines. In addition, if the CDATA did not have * a line-break (followed by any number of space characters) just before opening the element, a * single newline is added before handling the next content. */ @SuppressWarnings({ "serial", "hiding" }) static final Set<String> ADD_TWO_LINEBREAKS = Collections.unmodifiableSet(new HashSet<String>() { { add("abstract"); add("ack"); // nowledgements add("address"); add("app"); // endix add("app-group"); add("array"); add("article-meta"); add("award-group"); add("author-notes"); add("back"); add("bio"); // graphy add("body"); add("boxed-text"); add("caption"); add("chem-struct-wrap"); add("contrib-group"); add("custom-meta-group"); add("def-list"); add("disp-formula-group"); add("fig"); add("fig-group"); add("floats-group"); add("fn-group"); add("front"); add("funding-group"); add("glossary"); add("graphic"); add("history"); add("journal-meta"); add("journal-title-group"); add("kwd-group"); add("list"); add("nlm-citation"); add("notes"); add("p"); add("permissions"); add("ref"); add("ref-list"); add("response"); add("sec"); add("sig-block"); add("statement"); add("sub-article"); add("subj-group"); add("supplementary-material"); add("table"); add("table-wrap"); add("table-wrap-footer"); add("table-wrap-group"); add("title"); add("title-group"); add("trans-abstract"); add("verse-group"); } }); /** * @param handler that is being decorated * @see org.apache.tika.sax.ContentHandlerDecorator#ContentHandlerDecorator(org.xml.sax.ContentHandler) */ public PubMedCentralXMLContentHandler(ContentHandler handler) { super(handler); inTitle = false; } /* === PUBLIC API === */ /** * Start element handler. Special case for handling for BREAK and HR elements: add a newline. * * @see org.xml.sax.ContentHandler#startElement(String, String, String, org.xml.sax.Attributes) */ @Override public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException { // Special cases: if ("break".equals(name) || "hr".equals(name)) { // - force a newline character whenever a BR or VSP occurs addCharacters(new char[] { '\n' }); return; } super.startElement(uri, null, name, atts); // Transition the parser state if (ADD_TWO_LINEBREAKS.contains(name)) { setNewlineState(); } else if (ADD_LINEBREAK.contains(name)) { setNewlineState(); } else { setWhitespaceState(); } } /** * Transition to double newline or newline states for block elements, and to whitespace states * otherwise. Special case handling for BREAK and HR elements: ignore them. * * @see org.xml.sax.ContentHandler#endElement(String, String, String) */ @Override public void endElement(String uri, String localName, String name) throws SAXException { if (!"break".equals(name) || !"hr".equals(name)) { super.endElement(uri, null, name); // Transition the parser state if (ADD_TWO_LINEBREAKS.contains(name)) { setDoubleNewlineState(); } else if (ADD_LINEBREAK.contains(name)) { setNewlineState(); } else { setWhitespaceState(); } } } }
{ "content_hash": "b5bc41ed71ff24260d09fefedb678c3a", "timestamp": "", "source": "github", "line_count": 189, "max_line_length": 105, "avg_line_length": 29.91005291005291, "alnum_prop": 0.6058729877940916, "repo_name": "fnl/txtfnnl", "id": "9298a8375f3b6219bb3342ecc72dfd6501422067", "size": "5653", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "txtfnnl-tika/src/main/java/txtfnnl/tika/sax/PubMedCentralXMLContentHandler.java", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "HTML", "bytes": "966631" }, { "name": "Java", "bytes": "1048631" }, { "name": "Python", "bytes": "20298" }, { "name": "Shell", "bytes": "7334" } ], "symlink_target": "" }
{% extends 'templates/nhs_transaction_layout.html' %} {% import 'includes/form_macros.html' as form_macros %} {% block afterHeader %} {% include "includes/service-headers/health-costs-checker.html" %} {% endblock %} {% block content %} <style> .panel__column{ background-color: #F8F8F8; border-left-width: 3px; box-sizing: border-box; clear: both; border-left-style: solid; border-color: #bfc1c3; padding: 0.7894736842em; margin-bottom: 0.7894736842em; } .left{ padding-left:0px; } .panel--binary{ padding: 1.2em 0 1.2em 0; } .column-half { padding: 0 15px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } @media (max-width: 641px) { .column-half { float: left; width: 100%; margin-top:1em; border: 3px solid #bfc1c3; } } .content-block ol.steps,article ol.steps { padding-left:0; margin-left:0; margin-bottom:0; overflow:hidden; } .content-block ol.steps2{ padding-left:0; margin-left:0; margin-bottom:0; overflow:hidden; } .content-block ol.steps>li,article ol.steps>li { background-position:1 0.87em; background-repeat:no-repeat; list-style-type:decimal; margin-left:0; padding:0em 0 0 2.2em } .content-block ol.steps2>li{ background-position:1 0.87em; background-repeat:no-repeat; list-style-type:decimal; margin-left:0; padding:0em 0 0 2.2em } .content-block ol.steps>li:nth-child(1),article ol.steps>li:nth-child(1) { background-image:url(https://assets.publishing.service.gov.uk/static/icon-steps/icon-step-1-4d6351dedaee517e9fc84bc030fe7a9f04f876a30dc95ec28bbd0cabd1d94210.png); } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 20 / 10), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .content-block ol.steps>li:nth-child(1),article ol.steps>li:nth-child(1) { background-image:url(https://assets.publishing.service.gov.uk/static/icon-steps/icon-step-1-2x-1e99d30f52eef13744bcce8fe79d7057b79e56134c2456ffc1dd2c02203abed8.png); background-size:24px 24px; padding-bottom:0.8em; } } .content-block ol.steps2>li:nth-child(1),article ol.steps2>li:nth-child(1) { background-image:url(https://assets.publishing.service.gov.uk/static/icon-steps/icon-step-2-fe28a816d0187a23b9c4164f92ef7f7d494ea9d5d92fbcdb43b441981083c342.png) } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 20 / 10), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .content-block ol.steps2>li:nth-child(1),article ol.steps2>li:nth-child(1) { background-image:url(https://assets.publishing.service.gov.uk/static/icon-steps/icon-step-2-2x-a7267f61d550c519691b6df11d6d87c52784f7e2050933c6306fb75fc07106f7.png); background-size:24px 24px; padding-bottom:0.8em; } } .box-heading{ padding-top:0; } .heading-secondary{ font-size: 24px; line-height: 1.25; font-weight: 400; text-transform: none; color: #6f777b; margin-bottom: 0; padding-bottom: .167em; } @media (max-width: 641px) { .heading-secondary { font-size:19px; } } .callout{ margin-top:32px; } .callout--compact { display: inline-block; padding: 16px 24px; } .callout--info { background-color: #eff1f2; border: solid #768692; border-width: 0 0 0 4px; } .neg-heading{ padding-top: 1em; border-top: 2px solid #b9d2dc; } </style> <main id="content" role="main"> <a href="javascript:history.go(-1)" class="link-back">Back</a> <div class="grid-row content-block"> <div class="column-two-thirds"> <h1 class="heading-large"> <span class="heading-secondary">Based on what you've told us:</span> <br> You get free prescriptions and dental care</h1> <p class="intro-to-list"> Because you're pregnant or have had a baby in the last 12 months, you get free: </p> <ul class="form-hint-list"> <li class="form-hint-list-item form-hint-list-item--valid"> <span class="form-hint-list-item__indicator"></span> NHS prescriptions<br> <!-- <p>To get free prescriptions you need to have a valid maternity exemption certificate.</p>--> </li> <li class="form-hint-list-item form-hint-list-item--valid"> <span class="form-hint-list-item__indicator"></span> NHS dental treatment </li> </ul> <details> <summary role="button" aria-controls="details-content-0" tabindex="0" aria-expanded="true"><span class="summary">What you should do next</span></summary> <div class="panel-indent" id="details-content-0" aria-hidden="false" style="display: block;"> <h3 class="heading-small">To get free prescriptions</h3> <p>You need to have a valid maternity exemption certificate.</p> <p>You can get an application form from your midwife, doctor or health visitor.</p> <p>If you didn't get your maternity exemption certificate while you were pregnant, you can still apply at any time during the 12 months after your baby was born.</p> <details> <summary><span class="summary">Loss of a baby</span></summary> <div class="panel panel-border-narrow"> <p>If you've lost your baby after the 24th week of you pregnancy, you can still apply for a maternity exemption certificate.</p> <p>If you have a miscarriage, abortion or stillborn birth you can use your maternity exemption certificate until it expires.</p> </div> </details> <br> <h3 class="heading-small">To get free NHS dental check ups and treatment </h3> <p>You may need to show proof of your pregnancy, or that you have had a baby in the past 12 months. You can show things like:</p> <ul class="list-bullet"> <li>a valid maternity exemption certificate</li> <li>a MATB1 certificate issued by your midwife or GP</li> <li>your childs birth certificate</li> <li>a notification of birth form – the midwife who delivers your baby will give you this form</li> <li>a stillbirth certificate- issued by your local registrar of births, marriages and deaths</li> </ul> </div> </details> <br> <h2 class="heading-medium neg-heading">You don't automatically get help towards the cost of:</h2> <ul> <li class="form-hint-list-item form-hint-list-item--false"> <span class="form-hint-list-item__indicator"></span> NHS sight tests </li> <li class="form-hint-list-item form-hint-list-item--false"> <span class="form-hint-list-item__indicator"></span> New or replacement glasses or contact lenses </li> <li class="form-hint-list-item form-hint-list-item--false"> <span class="form-hint-list-item__indicator"></span> NHS wigs and fabric supports </li> <li class="form-hint-list-item form-hint-list-item--false"> <span class="form-hint-list-item__indicator"></span> Travel to receive NHS treatment </li> </ul> <h3 class="heading-small">If you find it hard to pay for any of these health costs, you could get help through the Low Income Scheme</h3> {{ form_macros.button({ classes: 'button-secondary-cta', href: 'http://www.nhsbsa.nhs.uk/HealthCosts/1128.aspx', label: 'Find out about the Low Income Scheme' }) }} </div> </div> </main> {% endblock %}
{ "content_hash": "486b28ea14f112925147b3a605e8f574", "timestamp": "", "source": "github", "line_count": 240, "max_line_length": 292, "avg_line_length": 32.4375, "alnum_prop": 0.6665382145150931, "repo_name": "nhsbsa/HWHC_checker", "id": "9d031af36d45f2ce309a2a9d9c01144ab2b4787f", "size": "7788", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/views/sprints/b3/answers-preg-lis.html", "mode": "33188", "license": "mit", "language": [ { "name": "CSS", "bytes": "1392923" }, { "name": "HTML", "bytes": "2678704" }, { "name": "JavaScript", "bytes": "94470" }, { "name": "Ruby", "bytes": "299" }, { "name": "Shell", "bytes": "929" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>User agent detail - Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-T670 Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.5 Chrome/38.0.2125.102 Safari/537.36</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/css/materialize.min.css"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="../circle.css" rel="stylesheet"> </head> <body> <div class="container"> <div class="section"> <h1 class="header center orange-text">User agent detail</h1> <div class="row center"> <h5 class="header light"> Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-T670 Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.5 Chrome/38.0.2125.102 Safari/537.36 </h5> </div> </div> <div class="section"> <table class="striped"><tr><th></th><th colspan="3">General</th><th colspan="5">Device</th><th colspan="3">Bot</th><th colspan="2"></th></tr><tr><th>Provider</th><th>Browser</th><th>Engine</th><th>OS</th><th>Brand</th><th>Model</th><th>Type</th><th>Is mobile</th><th>Is touch</th><th>Is bot</th><th>Name</th><th>Type</th><th>Parse time</th><th>Actions</th></tr><tr><th colspan="14" class="green lighten-3">Test suite</th></tr><tr><td>WhichBrowser<br /><small>v2.0.18</small><br /><small>vendor/whichbrowser/parser/tests/data/tablet/manufacturer-samsung.yaml</small></td><td>Samsung Internet 3.5</td><td>Blink </td><td>Android 5.1.1</td><td style="border-left: 1px solid #555"></td><td>Galaxy View</td><td>tablet</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-027cff01-4a76-491b-ace3-9289fcbc172f">Detail</a> <!-- Modal Structure --> <div id="modal-027cff01-4a76-491b-ace3-9289fcbc172f" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhichBrowser result detail</h4> <p><pre><code class="php">Array ( [headers] => User-Agent: Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-T670 Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.5 Chrome/38.0.2125.102 Safari/537.36 [result] => Array ( [browser] => Array ( [name] => Samsung Internet [version] => 3.5 [type] => browser ) [engine] => Array ( [name] => Blink ) [os] => Array ( [name] => Android [version] => 5.1.1 ) [device] => Array ( [type] => tablet [manufacturer] => Samsung [model] => Galaxy View ) ) [readable] => Samsung Internet 3.5 on a Samsung Galaxy View running Android 5.1.1 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><th colspan="14" class="green lighten-3">Providers</th></tr><tr><td>BrowscapFull<br /><small>6014</small><br /></td><td>Samsung Browser 3.5</td><td>Blink </td><td>Android 5.1</td><td style="border-left: 1px solid #555"></td><td></td><td>Mobile Phone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.042</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-47a9cd06-e213-4882-bc34-db6aed664223">Detail</a> <!-- Modal Structure --> <div id="modal-47a9cd06-e213-4882-bc34-db6aed664223" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>BrowscapFull result detail</h4> <p><pre><code class="php">stdClass Object ( [browser_name_regex] => /^mozilla\/5\.0 \(.*linux.*android.5\.1.* build\/.*\) applewebkit\/.* \(khtml.* like gecko\) samsungbrowser\/3\.5.*chrome.*safari.*$/ [browser_name_pattern] => mozilla/5.0 (*linux*android?5.1* build/*) applewebkit/* (khtml* like gecko) samsungbrowser/3.5*chrome*safari* [parent] => Samsung Browser 3.5 [comment] => Samsung Browser 3.5 [browser] => Samsung Browser [browser_type] => Browser [browser_bits] => 32 [browser_maker] => Samsung [browser_modus] => unknown [version] => 3.5 [majorver] => 3 [minorver] => 5 [platform] => Android [platform_version] => 5.1 [platform_description] => Android OS [platform_bits] => 32 [platform_maker] => Google Inc [alpha] => [beta] => [win16] => [win32] => [win64] => [frames] => 1 [iframes] => 1 [tables] => 1 [cookies] => 1 [backgroundsounds] => [javascript] => 1 [vbscript] => [javaapplets] => [activexcontrols] => [ismobiledevice] => 1 [istablet] => [issyndicationreader] => [crawler] => [isfake] => [isanonymized] => [ismodified] => [cssversion] => 3 [aolversion] => 0 [device_name] => general Mobile Phone [device_maker] => unknown [device_type] => Mobile Phone [device_pointing_method] => touchscreen [device_code_name] => general Mobile Phone [device_brand_name] => unknown [renderingengine_name] => Blink [renderingengine_version] => unknown [renderingengine_description] => a WebKit Fork by Google [renderingengine_maker] => Google Inc ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>BrowscapLite<br /><small>6014</small><br /></td> <td colspan="12" class="center-align red lighten-1"> <strong>No result found</strong> </td> </tr><tr><td>BrowscapPhp<br /><small>6014</small><br /></td><td>Samsung Browser 3.5</td><td><i class="material-icons">close</i></td><td>Android </td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>Mobile Phone</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.018</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-ad0041a2-b0f4-43f6-a70d-cad1443caa68">Detail</a> <!-- Modal Structure --> <div id="modal-ad0041a2-b0f4-43f6-a70d-cad1443caa68" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>BrowscapPhp result detail</h4> <p><pre><code class="php">stdClass Object ( [browser_name_regex] => /^mozilla\/5\.0 \(.*linux.*android.5\.1.* build\/.*\) applewebkit\/.* \(khtml.* like gecko\) samsungbrowser\/3\.5.*chrome.*safari.*$/ [browser_name_pattern] => mozilla/5.0 (*linux*android?5.1* build/*) applewebkit/* (khtml* like gecko) samsungbrowser/3.5*chrome*safari* [parent] => Samsung Browser 3.5 [comment] => Samsung Browser 3.5 [browser] => Samsung Browser [browser_type] => unknown [browser_bits] => 0 [browser_maker] => Samsung [browser_modus] => unknown [version] => 3.5 [majorver] => 3 [minorver] => 5 [platform] => Android [platform_version] => unknown [platform_description] => unknown [platform_bits] => 0 [platform_maker] => unknown [alpha] => false [beta] => false [win16] => false [win32] => false [win64] => false [frames] => false [iframes] => false [tables] => false [cookies] => false [backgroundsounds] => false [javascript] => false [vbscript] => false [javaapplets] => false [activexcontrols] => false [ismobiledevice] => 1 [istablet] => [issyndicationreader] => false [crawler] => [isfake] => false [isanonymized] => false [ismodified] => false [cssversion] => 0 [aolversion] => 0 [device_name] => unknown [device_maker] => unknown [device_type] => Mobile Phone [device_pointing_method] => touchscreen [device_code_name] => unknown [device_brand_name] => unknown [renderingengine_name] => unknown [renderingengine_version] => unknown [renderingengine_description] => unknown [renderingengine_maker] => unknown ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>DonatjUAParser<br /><small>v0.5.1</small><br /></td><td>Chrome 38.0.2125.102</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-15fbc1f0-2615-4d42-b5d9-a30dd647b050">Detail</a> <!-- Modal Structure --> <div id="modal-15fbc1f0-2615-4d42-b5d9-a30dd647b050" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>DonatjUAParser result detail</h4> <p><pre><code class="php">Array ( [platform] => Android [browser] => Chrome [version] => 38.0.2125.102 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>JenssegersAgent<br /><small>v2.3.3</small><br /></td><td>Chrome 38.0.2125.102</td><td><i class="material-icons">close</i></td><td>AndroidOS 5.1.1</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.001</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-b85a2b91-6a55-4436-a82c-1ea0d46e2e51">Detail</a> <!-- Modal Structure --> <div id="modal-b85a2b91-6a55-4436-a82c-1ea0d46e2e51" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>JenssegersAgent result detail</h4> <p><pre><code class="php">Array ( [browserName] => Chrome [browserVersion] => 38.0.2125.102 [osName] => AndroidOS [osVersion] => 5.1.1 [deviceModel] => Samsung [isMobile] => 1 [isRobot] => [botName] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>NeutrinoApiCom<br /><small></small><br /></td><td>Chrome 38.0.2125.102</td><td><i class="material-icons">close</i></td><td>Android 5.1.1</td><td style="border-left: 1px solid #555">Samsung</td><td>Galaxy View</td><td>desktop-browser</td><td></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.28702</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-8c2a7a4e-3fbf-4df2-8d61-5e730422f67b">Detail</a> <!-- Modal Structure --> <div id="modal-8c2a7a4e-3fbf-4df2-8d61-5e730422f67b" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>NeutrinoApiCom result detail</h4> <p><pre><code class="php">stdClass Object ( [mobile_screen_height] => 0 [is_mobile] => [type] => desktop-browser [mobile_brand] => Samsung [mobile_model] => Galaxy View [version] => 38.0.2125.102 [is_android] => [browser_name] => Chrome [operating_system_family] => Android [operating_system_version] => 5.1.1 [is_ios] => [producer] => Google Inc. [operating_system] => Android [mobile_screen_width] => 0 [mobile_browser] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>PiwikDeviceDetector<br /><small>3.6.1</small><br /></td><td>Chrome 38.0</td><td>Blink </td><td>Android 5.1</td><td style="border-left: 1px solid #555">Samsung</td><td>SM-T670</td><td>tablet</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.003</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-4a941d34-a8d3-4914-9724-346f60ad7046">Detail</a> <!-- Modal Structure --> <div id="modal-4a941d34-a8d3-4914-9724-346f60ad7046" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>PiwikDeviceDetector result detail</h4> <p><pre><code class="php">Array ( [client] => Array ( [type] => browser [name] => Chrome [short_name] => CH [version] => 38.0 [engine] => Blink ) [operatingSystem] => Array ( [name] => Android [short_name] => AND [version] => 5.1 [platform] => ) [device] => Array ( [brand] => SA [brandName] => Samsung [model] => SM-T670 [device] => 2 [deviceName] => tablet ) [bot] => [extra] => Array ( [isBot] => [isBrowser] => 1 [isFeedReader] => [isMobileApp] => [isPIM] => [isLibrary] => [isMediaPlayer] => [isCamera] => [isCarBrowser] => [isConsole] => [isFeaturePhone] => [isPhablet] => [isPortableMediaPlayer] => [isSmartDisplay] => [isSmartphone] => [isTablet] => 1 [isTV] => [isDesktop] => [isMobile] => 1 [isTouchEnabled] => ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>SinergiBrowserDetector<br /><small>6.0.1</small><br /></td><td>Chrome 38.0.2125.102</td><td><i class="material-icons">close</i></td><td>Android 5.1.1</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td></td><td><i class="material-icons">close</i></td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-ec1cd248-02b0-457e-8a9d-35bb99af008c">Detail</a> <!-- Modal Structure --> <div id="modal-ec1cd248-02b0-457e-8a9d-35bb99af008c" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>SinergiBrowserDetector result detail</h4> <p><pre><code class="php">Array ( [browser] => Sinergi\BrowserDetector\Browser Object ( [userAgent:Sinergi\BrowserDetector\Browser:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-T670 Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.5 Chrome/38.0.2125.102 Safari/537.36 ) [name:Sinergi\BrowserDetector\Browser:private] => Chrome [version:Sinergi\BrowserDetector\Browser:private] => 38.0.2125.102 [isRobot:Sinergi\BrowserDetector\Browser:private] => [isChromeFrame:Sinergi\BrowserDetector\Browser:private] => [isFacebookWebView:Sinergi\BrowserDetector\Browser:private] => [isCompatibilityMode:Sinergi\BrowserDetector\Browser:private] => ) [operatingSystem] => Sinergi\BrowserDetector\Os Object ( [name:Sinergi\BrowserDetector\Os:private] => Android [version:Sinergi\BrowserDetector\Os:private] => 5.1.1 [isMobile:Sinergi\BrowserDetector\Os:private] => 1 [userAgent:Sinergi\BrowserDetector\Os:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-T670 Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.5 Chrome/38.0.2125.102 Safari/537.36 ) ) [device] => Sinergi\BrowserDetector\Device Object ( [name:Sinergi\BrowserDetector\Device:private] => unknown [userAgent:Sinergi\BrowserDetector\Device:private] => Sinergi\BrowserDetector\UserAgent Object ( [userAgentString:Sinergi\BrowserDetector\UserAgent:private] => Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-T670 Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.5 Chrome/38.0.2125.102 Safari/537.36 ) ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UAParser<br /><small>v3.4.5</small><br /></td><td>Chrome 38.0.2125</td><td><i class="material-icons">close</i></td><td>Android 5.1.1</td><td style="border-left: 1px solid #555">Samsung</td><td>SM-T670</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.002</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-3160e405-8a8f-46dd-8f47-5115f06462d2">Detail</a> <!-- Modal Structure --> <div id="modal-3160e405-8a8f-46dd-8f47-5115f06462d2" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UAParser result detail</h4> <p><pre><code class="php">UAParser\Result\Client Object ( [ua] => UAParser\Result\UserAgent Object ( [major] => 38 [minor] => 0 [patch] => 2125 [family] => Chrome ) [os] => UAParser\Result\OperatingSystem Object ( [major] => 5 [minor] => 1 [patch] => 1 [patchMinor] => [family] => Android ) [device] => UAParser\Result\Device Object ( [brand] => Samsung [model] => SM-T670 [family] => Samsung SM-T670 ) [originalUserAgent] => Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-T670 Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.5 Chrome/38.0.2125.102 Safari/537.36 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UserAgentApiCom<br /><small></small><br /></td><td>Chrome 38.0.2125.102</td><td>WebKit 537.36</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>Mobile</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.16801</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-afeb05fb-26b9-4509-b8ac-0c604a9e97d6">Detail</a> <!-- Modal Structure --> <div id="modal-afeb05fb-26b9-4509-b8ac-0c604a9e97d6" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UserAgentApiCom result detail</h4> <p><pre><code class="php">stdClass Object ( [platform_name] => Android [platform_version] => 5.1.1 [platform_type] => Mobile [browser_name] => Chrome [browser_version] => 38.0.2125.102 [engine_name] => WebKit [engine_version] => 537.36 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>UserAgentStringCom<br /><small></small><br /></td><td>Android Webkit Browser </td><td><i class="material-icons">close</i></td><td>Android 5.1.1</td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.10901</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-08a9ddfb-838f-48d7-9ede-1d132306b2ee">Detail</a> <!-- Modal Structure --> <div id="modal-08a9ddfb-838f-48d7-9ede-1d132306b2ee" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>UserAgentStringCom result detail</h4> <p><pre><code class="php">stdClass Object ( [agent_type] => Browser [agent_name] => Android Webkit Browser [agent_version] => -- [os_type] => Android [os_name] => Android [os_versionName] => [os_versionNumber] => 5.1.1 [os_producer] => [os_producerURL] => [linux_distibution] => Null [agent_language] => [agent_languageTag] => ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>WhatIsMyBrowserCom<br /><small></small><br /></td><td>Samsung Browser 3.5</td><td>WebKit 537.36</td><td>Android 5.1.1</td><td style="border-left: 1px solid #555">Samsung</td><td></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.33502</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-5fc1ff22-a74d-481b-9ad1-fcfde73ded9c">Detail</a> <!-- Modal Structure --> <div id="modal-5fc1ff22-a74d-481b-9ad1-fcfde73ded9c" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhatIsMyBrowserCom result detail</h4> <p><pre><code class="php">stdClass Object ( [operating_system_name] => Android [simple_sub_description_string] => [simple_browser_string] => Samsung Browser 3.5 on Android (Lollipop) [browser_version] => 3.5 [extra_info] => Array ( ) [operating_platform] => [extra_info_table] => stdClass Object ( [System Build] => LMY47X ) [layout_engine_name] => WebKit [detected_addons] => Array ( ) [operating_system_flavour_code] => [hardware_architecture] => [operating_system_flavour] => [operating_system_frameworks] => Array ( ) [browser_name_code] => samsung-browser [operating_system_version] => Lollipop [simple_operating_platform_string] => Samsung SM-T670 [is_abusive] => [layout_engine_version] => 537.36 [browser_capabilities] => Array ( ) [operating_platform_vendor_name] => Samsung [operating_system] => Android (Lollipop) [operating_system_version_full] => 5.1.1 [operating_platform_code] => SM-T670 [browser_name] => Samsung Browser [operating_system_name_code] => android [user_agent] => Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-T670 Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/3.5 Chrome/38.0.2125.102 Safari/537.36 [browser_version_full] => 3.5 [browser] => Samsung Browser 3.5 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>WhichBrowser<br /><small>v2.0.18</small><br /></td><td>Samsung Internet 3.5</td><td>Blink </td><td>Android 5.1.1</td><td style="border-left: 1px solid #555">Samsung</td><td>Galaxy View</td><td>tablet</td><td>yes</td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0.006</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-083a336f-5d73-4505-84f3-c5fc9bb78652">Detail</a> <!-- Modal Structure --> <div id="modal-083a336f-5d73-4505-84f3-c5fc9bb78652" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>WhichBrowser result detail</h4> <p><pre><code class="php">Array ( [browser] => Array ( [name] => Samsung Internet [version] => 3.5 [type] => browser ) [engine] => Array ( [name] => Blink ) [os] => Array ( [name] => Android [version] => 5.1.1 ) [device] => Array ( [type] => tablet [manufacturer] => Samsung [model] => Galaxy View ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Woothee<br /><small>v1.2.0</small><br /></td><td>Chrome 38.0.2125.102</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>smartphone</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"></td><td></td><td><i class="material-icons">close</i></td><td>0</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-f00e7198-0e22-49fe-bad0-dbb3a9cde9b9">Detail</a> <!-- Modal Structure --> <div id="modal-f00e7198-0e22-49fe-bad0-dbb3a9cde9b9" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Woothee result detail</h4> <p><pre><code class="php">Array ( [name] => Chrome [vendor] => Google [version] => 38.0.2125.102 [category] => smartphone [os] => Android [os_version] => 5.1.1 ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Wurfl<br /><small>1.7.1.0</small><br /></td><td>Samsung Browser 3.5</td><td><i class="material-icons">close</i></td><td>Android 5.1.1</td><td style="border-left: 1px solid #555">Samsung</td><td>SM-T670</td><td>Tablet</td><td>yes</td><td>yes</td><td style="border-left: 1px solid #555"></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.021</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-a2bedf8c-4a95-42a7-96c5-aaf233b2ac50">Detail</a> <!-- Modal Structure --> <div id="modal-a2bedf8c-4a95-42a7-96c5-aaf233b2ac50" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Wurfl result detail</h4> <p><pre><code class="php">Array ( [virtual] => Array ( [is_android] => true [is_ios] => false [is_windows_phone] => false [is_app] => false [is_full_desktop] => false [is_largescreen] => true [is_mobile] => true [is_robot] => false [is_smartphone] => false [is_touchscreen] => true [is_wml_preferred] => false [is_xhtmlmp_preferred] => false [is_html_preferred] => true [advertised_device_os] => Android [advertised_device_os_version] => 5.1.1 [advertised_browser] => Samsung Browser [advertised_browser_version] => 3.5 [complete_device_name] => Samsung SM-T670 (Galaxy View) [device_name] => Samsung Galaxy View [form_factor] => Tablet [is_phone] => false [is_app_webview] => false ) [all] => Array ( [brand_name] => Samsung [model_name] => SM-T670 [unique] => true [ununiqueness_handler] => [is_wireless_device] => true [device_claims_web_support] => true [has_qwerty_keyboard] => true [can_skip_aligned_link_row] => true [uaprof] => [uaprof2] => [uaprof3] => [nokia_series] => 0 [nokia_edition] => 0 [device_os] => Android [mobile_browser] => Chrome Mobile [mobile_browser_version] => [device_os_version] => 5.1 [pointing_method] => touchscreen [release_date] => 2015_march [marketing_name] => Galaxy View [model_extra_info] => [nokia_feature_pack] => 0 [can_assign_phone_number] => false [is_tablet] => true [manufacturer_name] => [is_bot] => false [is_google_glass] => false [proportional_font] => false [built_in_back_button_support] => false [card_title_support] => true [softkey_support] => false [table_support] => true [numbered_menus] => false [menu_with_select_element_recommended] => false [menu_with_list_of_links_recommended] => true [icons_on_menu_items_support] => false [break_list_of_links_with_br_element_recommended] => true [access_key_support] => false [wrap_mode_support] => false [times_square_mode_support] => false [deck_prefetch_support] => false [elective_forms_recommended] => true [wizards_recommended] => false [image_as_link_support] => false [insert_br_element_after_widget_recommended] => false [wml_can_display_images_and_text_on_same_line] => false [wml_displays_image_in_center] => false [opwv_wml_extensions_support] => false [wml_make_phone_call_string] => wtai://wp/mc; [chtml_display_accesskey] => false [emoji] => false [chtml_can_display_images_and_text_on_same_line] => false [chtml_displays_image_in_center] => false [imode_region] => none [chtml_make_phone_call_string] => tel: [chtml_table_support] => false [xhtml_honors_bgcolor] => true [xhtml_supports_forms_in_table] => true [xhtml_support_wml2_namespace] => false [xhtml_autoexpand_select] => false [xhtml_select_as_dropdown] => false [xhtml_select_as_radiobutton] => false [xhtml_select_as_popup] => false [xhtml_display_accesskey] => false [xhtml_supports_invisible_text] => false [xhtml_supports_inline_input] => false [xhtml_supports_monospace_font] => false [xhtml_supports_table_for_layout] => true [xhtml_supports_css_cell_table_coloring] => true [xhtml_format_as_css_property] => false [xhtml_format_as_attribute] => false [xhtml_nowrap_mode] => false [xhtml_marquee_as_css_property] => false [xhtml_readable_background_color1] => #FFFFFF [xhtml_readable_background_color2] => #FFFFFF [xhtml_allows_disabled_form_elements] => true [xhtml_document_title_support] => true [xhtml_preferred_charset] => iso-8859-1 [opwv_xhtml_extensions_support] => false [xhtml_make_phone_call_string] => tel: [xhtmlmp_preferred_mime_type] => text/html [xhtml_table_support] => true [xhtml_send_sms_string] => sms: [xhtml_send_mms_string] => mms: [xhtml_file_upload] => supported [cookie_support] => true [accept_third_party_cookie] => true [xhtml_supports_iframe] => full [xhtml_avoid_accesskeys] => true [xhtml_can_embed_video] => none [ajax_support_javascript] => true [ajax_manipulate_css] => true [ajax_support_getelementbyid] => true [ajax_support_inner_html] => true [ajax_xhr_type] => standard [ajax_manipulate_dom] => true [ajax_support_events] => true [ajax_support_event_listener] => true [ajax_preferred_geoloc_api] => w3c_api [xhtml_support_level] => 4 [preferred_markup] => html_web_4_0 [wml_1_1] => false [wml_1_2] => false [wml_1_3] => false [html_wi_w3_xhtmlbasic] => true [html_wi_oma_xhtmlmp_1_0] => true [html_wi_imode_html_1] => false [html_wi_imode_html_2] => false [html_wi_imode_html_3] => false [html_wi_imode_html_4] => false [html_wi_imode_html_5] => false [html_wi_imode_htmlx_1] => false [html_wi_imode_htmlx_1_1] => false [html_wi_imode_compact_generic] => false [html_web_3_2] => true [html_web_4_0] => true [voicexml] => false [multipart_support] => false [total_cache_disable_support] => false [time_to_live_support] => false [resolution_width] => 1080 [resolution_height] => 1920 [columns] => 60 [max_image_width] => 320 [max_image_height] => 640 [rows] => 40 [physical_screen_width] => 230 [physical_screen_height] => 408 [dual_orientation] => true [density_class] => 1.0 [wbmp] => true [bmp] => false [epoc_bmp] => false [gif_animated] => false [jpg] => true [png] => true [tiff] => false [transparent_png_alpha] => true [transparent_png_index] => true [svgt_1_1] => true [svgt_1_1_plus] => false [greyscale] => false [gif] => true [colors] => 65536 [webp_lossy_support] => true [webp_lossless_support] => true [post_method_support] => true [basic_authentication_support] => true [empty_option_value_support] => true [emptyok] => false [nokia_voice_call] => false [wta_voice_call] => false [wta_phonebook] => false [wta_misc] => false [wta_pdc] => false [https_support] => true [phone_id_provided] => false [max_data_rate] => 3600 [wifi] => true [sdio] => false [vpn] => false [has_cellular_radio] => true [max_deck_size] => 2000000 [max_url_length_in_requests] => 256 [max_url_length_homepage] => 0 [max_url_length_bookmark] => 0 [max_url_length_cached_page] => 0 [max_no_of_connection_settings] => 0 [max_no_of_bookmarks] => 0 [max_length_of_username] => 0 [max_length_of_password] => 0 [max_object_size] => 0 [downloadfun_support] => false [directdownload_support] => true [inline_support] => false [oma_support] => true [ringtone] => false [ringtone_3gpp] => false [ringtone_midi_monophonic] => false [ringtone_midi_polyphonic] => false [ringtone_imelody] => false [ringtone_digiplug] => false [ringtone_compactmidi] => false [ringtone_mmf] => false [ringtone_rmf] => false [ringtone_xmf] => false [ringtone_amr] => false [ringtone_awb] => false [ringtone_aac] => false [ringtone_wav] => false [ringtone_mp3] => false [ringtone_spmidi] => false [ringtone_qcelp] => false [ringtone_voices] => 1 [ringtone_df_size_limit] => 0 [ringtone_directdownload_size_limit] => 0 [ringtone_inline_size_limit] => 0 [ringtone_oma_size_limit] => 0 [wallpaper] => false [wallpaper_max_width] => 0 [wallpaper_max_height] => 0 [wallpaper_preferred_width] => 0 [wallpaper_preferred_height] => 0 [wallpaper_resize] => none [wallpaper_wbmp] => false [wallpaper_bmp] => false [wallpaper_gif] => false [wallpaper_jpg] => false [wallpaper_png] => false [wallpaper_tiff] => false [wallpaper_greyscale] => false [wallpaper_colors] => 2 [wallpaper_df_size_limit] => 0 [wallpaper_directdownload_size_limit] => 0 [wallpaper_inline_size_limit] => 0 [wallpaper_oma_size_limit] => 0 [screensaver] => false [screensaver_max_width] => 0 [screensaver_max_height] => 0 [screensaver_preferred_width] => 0 [screensaver_preferred_height] => 0 [screensaver_resize] => none [screensaver_wbmp] => false [screensaver_bmp] => false [screensaver_gif] => false [screensaver_jpg] => false [screensaver_png] => false [screensaver_greyscale] => false [screensaver_colors] => 2 [screensaver_df_size_limit] => 0 [screensaver_directdownload_size_limit] => 0 [screensaver_inline_size_limit] => 0 [screensaver_oma_size_limit] => 0 [picture] => false [picture_max_width] => 0 [picture_max_height] => 0 [picture_preferred_width] => 0 [picture_preferred_height] => 0 [picture_resize] => none [picture_wbmp] => false [picture_bmp] => false [picture_gif] => false [picture_jpg] => false [picture_png] => false [picture_greyscale] => false [picture_colors] => 2 [picture_df_size_limit] => 0 [picture_directdownload_size_limit] => 0 [picture_inline_size_limit] => 0 [picture_oma_size_limit] => 0 [video] => false [oma_v_1_0_forwardlock] => false [oma_v_1_0_combined_delivery] => false [oma_v_1_0_separate_delivery] => false [streaming_video] => true [streaming_3gpp] => true [streaming_mp4] => true [streaming_mov] => false [streaming_video_size_limit] => 0 [streaming_real_media] => none [streaming_flv] => false [streaming_3g2] => false [streaming_vcodec_h263_0] => 10 [streaming_vcodec_h263_3] => -1 [streaming_vcodec_mpeg4_sp] => 2 [streaming_vcodec_mpeg4_asp] => -1 [streaming_vcodec_h264_bp] => 3.0 [streaming_acodec_amr] => nb [streaming_acodec_aac] => lc [streaming_wmv] => none [streaming_preferred_protocol] => http [streaming_preferred_http_protocol] => apple_live_streaming [wap_push_support] => false [connectionless_service_indication] => false [connectionless_service_load] => false [connectionless_cache_operation] => false [connectionoriented_unconfirmed_service_indication] => false [connectionoriented_unconfirmed_service_load] => false [connectionoriented_unconfirmed_cache_operation] => false [connectionoriented_confirmed_service_indication] => false [connectionoriented_confirmed_service_load] => false [connectionoriented_confirmed_cache_operation] => false [utf8_support] => true [ascii_support] => false [iso8859_support] => false [expiration_date] => false [j2me_cldc_1_0] => false [j2me_cldc_1_1] => false [j2me_midp_1_0] => false [j2me_midp_2_0] => false [doja_1_0] => false [doja_1_5] => false [doja_2_0] => false [doja_2_1] => false [doja_2_2] => false [doja_3_0] => false [doja_3_5] => false [doja_4_0] => false [j2me_jtwi] => false [j2me_mmapi_1_0] => false [j2me_mmapi_1_1] => false [j2me_wmapi_1_0] => false [j2me_wmapi_1_1] => false [j2me_wmapi_2_0] => false [j2me_btapi] => false [j2me_3dapi] => false [j2me_locapi] => false [j2me_nokia_ui] => false [j2me_motorola_lwt] => false [j2me_siemens_color_game] => false [j2me_siemens_extension] => false [j2me_heap_size] => 0 [j2me_max_jar_size] => 0 [j2me_storage_size] => 0 [j2me_max_record_store_size] => 0 [j2me_screen_width] => 0 [j2me_screen_height] => 0 [j2me_canvas_width] => 0 [j2me_canvas_height] => 0 [j2me_bits_per_pixel] => 0 [j2me_audio_capture_enabled] => false [j2me_video_capture_enabled] => false [j2me_photo_capture_enabled] => false [j2me_capture_image_formats] => none [j2me_http] => false [j2me_https] => false [j2me_socket] => false [j2me_udp] => false [j2me_serial] => false [j2me_gif] => false [j2me_gif89a] => false [j2me_jpg] => false [j2me_png] => false [j2me_bmp] => false [j2me_bmp3] => false [j2me_wbmp] => false [j2me_midi] => false [j2me_wav] => false [j2me_amr] => false [j2me_mp3] => false [j2me_mp4] => false [j2me_imelody] => false [j2me_rmf] => false [j2me_au] => false [j2me_aac] => false [j2me_realaudio] => false [j2me_xmf] => false [j2me_wma] => false [j2me_3gpp] => false [j2me_h263] => false [j2me_svgt] => false [j2me_mpeg4] => false [j2me_realvideo] => false [j2me_real8] => false [j2me_realmedia] => false [j2me_left_softkey_code] => 0 [j2me_right_softkey_code] => 0 [j2me_middle_softkey_code] => 0 [j2me_select_key_code] => 0 [j2me_return_key_code] => 0 [j2me_clear_key_code] => 0 [j2me_datefield_no_accepts_null_date] => false [j2me_datefield_broken] => false [receiver] => false [sender] => false [mms_max_size] => 0 [mms_max_height] => 0 [mms_max_width] => 0 [built_in_recorder] => false [built_in_camera] => true [mms_jpeg_baseline] => false [mms_jpeg_progressive] => false [mms_gif_static] => false [mms_gif_animated] => false [mms_png] => false [mms_bmp] => false [mms_wbmp] => false [mms_amr] => false [mms_wav] => false [mms_midi_monophonic] => false [mms_midi_polyphonic] => false [mms_midi_polyphonic_voices] => 0 [mms_spmidi] => false [mms_mmf] => false [mms_mp3] => false [mms_evrc] => false [mms_qcelp] => false [mms_ota_bitmap] => false [mms_nokia_wallpaper] => false [mms_nokia_operatorlogo] => false [mms_nokia_3dscreensaver] => false [mms_nokia_ringingtone] => false [mms_rmf] => false [mms_xmf] => false [mms_symbian_install] => false [mms_jar] => false [mms_jad] => false [mms_vcard] => false [mms_vcalendar] => false [mms_wml] => false [mms_wbxml] => false [mms_wmlc] => false [mms_video] => false [mms_mp4] => false [mms_3gpp] => false [mms_3gpp2] => false [mms_max_frame_rate] => 0 [nokiaring] => false [picturemessage] => false [operatorlogo] => false [largeoperatorlogo] => false [callericon] => false [nokiavcard] => false [nokiavcal] => false [sckl_ringtone] => false [sckl_operatorlogo] => false [sckl_groupgraphic] => false [sckl_vcard] => false [sckl_vcalendar] => false [text_imelody] => false [ems] => false [ems_variablesizedpictures] => false [ems_imelody] => false [ems_odi] => false [ems_upi] => false [ems_version] => 0 [siemens_ota] => false [siemens_logo_width] => 101 [siemens_logo_height] => 29 [siemens_screensaver_width] => 101 [siemens_screensaver_height] => 50 [gprtf] => false [sagem_v1] => false [sagem_v2] => false [panasonic] => false [sms_enabled] => true [wav] => false [mmf] => false [smf] => false [mld] => false [midi_monophonic] => false [midi_polyphonic] => false [sp_midi] => false [rmf] => false [xmf] => false [compactmidi] => false [digiplug] => false [nokia_ringtone] => false [imelody] => false [au] => false [amr] => false [awb] => false [aac] => true [mp3] => true [voices] => 1 [qcelp] => false [evrc] => false [flash_lite_version] => [fl_wallpaper] => false [fl_screensaver] => false [fl_standalone] => false [fl_browser] => false [fl_sub_lcd] => false [full_flash_support] => false [css_supports_width_as_percentage] => true [css_border_image] => webkit [css_rounded_corners] => webkit [css_gradient] => none [css_spriting] => true [css_gradient_linear] => none [is_transcoder] => false [transcoder_ua_header] => user-agent [rss_support] => false [pdf_support] => true [progressive_download] => true [playback_vcodec_h263_0] => 10 [playback_vcodec_h263_3] => -1 [playback_vcodec_mpeg4_sp] => 0 [playback_vcodec_mpeg4_asp] => -1 [playback_vcodec_h264_bp] => 3.0 [playback_real_media] => none [playback_3gpp] => true [playback_3g2] => false [playback_mp4] => true [playback_mov] => false [playback_acodec_amr] => nb [playback_acodec_aac] => none [playback_df_size_limit] => 0 [playback_directdownload_size_limit] => 0 [playback_inline_size_limit] => 0 [playback_oma_size_limit] => 0 [playback_acodec_qcelp] => false [playback_wmv] => none [hinted_progressive_download] => true [html_preferred_dtd] => html4 [viewport_supported] => true [viewport_width] => device_width_token [viewport_userscalable] => no [viewport_initial_scale] => [viewport_maximum_scale] => [viewport_minimum_scale] => [mobileoptimized] => false [handheldfriendly] => false [canvas_support] => full [image_inlining] => true [is_smarttv] => false [is_console] => false [nfc_support] => false [ux_full_desktop] => false [jqm_grade] => A [is_sencha_touch_ok] => false ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr><tr><td>Zsxsoft<br /><small>1.3</small><br /></td><td>Google Chrome 38.0.2125.102</td><td><i class="material-icons">close</i></td><td>Android 5.1.1</td><td style="border-left: 1px solid #555">Samsung</td><td>T670</td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td style="border-left: 1px solid #555"><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td><i class="material-icons">close</i></td><td>0.001</td><td> <!-- Modal Trigger --> <a class="modal-trigger btn waves-effect waves-light" href="#modal-5d43e024-b46c-44f6-8914-529b05569bc2">Detail</a> <!-- Modal Structure --> <div id="modal-5d43e024-b46c-44f6-8914-529b05569bc2" class="modal modal-fixed-footer"> <div class="modal-content"> <h4>Zsxsoft result detail</h4> <p><pre><code class="php">Array ( [browser] => Array ( [link] => http://google.com/chrome/ [title] => Google Chrome 38.0.2125.102 [name] => Google Chrome [version] => 38.0.2125.102 [code] => chrome [image] => img/16/browser/chrome.png ) [os] => Array ( [link] => http://www.android.com/ [name] => Android [version] => 5.1.1 [code] => android [x64] => [title] => Android 5.1.1 [type] => os [dir] => os [image] => img/16/os/android.png ) [device] => Array ( [link] => http://www.samsungmobile.com/ [title] => Samsung T670 [model] => T670 [brand] => Samsung [code] => samsung [dir] => device [type] => device [image] => img/16/device/samsung.png ) [platform] => Array ( [link] => http://www.samsungmobile.com/ [title] => Samsung T670 [model] => T670 [brand] => Samsung [code] => samsung [dir] => device [type] => device [image] => img/16/device/samsung.png ) ) </code></pre></p> </div> <div class="modal-footer"> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat ">close</a> </div> </div> </td></tr></table> </div> <div class="section"> <h1 class="header center orange-text">About this comparison</h1> <div class="row center"> <h5 class="header light"> The primary goal of this project is simple<br /> I wanted to know which user agent parser is the most accurate in each part - device detection, bot detection and so on...<br /> <br /> The secondary goal is to provide a source for all user agent parsers to improve their detection based on this results.<br /> <br /> You can also improve this further, by suggesting ideas at <a href="https://github.com/ThaDafinser/UserAgentParserComparison">ThaDafinser/UserAgentParserComparison</a><br /> <br /> The comparison is based on the abstraction by <a href="https://github.com/ThaDafinser/UserAgentParser">ThaDafinser/UserAgentParser</a> </h5> </div> </div> <div class="card"> <div class="card-content"> Comparison created <i>2016-05-10 08:02:09</i> | by <a href="https://github.com/ThaDafinser">ThaDafinser</a> </div> </div> </div> <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.3/js/materialize.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/list.js/1.2.0/list.min.js"></script> <script> $(document).ready(function(){ // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered $('.modal-trigger').leanModal(); }); </script> </body> </html>
{ "content_hash": "198757687fd6a8854c8f562e4f678a5c", "timestamp": "", "source": "github", "line_count": 1332, "max_line_length": 920, "avg_line_length": 41.12537537537538, "alnum_prop": 0.5423793789590902, "repo_name": "ThaDafinser/UserAgentParserComparison", "id": "a78b9964a80794373617e7007325bedd7d82efe9", "size": "54780", "binary": false, "copies": "1", "ref": "refs/heads/gh-pages", "path": "v5/user-agent-detail/8a/63/8a633efd-189c-4cc6-85a4-e9d9a01d4ec2.html", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "2060859160" } ], "symlink_target": "" }
""" Import legacy data from TIM (including households, ...). An extension of :mod:`tim2lino <lino_xl.lib.tim2lino.tim2lino>`. """ from __future__ import unicode_literals import datetime from builtins import str # from lino.utils import mti from lino.api import dd, rt, _ from lino.utils.instantiator import create from django.core.exceptions import ValidationError from .timloader1 import TimLoader Person = dd.resolve_model("contacts.Person") Company = dd.resolve_model("contacts.Company") RoleType = dd.resolve_model("contacts.RoleType") Role = dd.resolve_model("contacts.Role") Household = rt.models.households.Household Product = dd.resolve_model('products.Product') # List = dd.resolve_model('lists.List') Client = rt.models.tera.Client Course = rt.models.courses.Course Line = rt.models.courses.Line ActivityLayouts = rt.models.courses.ActivityLayouts Course = rt.models.courses.Course Enrolment = rt.models.courses.Enrolment Event = rt.models.cal.Event Account = dd.resolve_model('ledger.Account') working = dd.resolve_app('working') User = rt.models.users.User Note = rt.models.notes.Note UserTypes = rt.models.users.UserTypes Partner = rt.models.contacts.Partner # Coaching = rt.models.coachings.Coaching # lists_Member = rt.models.lists.Member households_Member = rt.models.households.Member households_MemberRoles = rt.models.households.MemberRoles class TimLoader(TimLoader): # archived_tables = set('GEN ART VEN VNL JNL FIN FNL'.split()) # archive_name = 'rumma' # has_projects = False # languages = 'de fr' def __init__(self, *args, **kwargs): super(TimLoader, self).__init__(*args, **kwargs) self.imported_sessions = set([]) self.obsolete_list = [] # LinkTypes = rt.models.humanlinks.LinkTypes # plptypes = dict() # plptypes['01'] = LinkTypes.parent # plptypes['01R'] = None # plptypes['02'] = LinkTypes.uncle # plptypes['02R'] = None # plptypes['03'] = LinkTypes.stepparent # plptypes['03R'] = None # plptypes['04'] = LinkTypes.grandparent # plptypes['04R'] = None # plptypes['10'] = LinkTypes.spouse # plptypes['11'] = LinkTypes.friend # self.linktypes = plptypes def get_users(self, row): for idusr in (row.idusr2, row.idusr1, row.idusr3): user = self.get_user(idusr) if user is not None: yield user def par_pk(self, pk): try: if pk.startswith('E'): return 1000000 + int(pk[1:]) elif pk.startswith('S'): return 2000000 + int(pk[1:]) return int(pk) except ValueError: return None def par_class(self, data): prt = data.idprt if prt == 'L': # Lieferant return Company elif prt == 'K': # Krankenkasse return Company elif prt == 'S': # Sonstige return Company elif prt == 'W': # Netzwerkpartner return Company elif prt == 'R': # Ärzte return Person elif prt == 'Z': # Zahler return Company elif prt == 'P': # Personen return Client elif prt == 'G': # Lebensgruppen return Household elif prt == 'T': # Therapeutische Gruppen return Household # List #~ dblogger.warning("Unhandled PAR->IdPrt %r",prt) def load_par(self, row): for obj in super(TimLoader, self).load_par(row): if row.idpar.startswith('E'): obj.team = self.eupen elif row.idpar.startswith('S'): obj.team = self.stvith # idpar2 = row.idpar2.strip() # if idpar2 and row.idpar != idpar2: # self.obsolete_list.append( # (obj, self.par_pk(idpar2))) # if isinstance(obj, Partner): # obj.isikukood = row['regkood'].strip() # obj.created = row['datcrea'] # obj.modified = datetime.datetime.now() name = row.firme.strip() if row.name2.strip(): name += "-" + row.name2.strip() name += ' ' + row.vorname.strip() prt = row.idprt if prt == "T": # if Course.objects.filter(id=obj.id).exists(): # return # if Course.objects.filter(ref=row.idpar.strip()).exists(): # return kw = dict(name=name, line=self.other_groups, id=obj.id) kw.update(ref=row.idpar.strip()) for user in self.get_users(row): kw.update(teacher=user) break yield Course(**kw) return yield obj if prt == "G": # if Course.objects.filter(id=obj.id).exists(): # return # if Course.objects.filter(ref=row.idpar.strip()).exists(): # return kw = dict( name=name, line=self.life_groups, id=obj.id, partner_id=obj.id) kw.update(ref=row.idpar.strip()) for user in self.get_users(row): kw.update(teacher=user) break yield Course(**kw) return if prt == "P": for user in self.get_users(row): # if Course.objects.filter(id=obj.id).exists(): # return # if Course.objects.filter(ref=row.idpar.strip()).exists(): # return therapy = Course( line=self.therapies, partner_id=obj.id, name=name, teacher=user, id=obj.id, ref=row.idpar.strip()) yield therapy kw = dict() if row.date1: kw.update(start_date=row.date1) if row.date2 and row.date2 > row.date1: # avoid "Date period ends before it started." kw.update(end_date=row.date2) yield Enrolment(pupil=obj, course=therapy, **kw) return else: dd.logger.warning( "No coaching for non-client %s", obj) # def load_pls(self, row, **kw): # kw.update(ref=row.idpls.strip()) # kw.update(name=row.name) # return List(**kw) def get_user(self, idusr=None): try: return User.objects.get(username=idusr.strip().lower()) except User.DoesNotExist: return None def create_users(self): pass def load_usr(self, row, **kw): kw.update(username=row.userid.strip().lower()) kw.update(first_name=row.name.strip()) abtlg = row.abtlg.strip() if abtlg == 'E': kw.update(team=self.eupen) elif abtlg == 'S': kw.update(team=self.stvith) kw.update(user_type=UserTypes.admin) o = User(**kw) o.set_password("1234") return o def get_partner(self, model, idpar): pk = self.par_pk(idpar.strip()) try: return model.objects.get(pk=pk) except model.DoesNotExist: return None def load_plp(self, row, **kw): # Link = rt.models.humanlinks.Link # LinkTypes = rt.models.humanlinks.LinkTypes plptype = row.type.strip() if plptype.endswith("-"): return if not plptype: return if plptype[0] in "01": if not plptype in self.linktypes: dd.logger.warning( "Ignored PLP %s : Invalid type %s", row, plptype) return linktype = self.linktypes.get(plptype) if linktype is None: # silently ignore reverse PLPType return p1 = self.get_partner(Person, row.idpar1) if p1 is None: dd.logger.debug( "Ignored PLP %s : Invalid idpar1", row) return p2 = self.get_partner(Person, row.idpar2) if p2 is None: dd.logger.debug( "Ignored PLP %s : Invalid idpar2", row) return yield Link(parent=p1, child=p2, type=linktype) elif plptype == "80": # p1 = self.get_partner(List, row.idpar1) p1 = self.get_partner(Course, row.idpar1) if p1 is None: dd.logger.debug( "Ignored PLP %s : Invalid idpar1", row) return p2 = self.get_partner(Client, row.idpar2) if p2 is None: dd.logger.debug( "Ignored PLP %s : Invalid idpar2", row) return # return lists_Member(list=p1, partner=p2) yield Enrolment(course=p1, pupil=p2, state='confirmed') # elif plptype[0] in "78": p1 = self.get_partner(Household, row.idpar1) if p1 is None: dd.logger.warning( "Ignored PLP %s : Invalid idpar1", row) return p2 = self.get_partner(Client, row.idpar2) if p2 is None: dd.logger.warning( "Ignored PLP %s : Invalid idpar2", row) return if plptype == "81": role = households_MemberRoles.spouse elif plptype == "82": role = households_MemberRoles.child elif plptype == "83": role = households_MemberRoles.partner elif plptype == "84": role = households_MemberRoles.other elif plptype == "71": # Onkel/Tante role = households_MemberRoles.relative elif plptype == "72": # Nichte/Neffe role = households_MemberRoles.relative else: role = households_MemberRoles.relative yield households_Member(household=p1, person=p2, role=role) p1 = self.get_partner(Course, row.idpar1) if p1 is None: dd.logger.warning( "Ignored PLP %s : no course for idpar1", row) return yield Enrolment(course=p1, pupil=p2, remark=str(role), state='confirmed') elif plptype == "81-": return dd.logger.debug( "Ignored PLP %s : invalid plptype", row) def unused_load_dls(self, row, **kw): if not row.iddls.strip(): return # if not row.idpin.strip(): # return pk = row.iddls.strip() idusr = row.idusr.strip() if pk.startswith('E'): team = self.eupen pk = int(pk[1:]) elif pk.startswith('S'): team = self.stvith pk = int(pk[1:]) + 1000000 if pk in self.imported_sessions: dd.logger.warning( "Cannot import duplicate session %s", pk) return self.imported_sessions.add(pk) u = self.get_user(idusr) if u is None: dd.logger.warning( "Cannot import session %s because there is no user %s", pk, idusr) return if u.team != team: u1 = u idusr += '@' + str(team.pk) try: u = User.objects.get(username=idusr) except User.DoesNotExist: u = create( User, username=idusr, first_name=u1.first_name, team=team, user_type=u1.user_type) kw.update(user=u) kw.update(id=pk) # if row.idprj.strip(): # kw.update(project_id=int(row.idprj)) # kw.update(partner_id=PRJPAR.get(int(row.idprj),None)) if row.idpar.strip(): idpar = self.par_pk(row.idpar.strip()) try: ticket = Partner.objects.get(id=idpar) kw.update(ticket=ticket) except Partner.DoesNotExist: dd.logger.warning( "Cannot import session %s because there is no partner %d", pk, idpar) return kw.update(summary=row.nb.strip()) kw.update(start_date=row.date) def set_time(kw, fldname, v): v = v.strip() if not v: return if v == '24:00': v = '0:00' kw[fldname] = v set_time(kw, 'start_time', row.von) set_time(kw, 'end_time', row.bis) # set_time(kw, 'break_time', row.pause) # kw.update(start_time=row.von.strip()) # kw.update(end_time=row.bis.strip()) # kw.update(break_time=row.pause.strip()) # kw.update(is_private=tim2bool(row.isprivat)) obj = working.Session(**kw) # if row.idpar.strip(): # partner_id = self.par_pk(row.idpar) # if obj.project and obj.project.partner \ # and obj.project.partner.id == partner_id: # pass # elif obj.ticket and obj.ticket.partner \ # and obj.ticket.partner.id == partner_id: # pass # else: # ~ dblogger.warning("Lost DLS->IdPar of DLS#%d" % pk) yield obj # if row.memo.strip(): # kw = dict(owner=obj) # kw.update(body=self.dbfmemo(row.memo)) # kw.update(user=obj.user) # kw.update(date=obj.start_date) # yield rt.models.notes.Note(**kw) def finalize(self): dd.logger.info("Deleting %d obsolete partners", len(self.obsolete_list)) for (par1, idpar2) in self.obsolete_list: par2 = None try: par2 = Client.objects.get(id=idpar2) except Client.DoesNotExist: try: par2 = Household.objects.get(id=idpar2) except Household.DoesNotExist: pass if par2 is None: continue def replace(model, k, delete=False): for obj in model.objects.filter(**{k: par1}): setattr(obj, k, par2) try: obj.full_clean() obj.save() except ValidationError as e: if delete: obj.delete() else: dd.logger.warning( "Couldn't change obsolete %s to %s: %s", k, par2, e) # replace(Coaching, 'client') if isinstance(par1, Person): replace(Enrolment, 'pupil', True) replace(rt.models.households.Member, 'person') #replace(rt.models.humanlinks.Link, 'parent') #replace(rt.models.humanlinks.Link, 'child') replace(rt.models.cal.Guest, 'partner', True) replace(rt.models.clients.ClientContact, 'client') if isinstance(par1, Client): replace(Course, 'partner') if isinstance(par1, Household): if isinstance(par2, Household): replace(Course, 'partner') try: par1.delete() except Exception as e: par1.obsoletes = par2 par1.full_clean() par1.save() dd.logger.warning("Failed to delete {} : {}".format( par1, e)) super(TimLoader, self).finalize() dd.logger.info("Deleting dangling individual therapies") # if there is exactly one therapy for a patient, and if that # therapy has only one enrolment, and if that patient has # enrolments in other therapies as well, then the therapy is # useless for p in Client.objects.all(): qs = Course.objects.filter(partner=p) if qs.count() == 1: et = qs[0] if Note.objects.filter(project=et).count(): continue if Event.objects.filter(project=et).count(): continue qs = Enrolment.objects.filter(pupil=p) qs = qs.exclude(course=et) if qs.count() > 0: qs = Enrolment.objects.filter(course=et) if qs.count() == 1: Enrolment.objects.filter(course=et).delete() et.delete() def objects(self): Team = rt.models.teams.Team Country = rt.models.countries.Country self.eupen = create(Team, name="Eupen") yield self.eupen self.stvith = create(Team, name="St. Vith") yield self.stvith yield Country(isocode='LU', **dd.str2kw('name', _("Luxemburg"))) yield Country(isocode='PL', **dd.str2kw('name', _("Poland"))) yield Country(isocode='AU', **dd.str2kw('name', _("Austria"))) yield Country(isocode='US', short_code='USA', **dd.str2kw('name', _("United States"))) yield self.load_dbf('USR') yield super(TimLoader, self).objects() yield self.load_dbf('PLP') if False: yield self.load_dbf('DLS')
{ "content_hash": "6acc6b55b4d110eeee4915fd7c12a9be", "timestamp": "", "source": "github", "line_count": 496, "max_line_length": 80, "avg_line_length": 36.01209677419355, "alnum_prop": 0.49848841115216663, "repo_name": "lino-framework/xl", "id": "da1f318874ec4ac1c71498d2f1d9f7c8de31efcf", "size": "18004", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lino_xl/lib/tim2lino/spzloader.py", "mode": "33188", "license": "bsd-2-clause", "language": [ { "name": "CSS", "bytes": "186625" }, { "name": "HTML", "bytes": "1417287" }, { "name": "JavaScript", "bytes": "1630929" }, { "name": "PHP", "bytes": "40437" }, { "name": "Python", "bytes": "2395471" } ], "symlink_target": "" }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Ballistics Training")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Ballistics Training")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("a6cee9db-02d0-4fbd-952e-b53cf6fd3b66")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
{ "content_hash": "7be79f76ee526acf1267a08d720ee201", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 84, "avg_line_length": 39.19444444444444, "alnum_prop": 0.7462792345854005, "repo_name": "mkpetrov/Programming-Fundamentals-SoftUni-Jan2017", "id": "0f431e286d0beecf847c3f8d797889407aa93a95", "size": "1414", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "Arrays/Ballistics Training/Properties/AssemblyInfo.cs", "mode": "33188", "license": "mit", "language": [ { "name": "C#", "bytes": "483345" } ], "symlink_target": "" }
// // Created by Andrew Bartow on 12/14/16. // #ifndef OPENBADGE_BATTERY_H #define OPENBADGE_BATTERY_H /* * Initializes the battery monitoring service. * * Depends on ADC already being initialized. */ void BatteryMonitor_init(void); /* * Returns the current supply voltage of the battery. Should be used in place of getBatteryVoltage in analog.c * * Note: this value is a running average across several battery readings. */ float BatteryMonitor_getBatteryVoltage(void); #endif //OPENBADGE_BATTERY_H
{ "content_hash": "9abdb8192218219fc745b0052dde8751", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 110, "avg_line_length": 23.227272727272727, "alnum_prop": 0.7495107632093934, "repo_name": "HumanDynamics/OpenBadge", "id": "0904b7f6b0035706350513c24d6e407e68bedb1c", "size": "511", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "firmware/nRF_badge/rssi_scanner/incl/battery.h", "mode": "33188", "license": "mit", "language": [ { "name": "C", "bytes": "169781" }, { "name": "C++", "bytes": "629" }, { "name": "Eagle", "bytes": "3544310" }, { "name": "Jupyter Notebook", "bytes": "4388" }, { "name": "Makefile", "bytes": "14474" }, { "name": "Objective-C", "bytes": "14787" }, { "name": "Python", "bytes": "43750" }, { "name": "Shell", "bytes": "2059" } ], "symlink_target": "" }
<?xml version="1.0" encoding="utf-8"?> <ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="#edfafafa"> <item android:drawable="@drawable/treeview_second_level_green_bg"></item> </ripple>
{ "content_hash": "6af626a3efac0211e0c34c2a3627dbc9", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 77, "avg_line_length": 44.8, "alnum_prop": 0.7098214285714286, "repo_name": "jvg637upv/TrivialAndroid", "id": "ca193ba4a3c941557978d9ec15b6dbc227d76ae5", "size": "224", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "app/src/main/res/drawable-v21/treeview_second_level_clickable_green_bg.xml", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "Java", "bytes": "600446" }, { "name": "Roff", "bytes": "6641" } ], "symlink_target": "" }
Using Groups With FOSUserBundle =============================== FOSUserBundle allows you to associate groups to your users. Groups are a way to group a collection of roles. The roles of a group will be granted to all users belonging to it. .. note:: Symfony supports role inheritance so inheriting roles from groups is not always needed. If the role inheritance is enough for your use case, it is better to use it instead of groups as it is more efficient (loading the groups triggers the database). To use the groups, you need to explicitly enable this functionality in your configuration. The only mandatory configuration is the fully qualified class name (FQCN) of your ``Group`` class which must implement ``FOS\UserBundle\Model\GroupInterface``. Below is an example configuration for enabling groups support. .. configuration-block:: .. code-block:: yaml # app/config/config.yml fos_user: db_driver: orm firewall_name: main user_class: AppBundle\Entity\User group: group_class: AppBundle\Entity\Group .. code-block:: xml <!-- app/config/config.xml --> <fos_user:config db-driver="orm" firewall-name="main" user-class="AppBundle\Entity\User" > <fos_user:group group-class="AppBundle\Entity\Group" /> </fos_user:config> The Group class --------------- The simplest way to create a Group class is to extend the mapped superclass provided by the bundle. a) ORM Group class implementation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. configuration-block:: .. code-block:: php-annotations // src/MyProject/MyBundle/Entity/Group.php namespace MyProject\MyBundle\Entity; use FOS\UserBundle\Model\Group as BaseGroup; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity * @ORM\Table(name="fos_group") */ class Group extends BaseGroup { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; } .. code-block:: yaml # src/AppBundle/Resources/config/doctrine/Group.orm.yml AppBundle\Entity\Group: type: entity table: fos_group id: id: type: integer generator: strategy: AUTO .. note:: ``Group`` is a reserved keyword in SQL so it cannot be used as the table name. b) MongoDB Group class implementation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: php // src/MyProject/MyBundle/Document/Group.php namespace MyProject\MyBundle\Document; use FOS\UserBundle\Model\Group as BaseGroup; use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB; /** * @MongoDB\Document */ class Group extends BaseGroup { /** * @MongoDB\Id(strategy="auto") */ protected $id; } c) CouchDB Group class implementation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: php // src/MyProject/MyBundle/CouchDocument/Group.php namespace MyProject\MyBundle\CouchDocument; use FOS\UserBundle\Model\Group as BaseGroup; use Doctrine\ODM\CouchDB\Mapping\Annotations as CouchDB; /** * @CouchDB\Document */ class Group extends BaseGroup { /** * @CouchDB\Id */ protected $id; } Defining the User-Group relation -------------------------------- The next step is to map the relation in your ``User`` class. a) ORM User-Group mapping ~~~~~~~~~~~~~~~~~~~~~~~~~ .. configuration-block:: .. code-block:: php-annotations // src/MyProject/MyBundle/Entity/User.php namespace MyProject\MyBundle\Entity; use FOS\UserBundle\Model\User as BaseUser; /** * @ORM\Entity * @ORM\Table(name="fos_user") */ class User extends BaseUser { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\ManyToMany(targetEntity="MyProject\MyBundle\Entity\Group") * @ORM\JoinTable(name="fos_user_user_group", * joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")}, * inverseJoinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id")} * ) */ protected $groups; } .. code-block:: yaml # src/AppBundle/Resources/config/doctrine/User.orm.yml AppBundle\Entity\User: type: entity table: fos_user id: id: type: integer generator: strategy: AUTO manyToMany: groups: targetEntity: Group joinTable: name: fos_user_group joinColumns: user_id: referencedColumnName: id inverseJoinColumns: group_id: referencedColumnName: id .. code-block:: xml <?xml version="1.0" encoding="UTF-8"?> <doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> <entity name="AppBundle\Entity\User" table="fos_user"> <id name="id" column="id" type="integer"> <generator strategy="AUTO" /> </id> <many-to-many field="groups" target-entity="Group"> <join-table name="fos_user_group"> <join-columns> <join-column name="user_id" referenced-column-name="id"/> </join-columns> <inverse-join-columns> <join-column name="group_id" referenced-column-name="id" /> </inverse-join-columns> </join-table> </many-to-many> </entity> </doctrine-mapping> b) MongoDB User-Group mapping ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: php // src/MyProject/MyBundle/Document/User.php namespace MyProject\MyBundle\Document; use FOS\UserBundle\Model\User as BaseUser; use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB; /** * @MongoDB\Document */ class User extends BaseUser { /** @MongoDB\Id(strategy="auto") */ protected $id; /** * @MongoDB\ReferenceMany(targetDocument="MyProject\MyBundle\Document\Group") */ protected $groups; } c) CouchDB User-Group mapping ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: php // src/MyProject/MyBundle/CouchDocument/User.php namespace MyProject\MyBundle\CouchDocument; use FOS\UserBundle\Model\User as BaseUser; use Doctrine\ODM\CouchDB\Mapping\Annotations as CouchDB; /** * @CouchDB\Document */ class User extends BaseUser { /** * @CouchDB\Id */ protected $id; /** * @CouchDB\ReferenceMany(targetDocument="MyProject\MyBundle\CouchDocument\Group") */ protected $groups; } Enabling the routing for the GroupController -------------------------------------------- You can import the routing file ``group.xml`` to use the built-in controller to manipulate groups. .. code-block:: yaml # app/config/routing.yml fos_user_group: resource: "@FOSUserBundle/Resources/config/routing/group.xml" prefix: /group
{ "content_hash": "03e1555c967d5f443367b60ee56fc9ff", "timestamp": "", "source": "github", "line_count": 294, "max_line_length": 102, "avg_line_length": 27.833333333333332, "alnum_prop": 0.5409996333862886, "repo_name": "xarisma/jc-xarisma-master.com", "id": "218b0eadd0fde640af976fc6246b3fbff95599bb", "size": "8183", "binary": false, "copies": "2", "ref": "refs/heads/master", "path": "vendor/friendsofsymfony/user-bundle/Resources/doc/groups.rst", "mode": "33188", "license": "mit", "language": [ { "name": "ApacheConf", "bytes": "3297" }, { "name": "CSS", "bytes": "1282" }, { "name": "HTML", "bytes": "34446" }, { "name": "PHP", "bytes": "187001" }, { "name": "Shell", "bytes": "2824" } ], "symlink_target": "" }
namespace swganh { namespace messages { struct CancelTicketResponseMessage : public BaseSwgMessage { uint16_t Opcount() const { return 3; } uint32_t Opcode() const { return 0xD6FBF318; } uint32_t message_flag; // 0 = success message, 1 = failure message uint32_t ticket_id; void OnSerialize(swganh::ByteBuffer& buffer) const { buffer.write(message_flag); buffer.write(ticket_id); } void OnDeserialize(swganh::ByteBuffer& buffer) { message_flag = buffer.read<uint32_t>(); ticket_id = buffer.read<uint32_t>(); } }; } } // namespace swganh::messages
{ "content_hash": "d41c149f350915fdd61aefa8bf94addc", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 70, "avg_line_length": 19.294117647058822, "alnum_prop": 0.6189024390243902, "repo_name": "anhstudios/swganh", "id": "44eb62a98a47949c5d8defef8e948214887999e1", "size": "879", "binary": false, "copies": "2", "ref": "refs/heads/develop", "path": "src/swganh_core/messages/cancel_ticket_response_message.h", "mode": "33188", "license": "mit", "language": [ { "name": "Batchfile", "bytes": "11887" }, { "name": "C", "bytes": "7699" }, { "name": "C++", "bytes": "2357839" }, { "name": "CMake", "bytes": "41264" }, { "name": "PLSQL", "bytes": "42065" }, { "name": "Python", "bytes": "7503510" }, { "name": "SQLPL", "bytes": "42770" } ], "symlink_target": "" }
echo "Backing up previous nvim config" webdev=0 if [ -f "${HOME}/.config/nvim/webdev.vim" ]; then webdev=1 fi # TODO not working for sum reason. if [ -r "${HOME}/.config/nvim" ]; then if [ -r "${HOME}/.dotfiles-bak/.nvim" ]; then rm -rf ${HOME}/.dotfiles-bak/.nvim 2> /dev/null fi mv -f ${HOME}/.config/nvim ${HOME}/.dotfiles-bak/ 2> /dev/null fi if [ $webdev -eq 11 ]; then touch ${HOME}/.config/nvim/webdev.vim fi # config install mkdir -p ${HOME}/.config/nvim/ ln -sfv "${PACKAGE_INSTALL}/config/nvim/vundle.vim" ~/.config/nvim/ ln -sfv "${PACKAGE_INSTALL}/config/nvim/init.vim" ~/.config/nvim/ cp "${PACKAGE_INSTALL}/config/nvim/python.vim" ~/.config/nvim/ cp "${PACKAGE_INSTALL}/config/nvim/custom.vim" ~/.config/nvim/ if [ "$DISTRO" == "Arch" ]; then # work around for arch, because smart python linking. python2_path=`which python` else python2_path=`which python3` fi sed -i -e 's#%python-path%#'${python2_path}'#g' ~/.config/nvim/python.vim BUNDLE_DIR=${HOME}/.config/nvim/bundle # Install fzf git clone --depth 1 https://github.com/junegunn/fzf.git ${BUNDLE_DIR}/.fzf # Install/update Vundle mkdir -p "${BUNDLE_DIR}" && (git clone https://github.com/VundleVim/Vundle.vim.git "${BUNDLE_DIR}/vundle" || (cd "${BUNDLE_DIR}/vundle" && git pull origin master)) # Install bundles nvim +PluginInstall +qall echo "Compiling ycm" # Compile YouCompleteMe cd "${BUNDLE_DIR}/YouCompleteMe" if [ "$DISTRO" == "Arch" ]; then # work around for arch, because smart python linking. /usr/bin/env python install.py --clang-completer --system-libclang else /usr/bin/env python3 install.py fi cd - cp "${PACKAGE_INSTALL}/config/nvim/powerline.vim" "${BUNDLE_DIR}/lightline.vim/autoload/lightline/colorscheme/" # Removing variables unset BUNDLE_DIR
{ "content_hash": "d849a9e92bbb6beb5f3e0434385edaf3", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 163, "avg_line_length": 28.0625, "alnum_prop": 0.6798440979955457, "repo_name": "Serubin/dotfiles", "id": "2f12efad5fc58ebb5620197a7b04a279b2826549", "size": "1927", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "packages/cli/nvim/nvim.sh", "mode": "33188", "license": "mit", "language": [ { "name": "Shell", "bytes": "42434" }, { "name": "Vim Snippet", "bytes": "2229" }, { "name": "Vim script", "bytes": "16320" } ], "symlink_target": "" }
import React from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import * as actions from '../../actions'; import Stream from './presenter'; function mapStateToProps(state) { const { user } = state.auth; const { tracks, activeTrack } = state.track; return { user, tracks, activeTrack } } function mapDispatchToProps(dispatch) { return { onAuth: bindActionCreators(actions.auth, dispatch), onPlay: bindActionCreators(actions.playTrack, dispatch) }; } export default connect(mapStateToProps, mapDispatchToProps)(Stream);
{ "content_hash": "aaf2c20c10a776744de479b8710ff380", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 68, "avg_line_length": 26.291666666666668, "alnum_prop": 0.6751188589540412, "repo_name": "koden-km/sc-react-redux", "id": "394b1a71bb1ec6271accc753dccd33879f2d4ffc", "size": "686", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "src/components/Stream/index.js", "mode": "33188", "license": "mit", "language": [ { "name": "JavaScript", "bytes": "11850" } ], "symlink_target": "" }
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Editor PHP 2.0.7</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <base href="../"> <link rel="icon" href="images/favicon.ico"/> <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/base.css"> <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="css/template.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" /> <script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script> <script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/js/all.min.js" integrity="sha256-0vuk8LXoyrmCjp1f0O300qo1M75ZQyhH9X3J6d+scmk=" crossorigin="anonymous"></script> <script src="js/search.js"></script> <script defer src="js/searchIndex.js"></script> </head> <body id="top"> <header class="phpdocumentor-header phpdocumentor-section"> <h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Editor PHP 2.0.7</a></h1> <input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" /> <label class="phpdocumentor-header__menu-icon" for="menu-button"> <i class="fas fa-bars"></i> </label> <section data-search-form class="phpdocumentor-search"> <label> <span class="visually-hidden">Search for</span> <svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg"> <circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/> <line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/> </svg> <input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled /> </label> </section> <nav class="phpdocumentor-topnav"> <ul class="phpdocumentor-topnav__menu"> </ul> </nav> </header> <main class="phpdocumentor"> <div class="phpdocumentor-section"> <input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" /> <label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button"> Menu </label> <aside class="phpdocumentor-column -four phpdocumentor-sidebar"> <section class="phpdocumentor-sidebar__category"> <h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2> <h4 class="phpdocumentor-sidebar__root-namespace"><a href="namespaces/datatables.html"><abbr title="\DataTables">DataTables</abbr></a></h4> <ul class="phpdocumentor-list"> <li><a href="namespaces/datatables-database.html"><abbr title="\DataTables\Database">Database</abbr></a></li> <li><a href="namespaces/datatables-editor.html"><abbr title="\DataTables\Editor">Editor</abbr></a></li> <li><a href="namespaces/datatables-htmlawed.html"><abbr title="\DataTables\HtmLawed">HtmLawed</abbr></a></li> </ul> </section> <section class="phpdocumentor-sidebar__category"> <h2 class="phpdocumentor-sidebar__category-header">Reports</h2> <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3> <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3> <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3> </section> <section class="phpdocumentor-sidebar__category"> <h2 class="phpdocumentor-sidebar__category-header">Indices</h2> <h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3> </section> </aside> <div class="phpdocumentor-column -eight phpdocumentor-content"> <ul class="phpdocumentor-breadcrumbs"> </ul> <article class="phpdocumentor-element -file"> <h2 class="phpdocumentor-content__title">DataTables.php</h2> </article> <section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden"> <section class="phpdocumentor-search-results__dialog"> <header class="phpdocumentor-search-results__header"> <h2 class="phpdocumentor-search-results__title">Search results</h2> <button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button> </header> <section class="phpdocumentor-search-results__body"> <ul class="phpdocumentor-search-results__entries"></ul> </section> </section> </section> </div> </div> <a href="files/datatables.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a> </main> <script> cssVars({}); </script> </body> </html>
{ "content_hash": "80b75c00fbcd1c09091337ebc8fd88fd", "timestamp": "", "source": "github", "line_count": 114, "max_line_length": 203, "avg_line_length": 48.324561403508774, "alnum_prop": 0.6262479578870939, "repo_name": "cloudfoundry-incubator/admin-ui", "id": "498207ba9486ed1b74cae7493f17ff0c6cde4812", "size": "5509", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "lib/admin/public/js/external/jquery/DataTables-1.12.1/xxtmp/html/php/lib/docs/files/datatables.html", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "14079" }, { "name": "HTML", "bytes": "108646" }, { "name": "JavaScript", "bytes": "697152" }, { "name": "Ruby", "bytes": "2181290" } ], "symlink_target": "" }
import Ember from 'ember'; // import SpacedogInitializer from 'dummy/initializers/spacedog'; import { module, test } from 'qunit'; let application; module('Unit | Initializer | spacedog', { beforeEach() { Ember.run(function() { application = Ember.Application.create(); application.deferReadiness(); }); } }); // Replace this with your real tests. test('it works', function(assert) { // XXX doesn't work yet // SpacedogInitializer.initialize(application); // you would normally confirm the results of the initializer here assert.ok(true); });
{ "content_hash": "fd49d56d4d1092afabd0c7671ac8c6b9", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 67, "avg_line_length": 25.17391304347826, "alnum_prop": 0.690846286701209, "repo_name": "dubo-dubon-duponey/tsygan", "id": "f16b7644ff3992ffed7883705e76797dcaac3e30", "size": "579", "binary": false, "copies": "1", "ref": "refs/heads/master", "path": "tests/unit/initializers/tsygan-test.js", "mode": "33188", "license": "mit", "language": [ { "name": "HTML", "bytes": "1631" }, { "name": "JavaScript", "bytes": "88846" } ], "symlink_target": "" }
+++ Title = "Código de Conduta" Type = "event" Description = "Código de Conduta - devopsdays São Paulo 2019" +++ ## Código de conduta O DevOpsDays é um evento sem fins lucrativos cujo principal objetivo é promover a troca de experiências entre as pessoas sobre a cultura DevOps no Brasil. Este Código de Conduta será aplicado para todos enquanto participantes desse evento para proteger o público de danos e perigos morais. Nos dedicamos a promover um evento respeitoso e livre de assédio para todos. Não toleramos quaisquer formas de assédios ou intimidações de qualquer participante. Imagens, atividades ou materiais de conteúdo sexual, homofóbico, pejorativo e/ou discriminatório de qualquer natureza não são aceitos. Por assédio entende-se sem limitação: <ul> <li>Comentários ofensivos, verbais ou eletrônicos, relacionados a características pessoais, origem racial, orientação sexual, identidade de gênero, bem como comentários ou imagens sexuais, racistas, homofóbicas ou discriminatórias de qualquer natureza em espaços públicos ou digitais;</li> <li>Intimidação deliberada;</li> <li>Bullying;</li> <li>Perseguição;</li> <li>Encalço;</li> <li>Fotografias ou gravações que gerem embaraço;</li> <li>Interrupções reiteradas de palestras, bate-papos, reuniões eletrônicas, reuniões físicas ou outros eventos;</li> <li>Contato físico inadequado ou atenção sexual indesejada.</li> </ul> Espera-se que os participantes cumpram imediatamente solicitações para descontinuar qualquer assédio ou comportamento de bullying. Sejam gentis com os outros. Não insultem ou ofendam outros participantes. Lembrem-se de que piadas de assédio, sexismo, racismo ou exclusão não são aceitas pela sociedade, muito menos para nosso evento. Qualquer participante que violar tais regras pode ser convidado a se retirar, a critério exclusivo dos organizadores do evento. Se um participante se engajar em comportamento de assédio, os organizadores do evento podem tomar medidas que considerem adequadas, desde alertas ao infrator até a vedação de sua participação em demais eventos promovidos pelos membros da organização individual ou coletivamente. Se você for assediado, perceber que alguém está sendo assediado, ou tem outras preocupações, por favor aja para interceptar ou peça ajuda aos organizadores. Estamos certos de que essa política ajudará a fazer do DevOpsDays um espaço mais acolhedor, inclusivo, e integrador para todos. Este Código de Conduta foi adaptado a partir do código de conduta utilizado pelo DevOpsDays Porto Alegre 2016, que foi adaptado pela comunidade GTC - Grupo de Testes Carioca, que foi adaptado pelo evento LinguÁgil, que foi adaptado pelo evento Agile Trends, que foi adaptado a partir dos códigos de conduta utilizados pelo Ideias em Produção, adaptados a partir do Python Brasil 9, este por sua vez adaptados dos códigos de conduta utilizados pela Plone Foundation e pela PyCon US, e estão licenciados sob a Creative Commons Attribution-Share Alike 3.0 Unported.
{ "content_hash": "f1fd92273f4ab327f76bdaa9a8665a30", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 562, "avg_line_length": 83.41666666666667, "alnum_prop": 0.8085248085248086, "repo_name": "gomex/devopsdays-web", "id": "e41e90be91e578e10bb13eee166e28d0ead2cbaa", "size": "3088", "binary": false, "copies": "5", "ref": "refs/heads/master", "path": "content/events/2019-sao-paulo/conduta.md", "mode": "33188", "license": "apache-2.0", "language": [ { "name": "CSS", "bytes": "1568" }, { "name": "HTML", "bytes": "1937025" }, { "name": "JavaScript", "bytes": "14313" }, { "name": "PowerShell", "bytes": "291" }, { "name": "Ruby", "bytes": "650" }, { "name": "Shell", "bytes": "12282" } ], "symlink_target": "" }