code stringlengths 4 991k | repo_name stringlengths 6 116 | path stringlengths 4 249 | language stringclasses 30 values | license stringclasses 15 values | size int64 4 991k | input_ids listlengths 502 502 | token_type_ids listlengths 502 502 | attention_mask listlengths 502 502 | labels listlengths 502 502 |
|---|---|---|---|---|---|---|---|---|---|
// Copyright 2014 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.
#include "components/bookmarks/browser/bookmark_model.h"
#include <algorithm>
#include <functional>
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/i18n/string_compare.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
#include "base/profiler/scoped_tracker.h"
#include "base/strings/string_util.h"
#include "components/bookmarks/browser/bookmark_expanded_state_tracker.h"
#include "components/bookmarks/browser/bookmark_index.h"
#include "components/bookmarks/browser/bookmark_match.h"
#include "components/bookmarks/browser/bookmark_model_observer.h"
#include "components/bookmarks/browser/bookmark_node_data.h"
#include "components/bookmarks/browser/bookmark_storage.h"
#include "components/bookmarks/browser/bookmark_undo_delegate.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/favicon_base/favicon_types.h"
#include "grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/favicon_size.h"
using base::Time;
namespace bookmarks {
namespace {
// Helper to get a mutable bookmark node.
BookmarkNode* AsMutable(const BookmarkNode* node) {
return const_cast<BookmarkNode*>(node);
}
// Helper to get a mutable permanent bookmark node.
BookmarkPermanentNode* AsMutable(const BookmarkPermanentNode* node) {
return const_cast<BookmarkPermanentNode*>(node);
}
// Comparator used when sorting permanent nodes. Nodes that are initially
// visible are sorted before nodes that are initially hidden.
class VisibilityComparator
: public std::binary_function<const BookmarkPermanentNode*,
const BookmarkPermanentNode*,
bool> {
public:
explicit VisibilityComparator(BookmarkClient* client) : client_(client) {}
// Returns true if |n1| preceeds |n2|.
bool operator()(const BookmarkPermanentNode* n1,
const BookmarkPermanentNode* n2) {
bool n1_visible = client_->IsPermanentNodeVisible(n1);
bool n2_visible = client_->IsPermanentNodeVisible(n2);
return n1_visible != n2_visible && n1_visible;
}
private:
BookmarkClient* client_;
};
// Comparator used when sorting bookmarks. Folders are sorted first, then
// bookmarks.
class SortComparator : public std::binary_function<const BookmarkNode*,
const BookmarkNode*,
bool> {
public:
explicit SortComparator(icu::Collator* collator) : collator_(collator) {}
// Returns true if |n1| preceeds |n2|.
bool operator()(const BookmarkNode* n1, const BookmarkNode* n2) {
if (n1->type() == n2->type()) {
// Types are the same, compare the names.
if (!collator_)
return n1->GetTitle() < n2->GetTitle();
return base::i18n::CompareString16WithCollator(
*collator_, n1->GetTitle(), n2->GetTitle()) == UCOL_LESS;
}
// Types differ, sort such that folders come first.
return n1->is_folder();
}
private:
icu::Collator* collator_;
};
// Delegate that does nothing.
class EmptyUndoDelegate : public BookmarkUndoDelegate {
public:
EmptyUndoDelegate() {}
~EmptyUndoDelegate() override {}
private:
// BookmarkUndoDelegate:
void SetUndoProvider(BookmarkUndoProvider* provider) override {}
void OnBookmarkNodeRemoved(BookmarkModel* model,
const BookmarkNode* parent,
int index,
scoped_ptr<BookmarkNode> node) override {}
DISALLOW_COPY_AND_ASSIGN(EmptyUndoDelegate);
};
} // namespace
// BookmarkModel --------------------------------------------------------------
BookmarkModel::BookmarkModel(BookmarkClient* client)
: client_(client),
loaded_(false),
root_(GURL()),
bookmark_bar_node_(NULL),
other_node_(NULL),
mobile_node_(NULL),
next_node_id_(1),
observers_(
base::ObserverList<BookmarkModelObserver>::NOTIFY_EXISTING_ONLY),
loaded_signal_(true, false),
extensive_changes_(0),
undo_delegate_(nullptr),
empty_undo_delegate_(new EmptyUndoDelegate) {
DCHECK(client_);
}
BookmarkModel::~BookmarkModel() {
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkModelBeingDeleted(this));
if (store_.get()) {
// The store maintains a reference back to us. We need to tell it we're gone
// so that it doesn't try and invoke a method back on us again.
store_->BookmarkModelDeleted();
}
}
void BookmarkModel::Shutdown() {
if (loaded_)
return;
// See comment in HistoryService::ShutdownOnUIThread where this is invoked for
// details. It is also called when the BookmarkModel is deleted.
loaded_signal_.Signal();
}
void BookmarkModel::Load(
PrefService* pref_service,
const std::string& accept_languages,
const base::FilePath& profile_path,
const scoped_refptr<base::SequencedTaskRunner>& io_task_runner,
const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner) {
if (store_.get()) {
// If the store is non-null, it means Load was already invoked. Load should
// only be invoked once.
NOTREACHED();
return;
}
expanded_state_tracker_.reset(
new BookmarkExpandedStateTracker(this, pref_service));
// Load the bookmarks. BookmarkStorage notifies us when done.
store_.reset(new BookmarkStorage(this, profile_path, io_task_runner.get()));
store_->LoadBookmarks(CreateLoadDetails(accept_languages), ui_task_runner);
}
const BookmarkNode* BookmarkModel::GetParentForNewNodes() {
std::vector<const BookmarkNode*> nodes =
GetMostRecentlyModifiedUserFolders(this, 1);
DCHECK(!nodes.empty()); // This list is always padded with default folders.
return nodes[0];
}
void BookmarkModel::AddObserver(BookmarkModelObserver* observer) {
observers_.AddObserver(observer);
}
void BookmarkModel::RemoveObserver(BookmarkModelObserver* observer) {
observers_.RemoveObserver(observer);
}
void BookmarkModel::BeginExtensiveChanges() {
if (++extensive_changes_ == 1) {
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
ExtensiveBookmarkChangesBeginning(this));
}
}
void BookmarkModel::EndExtensiveChanges() {
--extensive_changes_;
DCHECK_GE(extensive_changes_, 0);
if (extensive_changes_ == 0) {
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
ExtensiveBookmarkChangesEnded(this));
}
}
void BookmarkModel::BeginGroupedChanges() {
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
GroupedBookmarkChangesBeginning(this));
}
void BookmarkModel::EndGroupedChanges() {
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
GroupedBookmarkChangesEnded(this));
}
void BookmarkModel::Remove(const BookmarkNode* node) {
DCHECK(loaded_);
DCHECK(node);
DCHECK(!is_root_node(node));
RemoveAndDeleteNode(AsMutable(node));
}
void BookmarkModel::RemoveAllUserBookmarks() {
std::set<GURL> removed_urls;
struct RemoveNodeData {
RemoveNodeData(const BookmarkNode* parent, int index, BookmarkNode* node)
: parent(parent), index(index), node(node) {}
const BookmarkNode* parent;
int index;
BookmarkNode* node;
};
std::vector<RemoveNodeData> removed_node_data_list;
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
OnWillRemoveAllUserBookmarks(this));
BeginExtensiveChanges();
// Skip deleting permanent nodes. Permanent bookmark nodes are the root and
// its immediate children. For removing all non permanent nodes just remove
// all children of non-root permanent nodes.
{
base::AutoLock url_lock(url_lock_);
for (int i = 0; i < root_.child_count(); ++i) {
const BookmarkNode* permanent_node = root_.GetChild(i);
if (!client_->CanBeEditedByUser(permanent_node))
continue;
for (int j = permanent_node->child_count() - 1; j >= 0; --j) {
BookmarkNode* child_node = AsMutable(permanent_node->GetChild(j));
RemoveNodeAndGetRemovedUrls(child_node, &removed_urls);
removed_node_data_list.push_back(
RemoveNodeData(permanent_node, j, child_node));
}
}
}
EndExtensiveChanges();
if (store_.get())
store_->ScheduleSave();
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkAllUserNodesRemoved(this, removed_urls));
BeginGroupedChanges();
for (const auto& removed_node_data : removed_node_data_list) {
undo_delegate()->OnBookmarkNodeRemoved(
this,
removed_node_data.parent,
removed_node_data.index,
scoped_ptr<BookmarkNode>(removed_node_data.node));
}
EndGroupedChanges();
}
void BookmarkModel::Move(const BookmarkNode* node,
const BookmarkNode* new_parent,
int index) {
if (!loaded_ || !node || !IsValidIndex(new_parent, index, true) ||
is_root_node(new_parent) || is_permanent_node(node)) {
NOTREACHED();
return;
}
if (new_parent->HasAncestor(node)) {
// Can't make an ancestor of the node be a child of the node.
NOTREACHED();
return;
}
const BookmarkNode* old_parent = node->parent();
int old_index = old_parent->GetIndexOf(node);
if (old_parent == new_parent &&
(index == old_index || index == old_index + 1)) {
// Node is already in this position, nothing to do.
return;
}
SetDateFolderModified(new_parent, Time::Now());
if (old_parent == new_parent && index > old_index)
index--;
BookmarkNode* mutable_new_parent = AsMutable(new_parent);
mutable_new_parent->Add(AsMutable(node), index);
if (store_.get())
store_->ScheduleSave();
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkNodeMoved(this, old_parent, old_index,
new_parent, index));
}
void BookmarkModel::Copy(const BookmarkNode* node,
const BookmarkNode* new_parent,
int index) {
if (!loaded_ || !node || !IsValidIndex(new_parent, index, true) ||
is_root_node(new_parent) || is_permanent_node(node)) {
NOTREACHED();
return;
}
if (new_parent->HasAncestor(node)) {
// Can't make an ancestor of the node be a child of the node.
NOTREACHED();
return;
}
SetDateFolderModified(new_parent, Time::Now());
BookmarkNodeData drag_data(node);
// CloneBookmarkNode will use BookmarkModel methods to do the job, so we
// don't need to send notifications here.
CloneBookmarkNode(this, drag_data.elements, new_parent, index, true);
if (store_.get())
store_->ScheduleSave();
}
const gfx::Image& BookmarkModel::GetFavicon(const BookmarkNode* node) {
DCHECK(node);
if (node->favicon_state() == BookmarkNode::INVALID_FAVICON) {
BookmarkNode* mutable_node = AsMutable(node);
LoadFavicon(mutable_node,
client_->PreferTouchIcon() ? favicon_base::TOUCH_ICON
: favicon_base::FAVICON);
}
return node->favicon();
}
favicon_base::IconType BookmarkModel::GetFaviconType(const BookmarkNode* node) {
DCHECK(node);
return node->favicon_type();
}
void BookmarkModel::SetTitle(const BookmarkNode* node,
const base::string16& title) {
DCHECK(node);
if (node->GetTitle() == title)
return;
if (is_permanent_node(node) && !client_->CanSetPermanentNodeTitle(node)) {
NOTREACHED();
return;
}
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
OnWillChangeBookmarkNode(this, node));
// The title index doesn't support changing the title, instead we remove then
// add it back.
index_->Remove(node);
AsMutable(node)->SetTitle(title);
index_->Add(node);
if (store_.get())
store_->ScheduleSave();
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkNodeChanged(this, node));
}
void BookmarkModel::SetURL(const BookmarkNode* node, const GURL& url) {
DCHECK(node && !node->is_folder());
if (node->url() == url)
return;
BookmarkNode* mutable_node = AsMutable(node);
mutable_node->InvalidateFavicon();
CancelPendingFaviconLoadRequests(mutable_node);
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
OnWillChangeBookmarkNode(this, node));
{
base::AutoLock url_lock(url_lock_);
RemoveNodeFromInternalMaps(mutable_node);
mutable_node->set_url(url);
AddNodeToInternalMaps(mutable_node);
}
if (store_.get())
store_->ScheduleSave();
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkNodeChanged(this, node));
}
void BookmarkModel::SetNodeMetaInfo(const BookmarkNode* node,
const std::string& key,
const std::string& value) {
std::string old_value;
if (node->GetMetaInfo(key, &old_value) && old_value == value)
return;
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
OnWillChangeBookmarkMetaInfo(this, node));
if (AsMutable(node)->SetMetaInfo(key, value) && store_.get())
store_->ScheduleSave();
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkMetaInfoChanged(this, node));
}
void BookmarkModel::SetNodeMetaInfoMap(
const BookmarkNode* node,
const BookmarkNode::MetaInfoMap& meta_info_map) {
const BookmarkNode::MetaInfoMap* old_meta_info_map = node->GetMetaInfoMap();
if ((!old_meta_info_map && meta_info_map.empty()) ||
(old_meta_info_map && meta_info_map == *old_meta_info_map))
return;
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
OnWillChangeBookmarkMetaInfo(this, node));
AsMutable(node)->SetMetaInfoMap(meta_info_map);
if (store_.get())
store_->ScheduleSave();
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkMetaInfoChanged(this, node));
}
void BookmarkModel::DeleteNodeMetaInfo(const BookmarkNode* node,
const std::string& key) {
const BookmarkNode::MetaInfoMap* meta_info_map = node->GetMetaInfoMap();
if (!meta_info_map || meta_info_map->find(key) == meta_info_map->end())
return;
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
OnWillChangeBookmarkMetaInfo(this, node));
if (AsMutable(node)->DeleteMetaInfo(key) && store_.get())
store_->ScheduleSave();
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkMetaInfoChanged(this, node));
}
void BookmarkModel::AddNonClonedKey(const std::string& key) {
non_cloned_keys_.insert(key);
}
void BookmarkModel::SetNodeSyncTransactionVersion(
const BookmarkNode* node,
int64 sync_transaction_version) {
DCHECK(client_->CanSyncNode(node));
if (sync_transaction_version == node->sync_transaction_version())
return;
AsMutable(node)->set_sync_transaction_version(sync_transaction_version);
if (store_.get())
store_->ScheduleSave();
}
void BookmarkModel::OnFaviconsChanged(const std::set<GURL>& page_urls,
const GURL& icon_url) {
std::set<const BookmarkNode*> to_update;
for (const GURL& page_url : page_urls) {
std::vector<const BookmarkNode*> nodes;
GetNodesByURL(page_url, &nodes);
to_update.insert(nodes.begin(), nodes.end());
}
if (!icon_url.is_empty()) {
// Log Histogram to determine how often |icon_url| is non empty in
// practice.
// TODO(pkotwicz): Do something more efficient if |icon_url| is non-empty
// many times a day for each user.
UMA_HISTOGRAM_BOOLEAN("Bookmarks.OnFaviconsChangedIconURL", true);
base::AutoLock url_lock(url_lock_);
for (const BookmarkNode* node : nodes_ordered_by_url_set_) {
if (icon_url == node->icon_url())
to_update.insert(node);
}
}
for (const BookmarkNode* node : to_update) {
// Rerequest the favicon.
BookmarkNode* mutable_node = AsMutable(node);
mutable_node->InvalidateFavicon();
CancelPendingFaviconLoadRequests(mutable_node);
FOR_EACH_OBSERVER(BookmarkModelObserver,
observers_,
BookmarkNodeFaviconChanged(this, node));
}
}
void BookmarkModel::SetDateAdded(const BookmarkNode* node, Time date_added) {
DCHECK(node && !is_permanent_node(node));
if (node->date_added() == date_added)
return;
AsMutable(node)->set_date_added(date_added);
// Syncing might result in dates newer than the folder's last modified date.
if (date_added > node->parent()->date_folder_modified()) {
// Will trigger store_->ScheduleSave().
SetDateFolderModified(node->parent(), date_added);
} else if (store_.get()) {
store_->ScheduleSave();
}
}
void BookmarkModel::GetNodesByURL(const GURL& url,
std::vector<const BookmarkNode*>* nodes) {
base::AutoLock url_lock(url_lock_);
BookmarkNode tmp_node(url);
NodesOrderedByURLSet::iterator i = nodes_ordered_by_url_set_.find(&tmp_node);
while (i != nodes_ordered_by_url_set_.end() && (*i)->url() == url) {
nodes->push_back(*i);
++i;
}
}
const BookmarkNode* BookmarkModel::GetMostRecentlyAddedUserNodeForURL(
const GURL& url) {
std::vector<const BookmarkNode*> nodes;
GetNodesByURL(url, &nodes);
std::sort(nodes.begin(), nodes.end(), &MoreRecentlyAdded);
// Look for the first node that the user can edit.
for (size_t i = 0; i < nodes.size(); ++i) {
if (client_->CanBeEditedByUser(nodes[i]))
return nodes[i];
}
return NULL;
}
bool BookmarkModel::HasBookmarks() {
base::AutoLock url_lock(url_lock_);
return !nodes_ordered_by_url_set_.empty();
}
bool BookmarkModel::IsBookmarked(const GURL& url) {
base::AutoLock url_lock(url_lock_);
return IsBookmarkedNoLock(url);
}
void BookmarkModel::GetBookmarks(
std::vector<BookmarkModel::URLAndTitle>* bookmarks) {
base::AutoLock url_lock(url_lock_);
const GURL* last_url = NULL;
for (NodesOrderedByURLSet::iterator i = nodes_ordered_by_url_set_.begin();
i != nodes_ordered_by_url_set_.end(); ++i) {
const GURL* url = &((*i)->url());
// Only add unique URLs.
if (!last_url || *url != *last_url) {
BookmarkModel::URLAndTitle bookmark;
bookmark.url = *url;
bookmark.title = (*i)->GetTitle();
bookmarks->push_back(bookmark);
}
last_url = url;
}
}
void BookmarkModel::BlockTillLoaded() {
loaded_signal_.Wait();
}
const BookmarkNode* BookmarkModel::AddFolder(const BookmarkNode* parent,
int index,
const base::string16& title) {
return AddFolderWithMetaInfo(parent, index, title, NULL);
}
const BookmarkNode* BookmarkModel::AddFolderWithMetaInfo(
const BookmarkNode* parent,
int index,
const base::string16& title,
const BookmarkNode::MetaInfoMap* meta_info) {
if (!loaded_ || is_root_node(parent) || !IsValidIndex(parent, index, true)) {
// Can't add to the root.
NOTREACHED();
return NULL;
}
BookmarkNode* new_node = new BookmarkNode(generate_next_node_id(), GURL());
new_node->set_date_folder_modified(Time::Now());
// Folders shouldn't have line breaks in their titles.
new_node->SetTitle(title);
new_node->set_type(BookmarkNode::FOLDER);
if (meta_info)
new_node->SetMetaInfoMap(*meta_info);
return AddNode(AsMutable(parent), index, new_node);
}
const BookmarkNode* BookmarkModel::AddURL(const BookmarkNode* parent,
int index,
const base::string16& title,
const GURL& url) {
return AddURLWithCreationTimeAndMetaInfo(
parent,
index,
title,
url,
Time::Now(),
NULL);
}
const BookmarkNode* BookmarkModel::AddURLWithCreationTimeAndMetaInfo(
const BookmarkNode* parent,
int index,
const base::string16& title,
const GURL& url,
const Time& creation_time,
const BookmarkNode::MetaInfoMap* meta_info) {
if (!loaded_ || !url.is_valid() || is_root_node(parent) ||
!IsValidIndex(parent, index, true)) {
NOTREACHED();
return NULL;
}
// Syncing may result in dates newer than the last modified date.
if (creation_time > parent->date_folder_modified())
SetDateFolderModified(parent, creation_time);
BookmarkNode* new_node = new BookmarkNode(generate_next_node_id(), url);
new_node->SetTitle(title);
new_node->set_date_added(creation_time);
new_node->set_type(BookmarkNode::URL);
if (meta_info)
new_node->SetMetaInfoMap(*meta_info);
return AddNode(AsMutable(parent), index, new_node);
}
void BookmarkModel::SortChildren(const BookmarkNode* parent) {
DCHECK(client_->CanBeEditedByUser(parent));
if (!parent || !parent->is_folder() || is_root_node(parent) ||
parent->child_count() <= 1) {
return;
}
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
OnWillReorderBookmarkNode(this, parent));
UErrorCode error = U_ZERO_ERROR;
scoped_ptr<icu::Collator> collator(icu::Collator::createInstance(error));
if (U_FAILURE(error))
collator.reset(NULL);
BookmarkNode* mutable_parent = AsMutable(parent);
std::sort(mutable_parent->children().begin(),
mutable_parent->children().end(),
SortComparator(collator.get()));
if (store_.get())
store_->ScheduleSave();
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkNodeChildrenReordered(this, parent));
}
void BookmarkModel::ReorderChildren(
const BookmarkNode* parent,
const std::vector<const BookmarkNode*>& ordered_nodes) {
DCHECK(client_->CanBeEditedByUser(parent));
// Ensure that all children in |parent| are in |ordered_nodes|.
DCHECK_EQ(static_cast<size_t>(parent->child_count()), ordered_nodes.size());
for (size_t i = 0; i < ordered_nodes.size(); ++i)
DCHECK_EQ(parent, ordered_nodes[i]->parent());
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
OnWillReorderBookmarkNode(this, parent));
AsMutable(parent)->SetChildren(
*(reinterpret_cast<const std::vector<BookmarkNode*>*>(&ordered_nodes)));
if (store_.get())
store_->ScheduleSave();
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkNodeChildrenReordered(this, parent));
}
void BookmarkModel::SetDateFolderModified(const BookmarkNode* parent,
const Time time) {
DCHECK(parent);
AsMutable(parent)->set_date_folder_modified(time);
if (store_.get())
store_->ScheduleSave();
}
void BookmarkModel::ResetDateFolderModified(const BookmarkNode* node) {
SetDateFolderModified(node, Time());
}
void BookmarkModel::GetBookmarksMatching(const base::string16& text,
size_t max_count,
std::vector<BookmarkMatch>* matches) {
GetBookmarksMatching(text, max_count,
query_parser::MatchingAlgorithm::DEFAULT, matches);
}
void BookmarkModel::GetBookmarksMatching(
const base::string16& text,
size_t max_count,
query_parser::MatchingAlgorithm matching_algorithm,
std::vector<BookmarkMatch>* matches) {
if (!loaded_)
return;
index_->GetBookmarksMatching(text, max_count, matching_algorithm, matches);
}
void BookmarkModel::ClearStore() {
store_.reset();
}
void BookmarkModel::SetPermanentNodeVisible(BookmarkNode::Type type,
bool value) {
BookmarkPermanentNode* node = AsMutable(PermanentNode(type));
node->set_visible(value || client_->IsPermanentNodeVisible(node));
}
const BookmarkPermanentNode* BookmarkModel::PermanentNode(
BookmarkNode::Type type) {
DCHECK(loaded_);
switch (type) {
case BookmarkNode::BOOKMARK_BAR:
return bookmark_bar_node_;
case BookmarkNode::OTHER_NODE:
return other_node_;
case BookmarkNode::MOBILE:
return mobile_node_;
default:
NOTREACHED();
return NULL;
}
}
void BookmarkModel::RestoreRemovedNode(const BookmarkNode* parent,
int index,
scoped_ptr<BookmarkNode> scoped_node) {
BookmarkNode* node = scoped_node.release();
AddNode(AsMutable(parent), index, node);
// We might be restoring a folder node that have already contained a set of
// child nodes. We need to notify all of them.
NotifyNodeAddedForAllDescendents(node);
}
void BookmarkModel::NotifyNodeAddedForAllDescendents(const BookmarkNode* node) {
for (int i = 0; i < node->child_count(); ++i) {
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkNodeAdded(this, node, i));
NotifyNodeAddedForAllDescendents(node->GetChild(i));
}
}
bool BookmarkModel::IsBookmarkedNoLock(const GURL& url) {
BookmarkNode tmp_node(url);
return (nodes_ordered_by_url_set_.find(&tmp_node) !=
nodes_ordered_by_url_set_.end());
}
void BookmarkModel::RemoveNode(BookmarkNode* node,
std::set<GURL>* removed_urls) {
if (!loaded_ || !node || is_permanent_node(node)) {
NOTREACHED();
return;
}
url_lock_.AssertAcquired();
if (node->is_url()) {
RemoveNodeFromInternalMaps(node);
removed_urls->insert(node->url());
}
CancelPendingFaviconLoadRequests(node);
// Recurse through children.
for (int i = node->child_count() - 1; i >= 0; --i)
RemoveNode(node->GetChild(i), removed_urls);
}
void BookmarkModel::DoneLoading(scoped_ptr<BookmarkLoadDetails> details) {
DCHECK(details);
if (loaded_) {
// We should only ever be loaded once.
NOTREACHED();
return;
}
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/467179
// is fixed.
tracked_objects::ScopedTracker tracking_profile1(
FROM_HERE_WITH_EXPLICIT_FUNCTION("467179 BookmarkModel::DoneLoading1"));
next_node_id_ = details->max_id();
if (details->computed_checksum() != details->stored_checksum() ||
details->ids_reassigned()) {
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/467179
// is fixed.
tracked_objects::ScopedTracker tracking_profile2(
FROM_HERE_WITH_EXPLICIT_FUNCTION("467179 BookmarkModel::DoneLoading2"));
// If bookmarks file changed externally, the IDs may have changed
// externally. In that case, the decoder may have reassigned IDs to make
// them unique. So when the file has changed externally, we should save the
// bookmarks file to persist new IDs.
if (store_.get())
store_->ScheduleSave();
}
bookmark_bar_node_ = details->release_bb_node();
other_node_ = details->release_other_folder_node();
mobile_node_ = details->release_mobile_folder_node();
index_.reset(details->release_index());
// Get any extra nodes and take ownership of them at the |root_|.
std::vector<BookmarkPermanentNode*> extra_nodes;
details->release_extra_nodes(&extra_nodes);
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/467179
// is fixed.
tracked_objects::ScopedTracker tracking_profile3(
FROM_HERE_WITH_EXPLICIT_FUNCTION("467179 BookmarkModel::DoneLoading3"));
// WARNING: order is important here, various places assume the order is
// constant (but can vary between embedders with the initial visibility
// of permanent nodes).
std::vector<BookmarkPermanentNode*> root_children;
root_children.push_back(bookmark_bar_node_);
root_children.push_back(other_node_);
root_children.push_back(mobile_node_);
for (size_t i = 0; i < extra_nodes.size(); ++i)
root_children.push_back(extra_nodes[i]);
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/467179
// is fixed.
tracked_objects::ScopedTracker tracking_profile4(
FROM_HERE_WITH_EXPLICIT_FUNCTION("467179 BookmarkModel::DoneLoading4"));
std::stable_sort(root_children.begin(),
root_children.end(),
VisibilityComparator(client_));
for (size_t i = 0; i < root_children.size(); ++i)
root_.Add(root_children[i], static_cast<int>(i));
root_.SetMetaInfoMap(details->model_meta_info_map());
root_.set_sync_transaction_version(details->model_sync_transaction_version());
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/467179
// is fixed.
tracked_objects::ScopedTracker tracking_profile5(
FROM_HERE_WITH_EXPLICIT_FUNCTION("467179 BookmarkModel::DoneLoading5"));
{
base::AutoLock url_lock(url_lock_);
// Update nodes_ordered_by_url_set_ from the nodes.
PopulateNodesByURL(&root_);
}
loaded_ = true;
loaded_signal_.Signal();
// TODO(robliao): Remove ScopedTracker below once https://crbug.com/467179
// is fixed.
tracked_objects::ScopedTracker tracking_profile6(
FROM_HERE_WITH_EXPLICIT_FUNCTION("467179 BookmarkModel::DoneLoading6"));
// Notify our direct observers.
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkModelLoaded(this, details->ids_reassigned()));
}
void BookmarkModel::RemoveAndDeleteNode(BookmarkNode* delete_me) {
scoped_ptr<BookmarkNode> node(delete_me);
const BookmarkNode* parent = node->parent();
DCHECK(parent);
int index = parent->GetIndexOf(node.get());
DCHECK_NE(-1, index);
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
OnWillRemoveBookmarks(this, parent, index, node.get()));
std::set<GURL> removed_urls;
{
base::AutoLock url_lock(url_lock_);
RemoveNodeAndGetRemovedUrls(node.get(), &removed_urls);
}
if (store_.get())
store_->ScheduleSave();
FOR_EACH_OBSERVER(
BookmarkModelObserver,
observers_,
BookmarkNodeRemoved(this, parent, index, node.get(), removed_urls));
undo_delegate()->OnBookmarkNodeRemoved(this, parent, index, node.Pass());
}
void BookmarkModel::RemoveNodeFromInternalMaps(BookmarkNode* node) {
index_->Remove(node);
// NOTE: this is called in such a way that url_lock_ is already held. As
// such, this doesn't explicitly grab the lock.
url_lock_.AssertAcquired();
NodesOrderedByURLSet::iterator i = nodes_ordered_by_url_set_.find(node);
DCHECK(i != nodes_ordered_by_url_set_.end());
// i points to the first node with the URL, advance until we find the
// node we're removing.
while (*i != node)
++i;
nodes_ordered_by_url_set_.erase(i);
}
void BookmarkModel::RemoveNodeAndGetRemovedUrls(BookmarkNode* node,
std::set<GURL>* removed_urls) {
// NOTE: this method should be always called with |url_lock_| held.
// This method does not explicitly acquires a lock.
url_lock_.AssertAcquired();
DCHECK(removed_urls);
BookmarkNode* parent = node->parent();
DCHECK(parent);
parent->Remove(node);
RemoveNode(node, removed_urls);
// RemoveNode adds an entry to removed_urls for each node of type URL. As we
// allow duplicates we need to remove any entries that are still bookmarked.
for (std::set<GURL>::iterator i = removed_urls->begin();
i != removed_urls->end();) {
if (IsBookmarkedNoLock(*i)) {
// When we erase the iterator pointing at the erasee is
// invalidated, so using i++ here within the "erase" call is
// important as it advances the iterator before passing the
// old value through to erase.
removed_urls->erase(i++);
} else {
++i;
}
}
}
BookmarkNode* BookmarkModel::AddNode(BookmarkNode* parent,
int index,
BookmarkNode* node) {
parent->Add(node, index);
if (store_.get())
store_->ScheduleSave();
{
base::AutoLock url_lock(url_lock_);
AddNodeToInternalMaps(node);
}
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkNodeAdded(this, parent, index));
return node;
}
void BookmarkModel::AddNodeToInternalMaps(BookmarkNode* node) {
url_lock_.AssertAcquired();
if (node->is_url()) {
index_->Add(node);
nodes_ordered_by_url_set_.insert(node);
}
for (int i = 0; i < node->child_count(); ++i)
AddNodeToInternalMaps(node->GetChild(i));
}
bool BookmarkModel::IsValidIndex(const BookmarkNode* parent,
int index,
bool allow_end) {
return (parent && parent->is_folder() &&
(index >= 0 && (index < parent->child_count() ||
(allow_end && index == parent->child_count()))));
}
BookmarkPermanentNode* BookmarkModel::CreatePermanentNode(
BookmarkNode::Type type) {
DCHECK(type == BookmarkNode::BOOKMARK_BAR ||
type == BookmarkNode::OTHER_NODE ||
type == BookmarkNode::MOBILE);
BookmarkPermanentNode* node =
new BookmarkPermanentNode(generate_next_node_id());
node->set_type(type);
node->set_visible(client_->IsPermanentNodeVisible(node));
int title_id;
switch (type) {
case BookmarkNode::BOOKMARK_BAR:
title_id = IDS_BOOKMARK_BAR_FOLDER_NAME;
break;
case BookmarkNode::OTHER_NODE:
title_id = IDS_BOOKMARK_BAR_OTHER_FOLDER_NAME;
break;
case BookmarkNode::MOBILE:
title_id = IDS_BOOKMARK_BAR_MOBILE_FOLDER_NAME;
break;
default:
NOTREACHED();
title_id = IDS_BOOKMARK_BAR_FOLDER_NAME;
break;
}
node->SetTitle(l10n_util::GetStringUTF16(title_id));
return node;
}
void BookmarkModel::OnFaviconDataAvailable(
BookmarkNode* node,
favicon_base::IconType icon_type,
const favicon_base::FaviconImageResult& image_result) {
DCHECK(node);
node->set_favicon_load_task_id(base::CancelableTaskTracker::kBadTaskId);
node->set_favicon_state(BookmarkNode::LOADED_FAVICON);
if (!image_result.image.IsEmpty()) {
node->set_favicon_type(icon_type);
node->set_favicon(image_result.image);
node->set_icon_url(image_result.icon_url);
FaviconLoaded(node);
} else if (icon_type == favicon_base::TOUCH_ICON) {
// Couldn't load the touch icon, fallback to the regular favicon.
DCHECK(client_->PreferTouchIcon());
LoadFavicon(node, favicon_base::FAVICON);
}
}
void BookmarkModel::LoadFavicon(BookmarkNode* node,
favicon_base::IconType icon_type) {
if (node->is_folder())
return;
DCHECK(node->url().is_valid());
node->set_favicon_state(BookmarkNode::LOADING_FAVICON);
base::CancelableTaskTracker::TaskId taskId =
client_->GetFaviconImageForPageURL(
node->url(),
icon_type,
base::Bind(
&BookmarkModel::OnFaviconDataAvailable,
base::Unretained(this),
node,
icon_type),
&cancelable_task_tracker_);
if (taskId != base::CancelableTaskTracker::kBadTaskId)
node->set_favicon_load_task_id(taskId);
}
void BookmarkModel::FaviconLoaded(const BookmarkNode* node) {
FOR_EACH_OBSERVER(BookmarkModelObserver, observers_,
BookmarkNodeFaviconChanged(this, node));
}
void BookmarkModel::CancelPendingFaviconLoadRequests(BookmarkNode* node) {
if (node->favicon_load_task_id() != base::CancelableTaskTracker::kBadTaskId) {
cancelable_task_tracker_.TryCancel(node->favicon_load_task_id());
node->set_favicon_load_task_id(base::CancelableTaskTracker::kBadTaskId);
}
}
void BookmarkModel::PopulateNodesByURL(BookmarkNode* node) {
// NOTE: this is called with url_lock_ already held. As such, this doesn't
// explicitly grab the lock.
if (node->is_url())
nodes_ordered_by_url_set_.insert(node);
for (int i = 0; i < node->child_count(); ++i)
PopulateNodesByURL(node->GetChild(i));
}
int64 BookmarkModel::generate_next_node_id() {
return next_node_id_++;
}
scoped_ptr<BookmarkLoadDetails> BookmarkModel::CreateLoadDetails(
const std::string& accept_languages) {
BookmarkPermanentNode* bb_node =
CreatePermanentNode(BookmarkNode::BOOKMARK_BAR);
BookmarkPermanentNode* other_node =
CreatePermanentNode(BookmarkNode::OTHER_NODE);
BookmarkPermanentNode* mobile_node =
CreatePermanentNode(BookmarkNode::MOBILE);
return scoped_ptr<BookmarkLoadDetails>(new BookmarkLoadDetails(
bb_node,
other_node,
mobile_node,
client_->GetLoadExtraNodesCallback(),
new BookmarkIndex(client_, accept_languages),
next_node_id_));
}
void BookmarkModel::SetUndoDelegate(BookmarkUndoDelegate* undo_delegate) {
undo_delegate_ = undo_delegate;
if (undo_delegate_)
undo_delegate_->SetUndoProvider(this);
}
BookmarkUndoDelegate* BookmarkModel::undo_delegate() const {
return undo_delegate_ ? undo_delegate_ : empty_undo_delegate_.get();
}
} // namespace bookmarks
| Workday/OpenFrame | components/bookmarks/browser/bookmark_model.cc | C++ | bsd-3-clause | 36,980 | [
30522,
1013,
1013,
9385,
2297,
1996,
10381,
21716,
5007,
6048,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
2224,
1997,
2023,
3120,
3642,
2003,
9950,
2011,
1037,
18667,
2094,
1011,
2806,
6105,
2008,
2064,
2022,
1013,
1013,
2179,
1999,
1996,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <mach/board.h>
#include <mach/io.h>
#include <mach/gpio.h>
#include <mach/iomux.h>
#include "rk30_hdmi.h"
#include "rk30_hdmi_hw.h"
struct hdmi *hdmi = NULL;
extern irqreturn_t hdmi_irq(int irq, void *priv);
extern void hdmi_work(struct work_struct *work);
extern struct rk_lcdc_device_driver * rk_get_lcdc_drv(char *name);
extern struct rk_display_device* hdmi_register_display_sysfs(struct hdmi *hdmi, struct device *parent);
extern void hdmi_unregister_display_sysfs(struct hdmi *hdmi);
int rk30_hdmi_register_hdcp_callbacks(void (*hdcp_cb)(void),
void (*hdcp_irq_cb)(int status),
int (*hdcp_power_on_cb)(void),
void (*hdcp_power_off_cb)(void))
{
if(hdmi == NULL)
return HDMI_ERROR_FALSE;
hdmi->hdcp_cb = hdcp_cb;
hdmi->hdcp_irq_cb = hdcp_irq_cb;
hdmi->hdcp_power_on_cb = hdcp_power_on_cb;
hdmi->hdcp_power_off_cb = hdcp_power_off_cb;
return HDMI_ERROR_SUCESS;
}
#ifdef CONFIG_HAS_EARLYSUSPEND
static void hdmi_early_suspend(struct early_suspend *h)
{
hdmi_dbg(hdmi->dev, "hdmi enter early suspend pwr %d state %d\n", hdmi->pwr_mode, hdmi->state);
// When HDMI 1.1V and 2.5V power off, DDC channel will be pull down, current is produced
// from VCC_IO which is pull up outside soc. We need to switch DDC IO to GPIO.
rk30_mux_api_set(GPIO0A2_HDMII2CSDA_NAME, GPIO0A_GPIO0A2);
rk30_mux_api_set(GPIO0A1_HDMII2CSCL_NAME, GPIO0A_GPIO0A1);
flush_delayed_work(&hdmi->delay_work);
mutex_lock(&hdmi->enable_mutex);
hdmi->suspend = 1;
if(!hdmi->enable) {
mutex_unlock(&hdmi->enable_mutex);
return;
}
disable_irq(hdmi->irq);
mutex_unlock(&hdmi->enable_mutex);
hdmi->command = HDMI_CONFIG_ENABLE;
init_completion(&hdmi->complete);
hdmi->wait = 1;
queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, 0);
wait_for_completion_interruptible_timeout(&hdmi->complete,
msecs_to_jiffies(5000));
flush_delayed_work(&hdmi->delay_work);
return;
}
static void hdmi_early_resume(struct early_suspend *h)
{
hdmi_dbg(hdmi->dev, "hdmi exit early resume\n");
mutex_lock(&hdmi->enable_mutex);
rk30_mux_api_set(GPIO0A2_HDMII2CSDA_NAME, GPIO0A_HDMI_I2C_SDA);
rk30_mux_api_set(GPIO0A1_HDMII2CSCL_NAME, GPIO0A_HDMI_I2C_SCL);
clk_enable(hdmi->hclk);
hdmi->suspend = 0;
rk30_hdmi_initial();
if(hdmi->enable) {
enable_irq(hdmi->irq);
}
mutex_unlock(&hdmi->enable_mutex);
return;
}
#endif
static inline void hdmi_io_remap(void)
{
unsigned int value;
// Remap HDMI IO Pin
rk30_mux_api_set(GPIO0A2_HDMII2CSDA_NAME, GPIO0A_HDMI_I2C_SDA);
rk30_mux_api_set(GPIO0A1_HDMII2CSCL_NAME, GPIO0A_HDMI_I2C_SCL);
rk30_mux_api_set(GPIO0A0_HDMIHOTPLUGIN_NAME, GPIO0A_HDMI_HOT_PLUG_IN);
// Select LCDC0 as video source and enabled.
value = (HDMI_SOURCE_DEFAULT << 14) | (1 << 30);
writel(value, GRF_SOC_CON0 + RK30_GRF_BASE);
}
static int __devinit rk30_hdmi_probe (struct platform_device *pdev)
{
int ret;
struct resource *res;
struct resource *mem;
hdmi = kmalloc(sizeof(struct hdmi), GFP_KERNEL);
if(!hdmi)
{
dev_err(&pdev->dev, ">>rk30 hdmi kmalloc fail!");
return -ENOMEM;
}
memset(hdmi, 0, sizeof(struct hdmi));
hdmi->dev = &pdev->dev;
platform_set_drvdata(pdev, hdmi);
if(HDMI_SOURCE_DEFAULT == HDMI_SOURCE_LCDC0)
hdmi->lcdc = rk_get_lcdc_drv("lcdc0");
else
hdmi->lcdc = rk_get_lcdc_drv("lcdc1");
if(hdmi->lcdc == NULL)
{
dev_err(hdmi->dev, "can not connect to video source lcdc\n");
ret = -ENXIO;
goto err0;
}
hdmi->xscale = 95;
hdmi->yscale = 95;
hdmi->hclk = clk_get(NULL,"hclk_hdmi");
if(IS_ERR(hdmi->hclk))
{
dev_err(hdmi->dev, "Unable to get hdmi hclk\n");
ret = -ENXIO;
goto err0;
}
clk_enable(hdmi->hclk);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(hdmi->dev, "Unable to get register resource\n");
ret = -ENXIO;
goto err0;
}
hdmi->regbase_phy = res->start;
hdmi->regsize_phy = (res->end - res->start) + 1;
mem = request_mem_region(res->start, (res->end - res->start) + 1, pdev->name);
if (!mem)
{
dev_err(hdmi->dev, "failed to request mem region for hdmi\n");
ret = -ENOENT;
goto err0;
}
hdmi->regbase = (int)ioremap(res->start, (res->end - res->start) + 1);
if (!hdmi->regbase) {
dev_err(hdmi->dev, "cannot ioremap registers\n");
ret = -ENXIO;
goto err1;
}
ret = rk30_hdmi_initial();
if(ret != HDMI_ERROR_SUCESS)
goto err1;
hdmi_io_remap();
hdmi_sys_init();
hdmi->workqueue = create_singlethread_workqueue("hdmi");
INIT_DELAYED_WORK(&(hdmi->delay_work), hdmi_work);
#ifdef CONFIG_HAS_EARLYSUSPEND
hdmi->early_suspend.suspend = hdmi_early_suspend;
hdmi->early_suspend.resume = hdmi_early_resume;
hdmi->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB - 10;
register_early_suspend(&hdmi->early_suspend);
#endif
// vsync related init - retrofreak
spin_lock_init(&hdmi->vsync_lock);
init_completion(&hdmi->vsync_comp);
hdmi->vsync_wait_cnt = 0;
hdmi->ddev = hdmi_register_display_sysfs(hdmi, NULL);
#ifdef CONFIG_SWITCH
hdmi->switch_hdmi.name="hdmi";
switch_dev_register(&(hdmi->switch_hdmi));
#endif
spin_lock_init(&hdmi->irq_lock);
mutex_init(&hdmi->enable_mutex);
hdmi->edid_block = 0;
mutex_init(&hdmi->edid_mutex);
hdmi->colour_mode = HDMI_COLOUR_MODE_LIMITED;
/* get the IRQ */
hdmi->irq = platform_get_irq(pdev, 0);
if(hdmi->irq <= 0) {
dev_err(hdmi->dev, "failed to get hdmi irq resource (%d).\n", hdmi->irq);
ret = -ENXIO;
goto err2;
}
/* request the IRQ */
ret = request_irq(hdmi->irq, hdmi_irq, 0, dev_name(&pdev->dev), hdmi);
if (ret)
{
dev_err(hdmi->dev, "hdmi request_irq failed (%d).\n", ret);
goto err2;
}
hdmi_dbg(hdmi->dev, "rk30 hdmi probe sucess.\n");
return 0;
err2:
#ifdef CONFIG_SWITCH
switch_dev_unregister(&(hdmi->switch_hdmi));
#endif
hdmi_unregister_display_sysfs(hdmi);
#ifdef CONFIG_HAS_EARLYSUSPEND
unregister_early_suspend(&hdmi->early_suspend);
#endif
iounmap((void*)hdmi->regbase);
err1:
release_mem_region(res->start,(res->end - res->start) + 1);
clk_disable(hdmi->hclk);
err0:
hdmi_dbg(hdmi->dev, "rk30 hdmi probe error.\n");
kfree(hdmi);
hdmi = NULL;
return ret;
}
static int __devexit rk30_hdmi_remove(struct platform_device *pdev)
{
if(hdmi) {
mutex_lock(&hdmi->enable_mutex);
if(!hdmi->suspend && hdmi->enable)
disable_irq(hdmi->irq);
mutex_unlock(&hdmi->enable_mutex);
free_irq(hdmi->irq, NULL);
flush_workqueue(hdmi->workqueue);
destroy_workqueue(hdmi->workqueue);
#ifdef CONFIG_SWITCH
switch_dev_unregister(&(hdmi->switch_hdmi));
#endif
hdmi_unregister_display_sysfs(hdmi);
#ifdef CONFIG_HAS_EARLYSUSPEND
unregister_early_suspend(&hdmi->early_suspend);
#endif
iounmap((void*)hdmi->regbase);
release_mem_region(hdmi->regbase_phy, hdmi->regsize_phy);
clk_disable(hdmi->hclk);
fb_destroy_modelist(&hdmi->edid.modelist);
if(hdmi->edid.audio)
kfree(hdmi->edid.audio);
if(hdmi->edid.specs)
{
if(hdmi->edid.specs->modedb)
kfree(hdmi->edid.specs->modedb);
kfree(hdmi->edid.specs);
}
kfree(hdmi);
hdmi = NULL;
}
printk(KERN_INFO "rk30 hdmi removed.\n");
return 0;
}
static void rk30_hdmi_shutdown(struct platform_device *pdev)
{
if(hdmi) {
#ifdef CONFIG_HAS_EARLYSUSPEND
unregister_early_suspend(&hdmi->early_suspend);
#endif
}
printk(KERN_INFO "rk30 hdmi shut down.\n");
}
static struct platform_driver rk30_hdmi_driver = {
.probe = rk30_hdmi_probe,
.remove = __devexit_p(rk30_hdmi_remove),
.driver = {
.name = "rk30-hdmi",
.owner = THIS_MODULE,
},
.shutdown = rk30_hdmi_shutdown,
};
static int __init rk30_hdmi_init(void)
{
return platform_driver_register(&rk30_hdmi_driver);
}
static void __exit rk30_hdmi_exit(void)
{
platform_driver_unregister(&rk30_hdmi_driver);
}
fs_initcall(rk30_hdmi_init);
//module_init(rk30_hdmi_init);
module_exit(rk30_hdmi_exit);
| uraran/rk3066-kernel | drivers/video/rockchip/hdmi/rk30_hdmi.c | C | gpl-2.0 | 8,442 | [
30522,
1001,
2421,
1026,
11603,
1013,
11336,
1012,
1044,
1028,
1001,
2421,
1026,
11603,
1013,
16293,
1012,
1044,
1028,
1001,
2421,
1026,
11603,
1013,
9413,
19139,
1012,
1044,
1028,
1001,
2421,
1026,
11603,
1013,
5164,
1012,
1044,
1028,
1001... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<html>
<head>
<title>User agent detail - SAMSUNG-SGH-U800</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">
</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">
SAMSUNG-SGH-U800
</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">Source result (test suite)</th></tr><tr><td>ua-parser/uap-core<br /><small>vendor/thadafinser/uap-core/tests/test_device.yaml</small></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-U800</td><td></td><td></td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td></td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-test">Detail</a>
<!-- Modal Structure -->
<div id="modal-test" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Testsuite result detail</h4>
<p><pre><code class="php">Array
(
[user_agent_string] => SAMSUNG-SGH-U800
[family] => Samsung SGH-U800
[brand] => Samsung
[model] => SGH-U800
)
</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>BrowscapPhp<br /><small>6012</small></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>DonatjUAParser<br /><small>v0.5.0</small></td><td>SAMSUNG-SGH-U800 </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-f1436016-fdf1-4aea-b4be-1d7c99ab0661">Detail</a>
<!-- Modal Structure -->
<div id="modal-f1436016-fdf1-4aea-b4be-1d7c99ab0661" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>DonatjUAParser result detail</h4>
<p><pre><code class="php">Array
(
[platform] =>
[browser] => SAMSUNG-SGH-U800
[version] =>
)
</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></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-U800</td><td>mobile-browser</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.20702</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc">Detail</a>
<!-- Modal Structure -->
<div id="modal-9b0fa449-ec1b-40c8-8b1c-9486eb3b9cbc" 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] => 1
[type] => mobile-browser
[mobile_brand] => Samsung
[mobile_model] => SGH-U800
[version] =>
[is_android] =>
[browser_name] => unknown
[operating_system_family] => unknown
[operating_system_version] =>
[is_ios] =>
[producer] => Samsung
[operating_system] => unknown
[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.5.2</small></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-U800</td><td>smartphone</td><td>yes</td><td></td><td style="border-left: 1px solid #555"></td><td></td><td></td><td>0.005</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-21638055-738d-46ba-a1b1-f5114bc26475">Detail</a>
<!-- Modal Structure -->
<div id="modal-21638055-738d-46ba-a1b1-f5114bc26475" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>PiwikDeviceDetector result detail</h4>
<p><pre><code class="php">Array
(
[client] =>
[operatingSystem] => Array
(
)
[device] => Array
(
[brand] => SA
[brandName] => Samsung
[model] => SGH-U800
[device] => 1
[deviceName] => smartphone
)
[bot] =>
[extra] => Array
(
[isBot] =>
[isBrowser] =>
[isFeedReader] =>
[isMobileApp] =>
[isPIM] =>
[isLibrary] =>
[isMediaPlayer] =>
[isCamera] =>
[isCarBrowser] =>
[isConsole] =>
[isFeaturePhone] =>
[isPhablet] =>
[isPortableMediaPlayer] =>
[isSmartDisplay] =>
[isSmartphone] => 1
[isTablet] =>
[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.0</small></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>UAParser<br /><small>v3.4.5</small></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-U800</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.003</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b">Detail</a>
<!-- Modal Structure -->
<div id="modal-346c1a98-5fd3-454f-b6c8-350f2f505d8b" 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] =>
[minor] =>
[patch] =>
[family] => Other
)
[os] => UAParser\Result\OperatingSystem Object
(
[major] =>
[minor] =>
[patch] =>
[patchMinor] =>
[family] => Other
)
[device] => UAParser\Result\Device Object
(
[brand] => Samsung
[model] => SGH-U800
[family] => Samsung SGH-U800
)
[originalUserAgent] => SAMSUNG-SGH-U800
)
</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></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>WhatIsMyBrowserCom<br /><small></small></td><td> </td><td> </td><td> </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.40204</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-9795f66f-7271-430e-973a-a5c0e14dc35a">Detail</a>
<!-- Modal Structure -->
<div id="modal-9795f66f-7271-430e-973a-a5c0e14dc35a" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhatIsMyBrowserCom result detail</h4>
<p><pre><code class="php">stdClass Object
(
[operating_system_name] =>
[simple_sub_description_string] =>
[simple_browser_string] =>
[browser_version] =>
[extra_info] => Array
(
)
[operating_platform] =>
[extra_info_table] => Array
(
)
[layout_engine_name] =>
[detected_addons] => Array
(
)
[operating_system_flavour_code] =>
[hardware_architecture] =>
[operating_system_flavour] =>
[operating_system_frameworks] => Array
(
)
[browser_name_code] =>
[operating_system_version] =>
[simple_operating_platform_string] => Samsung SGH-U800
[is_abusive] =>
[layout_engine_version] =>
[browser_capabilities] => Array
(
)
[operating_platform_vendor_name] => Samsung
[operating_system] =>
[operating_system_version_full] =>
[operating_platform_code] => SGH-U800
[browser_name] =>
[operating_system_name_code] =>
[user_agent] => SAMSUNG-SGH-U800
[browser_version_full] =>
[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>WhichBrowser<br /><small>2.0.10</small></td><td> </td><td> </td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-U800</td><td>mobile:feature</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.011</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4">Detail</a>
<!-- Modal Structure -->
<div id="modal-342c8d32-4765-40a8-8a5c-af3a38d19ae4" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>WhichBrowser result detail</h4>
<p><pre><code class="php">Array
(
[device] => Array
(
[type] => mobile
[subtype] => feature
[manufacturer] => Samsung
[model] => SGH-U800
)
)
</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></td>
<td colspan="12" class="center-align red lighten-1">
<strong>No result found</strong>
</td>
</tr><tr><td>Wurfl<br /><small>1.6.4</small></td><td> </td><td><i class="material-icons">close</i></td><td> </td><td style="border-left: 1px solid #555">Samsung</td><td>SGH-U800</td><td>Feature Phone</td><td>yes</td><td></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.032</td><td>
<!-- Modal Trigger -->
<a class="modal-trigger btn waves-effect waves-light" href="#modal-1a1aee36-7ce7-4111-a391-8e2c501f1532">Detail</a>
<!-- Modal Structure -->
<div id="modal-1a1aee36-7ce7-4111-a391-8e2c501f1532" class="modal modal-fixed-footer">
<div class="modal-content">
<h4>Wurfl result detail</h4>
<p><pre><code class="php">Array
(
[virtual] => Array
(
[is_android] => false
[is_ios] => false
[is_windows_phone] => false
[is_app] => false
[is_full_desktop] => false
[is_largescreen] => false
[is_mobile] => true
[is_robot] => false
[is_smartphone] => false
[is_touchscreen] => false
[is_wml_preferred] => false
[is_xhtmlmp_preferred] => false
[is_html_preferred] => true
[advertised_device_os] =>
[advertised_device_os_version] =>
[advertised_browser] =>
[advertised_browser_version] =>
[complete_device_name] => Samsung SGH-U800
[form_factor] => Feature Phone
[is_phone] => true
[is_app_webview] => false
)
[all] => Array
(
[brand_name] => Samsung
[model_name] => SGH-U800
[unique] => true
[ununiqueness_handler] =>
[is_wireless_device] => true
[device_claims_web_support] => true
[has_qwerty_keyboard] => false
[can_skip_aligned_link_row] => true
[uaprof] => http://wap.samsungmobile.com/uaprof/U800UAProf3G.xml
[uaprof2] =>
[uaprof3] =>
[nokia_series] => 0
[nokia_edition] => 0
[device_os] =>
[mobile_browser] => Access Netfront
[mobile_browser_version] => 3.4
[device_os_version] =>
[pointing_method] =>
[release_date] => 2002_july
[marketing_name] =>
[model_extra_info] =>
[nokia_feature_pack] => 0
[can_assign_phone_number] => true
[is_tablet] => false
[manufacturer_name] =>
[is_bot] => false
[is_google_glass] => false
[proportional_font] => false
[built_in_back_button_support] => false
[card_title_support] => true
[softkey_support] => true
[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] => true
[xhtml_format_as_attribute] => false
[xhtml_nowrap_mode] => false
[xhtml_marquee_as_css_property] => true
[xhtml_readable_background_color1] => #FFFFFF
[xhtml_readable_background_color2] => #FFFFFF
[xhtml_allows_disabled_form_elements] => false
[xhtml_document_title_support] => true
[xhtml_preferred_charset] => utf8
[opwv_xhtml_extensions_support] => false
[xhtml_make_phone_call_string] => tel:
[xhtmlmp_preferred_mime_type] => application/xhtml+xml
[xhtml_table_support] => true
[xhtml_send_sms_string] => sms:
[xhtml_send_mms_string] => none
[xhtml_file_upload] => supported
[cookie_support] => true
[accept_third_party_cookie] => true
[xhtml_supports_iframe] => none
[xhtml_avoid_accesskeys] => false
[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] => none
[xhtml_support_level] => 4
[preferred_markup] => html_web_4_0
[wml_1_1] => true
[wml_1_2] => true
[wml_1_3] => true
[html_wi_w3_xhtmlbasic] => true
[html_wi_oma_xhtmlmp_1_0] => true
[html_wi_imode_html_1] => true
[html_wi_imode_html_2] => true
[html_wi_imode_html_3] => true
[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] => 240
[resolution_height] => 320
[columns] => 20
[max_image_width] => 230
[max_image_height] => 310
[rows] => 16
[physical_screen_width] => 30
[physical_screen_height] => 41
[dual_orientation] => false
[density_class] => 1.0
[wbmp] => true
[bmp] => true
[epoc_bmp] => false
[gif_animated] => true
[jpg] => true
[png] => true
[tiff] => false
[transparent_png_alpha] => false
[transparent_png_index] => true
[svgt_1_1] => false
[svgt_1_1_plus] => false
[greyscale] => false
[gif] => true
[colors] => 262144
[webp_lossy_support] => false
[webp_lossless_support] => false
[post_method_support] => true
[basic_authentication_support] => true
[empty_option_value_support] => true
[emptyok] => false
[nokia_voice_call] => true
[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] => false
[sdio] => false
[vpn] => false
[has_cellular_radio] => true
[max_deck_size] => 40000
[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] => 240
[wallpaper_max_height] => 320
[wallpaper_preferred_width] => 240
[wallpaper_preferred_height] => 320
[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] => true
[oma_v_1_0_forwardlock] => false
[oma_v_1_0_combined_delivery] => false
[oma_v_1_0_separate_delivery] => true
[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] => 10
[streaming_vcodec_mpeg4_sp] => 0
[streaming_vcodec_mpeg4_asp] => -1
[streaming_vcodec_h264_bp] => -1
[streaming_acodec_amr] => nb
[streaming_acodec_aac] => none
[streaming_wmv] => none
[streaming_preferred_protocol] => rtsp
[streaming_preferred_http_protocol] => none
[wap_push_support] => true
[connectionless_service_indication] => true
[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] => false
[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] => true
[sender] => true
[mms_max_size] => 307200
[mms_max_height] => 2048
[mms_max_width] => 2048
[built_in_recorder] => true
[built_in_camera] => true
[mms_jpeg_baseline] => true
[mms_jpeg_progressive] => true
[mms_gif_static] => true
[mms_gif_animated] => true
[mms_png] => true
[mms_bmp] => true
[mms_wbmp] => true
[mms_amr] => true
[mms_wav] => true
[mms_midi_monophonic] => true
[mms_midi_polyphonic] => true
[mms_midi_polyphonic_voices] => 0
[mms_spmidi] => true
[mms_mmf] => true
[mms_mp3] => true
[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] => true
[mms_vcalendar] => false
[mms_wml] => false
[mms_wbxml] => false
[mms_wmlc] => false
[mms_video] => true
[mms_mp4] => true
[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] => true
[mmf] => true
[smf] => true
[mld] => true
[midi_monophonic] => true
[midi_polyphonic] => false
[sp_midi] => true
[rmf] => false
[xmf] => false
[compactmidi] => false
[digiplug] => false
[nokia_ringtone] => false
[imelody] => true
[au] => false
[amr] => true
[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] => none
[css_rounded_corners] => none
[css_gradient] => none
[css_spriting] => false
[css_gradient_linear] => none
[is_transcoder] => false
[transcoder_ua_header] => user-agent
[rss_support] => false
[pdf_support] => false
[progressive_download] => false
[playback_vcodec_h263_0] => 10
[playback_vcodec_h263_3] => 10
[playback_vcodec_mpeg4_sp] => 0
[playback_vcodec_mpeg4_asp] => -1
[playback_vcodec_h264_bp] => -1
[playback_real_media] => none
[playback_3gpp] => true
[playback_3g2] => false
[playback_mp4] => false
[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] => false
[html_preferred_dtd] => xhtml_mp1
[viewport_supported] => false
[viewport_width] =>
[viewport_userscalable] =>
[viewport_initial_scale] =>
[viewport_maximum_scale] =>
[viewport_minimum_scale] =>
[mobileoptimized] => false
[handheldfriendly] => false
[canvas_support] => none
[image_inlining] => true
[is_smarttv] => false
[is_console] => false
[nfc_support] => false
[ux_full_desktop] => false
[jqm_grade] => none
[is_sencha_touch_ok] => false
[controlcap_is_smartphone] => default
[controlcap_is_ios] => default
[controlcap_is_android] => default
[controlcap_is_robot] => default
[controlcap_is_app] => default
[controlcap_advertised_device_os] => default
[controlcap_advertised_device_os_version] => default
[controlcap_advertised_browser] => default
[controlcap_advertised_browser_version] => default
[controlcap_is_windows_phone] => default
[controlcap_is_full_desktop] => default
[controlcap_is_largescreen] => default
[controlcap_is_mobile] => default
[controlcap_is_touchscreen] => default
[controlcap_is_wml_preferred] => default
[controlcap_is_xhtmlmp_preferred] => default
[controlcap_is_html_preferred] => default
[controlcap_form_factor] => default
[controlcap_complete_device_name] => default
)
)
</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-02-13 13:26:05</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.1.1/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> | ThaDafinser/UserAgentParserComparison | v4/user-agent-detail/0f/ff/0fff9b43-3cb9-42b3-a772-72ae40584e27.html | HTML | mit | 37,444 | [
30522,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
2516,
1028,
5310,
4005,
6987,
1011,
19102,
1011,
22214,
2232,
1011,
1057,
17914,
2692,
1026,
1013,
2516,
1028,
1026,
4957,
2128,
2140,
1027,
1000,
6782,
21030,
2102,
1000,
17850,
12879,
1027... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Text;
namespace DesignPatterns.Structural.Bridge
{
public interface IGear
{
string Handle();
}
}
| Ysovuka/design-patterns | src/c-sharp/DesignPatterns/Structural/Bridge/IGear.cs | C# | mit | 182 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
3793,
1025,
3415,
15327,
2640,
4502,
12079,
3619,
1012,
8332,
1012,
2958,
1063,
2270,
8278,
1045,
3351,
2906,
1063,
5164,
5047,
1006,
1007,
1025,
1065,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*******************************************************************************
* Copyright (c) 2006, 2009 David A Carlson.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* David A Carlson (XMLmodeling.com) - initial API and implementation
*
* $Id$
*******************************************************************************/
package org.openhealthtools.mdht.uml.hdf.tooling.rsm.providers;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
import org.eclipse.gmf.runtime.common.core.service.IOperation;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
import org.openhealthtools.mdht.uml.hdf.tooling.rsm.types.RIMElementTypes;
/**
* @generated
*/
public class RIMEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider {
private final static String PROFILE_ASSOCIATIONS_SEMANTIC_ROLE = "ProfileAssociationsSemanticRole"; //$NON-NLS-1$
/**
* @generated
*/
public void createEditPolicies(EditPart editPart) {
editPart.installEditPolicy(PROFILE_ASSOCIATIONS_SEMANTIC_ROLE, new RIMAssociationEditPolicy());
}
/**
* @generated
*/
public boolean provides(IOperation operation) {
if (operation instanceof CreateEditPoliciesOperation) {
EditPart ep = ((CreateEditPoliciesOperation) operation).getEditPart();
if (ep instanceof IGraphicalEditPart) {
IGraphicalEditPart gep = (IGraphicalEditPart) ep;
EObject element = gep.getNotationView().getElement();
if (element != null) {
for (IElementType elementType : RIMElementTypes.NODE_TYPES) {
if (elementType instanceof ISpecializationType) {
if (((ISpecializationType) elementType).getMatcher().matches(element)) {
return true;
}
}
}
}
}
}
return false;
}
}
| drbgfc/mdht | hl7/plugins/org.openhealthtools.mdht.uml.hdf.tooling.rsm/src/org/openhealthtools/mdht/uml/hdf/tooling/rsm/providers/RIMEditPolicyProvider.java | Java | epl-1.0 | 2,440 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Threading.Tasks;
using Anotar.NLog;
using CroquetAustralia.Domain.Services.Serializers;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Queue;
namespace CroquetAustralia.Domain.Services.Queues
{
public abstract class QueueBase : IQueueBase
{
private readonly Lazy<CloudQueue> _lazyQueue;
private readonly string _queueName;
private readonly QueueMessageSerializer _serializer;
protected QueueBase(string queueName, IAzureStorageConnectionString connectionString)
: this(queueName, connectionString, new QueueMessageSerializer())
{
}
protected QueueBase(string queueName, IAzureStorageConnectionString connectionString, QueueMessageSerializer serializer)
{
_queueName = queueName;
_serializer = serializer;
_lazyQueue = new Lazy<CloudQueue>(() => GetQueue(queueName, connectionString.Value));
}
private CloudQueue CloudQueue => _lazyQueue.Value;
public async Task AddMessageAsync(object @event)
{
LogTo.Info($"Adding '{@event.GetType().FullName}' to '{_queueName}' queue.");
var content = _serializer.Serialize(@event);
var message = new CloudQueueMessage(content);
await CloudQueue.AddMessageAsync(message);
}
private static CloudQueue GetQueue(string queueName, string connectionString)
{
var storageAccount = CloudStorageAccount.Parse(connectionString);
var queueClient = storageAccount.CreateCloudQueueClient();
var queue = queueClient.GetQueueReference(queueName);
queue.CreateIfNotExists();
return queue;
}
}
} | croquet-australia/api.croquet-australia.com.au | source/CroquetAustralia.Domain/Services/Queues/QueueBase.cs | C# | mit | 1,778 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
2478,
2019,
17287,
2099,
1012,
17953,
8649,
1025,
2478,
13675,
2080,
12647,
20559,
21493,
2401,
1012,
5884,
1012,
2578,
1012,
7642,
17629,
2015,
1025,
2478,
7513,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* ----------------------------------------------------------------------
This is the
██╗ ██╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗████████╗███████╗
██║ ██║██╔════╝ ██╔════╝ ██╔════╝ ██║ ██║╚══██╔══╝██╔════╝
██║ ██║██║ ███╗██║ ███╗██║ ███╗███████║ ██║ ███████╗
██║ ██║██║ ██║██║ ██║██║ ██║██╔══██║ ██║ ╚════██║
███████╗██║╚██████╔╝╚██████╔╝╚██████╔╝██║ ██║ ██║ ███████║
╚══════╝╚═╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝®
DEM simulation engine, released by
DCS Computing Gmbh, Linz, Austria
http://www.dcs-computing.com, office@dcs-computing.com
LIGGGHTS® is part of CFDEM®project:
http://www.liggghts.com | http://www.cfdem.com
Core developer and main author:
Christoph Kloss, christoph.kloss@dcs-computing.com
LIGGGHTS® is open-source, distributed under the terms of the GNU Public
License, version 2 or later. It is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. You should have
received a copy of the GNU General Public License along with LIGGGHTS®.
If not, see http://www.gnu.org/licenses . See also top-level README
and LICENSE files.
LIGGGHTS® and CFDEM® are registered trade marks of DCS Computing GmbH,
the producer of the LIGGGHTS® software and the CFDEM®coupling software
See http://www.cfdem.com/terms-trademark-policy for details.
-------------------------------------------------------------------------
Contributing author and copyright for this file:
This file is from LAMMPS
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
------------------------------------------------------------------------- */
#ifdef ATOM_CLASS
AtomStyle(molecular,AtomVecMolecular)
#else
#ifndef LMP_ATOM_VEC_MOLECULAR_H
#define LMP_ATOM_VEC_MOLECULAR_H
#include "atom_vec.h"
namespace LAMMPS_NS {
class AtomVecMolecular : public AtomVec {
public:
AtomVecMolecular(class LAMMPS *);
void grow(int);
void grow_reset();
void copy(int, int, int);
int pack_comm(int, int *, double *, int, int *);
int pack_comm_vel(int, int *, double *, int, int *);
void unpack_comm(int, int, double *);
void unpack_comm_vel(int, int, double *);
int pack_reverse(int, int, double *);
void unpack_reverse(int, int *, double *);
int pack_border(int, int *, double *, int, int *);
int pack_border_vel(int, int *, double *, int, int *);
int pack_border_hybrid(int, int *, double *);
void unpack_border(int, int, double *);
void unpack_border_vel(int, int, double *);
int unpack_border_hybrid(int, int, double *);
int pack_exchange(int, double *);
int unpack_exchange(double *);
int size_restart();
int pack_restart(int, double *);
int unpack_restart(double *);
void create_atom(int, double *);
void data_atom(double *, tagint, char **);
int data_atom_hybrid(int, char **);
void pack_data(double **);
int pack_data_hybrid(int, double *);
void write_data(FILE *, int, double **);
int write_data_hybrid(FILE *, double *);
bigint memory_usage();
private:
int *tag,*type,*mask;
tagint *image;
double **x,**v,**f;
int *molecule;
int **nspecial,**special;
int *num_bond;
int **bond_type,**bond_atom;
int *num_angle;
int **angle_type;
int **angle_atom1,**angle_atom2,**angle_atom3;
int *num_dihedral;
int **dihedral_type;
int **dihedral_atom1,**dihedral_atom2,**dihedral_atom3,**dihedral_atom4;
int *num_improper;
int **improper_type;
int **improper_atom1,**improper_atom2,**improper_atom3,**improper_atom4;
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Per-processor system is too big
The number of owned atoms plus ghost atoms on a single
processor must fit in 32-bit integer.
E: Invalid atom ID in Atoms section of data file
Atom IDs must be positive integers.
E: Invalid atom type in Atoms section of data file
Atom types must range from 1 to specified # of types.
*/
| aaigner/LIGGGHTS-PUBLIC | src/atom_vec_molecular.h | C | gpl-2.0 | 4,997 | [
30522,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!-- -->
本章节将要学习的是接口,接口是什么,接口是实体提供给外界的一种抽象化概念。
## 第一个例子
<pre><code class='syntax brush-javascript'>interface Things {
count: number;
price: number;
}
function getTotlePrice(cart:Things):number{
return cart.count*cart.price;
}
</code></pre>
TypeScript 也用了和其他语言中一样的声明接口的方式,在其他语言中,interface 是一个抽象类,没有任何实际的用途,不能直接用它,必须将它实现才能像正常类一样使用。它给我们提供的仅仅是告诉我们需要实现这个接口程序才能完成正常的工作
TypeScript 中的 interface 是告诉编译器 参数cart 必须要实现things接口。如果cart中没有things中定义的参数,那么编译器就会报错。在上面的例子中,参数cart必须包含count 和 price 两个属性,如果在调用getTotlePrice是传入的对象不包含这两个属性,编译器就会报错。
<pre><code class='syntax brush-java'>class Apple{
count:number;
price:number;
constructor(count: number,price:number) {
this.count = count;
this.price = price;
}
}
class Orange{
price:number;
constructor(price:number) {
this.price = price;
}
}
let p=new Apple(10,3.5);
let o=new Orange(4);
getTotlePrice(p);
getTotlePrice(o);//error Orange 类没有count 参数。
</code></pre>
## 接口的定义
我们继续用第一个例子来做说明,用interface关键字来定义接口。
<pre><code class='syntax brush-javascript'>interface Things {
count: number;
price: number;
}
</code></pre>
看起来来是不是很像字面js中字面量的定义,但是每个属性的分隔符是‘;’,而不是‘,’。那么我们能不能像Java中一样用 implement 来实现接口,创造一个实例呢。当然可以,但不是用关键字implement。
<pre><code class='syntax brush-javascript'>let apple:Things={
count:5,
price:3.5
};
apple.count
</code></pre>
## 可选参数
当然有时候你不确定你得到的参数里面是否有某个属性。这个时候你该怎么做呢,TypeScript 为你想到了这点,设置可选参数可以让参数对象中没有这个属性,而编译器不会报错。当然,在函数中需要进行检查,参数是否拥有这种属性,如果不做这种检查后果可能变得很严重。
<pre><code class='syntax brush-javascript'>interface things {
count?: number;
price: number;
}
function getTotlePrice(cart:things):number{
if(cart.count)
return cart.count*cart.price;
return cart.price
}
</code></pre>
你看到了这个例子和前面的额例子的区别就是属性名后加了一个‘?’。
## 只读属性
一些对象属性只能在刚刚创建的时候对其进行赋值,你可以在属性前面添加限定名 readonly 来指定只读属性
<pre><code class='syntax brush-javascript'>let apple:Things={
readonly count:5,
price:3.5
};
apple.count=10//error
</code></pre>
readonly 仅仅只能在属性中使用,不能修饰变量。const 和 let 只能用来修饰变量,而不是属性。
## 属性检查
TypeScript 对属性检查的规则很严格,比如在使用 接口字面量作为参数的类型时。
<pre><code class='syntax brush-javascript'>interface Things {
count?: number;
price: number;
}
function returnObj(apple:Things):Things{
return apple;
}
returnObj({color:'red',price:3.5})//error 返回值
</code></pre>
虽然count 属性是可选属性所以返回值中没有这个属性也没有问题,但是返回值中有一个多余属性color,而在Things中并没有这个属性,TypeScript 就会报错。绕开这些检查非常简单。 最简便的方法是使用类型断言:
<pre><code class='syntax brush-javascript'>returnObj({color:'red',price:3.5} as Things);//error 返回值
</code></pre>
<b>上面的例子仅仅介绍了简单的类型,下面将介绍含有特殊类型的接口,如函数类型、类类型</b>
## 函数类型
含有函数类型的接口定义如下
<pre><code class='syntax brush-javascript'>interface Things {
count: number;
price: number;
(count:number,price:number):number;
}
</code></pre>
这样仅仅是声明了一个匿名的函数作为属性,如果想实现这个接口,必须声明一个有函数名的函数
<pre><code class='syntax brush-javascript'>interface Things {
count: number;
price: number;
getTotlePrice():number;
}
let apple:Tings={
count:5,
price:3.5,
getTotlePrice:function(){
return this.count*this.price
}
}
</code></pre>
## 可索引类型
所谓的可索引类型就是可以通过arr[10],arr['name']这种方式取到值,这个就叫可索引类型。可索引类型具有一个索引签名,它描述了对象索引的类型,还有相应的索引返回值类型。
<pre><code class='syntax brush-javascript'>interface Things {
count: number;
price: number;
getTotlePrice():number;
[index:string]:any;//[索引签名:索引签名的类型]:返回值的类型
}
</code></pre>
属性的类型必须与索引的返回值类型一样,如果属性类型不一致可以用any。
<pre><code class='syntax brush-javascript'>interface Things {
count: number;
price: number;
getTotlePrice():number;
[index:string]:number;//error
}
</code></pre>
最后,你可以将索引签名设置为只读,这样就防止了给索引赋值:
<pre><code class='syntax brush-javascript'>interface Things {
count: number;
price: number;
getTotlePrice():number;
readonly [index:string]:any;
}
</code></pre>
## 类类型
### 实现接口
TypeScript 的类也可以使用implements 关键字去实现接口,来强制一个类去符合某种约定。
<pre><code class='syntax brush-java'>class Apple implements Tings{
count:number;
price:number;
getTotlePrice():number{
return this.count*this.price;
} ;
constructor(count: number,price:number) {
this.count = count;
this.price = price;
}
}
</code></pre>
这个例子就是定义了一个Apple类实现了接口Tings,所以必须在Apple类中声明count和price这两个属性和getTotlePrice这个,不然编译器就会报错。
### 类静态部分与实例部分的区别
当操作类和接口时,你要知道类是具有两个类型的,静态部分和实例部分。在java中用static 关键字去声明静态类、静态方法。同样的,在TypeScript 也是用static关键字来定义静态属性的。 你会注意到,当你用构造器去定义一个接口并试图定义一个类去实现这个接口时会得到一个错误:
<pre><code class='syntax brush-java'>interface FruitsConstructor{
new (count:number,price:number);
}
class Apple implements FruitsConstructor{
createTime:Date;
constructor(count: number, price: number) { }
}
</code></pre>
因为类在实现一个接口的过程中,只会去检查实例部分,静态部分并不会去检查,constructor是类的静态部分,所以TypeScript 不对其进行检查。
因此,我们应该直接去操作类的静态属性。
<pre><code class='syntax brush-java'>interface FruitsConstructor{
new (count:number,price:number);
}
//定义一个构造器函数,该函数指定了两个参数,如果某个类实现了这个接口,
//那么他的构造函数必须含有两个参数。
interface Fruits{
count:number;
price:number;
}
function createFruits (fruit:FruitsConstructor,count:number,price:number):Fruits{
return new fruit(count,price);
}
class Banana implements Fruits {
count:number;
price:number;
color:'yellow';
constructor(c:number,p:number){};
}
let f=createFruits(Banana,5,2.5);
</code></pre>
这个确实很难理解 new 一个函数,简单的理解就是 FruitsConstructor 接口定义了实现这个接口的类的构造函数的参数。这部分的内容,计划在以后的章节中再提。
## 继承接口
和类一样,接口也可以被继承
<pre><code class='syntax brush-java'>interface Fruits{
count:number;
price:number;
}
interface Apple extends Fruits {
color:string;
}
</code></pre>
一个接口可以继承多个接口,组成一个合成接口。
## 接口继承 类
当接口继承了一个类类型时,它会继承类的成员但不包括其实现。 就好像接口声明了所有类中存在的成员,但并没有提供具体实现一样。 接口同样会继承到类的private和protected成员。 这意味着当你创建了一个接口继承了一个拥有私有或受保护的成员的类时,这个接口类型只能被这个类或其子类所实现(implement)。
当你有一个庞大的继承结构时这很有用,但要指出的是你的代码只在子类拥有特定属性时起作用。 这个子类除了继承至基类外与基类没有任何关系。
<pre><code class='syntax brush-java'>class Control {
private state: any;
}
interface SelectableControl extends Control {
select(): void;
}
class Button extends Control implements SelectableControl {
select() { }
}
class TextBox extends Control {
}
// 错误:“Image”类型缺少“state”属性。
class Image implements SelectableControl {
select() { }
}
class Location {
}
</code></pre>
| YujieCheng/yujie.github.io | data/md/TypeScript2.md | Markdown | mit | 9,264 | [
30522,
1026,
999,
1011,
1011,
1011,
1011,
1028,
1876,
1932,
100,
100,
100,
1817,
100,
1916,
100,
100,
1788,
1989,
100,
1788,
100,
100,
100,
1989,
100,
1788,
100,
100,
100,
100,
100,
100,
1809,
100,
1916,
1740,
100,
100,
100,
100,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* $NetBSD: convert.c,v 1.2 2011/02/16 03:46:58 christos Exp $ */
/*
* convert.c - convert domain name
*/
/*
* Copyright (c) 2000,2002 Japan Network Information Center.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set forth bellow.
*
* LICENSE TERMS AND CONDITIONS
*
* The following License Terms and Conditions apply, unless a different
* license is obtained from Japan Network Information Center ("JPNIC"),
* a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
* Chiyoda-ku, Tokyo 101-0047, Japan.
*
* 1. Use, Modification and Redistribution (including distribution of any
* modified or derived work) in source and/or binary forms is permitted
* under this License Terms and Conditions.
*
* 2. Redistribution of source code must retain the copyright notices as they
* appear in each source code file, this License Terms and Conditions.
*
* 3. Redistribution in binary form must reproduce the Copyright Notice,
* this License Terms and Conditions, in the documentation and/or other
* materials provided with the distribution. For the purposes of binary
* distribution the "Copyright Notice" refers to the following language:
* "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
*
* 4. The name of JPNIC may not be used to endorse or promote products
* derived from this Software without specific prior written approval of
* JPNIC.
*
* 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "wrapcommon.h"
/*
* prepare/dispose conversion context
*/
void
idnConvDone(idn_resconf_t ctx)
{
if (ctx != NULL) {
idnLogReset();
idn_resconf_destroy(ctx);
}
}
idn_resconf_t
idnConvInit(void)
{
char encoding[256];
idn_resconf_t ctx;
idn_result_t r;
idnLogReset();
idnLogPrintf(idn_log_level_info, "idnkit version: %-.20s\n",
idn_version_getstring());
/*
* Initialize.
*/
if ((r = idn_resconf_initialize()) != idn_success) {
idnPrintf("idnConvInit: cannot initialize idn library: %s\n",
idn_result_tostring(r));
return NULL;
}
if ((r = idn_resconf_create(&ctx)) != idn_success) {
idnPrintf("idnConvInit: cannot create context: %s\n",
idn_result_tostring(r));
return NULL;
}
/*
* load configuration file.
*/
if ((r = idn_resconf_loadfile(ctx, NULL)) != idn_success) {
idnPrintf("idnConvInit: cannot read configuration file: %s\n",
idn_result_tostring(r));
if ((r = idn_resconf_setdefaults(ctx)) != idn_success) {
idnPrintf("idnConvInit: setting default configuration"
" failed: %s\n",
idn_result_tostring(r));
idnConvDone(ctx);
return (NULL);
}
idnPrintf("idnConvInit: using default configuration\n");
}
/*
* Set local codeset.
*/
if (idnGetPrgEncoding(encoding, sizeof(encoding)) == TRUE) {
idnPrintf("Encoding PRG <%-.100s>\n", encoding);
r = idn_resconf_setlocalconvertername(ctx, encoding,
IDN_CONVERTER_RTCHECK);
if (r != idn_success) {
idnPrintf("idnConvInit: invalid local codeset "
"\"%-.100s\": %s\n",
encoding, idn_result_tostring(r));
idnConvDone(ctx);
return NULL;
}
}
return ctx;
}
/*
* idnConvReq - convert domain name in a DNS request
*
* convert local encoding to DNS encoding
*/
BOOL
idnConvReq(idn_resconf_t ctx, const char FAR *from, char FAR *to, size_t tolen)
{
idn_result_t r;
idnLogReset();
idnLogPrintf(idn_log_level_trace, "idnConvReq(from=%-.100s)\n", from);
if (ctx == NULL) {
idnLogPrintf(idn_log_level_trace, "idnConvReq: ctx is NULL\n");
if (strlen(from) >= tolen)
return FALSE;
strcpy(to, from);
return TRUE;
}
r = idn_res_encodename(ctx, IDN_ENCODE_APP, from, to, tolen);
if (r == idn_success) {
return TRUE;
} else {
return FALSE;
}
}
/*
* idnConvRsp - convert domain name in a DNS response
*
* convert DNS encoding to local encoding
*/
BOOL
idnConvRsp(idn_resconf_t ctx, const char FAR *from, char FAR *to, size_t tolen)
{
idnLogReset();
idnLogPrintf(idn_log_level_trace, "idnConvRsp(from=%-.100s)\n", from);
if (ctx == NULL) {
if (strlen(from) >= tolen)
return FALSE;
strcpy(to, from);
return TRUE;
} else if (idn_res_decodename(ctx, IDN_DECODE_APP,
from, to, tolen) == idn_success) {
return TRUE;
} else {
return FALSE;
}
}
| execunix/vinos | external/bsd/bind/dist/contrib/idn/idnkit-1.0-src/wsock/common/convert.c | C | apache-2.0 | 5,178 | [
30522,
1013,
1008,
1002,
5658,
5910,
2094,
1024,
10463,
1012,
1039,
1010,
1058,
1015,
1012,
1016,
2249,
1013,
6185,
1013,
2385,
6021,
1024,
4805,
1024,
5388,
4828,
2891,
4654,
2361,
1002,
1008,
1013,
30524,
5884,
2171,
1008,
1013,
1013,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# typed: false
# frozen_string_literal: true
module Homebrew
module Diagnostic
class Volumes
def initialize
@volumes = get_mounts
end
def which(path)
vols = get_mounts path
# no volume found
return -1 if vols.empty?
vol_index = @volumes.index(vols[0])
# volume not found in volume list
return -1 if vol_index.nil?
vol_index
end
def get_mounts(path = nil)
vols = []
# get the volume of path, if path is nil returns all volumes
args = %w[/bin/df -P]
args << path if path
Utils.popen_read(*args) do |io|
io.each_line do |line|
case line.chomp
# regex matches: /dev/disk0s2 489562928 440803616 48247312 91% /
when /^.+\s+[0-9]+\s+[0-9]+\s+[0-9]+\s+[0-9]{1,3}%\s+(.+)/
vols << Regexp.last_match(1)
end
end
end
vols
end
end
class Checks
undef fatal_preinstall_checks, fatal_build_from_source_checks,
fatal_setup_build_environment_checks, supported_configuration_checks,
build_from_source_checks
def fatal_preinstall_checks
checks = %w[
check_access_directories
]
# We need the developer tools for `codesign`.
checks << "check_for_installed_developer_tools" if Hardware::CPU.arm?
checks.freeze
end
def fatal_build_from_source_checks
%w[
check_xcode_license_approved
check_xcode_minimum_version
check_clt_minimum_version
check_if_xcode_needs_clt_installed
check_if_supported_sdk_available
check_broken_sdks
].freeze
end
def fatal_setup_build_environment_checks
%w[
check_if_supported_sdk_available
].freeze
end
def supported_configuration_checks
%w[
check_for_unsupported_macos
].freeze
end
def build_from_source_checks
%w[
check_for_installed_developer_tools
check_xcode_up_to_date
check_clt_up_to_date
].freeze
end
def check_for_non_prefixed_findutils
findutils = Formula["findutils"]
return unless findutils.any_version_installed?
gnubin = %W[#{findutils.opt_libexec}/gnubin #{findutils.libexec}/gnubin]
default_names = Tab.for_name("findutils").with? "default-names"
return if !default_names && (paths & gnubin).empty?
<<~EOS
Putting non-prefixed findutils in your path can cause python builds to fail.
EOS
rescue FormulaUnavailableError
nil
end
def check_for_unsupported_macos
return if Homebrew::EnvConfig.developer?
who = +"We"
what = if OS::Mac.prerelease?
"pre-release version"
elsif OS::Mac.outdated_release?
who << " (and Apple)"
"old version"
end
return if what.blank?
who.freeze
<<~EOS
You are using macOS #{MacOS.version}.
#{who} do not provide support for this #{what}.
#{please_create_pull_requests(what)}
EOS
end
def check_xcode_up_to_date
return unless MacOS::Xcode.outdated?
# CI images are going to end up outdated so don't complain when
# `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew
# repository. This only needs to support whatever CI providers
# Homebrew/brew is currently using.
return if ENV["GITHUB_ACTIONS"]
message = <<~EOS
Your Xcode (#{MacOS::Xcode.version}) is outdated.
Please update to Xcode #{MacOS::Xcode.latest_version} (or delete it).
#{MacOS::Xcode.update_instructions}
EOS
if OS::Mac.prerelease?
current_path = Utils.popen_read("/usr/bin/xcode-select", "-p")
message += <<~EOS
If #{MacOS::Xcode.latest_version} is installed, you may need to:
sudo xcode-select --switch /Applications/Xcode.app
Current developer directory is:
#{current_path}
EOS
end
message
end
def check_clt_up_to_date
return unless MacOS::CLT.outdated?
# CI images are going to end up outdated so don't complain when
# `brew test-bot` runs `brew doctor` in the CI for the Homebrew/brew
# repository. This only needs to support whatever CI providers
# Homebrew/brew is currently using.
return if ENV["GITHUB_ACTIONS"]
<<~EOS
A newer Command Line Tools release is available.
#{MacOS::CLT.update_instructions}
EOS
end
def check_xcode_minimum_version
return unless MacOS::Xcode.below_minimum_version?
xcode = MacOS::Xcode.version.to_s
xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix?
<<~EOS
Your Xcode (#{xcode}) is too outdated.
Please update to Xcode #{MacOS::Xcode.latest_version} (or delete it).
#{MacOS::Xcode.update_instructions}
EOS
end
def check_clt_minimum_version
return unless MacOS::CLT.below_minimum_version?
<<~EOS
Your Command Line Tools are too outdated.
#{MacOS::CLT.update_instructions}
EOS
end
def check_if_xcode_needs_clt_installed
return unless MacOS::Xcode.needs_clt_installed?
<<~EOS
Xcode alone is not sufficient on #{MacOS.version.pretty_name}.
#{DevelopmentTools.installation_instructions}
EOS
end
def check_ruby_version
return if RUBY_VERSION == HOMEBREW_REQUIRED_RUBY_VERSION
return if Homebrew::EnvConfig.developer? && OS::Mac.prerelease?
<<~EOS
Ruby version #{RUBY_VERSION} is unsupported on #{MacOS.version}. Homebrew
is developed and tested on Ruby #{HOMEBREW_REQUIRED_RUBY_VERSION}, and may not work correctly
on other Rubies. Patches are accepted as long as they don't cause breakage
on supported Rubies.
EOS
end
def check_xcode_prefix
prefix = MacOS::Xcode.prefix
return if prefix.nil?
return unless prefix.to_s.include?(" ")
<<~EOS
Xcode is installed to a directory with a space in the name.
This will cause some formulae to fail to build.
EOS
end
def check_xcode_prefix_exists
prefix = MacOS::Xcode.prefix
return if prefix.nil? || prefix.exist?
<<~EOS
The directory Xcode is reportedly installed to doesn't exist:
#{prefix}
You may need to `xcode-select` the proper path if you have moved Xcode.
EOS
end
def check_xcode_select_path
return if MacOS::CLT.installed?
return unless MacOS::Xcode.installed?
return if File.file?("#{MacOS.active_developer_dir}/usr/bin/xcodebuild")
path = MacOS::Xcode.bundle_path
path = "/Developer" if path.nil? || !path.directory?
<<~EOS
Your Xcode is configured with an invalid path.
You should change it to the correct path:
sudo xcode-select --switch #{path}
EOS
end
def check_xcode_license_approved
# If the user installs Xcode-only, they have to approve the
# license or no "xc*" tool will work.
return unless `/usr/bin/xcrun clang 2>&1`.include?("license")
return if $CHILD_STATUS.success?
<<~EOS
You have not agreed to the Xcode license.
Agree to the license by opening Xcode.app or running:
sudo xcodebuild -license
EOS
end
def check_xquartz_up_to_date
return unless MacOS::XQuartz.outdated?
<<~EOS
Your XQuartz (#{MacOS::XQuartz.version}) is outdated.
Please install XQuartz #{MacOS::XQuartz.latest_version} (or delete the current version).
XQuartz can be updated using Homebrew Cask by running:
brew reinstall xquartz
EOS
end
def check_filesystem_case_sensitive
dirs_to_check = [
HOMEBREW_PREFIX,
HOMEBREW_REPOSITORY,
HOMEBREW_CELLAR,
HOMEBREW_TEMP,
]
case_sensitive_dirs = dirs_to_check.select do |dir|
# We select the dir as being case-sensitive if either the UPCASED or the
# downcased variant is missing.
# Of course, on a case-insensitive fs, both exist because the os reports so.
# In the rare situation when the user has indeed a downcased and an upcased
# dir (e.g. /TMP and /tmp) this check falsely thinks it is case-insensitive
# but we don't care because: 1. there is more than one dir checked, 2. the
# check is not vital and 3. we would have to touch files otherwise.
upcased = Pathname.new(dir.to_s.upcase)
downcased = Pathname.new(dir.to_s.downcase)
dir.exist? && !(upcased.exist? && downcased.exist?)
end
return if case_sensitive_dirs.empty?
volumes = Volumes.new
case_sensitive_vols = case_sensitive_dirs.map do |case_sensitive_dir|
volumes.get_mounts(case_sensitive_dir)
end
case_sensitive_vols.uniq!
<<~EOS
The filesystem on #{case_sensitive_vols.join(",")} appears to be case-sensitive.
The default macOS filesystem is case-insensitive. Please report any apparent problems.
EOS
end
def check_for_gettext
find_relative_paths("lib/libgettextlib.dylib",
"lib/libintl.dylib",
"include/libintl.h")
return if @found.empty?
# Our gettext formula will be caught by check_linked_keg_only_brews
gettext = begin
Formulary.factory("gettext")
rescue
nil
end
if gettext&.linked_keg&.directory?
homebrew_owned = @found.all? do |path|
Pathname.new(path).realpath.to_s.start_with? "#{HOMEBREW_CELLAR}/gettext"
end
return if homebrew_owned
end
inject_file_list @found, <<~EOS
gettext files detected at a system prefix.
These files can cause compilation and link failures, especially if they
are compiled with improper architectures. Consider removing these files:
EOS
end
def check_for_iconv
find_relative_paths("lib/libiconv.dylib", "include/iconv.h")
return if @found.empty?
libiconv = begin
Formulary.factory("libiconv")
rescue
nil
end
if libiconv&.linked_keg&.directory?
unless libiconv.keg_only?
<<~EOS
A libiconv formula is installed and linked.
This will break stuff. For serious. Unlink it.
EOS
end
else
inject_file_list @found, <<~EOS
libiconv files detected at a system prefix other than /usr.
Homebrew doesn't provide a libiconv formula, and expects to link against
the system version in /usr. libiconv in other prefixes can cause
compile or link failure, especially if compiled with improper
architectures. macOS itself never installs anything to /usr/local so
it was either installed by a user or some other third party software.
tl;dr: delete these files:
EOS
end
end
def check_for_bitdefender
if !Pathname("/Library/Bitdefender/AVP/EndpointSecurityforMac.app").exist? &&
!Pathname("/Library/Bitdefender/AVP/BDLDaemon").exist?
return
end
<<~EOS
You have installed Bitdefender. The "Traffic Scan" option interferes with
Homebrew's ability to download packages. See:
#{Formatter.url("https://github.com/Homebrew/brew/issues/5558")}
EOS
end
def check_for_multiple_volumes
return unless HOMEBREW_CELLAR.exist?
volumes = Volumes.new
# Find the volumes for the TMP folder & HOMEBREW_CELLAR
real_cellar = HOMEBREW_CELLAR.realpath
where_cellar = volumes.which real_cellar
begin
tmp = Pathname.new(Dir.mktmpdir("doctor", HOMEBREW_TEMP))
begin
real_tmp = tmp.realpath.parent
where_tmp = volumes.which real_tmp
ensure
Dir.delete tmp
end
rescue
return
end
return if where_cellar == where_tmp
<<~EOS
Your Cellar and TEMP directories are on different volumes.
macOS won't move relative symlinks across volumes unless the target file already
exists. Brews known to be affected by this are Git and Narwhal.
You should set the "HOMEBREW_TEMP" environment variable to a suitable
directory on the same volume as your Cellar.
EOS
end
def check_deprecated_caskroom_taps
tapped_caskroom_taps = Tap.select { |t| t.user == "caskroom" || t.name == "phinze/cask" }
.map(&:name)
return if tapped_caskroom_taps.empty?
<<~EOS
You have the following deprecated, cask taps tapped:
#{tapped_caskroom_taps.join("\n ")}
Untap them with `brew untap`.
EOS
end
def check_if_supported_sdk_available
return unless DevelopmentTools.installed?
return unless MacOS.sdk_root_needed?
return if MacOS.sdk
locator = MacOS.sdk_locator
source = if locator.source == :clt
update_instructions = MacOS::CLT.update_instructions
"Command Line Tools (CLT)"
else
update_instructions = MacOS::Xcode.update_instructions
"Xcode"
end
<<~EOS
Your #{source} does not support macOS #{MacOS.version}.
It is either outdated or was modified.
Please update your #{source} or delete it if no updates are available.
#{update_instructions}
EOS
end
# The CLT 10.x -> 11.x upgrade process on 10.14 contained a bug which broke the SDKs.
# Notably, MacOSX10.14.sdk would indirectly symlink to MacOSX10.15.sdk.
# This diagnostic was introduced to check for this and recommend a full reinstall.
def check_broken_sdks
locator = MacOS.sdk_locator
return if locator.all_sdks.all? do |sdk|
path_version = sdk.path.basename.to_s[MacOS::SDK::VERSIONED_SDK_REGEX, 1]
next true if path_version.blank?
sdk.version == MacOS::Version.new(path_version).strip_patch
end
if locator.source == :clt
source = "Command Line Tools (CLT)"
path_to_remove = MacOS::CLT::PKG_PATH
installation_instructions = MacOS::CLT.installation_instructions
else
source = "Xcode"
path_to_remove = MacOS::Xcode.bundle_path
installation_instructions = MacOS::Xcode.installation_instructions
end
<<~EOS
The contents of the SDKs in your #{source} installation do not match the SDK folder names.
A clean reinstall of #{source} should fix this.
Remove the broken installation before reinstalling:
sudo rm -rf #{path_to_remove}
#{installation_instructions}
EOS
end
end
end
end
| sjackman/homebrew | Library/Homebrew/extend/os/mac/diagnostic.rb | Ruby | bsd-2-clause | 15,624 | [
30522,
1001,
21189,
1024,
6270,
1001,
7708,
1035,
5164,
1035,
18204,
1024,
2995,
11336,
2188,
13578,
2860,
11336,
16474,
2465,
6702,
13366,
3988,
4697,
1030,
6702,
1027,
2131,
1035,
19363,
2203,
13366,
2029,
1006,
4130,
1007,
18709,
1027,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Configure Rails Envinronment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../config/environment.rb", __FILE__)
require "rails/test_help"
Rails.backtrace_cleaner.remove_silencers!
| DouglasAllen/site-camping | vendor/gems/ruby/2.2.0/gems/mab-0.0.3/test/rails/test/helper.rb | Ruby | mit | 193 | [
30522,
1001,
9530,
8873,
27390,
2063,
15168,
4372,
6371,
4948,
3672,
4372,
2615,
1031,
1000,
15168,
1035,
4372,
2615,
1000,
1033,
1027,
1000,
3231,
1000,
5478,
5371,
1012,
7818,
1035,
4130,
1006,
1000,
1012,
1012,
1013,
1012,
1012,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package io.github.trulyfree.modular6.test.action.impl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import io.github.trulyfree.modular6.action.Action;
import io.github.trulyfree.modular6.action.ActionGroup;
/* Modular6 library by TrulyFree: A general-use module-building library.
* Copyright (C) 2016 VTCAKAVSMoACE
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
public class SimpleActionGroup<T extends Action> implements ActionGroup<T> {
private List<T> actions;
private int current;
public SimpleActionGroup(List<T> actions) {
this.actions = actions;
current = 0;
}
@Override
public boolean enactNextAction() {
return actions.get(next()).enact();
}
@Override
public int size() {
return actions.size();
}
@Override
public Collection<T> getActions() {
Collection<T> actions = new ArrayList<T>(size());
for (T action : this.actions) {
actions.add(action);
}
return actions;
}
private int next() {
final int intermediary = current;
current++;
current %= this.size();
return intermediary;
}
@Override
public void enactAllOfType(Class<? extends T> type) {
for (T action : getActions()) {
if (type.isInstance(action)) {
action.enact();
}
}
}
@Override
public void enactAll() {
for (T action : getActions()) {
action.enact();
}
}
}
| TrulyFree/Modular6 | src/test/java/io/github/trulyfree/modular6/test/action/impl/SimpleActionGroup.java | Java | gpl-3.0 | 1,957 | [
30522,
7427,
22834,
1012,
21025,
2705,
12083,
1012,
5621,
23301,
1012,
19160,
2575,
1012,
3231,
1012,
2895,
1012,
17727,
2140,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
9140,
9863,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
3074,
1025,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: post
title: Word Embedding
category: NLP
---
## 基于矩阵的分布表示
* 选取上下文,确定矩阵类型
1. “词-文档”矩阵,非常稀疏
2. “词-词”矩阵,选取词附近上下文中的各个词(如上下文窗口中的5个词),相对稠密
3. “词-n gram词组”,选取词附近上下文各词组成的n元词组,更加精准,但是更加稀疏
* 确定矩阵中各元素的值,包括TF-IDF,PMI,log
* 矩阵分解,包括 SVD,NMF,CCA,HPCA
## 基于神经网络的语言模型
* NNLM basic Language model

* LBL 双线性结构
和nnlm基本类似,只是输出的目标函数稍有不同。
* RNNLM 利用所有的上下文信息,不进行简化(每个词都用上之前看过的所有单词,而不是n个)
一个语言模型的描述

当m很大的时候没法算,因此做了n-gram的估算

在计算右边的公式的时候,一般直接采用频率计数的方法进行计算

由此带来的问题是数据稀疏问题和平滑问题,由此,神经网络语言模型产生。
Bengio Neural Probabilistic Language Model

x是一个分布式向量

### word2vec
前面的模型相对而言都很复杂,然后出了一个CBOW和Skip-gram模型。

没有很多的计算过程,就是根据上下文关系的softmax
| cdmaok/cdmaok.github.io | _drafts/2016-03-01-Word-Embedding.md | Markdown | mit | 1,967 | [
30522,
1011,
1011,
1011,
9621,
1024,
2695,
2516,
1024,
2773,
7861,
8270,
4667,
4696,
1024,
17953,
2361,
1011,
1011,
1011,
1001,
1001,
100,
100,
100,
100,
1916,
1775,
100,
100,
1923,
1008,
100,
100,
1742,
1743,
1861,
1989,
100,
1822,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Participant'
db.delete_table(u'pa_participant')
# Removing M2M table for field user on 'Participant'
db.delete_table('pa_participant_user')
# Adding M2M table for field user on 'ReportingPeriod'
db.create_table(u'pa_reportingperiod_user', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('reportingperiod', models.ForeignKey(orm[u'pa.reportingperiod'], null=False)),
('user', models.ForeignKey(orm[u'pa.user'], null=False))
))
db.create_unique(u'pa_reportingperiod_user', ['reportingperiod_id', 'user_id'])
def backwards(self, orm):
# Adding model 'Participant'
db.create_table(u'pa_participant', (
(u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('reporting_period', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['pa.ReportingPeriod'])),
))
db.send_create_signal(u'pa', ['Participant'])
# Adding M2M table for field user on 'Participant'
db.create_table(u'pa_participant_user', (
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
('participant', models.ForeignKey(orm[u'pa.participant'], null=False)),
('user', models.ForeignKey(orm[u'pa.user'], null=False))
))
db.create_unique(u'pa_participant_user', ['participant_id', 'user_id'])
# Removing M2M table for field user on 'ReportingPeriod'
db.delete_table('pa_reportingperiod_user')
models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'pa.activity': {
'Meta': {'object_name': 'Activity'},
'category': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['pa.Category']"}),
'description': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
u'pa.activityentry': {
'Meta': {'object_name': 'ActivityEntry'},
'activity': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['pa.Activity']"}),
'day': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
'hour': ('django.db.models.fields.IntegerField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slot': ('django.db.models.fields.IntegerField', [], {}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['pa.User']"})
},
u'pa.category': {
'Meta': {'object_name': 'Category'},
'description': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'grouping': ('django.db.models.fields.CharField', [], {'default': "'d'", 'max_length': '15'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'reporting_period': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['pa.ReportingPeriod']"})
},
u'pa.profession': {
'Meta': {'object_name': 'Profession'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '60'})
},
u'pa.reportingperiod': {
'Meta': {'object_name': 'ReportingPeriod'},
'end_date': ('django.db.models.fields.DateTimeField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
'slots_per_hour': ('django.db.models.fields.IntegerField', [], {}),
'start_date': ('django.db.models.fields.DateTimeField', [], {}),
'user': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['pa.User']", 'symmetrical': 'False'})
},
u'pa.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'profession': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['pa.Profession']", 'null': 'True', 'blank': 'True'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
}
}
complete_apps = ['pa'] | Mathew/psychoanalysis | psychoanalysis/apps/pa/migrations/0002_auto__del_participant.py | Python | mit | 7,476 | [
30522,
1001,
1011,
1008,
1011,
16861,
1024,
21183,
2546,
1011,
1022,
1011,
1008,
1011,
12324,
3058,
7292,
2013,
2148,
1012,
16962,
12324,
16962,
2013,
2148,
1012,
1058,
2475,
12324,
8040,
28433,
4328,
29397,
2013,
6520,
23422,
1012,
16962,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import { browser } from 'protractor';
export class E2ePage {
navigateToHome() {
return browser.get('/');
}
}
| jsperts/workshop_unterlagen | angular/examples/E2E_Tests/e2e/app.po.ts | TypeScript | mit | 118 | [
30522,
12324,
1063,
16602,
1065,
2013,
1005,
4013,
6494,
16761,
1005,
1025,
9167,
2465,
1041,
2475,
13699,
4270,
1063,
22149,
3406,
23393,
2063,
1006,
1007,
1063,
2709,
16602,
1012,
2131,
1006,
1005,
1013,
1005,
1007,
1025,
1065,
1065,
102,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2002, Intel Corporation. All rights reserved.
* Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
*
* Note: This test is not based on the POSIX spec, but is a speculation
* about behavior for an assertion where the POSIX spec does not make a
* statement about the behavior in either case.
*
* Test that if clock_settime() changes the value for CLOCK_REALTIME,
* a repeating absolute timer uses this new value for expires.
*
* Document whether expirations which have already happened happen again or
* not.
*
* Steps:
* - get time T0
* - create/enable a timer to expire at T1 = T0 + TIMERINTERVAL and repeat
* at interval TIMERINTERVAL
* - sleep for time TIMERINTERVAL+ADDITIONALEXPIRES*TIMERINTERAL (must do
* in a loop to catch all expires)
* - set time backward to T0
* - sleep for time TIMERINTERVAL and ensure timer expires (2X)
*
* signal SIGTOTEST is used.
*/
#include <stdio.h>
#include <time.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include "posixtest.h"
#include "../helpers.h"
#define TIMERINTERVAL 5
#define ADDITIONALEXPIRES 2
#define ADDITIONALDELTA 1
#define SIGTOTEST SIGALRM
int caught = 0;
void handler(int signo)
{
printf("Caught signal\n");
caught++;
}
int main(int argc, char *argv[])
{
struct sigevent ev;
struct sigaction act;
struct timespec tpT0, tpclock, tsreset;
struct itimerspec its;
timer_t tid;
int i, flags = 0, nocaught = 0;
/*
* set up sigevent for timer
* set up sigaction to catch signal
*/
ev.sigev_notify = SIGEV_SIGNAL;
ev.sigev_signo = SIGTOTEST;
act.sa_handler = handler;
act.sa_flags = 0;
if (sigemptyset(&act.sa_mask) != 0) {
perror("sigemptyset() was not successful\n");
return PTS_UNRESOLVED;
}
if (sigaction(SIGTOTEST, &act, 0) != 0) {
perror("sigaction() was not successful\n");
return PTS_UNRESOLVED;
}
if (clock_gettime(CLOCK_REALTIME, &tpT0) != 0) {
perror("clock_gettime() was not successful\n");
return PTS_UNRESOLVED;
}
if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) {
perror("timer_create() did not return success\n");
return PTS_UNRESOLVED;
}
flags |= TIMER_ABSTIME;
its.it_interval.tv_sec = TIMERINTERVAL;
its.it_interval.tv_nsec = 0;
its.it_value.tv_sec = tpT0.tv_sec + TIMERINTERVAL;
its.it_value.tv_nsec = tpT0.tv_nsec;
if (timer_settime(tid, flags, &its, NULL) != 0) {
perror("timer_settime() did not return success\n");
return PTS_UNRESOLVED;
}
sleep(TIMERINTERVAL);
for (i = 0; i < ADDITIONALEXPIRES; i++) {
sleep(TIMERINTERVAL);
}
tpclock.tv_sec = tpT0.tv_sec;
tpclock.tv_nsec = tpT0.tv_nsec;
getBeforeTime(&tsreset);
if (clock_settime(CLOCK_REALTIME, &tpclock) != 0) {
printf("clock_settime() was not successful\n");
return PTS_UNRESOLVED;
}
caught = 0;
sleep(TIMERINTERVAL + ADDITIONALDELTA);
if (caught == 1) {
printf("Caught the first signal\n");
} else {
printf("FAIL: Didn't catch timer after TIMERINTERVAL.\n");
nocaught = 1;
}
sleep(TIMERINTERVAL + ADDITIONALDELTA);
if (caught >= 2) {
printf("Caught another signal\n");
} else {
printf("Caught %d < 2 signals\n", caught);
nocaught = 1;
}
if (nocaught) {
printf
("Implementation does not repeat signals on clock reset\n");
} else {
printf("Implementation does repeat signals on clock reset\n");
}
// If we finish, pass
tsreset.tv_sec += 2 * (TIMERINTERVAL + ADDITIONALDELTA);
setBackTime(tsreset);
return PTS_PASS;
}
| rogerq/ltp-ddt | testcases/open_posix_testsuite/conformance/interfaces/clock_settime/speculative/4-4.c | C | gpl-2.0 | 3,602 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2526,
1010,
13420,
3840,
1012,
2035,
2916,
9235,
1012,
1008,
2580,
2011,
1024,
7628,
1012,
1050,
1012,
13109,
17580,
7474,
6366,
1011,
2023,
2012,
13420,
11089,
4012,
1008,
2023,
5371,
2003,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package bnfc.abs.Absyn; // Java Package generated by the BNF Converter.
public class SIf extends Stm {
public final PureExp pureexp_;
public final Stm stm_;
public SIf(PureExp p1, Stm p2) { pureexp_ = p1; stm_ = p2; }
public <R,A> R accept(bnfc.abs.Absyn.Stm.Visitor<R,A> v, A arg) { return v.visit(this, arg); }
public boolean equals(Object o) {
if (this == o) return true;
if (o instanceof bnfc.abs.Absyn.SIf) {
bnfc.abs.Absyn.SIf x = (bnfc.abs.Absyn.SIf)o;
return this.pureexp_.equals(x.pureexp_) && this.stm_.equals(x.stm_);
}
return false;
}
public int hashCode() {
return 37*(this.pureexp_.hashCode())+this.stm_.hashCode();
}
}
| peteryhwong/jabsc | src/main/java/bnfc/abs/Absyn/SIf.java | Java | apache-2.0 | 712 | [
30522,
7427,
24869,
11329,
1012,
14689,
1012,
14689,
6038,
1025,
1013,
1013,
9262,
7427,
7013,
2011,
1996,
24869,
2546,
10463,
2121,
1012,
2270,
2465,
9033,
2546,
8908,
2358,
2213,
1063,
2270,
2345,
5760,
10288,
2361,
5760,
10288,
2361,
103... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* ScriptDev2 is an extension for mangos providing enhanced features for
* area triggers, creatures, game objects, instances, items, and spells beyond
* the default database scripting in mangos.
*
* Copyright (C) 2006-2013 ScriptDev2 <http://www.scriptdev2.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
/**
* ScriptData
* SDName: Teldrassil
* SD%Complete: 100
* SDComment: Quest support: 938
* SDCategory: Teldrassil
* EndScriptData
*/
/**
* ContentData
* npc_mist
* EndContentData
*/
#include "precompiled.h"
#include "follower_ai.h"
/*####
# npc_mist
####*/
enum
{
SAY_AT_HOME = -1000323,
EMOTE_AT_HOME = -1000324,
QUEST_MIST = 938,
NPC_ARYNIA = 3519,
FACTION_DARNASSUS = 79
};
struct npc_mistAI : public FollowerAI
{
npc_mistAI(Creature* pCreature) : FollowerAI(pCreature) { Reset(); }
void Reset() override { }
void MoveInLineOfSight(Unit* pWho) override
{
FollowerAI::MoveInLineOfSight(pWho);
if (!m_creature->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_ARYNIA)
{
if (m_creature->IsWithinDistInMap(pWho, 10.0f))
{
DoScriptText(SAY_AT_HOME, pWho);
DoComplete();
}
}
}
void DoComplete()
{
DoScriptText(EMOTE_AT_HOME, m_creature);
if (Player* pPlayer = GetLeaderForFollower())
{
if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE)
{
pPlayer->GroupEventHappens(QUEST_MIST, m_creature);
}
}
// The follow is over (and for later development, run off to the woods before really end)
SetFollowComplete();
}
// call not needed here, no known abilities
/*void UpdateFollowerAI(const uint32 uiDiff) override
{
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
return;
DoMeleeAttackIfReady();
}*/
};
CreatureAI* GetAI_npc_mist(Creature* pCreature)
{
return new npc_mistAI(pCreature);
}
bool QuestAccept_npc_mist(Player* pPlayer, Creature* pCreature, const Quest* pQuest)
{
if (pQuest->GetQuestId() == QUEST_MIST)
{
if (npc_mistAI* pMistAI = dynamic_cast<npc_mistAI*>(pCreature->AI()))
{
pMistAI->StartFollow(pPlayer, FACTION_DARNASSUS, pQuest);
}
}
return true;
}
void AddSC_teldrassil()
{
Script* pNewScript;
pNewScript = new Script;
pNewScript->Name = "npc_mist";
pNewScript->GetAI = &GetAI_npc_mist;
pNewScript->pQuestAcceptNPC = &QuestAccept_npc_mist;
pNewScript->RegisterSelf();
}
| lucasdnd/mangoszero-bots-test | src/modules/SD2/scripts/kalimdor/teldrassil.cpp | C++ | gpl-2.0 | 3,543 | [
30522,
1013,
1008,
1008,
1008,
5896,
24844,
2475,
2003,
2019,
5331,
2005,
24792,
2015,
4346,
9412,
2838,
2005,
1008,
2181,
27099,
1010,
7329,
1010,
2208,
5200,
1010,
12107,
1010,
5167,
1010,
1998,
11750,
3458,
1008,
1996,
12398,
7809,
5896,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.core;
import java.io.IOException;
import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener;
public class AsyncListenerWrapper {
private AsyncListener listener = null;
public void fireOnStartAsync(AsyncEvent event) throws IOException {
listener.onStartAsync(event);
}
public void fireOnComplete(AsyncEvent event) throws IOException {
listener.onComplete(event);
}
public void fireOnTimeout(AsyncEvent event) throws IOException {
listener.onTimeout(event);
}
public void fireOnError(AsyncEvent event) throws IOException {
listener.onError(event);
}
public AsyncListener getListener() {
return listener;
}
public void setListener(AsyncListener listener) {
this.listener = listener;
}
}
| wenzhucjy/tomcat_source | tomcat-8.0.9-sourcecode/java/org/apache/catalina/core/AsyncListenerWrapper.java | Java | apache-2.0 | 1,686 | [
30522,
1013,
1008,
1008,
7000,
2000,
1996,
15895,
4007,
3192,
1006,
2004,
2546,
1007,
2104,
2028,
2030,
2062,
1008,
12130,
6105,
10540,
1012,
2156,
1996,
5060,
5371,
5500,
2007,
1008,
2023,
2147,
2005,
3176,
2592,
4953,
9385,
6095,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
define([
'webgl/createProgram',
'webgl/shader/compileShaderFromFile'
], function(
createProgram,
compileShaderFromFile
) {
/**
* Creates a program from 2 script tags.
*
* @param {!WebGLRenderingContext} gl The WebGL Context.
* @param {string} vertexShaderFileName The file name of the vertex shader.
* @param {string} fragmentShaderFileName The file name of the fragment shader.
* @return {!WebGLProgram} A program
*/
return function createProgramFromScripts(gl, vertexShaderFileName, fragmentShaderFileName, callback) {
var async = !!callback;
if(async) {
compileShaderFromFile(gl, vertexShaderFileName, 'vertex', function(vertexShader) {
compileShaderFromFile(gl, fragmentShaderFileName, 'fragment', function(fragmentShader) {
callback(createProgram(gl, vertexShader, fragmentShader));
});
});
}
else {
return createProgram(gl,
compileShaderFromFile(gl, vertexShaderFileName, 'vertex'),
compileShaderFromFile(gl, fragmentShaderFileName, 'fragment'));
}
};
}); | bridgs/messing-with-webgl | javascripts/client/webgl/createProgramFromFiles.js | JavaScript | mit | 1,022 | [
30522,
9375,
1006,
1031,
1005,
4773,
23296,
1013,
3443,
21572,
13113,
1005,
1010,
1005,
4773,
23296,
1013,
8703,
2099,
1013,
4012,
22090,
7377,
4063,
19699,
5358,
8873,
2571,
1005,
1033,
1010,
3853,
1006,
3443,
21572,
13113,
1010,
4012,
220... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2005 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kie.workbench.common.widgets.metadata.client.widget;
import javax.inject.Inject;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Widget;
import org.guvnor.common.services.shared.metadata.model.Metadata;
/**
* This is a viewer/selector for tags.
* It will show a list of tags currently applicable, and allow you to
* remove/add to them.
* <p/>
* It is intended to work with the meta data form.
*/
public class TagWidget implements IsWidget {
private Metadata data;
private TagWidgetView view;
private boolean readOnly;
@Inject
public void setView( TagWidgetView view ) {
this.view = view;
view.setPresenter( this );
}
/**
* @param d The meta data.
* @param readOnly If it is to be non editable.
*/
public void setContent( Metadata d,
boolean readOnly ) {
this.data = d;
this.readOnly = readOnly;
view.setReadOnly(readOnly);
loadData();
}
public void onAddTags( String text ) {
if (text != null) {
String[] tags = text.split( " " );
for (String tag : tags) {
if (!data.getTags().contains( tag )) {
data.addTag( tag );
view.addTag( tag, readOnly );
}
}
}
}
public void onRemoveTag( String tag ) {
data.getTags().remove( tag );
loadData();
}
public void loadData( ) {
view.clear();
for (String tag : data.getTags()) {
view.addTag( tag, readOnly );
}
}
@Override
public Widget asWidget() {
if (view == null) initView();
return view.asWidget();
}
// TODO: remove this method when the MetaDataWidget is moved to MVP
private void initView() {
setView( new TagWidgetViewImpl() );
}
}
| jomarko/kie-wb-common | kie-wb-common-widgets/kie-wb-metadata-widget/src/main/java/org/kie/workbench/common/widgets/metadata/client/widget/TagWidget.java | Java | apache-2.0 | 2,542 | [
30522,
1013,
1008,
1008,
9385,
2384,
2417,
6045,
1010,
4297,
1012,
1998,
1013,
2030,
2049,
18460,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* Copyright (c) 2006-2007 Christopher J. W. Lloyd
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSObject.h>
@class NSNotification;
@interface NSNotificationObserver : NSObject {
id _observer;
SEL _selector;
}
- initWithObserver:object selector:(SEL)selector;
- observer;
- (void)postNotification:(NSNotification *)note;
@end
| ruppmatt/cocotron | Foundation/NSNotificationCenter/NSNotificationObserver.h | C | mit | 1,342 | [
30522,
1013,
1008,
9385,
1006,
1039,
1007,
2294,
1011,
2289,
5696,
1046,
1012,
1059,
1012,
6746,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
2000,
2151,
2711,
11381,
1037,
6100,
1997,
2023,
4007,
1998,
3378,
12653,
6764,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Prufa
=====
Testing, testing
| thorhildur13/Prufa | README.md | Markdown | mit | 30 | [
30522,
10975,
16093,
2050,
1027,
1027,
1027,
1027,
1027,
5604,
1010,
5604,
102,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
{% vizexercise %}
{% title %}
Add some margins between every two bars
{% data %}
[{name: 'China', pop: 1393783836},
{name: 'India', pop: 1267401849},
{name: 'USA', pop: 322583006},
{name: 'Indonesia', pop: 252812243}]
{% solution %}
function computeX(d, i) {
return i * 30
}
function computeHeight(d, i) {
return d.pop/3484459.59
}
function computeY(d, i) {
return 400 - d.pop/3484459.59
}
function computeColor(d, i) {
return 'red'
}
var viz = _.map(data, function(d, i){
return {
x: computeX(d, i),
y: computeY(d, i),
height: computeHeight(d, i),
color: computeColor(d, i)
}
})
console.log(viz)
var result = _.map(viz, function(d){
// invoke the compiled template function on each viz data
return template({d: d})
})
return result.join('\n')
{% template %}
<rect x="${d.x}"
y="${d.y}"
width="20"
height="${d.height}"
style="fill:${d.color};
stroke-width:3;
stroke:rgb(0,0,0)" />
{% output %}
<rect x="0"
y="0"
width="20"
height="400"
style="fill:red;
stroke-width:3;
stroke:rgb(0,0,0)" />
<rect x="30"
y="36.270183004188596"
width="20"
height="363.7298169958114"
style="fill:red;
stroke-width:3;
stroke:rgb(0,0,0)" />
<rect x="60"
y="307.4223713410894"
width="20"
height="92.57762865891063"
style="fill:red;
stroke-width:3;
stroke:rgb(0,0,0)" />
<rect x="90"
y="327.4457813413758"
width="20"
height="72.5542186586242"
style="fill:red;
stroke-width:3;
stroke:rgb(0,0,0)" />
{% endvizexercise %}
| ZachLamb/book | learning/week5/drills/margin.md | Markdown | mit | 1,776 | [
30522,
1063,
1003,
26619,
10288,
2121,
18380,
1003,
1065,
1063,
1003,
2516,
1003,
1065,
5587,
2070,
17034,
2090,
2296,
2048,
6963,
1063,
1003,
2951,
1003,
1065,
1031,
1063,
2171,
1024,
1005,
2859,
1005,
1010,
3769,
1024,
16621,
24434,
2620,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using OpenQA.Selenium;
using OpenQA.Selenium.Internal;
namespace Selenium.Internal.SeleniumEmulation
{
internal static class JavaScriptLibrary
{
private const string InjectableSeleniumResourceName = "injectableSelenium.js";
private const string HtmlUtilsResourceName = "htmlutils.js";
public static void CallEmbeddedSelenium(IWebDriver driver, string functionName, IWebElement element, params object[] values)
{
StringBuilder builder = new StringBuilder(ReadScript(InjectableSeleniumResourceName));
builder.Append("return browserbot.").Append(functionName).Append(".apply(browserbot, arguments);");
List<object> args = new List<object>();
args.Add(element);
args.AddRange(values);
((IJavaScriptExecutor)driver).ExecuteScript(builder.ToString(), args.ToArray());
}
public static object CallEmbeddedHtmlUtils(IWebDriver driver, string functionName, IWebElement element, params object[] values)
{
StringBuilder builder = new StringBuilder(ReadScript(HtmlUtilsResourceName));
builder.Append("return htmlutils.").Append(functionName).Append(".apply(htmlutils, arguments);");
List<object> args = new List<object>();
args.Add(element);
args.AddRange(values);
return ((IJavaScriptExecutor)driver).ExecuteScript(builder.ToString(), args.ToArray());
}
public static object ExecuteScript(IWebDriver driver, string script, params object[] args)
{
IJavaScriptExecutor executor = driver as IJavaScriptExecutor;
if (executor == null)
{
throw new InvalidOperationException("The underlying WebDriver instance does not support executing javascript");
}
else
{
return executor.ExecuteScript(script, args);
}
}
private static string ReadScript(string script)
{
string extractedScript = string.Empty;
Stream resourceStream = ResourceUtilities.GetResourceStream(script, script);
using (TextReader reader = new StreamReader(resourceStream))
{
extractedScript = reader.ReadToEnd();
}
return extractedScript;
}
}
}
| zerodiv/CTM-Windows-Agent | Continuum_Windows_Testing_Agent/Vendor/selenium/WebdriverBackedSelenium/Internal/SeleniumEmulation/JavaScriptLibrary.cs | C# | apache-2.0 | 2,460 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
22834,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
2330,
19062,
1012,
7367,
7770,
5007,
1025,
2478,
2330,
19062,
1012,
7367,
7770,
5007,
1012,
4722,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright (c) 2011-2014 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "omnicoinamountfield.h"
#include "omnicoinunits.h"
#include "guiconstants.h"
#include "qvaluecombobox.h"
#include <QApplication>
#include <QAbstractSpinBox>
#include <QHBoxLayout>
#include <QKeyEvent>
#include <QLineEdit>
/** QSpinBox that uses fixed-point numbers internally and uses our own
* formatting/parsing functions.
*/
class AmountSpinBox: public QAbstractSpinBox
{
Q_OBJECT
public:
explicit AmountSpinBox(QWidget *parent):
QAbstractSpinBox(parent),
currentUnit(OmnicoinUnits::OMC),
singleStep(100000) // satoshis
{
setAlignment(Qt::AlignRight);
connect(lineEdit(), SIGNAL(textEdited(QString)), this, SIGNAL(valueChanged()));
}
QValidator::State validate(QString &text, int &pos) const
{
if(text.isEmpty())
return QValidator::Intermediate;
bool valid = false;
parse(text, &valid);
/* Make sure we return Intermediate so that fixup() is called on defocus */
return valid ? QValidator::Intermediate : QValidator::Invalid;
}
void fixup(QString &input) const
{
bool valid = false;
CAmount val = parse(input, &valid);
if(valid)
{
input = OmnicoinUnits::format(currentUnit, val, false, OmnicoinUnits::separatorAlways);
lineEdit()->setText(input);
}
}
CAmount value(bool *valid_out=0) const
{
return parse(text(), valid_out);
}
void setValue(const CAmount& value)
{
lineEdit()->setText(OmnicoinUnits::format(currentUnit, value, false, OmnicoinUnits::separatorAlways));
Q_EMIT valueChanged();
}
void stepBy(int steps)
{
bool valid = false;
CAmount val = value(&valid);
val = val + steps * singleStep;
val = qMin(qMax(val, CAmount(0)), OmnicoinUnits::maxMoney());
setValue(val);
}
void setDisplayUnit(int unit)
{
bool valid = false;
CAmount val = value(&valid);
currentUnit = unit;
if(valid)
setValue(val);
else
clear();
}
void setSingleStep(const CAmount& step)
{
singleStep = step;
}
QSize minimumSizeHint() const
{
if(cachedMinimumSizeHint.isEmpty())
{
ensurePolished();
const QFontMetrics fm(fontMetrics());
int h = lineEdit()->minimumSizeHint().height();
int w = fm.width(OmnicoinUnits::format(OmnicoinUnits::OMC, OmnicoinUnits::maxMoney(), false, OmnicoinUnits::separatorAlways));
w += 2; // cursor blinking space
QStyleOptionSpinBox opt;
initStyleOption(&opt);
QSize hint(w, h);
QSize extra(35, 6);
opt.rect.setSize(hint + extra);
extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
QStyle::SC_SpinBoxEditField, this).size();
// get closer to final result by repeating the calculation
opt.rect.setSize(hint + extra);
extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
QStyle::SC_SpinBoxEditField, this).size();
hint += extra;
hint.setHeight(h);
opt.rect = rect();
cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this)
.expandedTo(QApplication::globalStrut());
}
return cachedMinimumSizeHint;
}
private:
int currentUnit;
CAmount singleStep;
mutable QSize cachedMinimumSizeHint;
/**
* Parse a string into a number of base monetary units and
* return validity.
* @note Must return 0 if !valid.
*/
CAmount parse(const QString &text, bool *valid_out=0) const
{
CAmount val = 0;
bool valid = OmnicoinUnits::parse(currentUnit, text, &val);
if(valid)
{
if(val < 0 || val > OmnicoinUnits::maxMoney())
valid = false;
}
if(valid_out)
*valid_out = valid;
return valid ? val : 0;
}
protected:
bool event(QEvent *event)
{
if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)
{
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
if (keyEvent->key() == Qt::Key_Comma)
{
// Translate a comma into a period
QKeyEvent periodKeyEvent(event->type(), Qt::Key_Period, keyEvent->modifiers(), ".", keyEvent->isAutoRepeat(), keyEvent->count());
return QAbstractSpinBox::event(&periodKeyEvent);
}
}
return QAbstractSpinBox::event(event);
}
StepEnabled stepEnabled() const
{
if (isReadOnly()) // Disable steps when AmountSpinBox is read-only
return StepNone;
if (text().isEmpty()) // Allow step-up with empty field
return StepUpEnabled;
StepEnabled rv = 0;
bool valid = false;
CAmount val = value(&valid);
if(valid)
{
if(val > 0)
rv |= StepDownEnabled;
if(val < OmnicoinUnits::maxMoney())
rv |= StepUpEnabled;
}
return rv;
}
Q_SIGNALS:
void valueChanged();
};
#include "omnicoinamountfield.moc"
OmnicoinAmountField::OmnicoinAmountField(QWidget *parent) :
QWidget(parent),
amount(0)
{
amount = new AmountSpinBox(this);
amount->setLocale(QLocale::c());
amount->installEventFilter(this);
amount->setMaximumWidth(170);
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(amount);
unit = new QValueComboBox(this);
unit->setModel(new OmnicoinUnits(this));
layout->addWidget(unit);
layout->addStretch(1);
layout->setContentsMargins(0,0,0,0);
setLayout(layout);
setFocusPolicy(Qt::TabFocus);
setFocusProxy(amount);
// If one if the widgets changes, the combined content changes as well
connect(amount, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
connect(unit, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged(int)));
// Set default based on configuration
unitChanged(unit->currentIndex());
}
void OmnicoinAmountField::clear()
{
amount->clear();
unit->setCurrentIndex(0);
}
void OmnicoinAmountField::setEnabled(bool fEnabled)
{
amount->setEnabled(fEnabled);
unit->setEnabled(fEnabled);
}
bool OmnicoinAmountField::validate()
{
bool valid = false;
value(&valid);
setValid(valid);
return valid;
}
void OmnicoinAmountField::setValid(bool valid)
{
if (valid)
amount->setStyleSheet("");
else
amount->setStyleSheet(STYLE_INVALID);
}
bool OmnicoinAmountField::eventFilter(QObject *object, QEvent *event)
{
if (event->type() == QEvent::FocusIn)
{
// Clear invalid flag on focus
setValid(true);
}
return QWidget::eventFilter(object, event);
}
QWidget *OmnicoinAmountField::setupTabChain(QWidget *prev)
{
QWidget::setTabOrder(prev, amount);
QWidget::setTabOrder(amount, unit);
return unit;
}
CAmount OmnicoinAmountField::value(bool *valid_out) const
{
return amount->value(valid_out);
}
void OmnicoinAmountField::setValue(const CAmount& value)
{
amount->setValue(value);
}
void OmnicoinAmountField::setReadOnly(bool fReadOnly)
{
amount->setReadOnly(fReadOnly);
}
void OmnicoinAmountField::unitChanged(int idx)
{
// Use description tooltip for current unit for the combobox
unit->setToolTip(unit->itemData(idx, Qt::ToolTipRole).toString());
// Determine new unit ID
int newUnit = unit->itemData(idx, OmnicoinUnits::UnitRole).toInt();
amount->setDisplayUnit(newUnit);
}
void OmnicoinAmountField::setDisplayUnit(int newUnit)
{
unit->setValue(newUnit);
}
void OmnicoinAmountField::setSingleStep(const CAmount& step)
{
amount->setSingleStep(step);
}
| MeshCollider/Omnicoin | src/qt/omnicoinamountfield.cpp | C++ | mit | 8,247 | [
30522,
1013,
1013,
9385,
1006,
1039,
1007,
2249,
1011,
2297,
1996,
2978,
3597,
2378,
4563,
9797,
1013,
1013,
5500,
2104,
1996,
10210,
4007,
6105,
1010,
2156,
1996,
10860,
1013,
1013,
5371,
24731,
2030,
8299,
1024,
1013,
1013,
7479,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.fincatto.nfe200.transformers;
import org.simpleframework.xml.transform.Transform;
import com.fincatto.nfe200.classes.NFNotaInfoSituacaoTributariaIPI;
public class NFNotaInfoSituacaoTributariaIPITransformer implements Transform<NFNotaInfoSituacaoTributariaIPI> {
@Override
public NFNotaInfoSituacaoTributariaIPI read(final String codigo) throws Exception {
return NFNotaInfoSituacaoTributariaIPI.valueOfCodigo(codigo);
}
@Override
public String write(final NFNotaInfoSituacaoTributariaIPI situacaoTributariaIPI) throws Exception {
return situacaoTributariaIPI.getCodigo();
}
} | daversilva/nfe | src/main/java/com/fincatto/nfe200/transformers/NFNotaInfoSituacaoTributariaIPITransformer.java | Java | apache-2.0 | 632 | [
30522,
7427,
4012,
1012,
10346,
11266,
3406,
1012,
1050,
7959,
28332,
1012,
19081,
1025,
12324,
8917,
1012,
3722,
15643,
6198,
1012,
20950,
1012,
10938,
1012,
10938,
1025,
12324,
4012,
1012,
10346,
11266,
3406,
1012,
1050,
7959,
28332,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2013 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.terasology.utilities.procedural;
import org.terasology.math.TeraMath;
import org.terasology.utilities.random.FastRandom;
/**
* A speed-improved simplex noise algorithm for Simplex noise in 2D, 3D and 4D.
* <br><br>
* Based on example code by Stefan Gustavson (stegu@itn.liu.se).
* Optimisations by Peter Eastman (peastman@drizzle.stanford.edu).
* Better rank ordering method by Stefan Gustavson in 2012.
* <br><br>
* This could be speeded up even further, but it's useful as it is.
* <br><br>
* Version 2012-03-09
* <br><br>
* This code was placed in the public domain by its original author,
* Stefan Gustavson. You may use it as you see fit, but
* attribution is appreciated.
* <br><br>
* See http://staffwww.itn.liu.se/~stegu/
* <br><br>
* msteiger: Introduced seed value
*/
public class SimplexNoise extends AbstractNoise implements Noise2D, Noise3D {
/**
* Multiply this with the gridDim provided and noise(x,x) will give tileable 1D noise which will tile
* when x crosses a multiple of (this * gridDim)
*/
public static final float TILEABLE1DMAGICNUMBER = 0.5773502691896258f;
private static Grad[] grad3 = {
new Grad(1, 1, 0), new Grad(-1, 1, 0), new Grad(1, -1, 0), new Grad(-1, -1, 0),
new Grad(1, 0, 1), new Grad(-1, 0, 1), new Grad(1, 0, -1), new Grad(-1, 0, -1),
new Grad(0, 1, 1), new Grad(0, -1, 1), new Grad(0, 1, -1), new Grad(0, -1, -1)};
private static Grad[] grad4 = {
new Grad(0, 1, 1, 1), new Grad(0, 1, 1, -1), new Grad(0, 1, -1, 1), new Grad(0, 1, -1, -1),
new Grad(0, -1, 1, 1), new Grad(0, -1, 1, -1), new Grad(0, -1, -1, 1), new Grad(0, -1, -1, -1),
new Grad(1, 0, 1, 1), new Grad(1, 0, 1, -1), new Grad(1, 0, -1, 1), new Grad(1, 0, -1, -1),
new Grad(-1, 0, 1, 1), new Grad(-1, 0, 1, -1), new Grad(-1, 0, -1, 1), new Grad(-1, 0, -1, -1),
new Grad(1, 1, 0, 1), new Grad(1, 1, 0, -1), new Grad(1, -1, 0, 1), new Grad(1, -1, 0, -1),
new Grad(-1, 1, 0, 1), new Grad(-1, 1, 0, -1), new Grad(-1, -1, 0, 1), new Grad(-1, -1, 0, -1),
new Grad(1, 1, 1, 0), new Grad(1, 1, -1, 0), new Grad(1, -1, 1, 0), new Grad(1, -1, -1, 0),
new Grad(-1, 1, 1, 0), new Grad(-1, 1, -1, 0), new Grad(-1, -1, 1, 0), new Grad(-1, -1, -1, 0)};
// Skewing and unskewing factors for 2, 3, and 4 dimensions
private static final float F2 = 0.5f * (float) (Math.sqrt(3.0f) - 1.0f);
private static final float G2 = (3.0f - (float) Math.sqrt(3.0f)) / 6.0f;
private static final float F3 = 1.0f / 3.0f;
private static final float G3 = 1.0f / 6.0f;
private static final float F4 = ((float) Math.sqrt(5.0f) - 1.0f) / 4.0f;
private static final float G4 = (5.0f - (float) Math.sqrt(5.0f)) / 20.0f;
private final short[] perm;
private final short[] permMod12;
private final int permCount;
/**
* Initialize permutations with a given seed and grid dimension.
*
* @param seed a seed value used for permutation shuffling
*/
public SimplexNoise(long seed) {
this(seed, 256);
}
/**
* Initialize permutations with a given seed and grid dimension.
* Supports 1D tileable noise
* @see SimplexNoise#tileable1DMagicNumber
*
* @param seed a seed value used for permutation shuffling
* @param gridDim gridDim x gridDim will be the number of squares in the square grid formed after skewing the simplices belonging to once "tile"
*/
public SimplexNoise(long seed, int gridDim) {
FastRandom rand = new FastRandom(seed);
permCount = gridDim;
perm = new short[permCount * 2];
permMod12 = new short[permCount * 2];
short[] p = new short[permCount];
// Initialize with all values [0..(permCount-1)]
for (short i = 0; i < permCount; i++) {
p[i] = i;
}
// Shuffle the array
for (int i = 0; i < permCount; i++) {
int j = rand.nextInt(permCount);
short swap = p[i];
p[i] = p[j];
p[j] = swap;
}
for (int i = 0; i < permCount * 2; i++) {
perm[i] = p[i % permCount];
permMod12[i] = (short) (perm[i] % 12);
}
}
private static float dot(Grad g, float x, float y) {
return g.x * x + g.y * y;
}
private static float dot(Grad g, float x, float y, float z) {
return g.x * x + g.y * y + g.z * z;
}
private static float dot(Grad g, float x, float y, float z, float w) {
return g.x * x + g.y * y + g.z * z + g.w * w;
}
/**
* 2D simplex noise
*
* @param xin the x input coordinate
* @param yin the y input coordinate
* @return a noise value in the interval [-1,1]
*/
@Override
public float noise(float xin, float yin) {
float n0;
float n1;
float n2; // Noise contributions from the three corners
// Skew the input space to determine which simplex cell we're in
float s = (xin + yin) * F2; // Hairy factor for 2D
int i = TeraMath.floorToInt(xin + s);
int j = TeraMath.floorToInt(yin + s);
float t = (i + j) * G2;
float xo0 = i - t; // Unskew the cell origin back to (x,y) space
float yo0 = j - t;
float x0 = xin - xo0; // The x,y distances from the cell origin
float y0 = yin - yo0;
// For the 2D case, the simplex shape is an equilateral triangle.
// Determine which simplex we are in.
int i1; // Offsets for second (middle) corner of simplex in (i,j) coords
int j1;
if (x0 > y0) { // lower triangle, XY order: (0,0)->(1,0)->(1,1)
i1 = 1;
j1 = 0;
} else { // upper triangle, YX order: (0,0)->(0,1)->(1,1)
i1 = 0;
j1 = 1;
}
// A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and
// a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where
// c = (3-sqrt(3))/6
float x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords
float y1 = y0 - j1 + G2;
float x2 = x0 - 1.0f + 2.0f * G2; // Offsets for last corner in (x,y) unskewed coords
float y2 = y0 - 1.0f + 2.0f * G2;
// Work out the hashed gradient indices of the three simplex corners
int ii = Math.floorMod(i, permCount);
int jj = Math.floorMod(j, permCount);
int gi0 = permMod12[ii + perm[jj]];
int gi1 = permMod12[ii + i1 + perm[jj + j1]];
int gi2 = permMod12[ii + 1 + perm[jj + 1]];
// Calculate the contribution from the three corners
float t0 = 0.5f - x0 * x0 - y0 * y0;
if (t0 < 0) {
n0 = 0.0f;
} else {
t0 *= t0;
n0 = t0 * t0 * dot(grad3[gi0], x0, y0); // (x,y) of grad3 used for 2D gradient
}
float t1 = 0.5f - x1 * x1 - y1 * y1;
if (t1 < 0) {
n1 = 0.0f;
} else {
t1 *= t1;
n1 = t1 * t1 * dot(grad3[gi1], x1, y1);
}
float t2 = 0.5f - x2 * x2 - y2 * y2;
if (t2 < 0) {
n2 = 0.0f;
} else {
t2 *= t2;
n2 = t2 * t2 * dot(grad3[gi2], x2, y2);
}
// Add contributions from each corner to get the final noise value.
// The result is scaled to return values in the interval [-1,1].
return 70.0f * (n0 + n1 + n2);
}
/**
* 3D simplex noise
*
* @param xin the x input coordinate
* @param yin the y input coordinate
* @param zin the z input coordinate
* @return a noise value in the interval [-1,1]
*/
@Override
public float noise(float xin, float yin, float zin) {
float n0;
float n1;
float n2;
float n3; // Noise contributions from the four corners
// Skew the input space to determine which simplex cell we're in
float s = (xin + yin + zin) * F3; // Very nice and simple skew factor for 3D
int i = TeraMath.floorToInt(xin + s);
int j = TeraMath.floorToInt(yin + s);
int k = TeraMath.floorToInt(zin + s);
float t = (i + j + k) * G3;
float xo0 = i - t; // Unskew the cell origin back to (x,y,z) space
float yo0 = j - t;
float zo0 = k - t;
float x0 = xin - xo0; // The x,y,z distances from the cell origin
float y0 = yin - yo0;
float z0 = zin - zo0;
// For the 3D case, the simplex shape is a slightly irregular tetrahedron.
// Determine which simplex we are in.
int i1;
int j1;
int k1; // Offsets for second corner of simplex in (i,j,k) coords
int i2;
int j2;
int k2; // Offsets for third corner of simplex in (i,j,k) coords
if (x0 >= y0) {
if (y0 >= z0) { // X Y Z order
i1 = 1;
j1 = 0;
k1 = 0;
i2 = 1;
j2 = 1;
k2 = 0;
} else if (x0 >= z0) { // X Z Y order
i1 = 1;
j1 = 0;
k1 = 0;
i2 = 1;
j2 = 0;
k2 = 1;
} else { // Z X Y order
i1 = 0;
j1 = 0;
k1 = 1;
i2 = 1;
j2 = 0;
k2 = 1;
}
} else { // x0<y0
if (y0 < z0) { // Z Y X order
i1 = 0;
j1 = 0;
k1 = 1;
i2 = 0;
j2 = 1;
k2 = 1;
} else if (x0 < z0) { // Y Z X order
i1 = 0;
j1 = 1;
k1 = 0;
i2 = 0;
j2 = 1;
k2 = 1;
} else { // Y X Z order
i1 = 0;
j1 = 1;
k1 = 0;
i2 = 1;
j2 = 1;
k2 = 0;
}
}
// A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z),
// a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and
// a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where
// c = 1/6.
float x1 = x0 - i1 + G3; // Offsets for second corner in (x,y,z) coords
float y1 = y0 - j1 + G3;
float z1 = z0 - k1 + G3;
float x2 = x0 - i2 + 2.0f * G3; // Offsets for third corner in (x,y,z) coords
float y2 = y0 - j2 + 2.0f * G3;
float z2 = z0 - k2 + 2.0f * G3;
float x3 = x0 - 1.0f + 3.0f * G3; // Offsets for last corner in (x,y,z) coords
float y3 = y0 - 1.0f + 3.0f * G3;
float z3 = z0 - 1.0f + 3.0f * G3;
// Work out the hashed gradient indices of the four simplex corners
int ii = Math.floorMod(i, permCount);
int jj = Math.floorMod(j, permCount);
int kk = Math.floorMod(k, permCount);
int gi0 = permMod12[ii + perm[jj + perm[kk]]];
int gi1 = permMod12[ii + i1 + perm[jj + j1 + perm[kk + k1]]];
int gi2 = permMod12[ii + i2 + perm[jj + j2 + perm[kk + k2]]];
int gi3 = permMod12[ii + 1 + perm[jj + 1 + perm[kk + 1]]];
// Calculate the contribution from the four corners
float t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0;
if (t0 < 0) {
n0 = 0.0f;
} else {
t0 *= t0;
n0 = t0 * t0 * dot(grad3[gi0], x0, y0, z0);
}
float t1 = 0.6f - x1 * x1 - y1 * y1 - z1 * z1;
if (t1 < 0) {
n1 = 0.0f;
} else {
t1 *= t1;
n1 = t1 * t1 * dot(grad3[gi1], x1, y1, z1);
}
float t2 = 0.6f - x2 * x2 - y2 * y2 - z2 * z2;
if (t2 < 0) {
n2 = 0.0f;
} else {
t2 *= t2;
n2 = t2 * t2 * dot(grad3[gi2], x2, y2, z2);
}
float t3 = 0.6f - x3 * x3 - y3 * y3 - z3 * z3;
if (t3 < 0) {
n3 = 0.0f;
} else {
t3 *= t3;
n3 = t3 * t3 * dot(grad3[gi3], x3, y3, z3);
}
// Add contributions from each corner to get the final noise value.
// The result is scaled to stay just inside [-1,1]
return 32.0f * (n0 + n1 + n2 + n3);
}
/**
* 4D simplex noise, better simplex rank ordering method 2012-03-09
*
* @param xin the x input coordinate
* @param yin the y input coordinate
* @param zin the z input coordinate
* @return a noise value in the interval [-1,1]
*/
public float noise(float xin, float yin, float zin, float win) {
float n0;
float n1;
float n2;
float n3;
float n4; // Noise contributions from the five corners
// Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in
float s = (xin + yin + zin + win) * F4; // Factor for 4D skewing
int i = TeraMath.floorToInt(xin + s);
int j = TeraMath.floorToInt(yin + s);
int k = TeraMath.floorToInt(zin + s);
int l = TeraMath.floorToInt(win + s);
float t = (i + j + k + l) * G4; // Factor for 4D unskewing
float xo0 = i - t; // Unskew the cell origin back to (x,y,z,w) space
float yo0 = j - t;
float zo0 = k - t;
float wo0 = l - t;
float x0 = xin - xo0; // The x,y,z,w distances from the cell origin
float y0 = yin - yo0;
float z0 = zin - zo0;
float w0 = win - wo0;
// For the 4D case, the simplex is a 4D shape I won't even try to describe.
// To find out which of the 24 possible simplices we're in, we need to
// determine the magnitude ordering of x0, y0, z0 and w0.
// Six pair-wise comparisons are performed between each possible pair
// of the four coordinates, and the results are used to rank the numbers.
int rankx = 0;
int ranky = 0;
int rankz = 0;
int rankw = 0;
if (x0 > y0) {
rankx++;
} else {
ranky++;
}
if (x0 > z0) {
rankx++;
} else {
rankz++;
}
if (x0 > w0) {
rankx++;
} else {
rankw++;
}
if (y0 > z0) {
ranky++;
} else {
rankz++;
}
if (y0 > w0) {
ranky++;
} else {
rankw++;
}
if (z0 > w0) {
rankz++;
} else {
rankw++;
}
int i1;
int j1;
int k1;
int l1; // The integer offsets for the second simplex corner
int i2;
int j2;
int k2;
int l2; // The integer offsets for the third simplex corner
int i3;
int j3;
int k3;
int l3; // The integer offsets for the fourth simplex corner
// simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order.
// Many values of c will never occur, since e.g. x>y>z>w makes x<z, y<w and x<w
// impossible. Only the 24 indices which have non-zero entries make any sense.
// We use a thresholding to set the coordinates in turn from the largest magnitude.
// Rank 3 denotes the largest coordinate.
i1 = rankx >= 3 ? 1 : 0;
j1 = ranky >= 3 ? 1 : 0;
k1 = rankz >= 3 ? 1 : 0;
l1 = rankw >= 3 ? 1 : 0;
// Rank 2 denotes the second largest coordinate.
i2 = rankx >= 2 ? 1 : 0;
j2 = ranky >= 2 ? 1 : 0;
k2 = rankz >= 2 ? 1 : 0;
l2 = rankw >= 2 ? 1 : 0;
// Rank 1 denotes the second smallest coordinate.
i3 = rankx >= 1 ? 1 : 0;
j3 = ranky >= 1 ? 1 : 0;
k3 = rankz >= 1 ? 1 : 0;
l3 = rankw >= 1 ? 1 : 0;
// The fifth corner has all coordinate offsets = 1, so no need to compute that.
float x1 = x0 - i1 + G4; // Offsets for second corner in (x,y,z,w) coords
float y1 = y0 - j1 + G4;
float z1 = z0 - k1 + G4;
float w1 = w0 - l1 + G4;
float x2 = x0 - i2 + 2.0f * G4; // Offsets for third corner in (x,y,z,w) coords
float y2 = y0 - j2 + 2.0f * G4;
float z2 = z0 - k2 + 2.0f * G4;
float w2 = w0 - l2 + 2.0f * G4;
float x3 = x0 - i3 + 3.0f * G4; // Offsets for fourth corner in (x,y,z,w) coords
float y3 = y0 - j3 + 3.0f * G4;
float z3 = z0 - k3 + 3.0f * G4;
float w3 = w0 - l3 + 3.0f * G4;
float x4 = x0 - 1.0f + 4.0f * G4; // Offsets for last corner in (x,y,z,w) coords
float y4 = y0 - 1.0f + 4.0f * G4;
float z4 = z0 - 1.0f + 4.0f * G4;
float w4 = w0 - 1.0f + 4.0f * G4;
// Work out the hashed gradient indices of the five simplex corners
int ii = Math.floorMod(i, permCount);
int jj = Math.floorMod(j, permCount);
int kk = Math.floorMod(k, permCount);
int ll = Math.floorMod(l, permCount);
int gi0 = perm[ii + perm[jj + perm[kk + perm[ll]]]] % 32;
int gi1 = perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]] % 32;
int gi2 = perm[ii + i2 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]] % 32;
int gi3 = perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]] % 32;
int gi4 = perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32;
// Calculate the contribution from the five corners
float t0 = 0.6f - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;
if (t0 < 0) {
n0 = 0.0f;
} else {
t0 *= t0;
n0 = t0 * t0 * dot(grad4[gi0], x0, y0, z0, w0);
}
float t1 = 0.6f - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;
if (t1 < 0) {
n1 = 0.0f;
} else {
t1 *= t1;
n1 = t1 * t1 * dot(grad4[gi1], x1, y1, z1, w1);
}
float t2 = 0.6f - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;
if (t2 < 0) {
n2 = 0.f;
} else {
t2 *= t2;
n2 = t2 * t2 * dot(grad4[gi2], x2, y2, z2, w2);
}
float t3 = 0.6f - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;
if (t3 < 0) {
n3 = 0.0f;
} else {
t3 *= t3;
n3 = t3 * t3 * dot(grad4[gi3], x3, y3, z3, w3);
}
float t4 = 0.6f - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;
if (t4 < 0) {
n4 = 0.0f;
} else {
t4 *= t4;
n4 = t4 * t4 * dot(grad4[gi4], x4, y4, z4, w4);
}
// Sum up and scale the result to cover the range [-1,1]
return 27.0f * (n0 + n1 + n2 + n3 + n4);
}
// Inner class to speed up gradient computations
// (array access is a lot slower than member access)
private static class Grad {
float x;
float y;
float z;
float w;
Grad(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
Grad(float x, float y, float z, float w) {
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
}
}
| Malanius/Terasology | engine/src/main/java/org/terasology/utilities/procedural/SimplexNoise.java | Java | apache-2.0 | 19,875 | [
30522,
1013,
1008,
1008,
9385,
2286,
3048,
23467,
2015,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
1008,
2017,
2089,
2025,
2224,
2023,
5371,
3272,
1999,
12646,
2007,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>OpenISA Dynamic Binary Translator: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="oi.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">OpenISA Dynamic Binary Translator
 <span id="projectnumber">0.0.1</span>
</div>
<div id="projectbrief">This project implements the Dynamic Binary Translator for the OpenISA Instruction Set. Besides, it implement the Region Formation Techniques such as NET, MRET2, NETPLUS, ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('structspp___1_1cvt_3_01const_01std_1_1pair_3_01const_01_k_00_01_v_01_4_01_4.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">spp_::cvt< const std::pair< const K, V > > Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="structspp___1_1cvt_3_01const_01std_1_1pair_3_01const_01_k_00_01_v_01_4_01_4.html">spp_::cvt< const std::pair< const K, V > ></a>, including all inherited members.</p>
<table class="directory">
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>type</b> typedef (defined in <a class="el" href="structspp___1_1cvt_3_01const_01std_1_1pair_3_01const_01_k_00_01_v_01_4_01_4.html">spp_::cvt< const std::pair< const K, V > ></a>)</td><td class="entry"><a class="el" href="structspp___1_1cvt_3_01const_01std_1_1pair_3_01const_01_k_00_01_v_01_4_01_4.html">spp_::cvt< const std::pair< const K, V > ></a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>
| OpenISA/oi-dbt | doc/html/structspp___1_1cvt_3_01const_01std_1_1pair_3_01const_01_k_00_01_v_01_4_01_4-members.html | HTML | mit | 5,992 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying
* LICENSE file.
*/
package com.pivotal.gemfirexd.internal.impl.services.cache;
import com.pivotal.gemfirexd.internal.iapi.error.StandardException;
import com.pivotal.gemfirexd.internal.iapi.reference.SQLState;
import com.pivotal.gemfirexd.internal.iapi.services.cache.Cacheable;
import com.pivotal.gemfirexd.internal.iapi.services.cache.CacheableFactory;
/**
* An extension to {@link ConcurrentCache} for GemFireXD that sets the identity
* on a {@link CacheEntry} before inserting into the cache. This is to avoid
* deadlock scenario with DDL read-write locks:
*
* distributed write lock (other VM) -> local write lock -> cache hit with
* existing entry -> {@link CacheEntry#waitUntilIdentityIsSet()}
*
* cache miss -> cache put -> {@link Cacheable#setIdentity(Object)} -> read from
* SYSTABLES -> local read lock
*
* See bug #40683 for more details.
*
* Currently this is only used for <code>TDCacheble</code>s while for other
* {@link Cacheable}s the normal {@link ConcurrentCache} is used.
*
* @see ConcurrentCache
*
* @author swale
*/
final class GfxdConcurrentCache extends ConcurrentCache {
/**
* Creates a new cache manager.
*
* @param holderFactory
* factory which creates <code>Cacheable</code>s
* @param name
* the name of the cache
* @param initialSize
* the initial capacity of the cache
* @param maxSize
* maximum number of elements in the cache
*/
GfxdConcurrentCache(CacheableFactory holderFactory, String name,
int initialSize, int maxSize) {
super(holderFactory, name, initialSize, maxSize);
}
// Overrides of ConcurrentCache
/**
* Find an object in the cache. If it is not present, add it to the cache. The
* returned object is kept until <code>release()</code> is called.
*
* @param key
* identity of the object to find
* @return the cached object, or <code>null</code> if it cannot be found
*/
@Override
public Cacheable find(Object key) throws StandardException {
if (stopped) {
return null;
}
Cacheable item;
CacheEntry entry = cache.get(key);
while (true) {
if (entry != null) {
// Found an entry in the cache, lock it.
entry.lock();
if (entry.isValid()) {
try {
// Entry is still valid. Return it.
item = entry.getCacheable();
// The object is already cached. Increase the use count and
// return it.
entry.keep(true);
return item;
} finally {
entry.unlock();
}
}
else {
// This entry has been removed from the cache while we were
// waiting for the lock. Unlock it and try again.
entry.unlock();
entry = cache.get(key);
}
}
else {
entry = new CacheEntry(true);
// Lock the entry before it's inserted in free slot.
entry.lock();
try {
// The object is not cached. Insert the entry into a free
// slot and retrieve a reusable Cacheable.
item = insertIntoFreeSlot(key, entry);
} finally {
entry.unlock();
}
// Set the identity without holding the lock on the entry. If we
// hold the lock, we may run into a deadlock if the user code in
// setIdentity() re-enters the buffer manager.
Cacheable itemWithIdentity = item.setIdentity(key);
if (itemWithIdentity != null) {
entry.setCacheable(itemWithIdentity);
// add the entry to cache
CacheEntry oldEntry = cache.putIfAbsent(key, entry);
if (oldEntry != null) {
// Someone inserted the entry while we created a new
// one. Retry with the entry currently in the cache.
entry = oldEntry;
}
else {
// We successfully inserted a new entry.
return itemWithIdentity;
}
}
else {
return null;
}
}
}
}
/**
* Create an object in the cache. The object is kept until
* <code>release()</code> is called.
*
* @param key
* identity of the object to create
* @param createParameter
* parameters passed to <code>Cacheable.createIdentity()</code>
* @return a reference to the cached object, or <code>null</code> if the
* object cannot be created
* @exception StandardException
* if the object is already in the cache, or if some other error
* occurs
* @see Cacheable#createIdentity(Object,Object)
*/
@Override
public Cacheable create(Object key, Object createParameter)
throws StandardException {
if (stopped) {
return null;
}
Cacheable item;
CacheEntry entry = new CacheEntry(true);
// Lock the entry before it's inserted in free slot.
entry.lock();
try {
// The object is not cached. Insert the entry into a free
// slot and retrieve a reusable Cacheable.
item = insertIntoFreeSlot(key, entry);
} finally {
entry.unlock();
}
// Create the identity without holding the lock on the entry.
// Otherwise, we may run into a deadlock if the user code in
// createIdentity() re-enters the buffer manager.
Cacheable itemWithIdentity = item.createIdentity(key, createParameter);
if (itemWithIdentity != null) {
entry.setCacheable(itemWithIdentity);
if (cache.putIfAbsent(key, entry) != null) {
// We can't create the object if it's already in the cache.
throw StandardException.newException(SQLState.OBJECT_EXISTS_IN_CACHE,
name, key);
}
}
return itemWithIdentity;
}
}
| papicella/snappy-store | gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/services/cache/GfxdConcurrentCache.java | Java | apache-2.0 | 6,422 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2230,
1011,
2325,
20369,
4007,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
1008,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#include "ExampleOne.h"
ExampleOneWrite::ExampleOneWrite(std::string name): SamClass(name)
{
}
void ExampleOneWrite::SamInit(void)
{
myint=0;
newPort(&myfirst2, "W2"); // add new port
newPort(&myfirst, "W1");
StartModule();
puts("started writer");
}
void ExampleOneWrite::SamIter(void)
{
Bottle& B = myfirst.prepare(); // prepare the bottle/port
B.clear();
B.addInt(myint++);
myfirst.write(); // add stuff then send
Bottle& C = myfirst2.prepare();
C.clear();
C.addInt(myint+5);
myfirst2.write();
puts("running writer");
}
////////////////////////////////////////////////////////////////////////////////
ExampleTwoRead::ExampleTwoRead(std::string name): SamClass(name)
{
}
void ExampleTwoRead::SamInit(void)
{
myint=0;
newPort(&myfirst, "R1");
StartModule();
puts("started reader");
}
void ExampleTwoRead::SamIter(void)
{
puts("running reader");
Bottle *input = myfirst.read(false); // get in the input from the port, if
// you want it to wait use true, else use false
if(input!=NULL) // check theres data
{
puts("got a msg");
puts(input->toString());
}
else
puts("didn't get a msg");
}
////////////////////////////////////////////////////////////////////////////////
ExampleThreeSendClass::ExampleThreeSendClass(std::string name): SamClass(name)
{
}
void ExampleThreeSendClass::SamInit(void)
{
//name = "/SClass";
myint=0;
newPort(&myfirst, "Out");
StartModule();
}
void ExampleThreeSendClass::SamIter(void)
{
myint++;
BinPortable<DataForm> &MyData = myfirst.prepare(); // prepare data/port
MyData.content().x=myint;
MyData.content().y=myint+5;
MyData.content().p=myint+10;
myfirst.write(); // add stuff and write
}
////////////////////////////////////////////////////////////////////////////////
// a Interupt port, when data hits this port it'll do whatever is onread, be
// carefull, fast firing interupts can cause big problems as in normal code
void DataPort ::onRead(BinPortable<DataForm>& b)
{
printf("X %i Y %i P %i \n",b.content().x,b.content().y,b.content().p);
}
ExampleFourReciveClassInterupt::ExampleFourReciveClassInterupt(std::string name): SamClass(name)
{
}
void ExampleFourReciveClassInterupt::SamInit(void)
{
myint=0;
//name="/RClass";
newPort(&myfirst, "In");
myfirst.useCallback(); // this tells it to use the onread method
StartModule();
}
void ExampleFourReciveClassInterupt::SamIter(void)
{
}
| nurv/lirec | libs/SAMGAR/trunk/Modules/Examples/ExampleOne.cpp | C++ | gpl-3.0 | 2,618 | [
30522,
1001,
2421,
1000,
2742,
5643,
1012,
1044,
1000,
2742,
5643,
26373,
1024,
1024,
2742,
5643,
26373,
1006,
2358,
2094,
1024,
1024,
5164,
2171,
1007,
1024,
3520,
26266,
1006,
2171,
1007,
1063,
1065,
11675,
2742,
5643,
26373,
1024,
1024,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import propertyTest from '../../helpers/propertyTest'
propertyTest('DTEND', {
transformableValue: new Date('1991-03-07 09:00:00'),
transformedValue: '19910307T090000'
})
| angeloashmore/ics-js | test/unit/properties/DTEND.js | JavaScript | isc | 175 | [
30522,
12324,
3200,
22199,
2013,
1005,
1012,
1012,
1013,
1012,
1012,
1013,
2393,
2545,
1013,
3200,
22199,
1005,
3200,
22199,
1006,
1005,
26718,
10497,
1005,
1010,
1063,
10938,
3085,
10175,
5657,
1024,
2047,
3058,
1006,
1005,
2889,
1011,
602... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2016 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License, version
* 2.0 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package io.netty.handler.flow;
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
import io.netty.channel.ChannelConfig;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.util.ReferenceCountUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import java.net.SocketAddress;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Exchanger;
import java.util.concurrent.atomic.AtomicReference;
import static java.util.concurrent.TimeUnit.*;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class FlowControlHandlerTest {
private static EventLoopGroup GROUP;
@BeforeClass
public static void init() {
GROUP = new NioEventLoopGroup();
}
@AfterClass
public static void destroy() {
GROUP.shutdownGracefully();
}
/**
* The {@link OneByteToThreeStringsDecoder} decodes this {@code byte[]} into three messages.
*/
private static ByteBuf newOneMessage() {
return Unpooled.wrappedBuffer(new byte[]{ 1 });
}
private static Channel newServer(final boolean autoRead, final ChannelHandler... handlers) {
assertTrue(handlers.length >= 1);
ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(GROUP)
.channel(NioServerSocketChannel.class)
.childOption(ChannelOption.AUTO_READ, autoRead)
.childHandler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) throws Exception {
ChannelPipeline pipeline = ch.pipeline();
pipeline.addLast(new OneByteToThreeStringsDecoder());
pipeline.addLast(handlers);
}
});
return serverBootstrap.bind(0)
.syncUninterruptibly()
.channel();
}
private static Channel newClient(SocketAddress server) {
Bootstrap bootstrap = new Bootstrap();
bootstrap.group(GROUP)
.channel(NioSocketChannel.class)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000)
.handler(new ChannelInboundHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
fail("In this test the client is never receiving a message from the server.");
}
});
return bootstrap.connect(server)
.syncUninterruptibly()
.channel();
}
/**
* This test demonstrates the default behavior if auto reading
* is turned on from the get-go and you're trying to turn it off
* once you've received your first message.
*
* NOTE: This test waits for the client to disconnect which is
* interpreted as the signal that all {@code byte}s have been
* transferred to the server.
*/
@Test
public void testAutoReadingOn() throws Exception {
final CountDownLatch latch = new CountDownLatch(3);
ChannelInboundHandlerAdapter handler = new ChannelInboundHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
ReferenceCountUtil.release(msg);
// We're turning off auto reading in the hope that no
// new messages are being sent but that is not true.
ctx.channel().config().setAutoRead(false);
latch.countDown();
}
};
Channel server = newServer(true, handler);
Channel client = newClient(server.localAddress());
try {
client.writeAndFlush(newOneMessage())
.syncUninterruptibly();
// We received three messages even through auto reading
// was turned off after we received the first message.
assertTrue(latch.await(1L, SECONDS));
} finally {
client.close();
server.close();
}
}
/**
* This test demonstrates the default behavior if auto reading
* is turned off from the get-go and you're calling read() in
* the hope that only one message will be returned.
*
* NOTE: This test waits for the client to disconnect which is
* interpreted as the signal that all {@code byte}s have been
* transferred to the server.
*/
@Test
public void testAutoReadingOff() throws Exception {
final Exchanger<Channel> peerRef = new Exchanger<Channel>();
final CountDownLatch latch = new CountDownLatch(3);
ChannelInboundHandlerAdapter handler = new ChannelInboundHandlerAdapter() {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
peerRef.exchange(ctx.channel(), 1L, SECONDS);
ctx.fireChannelActive();
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
ReferenceCountUtil.release(msg);
latch.countDown();
}
};
Channel server = newServer(false, handler);
Channel client = newClient(server.localAddress());
try {
// The client connection on the server side
Channel peer = peerRef.exchange(null, 1L, SECONDS);
// Write the message
client.writeAndFlush(newOneMessage())
.syncUninterruptibly();
// Read the message
peer.read();
// We received all three messages but hoped that only one
// message was read because auto reading was off and we
// invoked the read() method only once.
assertTrue(latch.await(1L, SECONDS));
} finally {
client.close();
server.close();
}
}
/**
* The {@link FlowControlHandler} will simply pass-through all messages
* if auto reading is on and remains on.
*/
@Test
public void testFlowAutoReadOn() throws Exception {
final CountDownLatch latch = new CountDownLatch(3);
ChannelInboundHandlerAdapter handler = new ChannelDuplexHandler() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
latch.countDown();
}
};
FlowControlHandler flow = new FlowControlHandler();
Channel server = newServer(true, flow, handler);
Channel client = newClient(server.localAddress());
try {
// Write the message
client.writeAndFlush(newOneMessage())
.syncUninterruptibly();
// We should receive 3 messages
assertTrue(latch.await(1L, SECONDS));
assertTrue(flow.isQueueEmpty());
} finally {
client.close();
server.close();
}
}
/**
* The {@link FlowControlHandler} will pass down messages one by one
* if {@link ChannelConfig#setAutoRead(boolean)} is being toggled.
*/
@Test
public void testFlowToggleAutoRead() throws Exception {
final Exchanger<Channel> peerRef = new Exchanger<Channel>();
final CountDownLatch msgRcvLatch1 = new CountDownLatch(1);
final CountDownLatch msgRcvLatch2 = new CountDownLatch(1);
final CountDownLatch msgRcvLatch3 = new CountDownLatch(1);
final CountDownLatch setAutoReadLatch1 = new CountDownLatch(1);
final CountDownLatch setAutoReadLatch2 = new CountDownLatch(1);
ChannelInboundHandlerAdapter handler = new ChannelInboundHandlerAdapter() {
private int msgRcvCount;
private int expectedMsgCount;
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
peerRef.exchange(ctx.channel(), 1L, SECONDS);
ctx.fireChannelActive();
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws InterruptedException {
ReferenceCountUtil.release(msg);
// Disable auto reading after each message
ctx.channel().config().setAutoRead(false);
if (msgRcvCount++ != expectedMsgCount) {
return;
}
switch (msgRcvCount) {
case 1:
msgRcvLatch1.countDown();
if (setAutoReadLatch1.await(1L, SECONDS)) {
++expectedMsgCount;
}
break;
case 2:
msgRcvLatch2.countDown();
if (setAutoReadLatch2.await(1L, SECONDS)) {
++expectedMsgCount;
}
break;
default:
msgRcvLatch3.countDown();
break;
}
}
};
FlowControlHandler flow = new FlowControlHandler();
Channel server = newServer(true, flow, handler);
Channel client = newClient(server.localAddress());
try {
// The client connection on the server side
Channel peer = peerRef.exchange(null, 1L, SECONDS);
client.writeAndFlush(newOneMessage())
.syncUninterruptibly();
// channelRead(1)
assertTrue(msgRcvLatch1.await(1L, SECONDS));
// channelRead(2)
peer.config().setAutoRead(true);
setAutoReadLatch1.countDown();
assertTrue(msgRcvLatch1.await(1L, SECONDS));
// channelRead(3)
peer.config().setAutoRead(true);
setAutoReadLatch2.countDown();
assertTrue(msgRcvLatch3.await(1L, SECONDS));
assertTrue(flow.isQueueEmpty());
} finally {
client.close();
server.close();
}
}
/**
* The {@link FlowControlHandler} will pass down messages one by one
* if auto reading is off and the user is calling {@code read()} on
* their own.
*/
@Test
public void testFlowAutoReadOff() throws Exception {
final Exchanger<Channel> peerRef = new Exchanger<Channel>();
final CountDownLatch msgRcvLatch1 = new CountDownLatch(1);
final CountDownLatch msgRcvLatch2 = new CountDownLatch(2);
final CountDownLatch msgRcvLatch3 = new CountDownLatch(3);
ChannelInboundHandlerAdapter handler = new ChannelDuplexHandler() {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelActive();
peerRef.exchange(ctx.channel(), 1L, SECONDS);
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
msgRcvLatch1.countDown();
msgRcvLatch2.countDown();
msgRcvLatch3.countDown();
}
};
FlowControlHandler flow = new FlowControlHandler();
Channel server = newServer(false, flow, handler);
Channel client = newClient(server.localAddress());
try {
// The client connection on the server side
Channel peer = peerRef.exchange(null, 1L, SECONDS);
// Write the message
client.writeAndFlush(newOneMessage())
.syncUninterruptibly();
// channelRead(1)
peer.read();
assertTrue(msgRcvLatch1.await(1L, SECONDS));
// channelRead(2)
peer.read();
assertTrue(msgRcvLatch2.await(1L, SECONDS));
// channelRead(3)
peer.read();
assertTrue(msgRcvLatch3.await(1L, SECONDS));
assertTrue(flow.isQueueEmpty());
} finally {
client.close();
server.close();
}
}
@Test
public void testReentranceNotCausesNPE() throws Throwable {
final Exchanger<Channel> peerRef = new Exchanger<Channel>();
final CountDownLatch latch = new CountDownLatch(3);
final AtomicReference<Throwable> causeRef = new AtomicReference<Throwable>();
ChannelInboundHandlerAdapter handler = new ChannelDuplexHandler() {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelActive();
peerRef.exchange(ctx.channel(), 1L, SECONDS);
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
latch.countDown();
ctx.read();
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
causeRef.set(cause);
}
};
FlowControlHandler flow = new FlowControlHandler();
Channel server = newServer(false, flow, handler);
Channel client = newClient(server.localAddress());
try {
// The client connection on the server side
Channel peer = peerRef.exchange(null, 1L, SECONDS);
// Write the message
client.writeAndFlush(newOneMessage())
.syncUninterruptibly();
// channelRead(1)
peer.read();
assertTrue(latch.await(1L, SECONDS));
assertTrue(flow.isQueueEmpty());
Throwable cause = causeRef.get();
if (cause != null) {
throw cause;
}
} finally {
client.close();
server.close();
}
}
/**
* This is a fictional message decoder. It decodes each {@code byte}
* into three strings.
*/
private static final class OneByteToThreeStringsDecoder extends ByteToMessageDecoder {
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
for (int i = 0; i < in.readableBytes(); i++) {
out.add("1");
out.add("2");
out.add("3");
}
in.readerIndex(in.readableBytes());
}
}
}
| bryce-anderson/netty | handler/src/test/java/io/netty/handler/flow/FlowControlHandlerTest.java | Java | apache-2.0 | 15,662 | [
30522,
1013,
1008,
1008,
9385,
2355,
1996,
5658,
3723,
2622,
1008,
1008,
1996,
5658,
3723,
2622,
15943,
2023,
5371,
2000,
2017,
2104,
1996,
15895,
6105,
1010,
2544,
1008,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* The MIT License (MIT)
*
* Copyright (c) 2014-2016 abel533@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package tk.mybatis.springboot.model;
/**
* @author liuzh_3nofxnp
* @since 2016-01-22 22:16
*/
public class City extends BaseEntity {
private String name;
private String state;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
| wangshijun101/JavaSenior | spider-web/src/main/java/tk/mybatis/springboot/model/City.java | Java | apache-2.0 | 1,614 | [
30522,
1013,
1008,
1008,
1996,
10210,
6105,
1006,
10210,
1007,
1008,
1008,
9385,
1006,
1039,
1007,
2297,
1011,
2355,
16768,
22275,
2509,
1030,
20917,
4014,
1012,
4012,
1008,
1008,
6656,
2003,
2182,
3762,
4379,
1010,
2489,
1997,
3715,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// AutoDetectStream.cpp
//
// $Id: //poco/1.4/Zip/src/AutoDetectStream.cpp#1 $
//
// Library: Zip
// Package: Zip
// Module: AutoDetectStream
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/Zip/AutoDetectStream.h"
#include "Poco/Zip/ZipLocalFileHeader.h"
#include "Poco/Zip/ZipArchiveInfo.h"
#include "Poco/Zip/ZipDataInfo.h"
#include "Poco/Zip/ZipFileInfo.h"
#include "Poco/Exception.h"
#include <cstring>
namespace Poco {
namespace Zip {
AutoDetectStreamBuf::AutoDetectStreamBuf(std::istream& in, const std::string& pre, const std::string& post, bool reposition, Poco::UInt32 start):
Poco::BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in),
_pIstr(&in),
_pOstr(0),
_eofDetected(false),
_matchCnt(0),
_prefix(pre),
_postfix(post),
_reposition(reposition),
_start(start)
{
}
AutoDetectStreamBuf::AutoDetectStreamBuf(std::ostream& out):
Poco::BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::out),
_pIstr(0),
_pOstr(&out),
_eofDetected(false),
_matchCnt(0),
_prefix(),
_postfix(),
_reposition(false),
_start(0u)
{
}
AutoDetectStreamBuf::~AutoDetectStreamBuf()
{
}
int AutoDetectStreamBuf::readFromDevice(char* buffer, std::streamsize length)
{
poco_assert_dbg(length >= 8);
if (_pIstr == 0 ||length == 0) return -1;
if (_reposition)
{
_pIstr->seekg(_start, std::ios_base::beg);
_reposition = false;
if (!_pIstr->good()) return -1;
}
if (!_prefix.empty())
{
std::streamsize tmp = (_prefix.size() > length)? length: static_cast<std::streamsize>(_prefix.size());
std::memcpy(buffer, _prefix.c_str(), tmp);
_prefix = _prefix.substr(tmp);
return tmp;
}
if (_eofDetected)
{
if (!_postfix.empty())
{
std::streamsize tmp = (_postfix.size() > length)? length: static_cast<std::streamsize>(_postfix.size());
std::memcpy(buffer, _postfix.c_str(), tmp);
_postfix = _postfix.substr(tmp);
return tmp;
}
else
return -1;
}
if (!_pIstr->good())
return -1;
char byte3('\x00');
std::streamsize tempPos = 0;
static std::istream::int_type eof = std::istream::traits_type::eof();
while (_pIstr->good() && !_pIstr->eof() && (tempPos+4) < length)
{
std::istream::int_type c = _pIstr->get();
if (c != eof)
{
// all zip headers start with the same 2byte prefix
if (_matchCnt<2)
{
if (c == ZipLocalFileHeader::HEADER[_matchCnt])
++_matchCnt;
else
{
// matchcnt was either 0 or 1 the headers have all unique chars -> safe to set to 0
if (_matchCnt == 1)
{
buffer[tempPos++] = ZipLocalFileHeader::HEADER[0];
}
_matchCnt = 0;
buffer[tempPos++] = static_cast<char>(c);
}
}
else
{
//the upper 2 bytes differ: the lower one must be in range 1,3,5,7, the upper must be one larger: 2,4,6,8
if (_matchCnt == 2)
{
if (ZipLocalFileHeader::HEADER[2] == c ||
ZipArchiveInfo::HEADER[2] == c ||
ZipFileInfo::HEADER[2] == c ||
ZipDataInfo::HEADER[2] == c)
{
byte3 = static_cast<char>(c);;
_matchCnt++;
}
else
{
buffer[tempPos++] = ZipLocalFileHeader::HEADER[0];
buffer[tempPos++] = ZipLocalFileHeader::HEADER[1];
buffer[tempPos++] = static_cast<char>(c);
_matchCnt = 0;
}
}
else if (_matchCnt == 3)
{
if (c-1 == byte3)
{
// a match, seek back first, try pushback as fallback
_pIstr->seekg(-4, std::ios::cur);
if (!_pIstr->good()) throw Poco::IOException("Failed to seek on input stream");
_eofDetected = true;
return tempPos;
}
else
{
buffer[tempPos++] = ZipLocalFileHeader::HEADER[0];
buffer[tempPos++] = ZipLocalFileHeader::HEADER[1];
buffer[tempPos++] = byte3;
buffer[tempPos++] = c;
_matchCnt = 0; //the headers have all unique chars -> safe to set to 0
}
}
}
}
}
return tempPos;
}
int AutoDetectStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
{
if (_pOstr == 0 || length == 0) return -1;
_pOstr->write(buffer, length);
if (_pOstr->good())
return length;
throw Poco::IOException("Failed to write to output stream");
}
AutoDetectIOS::AutoDetectIOS(std::istream& istr, const std::string& pre, const std::string& post, bool reposition, Poco::UInt32 start):
_buf(istr, pre, post, reposition, start)
{
poco_ios_init(&_buf);
}
AutoDetectIOS::AutoDetectIOS(std::ostream& ostr): _buf(ostr)
{
poco_ios_init(&_buf);
}
AutoDetectIOS::~AutoDetectIOS()
{
}
AutoDetectStreamBuf* AutoDetectIOS::rdbuf()
{
return &_buf;
}
AutoDetectInputStream::AutoDetectInputStream(std::istream& istr, const std::string& pre, const std::string& post, bool reposition, Poco::UInt32 start):
AutoDetectIOS(istr, pre, post, reposition, start),
std::istream(&_buf)
{
}
AutoDetectInputStream::~AutoDetectInputStream()
{
}
AutoDetectOutputStream::AutoDetectOutputStream(std::ostream& ostr):
AutoDetectIOS(ostr),
std::ostream(&_buf)
{
}
AutoDetectOutputStream::~AutoDetectOutputStream()
{
}
} } // namespace Poco::Zip
| nextsmsversion/macchina.io | platform/Zip/src/AutoDetectStream.cpp | C++ | apache-2.0 | 5,092 | [
30522,
1013,
1013,
1013,
1013,
8285,
3207,
26557,
3215,
25379,
1012,
18133,
2361,
1013,
1013,
1013,
1013,
1002,
8909,
1024,
1013,
1013,
13433,
3597,
1013,
1015,
1012,
1018,
1013,
14101,
1013,
5034,
2278,
1013,
8285,
3207,
26557,
3215,
25379... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
title: 異言の賜物
date: 08/07/2018
---
イエスの命令に従い、信者たちはエルサレムで約束の“霊”を待ちました。彼らは熱心に祈り、心から悔い改め、賛美しながら待ったのです。その日が来たとき、彼らは「一つになって集まって」(使徒 2:1)いました。たぶん、使徒言行録 1章の同じ家の上の部屋でしょう。しかし間もなく、彼らはもっと公の場に出て行くことになります(同 2:6 ~ 13)。
使徒言行録 2:1 ~ 3を読んでください。“霊”の注ぎの光景は強烈なものでした。突然、激しい嵐のとどろきのような音が天から聞こえてきてその場を満たし、次には炎の舌のようなものがあらわれて、そこにいた人々の上にとどまったのです。聖書では、「神の顕現」、つまり神が姿をあらわされることに、火や風がしばしば伴います(例えば、出 3:2、19:18、申 4:15)。加えて、火や風は神の“霊”をあらわすためにも用いられます(ヨハ 3:8、マタ3:11)。五旬祭の場合、そのような現象の正確な意味がどうであれ、それらは、約束された霊”の注ぎという特異な瞬間が救済史の中に入り込んだしるしでした。
“霊”は常に働いてこられました。旧約聖書の時代、神の民に対するその影響力は、しばしば目立つ形であらわれましたが、決して満ちあふれるほどではありませんでした。「父祖の時代には聖霊の感化はしばしば著しく現されたが、決して満ちあふれるほどではなかった。今、救い主のみ言葉に従って、弟子たちはこの賜物を懇願し、天においてはキリストがそのとりなしをしておられた。主はその民にみ霊を注ぐことができるように、み霊の賜物をお求めになったのである」(『希望への光』1369 ページ、『患難から栄光へ』上巻 31 ページ)。
バプテスマのヨハネは、メシアの到来に伴う“霊”によるバプテスマを予告し(ルカ3:16 参照、使徒 11:16と比較)、イエス御自身もこのことを何度か口になさいました(ルカ24:49、使徒 1:8)。この注ぎは、神の前におけるイエスの最初の執り成しの業だったのでしょう(ヨハ14:16、26、15:26)。五旬祭で、その約束は成就しました。
五旬祭での“霊”によるバプテスマは、十字架におけるイエスの勝利と天でイエスが高められたことに関係する特別な出来事でしたが、“霊”に満たされることは、信者たちの人生の中で継続的に繰り返される体験です(使徒 4:8、31、11:24、13:9、52、エフェ5:18)。
`◆ あなた自身の人生の中で“霊”が働いておられるというどのような証拠を、あなたは持っていますか。` | imasaru/sabbath-school-lessons | src/ja/2018-03/02/02.md | Markdown | mit | 3,079 | [
30522,
1011,
1011,
1011,
2516,
1024,
100,
100,
1671,
100,
100,
3058,
1024,
5511,
1013,
5718,
1013,
2760,
1011,
1011,
1011,
1695,
30224,
30233,
30197,
100,
100,
1668,
100,
1647,
1635,
1767,
100,
1661,
30188,
30198,
30224,
30259,
30231,
302... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import json
import bottle
from pyrouted.util import make_spec
def route(method, path):
def decorator(f):
f.http_route = path
f.http_method = method
return f
return decorator
class APIv1(object):
prefix = '/v1'
def __init__(self, ndb, config):
self.ndb = ndb
self.config = config
@route('GET', '/sources')
def sources_list(self, mode='short'):
ret = {}
mode = bottle.request.query.mode or mode
for name, spec in self.ndb.sources.items():
ret[name] = {'class': spec.nl.__class__.__name__,
'status': spec.status}
if mode == 'full':
ret[name]['config'] = spec.nl_kwarg
return bottle.template('{{!ret}}', ret=json.dumps(ret))
@route('PUT', '/sources')
def sources_restart(self):
node = bottle.request.body.getvalue().decode('utf-8')
self.ndb.sources[node].start()
@route('POST', '/sources')
def sources_add(self):
data = bottle.request.body.getvalue().decode('utf-8')
node, spec = make_spec(data, self.config)
self.config['sources'].append(node)
self.ndb.connect_source(node, spec)
@route('DELETE', '/sources')
def sources_del(self):
node = bottle.request.body.getvalue().decode('utf-8')
self.config['sources'].remove(node)
self.ndb.disconnect_source(node)
@route('GET', '/config')
def config_get(self):
return bottle.template('{{!ret}}',
ret=json.dumps(self.config))
@route('PUT', '/config')
def config_dump(self):
path = bottle.request.body.getvalue().decode('utf-8')
self.config.dump(path)
@route('GET', '/<name:re:(%s|%s|%s|%s|%s|%s)>' % ('interfaces',
'addresses',
'routes',
'neighbours',
'vlans',
'bridges'))
def view(self, name):
ret = []
obj = getattr(self.ndb, name)
for line in obj.dump():
ret.append(line)
return bottle.template('{{!ret}}', ret=json.dumps(ret))
@route('GET', '/query/<name:re:(%s|%s|%s|%s)>' % ('nodes',
'p2p_edges',
'l2_edges',
'l3_edges'))
def query(self, name):
ret = []
obj = getattr(self.ndb.query, name)
for line in obj():
ret.append(line)
return bottle.template('{{!ret}}', ret=json.dumps(ret))
| svinota/pyrouted | pyrouted/api.py | Python | gpl-2.0 | 2,803 | [
30522,
12324,
1046,
3385,
12324,
5835,
2013,
1052,
12541,
5833,
2098,
1012,
21183,
4014,
12324,
2191,
1035,
28699,
13366,
2799,
1006,
4118,
1010,
4130,
1007,
1024,
13366,
25545,
8844,
1006,
1042,
1007,
1024,
1042,
1012,
8299,
1035,
2799,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (c) 2003, the JUNG Project and the Regents of the University
* of California
* All rights reserved.
*
* This software is open-source under the BSD license; see either
* "license.txt" or
* http://jung.sourceforge.net/license.txt for a description.
*/
/*
*
* Created on Oct 29, 2003
*/
package edu.uci.ics.jung.algorithms.util;
import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Queue;
import java.util.Vector;
import org.apache.commons.collections15.IteratorUtils;
/**
* An array-based binary heap implementation of a priority queue,
* which also provides
* efficient <code>update()</code> and <code>contains</code> operations.
* It contains extra infrastructure (a hash table) to keep track of the
* position of each element in the array; thus, if the key value of an element
* changes, it may be "resubmitted" to the heap via <code>update</code>
* so that the heap can reposition it efficiently, as necessary.
*
* @author Joshua O'Madadhain
*/
public class MapBinaryHeap<T>
extends AbstractCollection<T>
implements Queue<T>
{
private Vector<T> heap = new Vector<T>(); // holds the heap as an implicit binary tree
private Map<T,Integer> object_indices = new HashMap<T,Integer>(); // maps each object in the heap to its index in the heap
private Comparator<T> comp;
private final static int TOP = 0; // the index of the top of the heap
/**
* Creates a <code>MapBinaryHeap</code> whose heap ordering
* is based on the ordering of the elements specified by <code>c</code>.
*/
public MapBinaryHeap(Comparator<T> comp)
{
initialize(comp);
}
/**
* Creates a <code>MapBinaryHeap</code> whose heap ordering
* will be based on the <i>natural ordering</i> of the elements,
* which must be <code>Comparable</code>.
*/
public MapBinaryHeap()
{
initialize(new ComparableComparator());
}
/**
* Creates a <code>MapBinaryHeap</code> based on the specified
* collection whose heap ordering
* will be based on the <i>natural ordering</i> of the elements,
* which must be <code>Comparable</code>.
*/
public MapBinaryHeap(Collection<T> c)
{
this();
addAll(c);
}
/**
* Creates a <code>MapBinaryHeap</code> based on the specified collection
* whose heap ordering
* is based on the ordering of the elements specified by <code>c</code>.
*/
public MapBinaryHeap(Collection<T> c, Comparator<T> comp)
{
this(comp);
addAll(c);
}
private void initialize(Comparator<T> comp)
{
this.comp = comp;
clear();
}
/**
* @see Collection#clear()
*/
@Override
public void clear()
{
object_indices.clear();
heap.clear();
}
/**
* Inserts <code>o</code> into this collection.
*/
@Override
public boolean add(T o)
{
int i = heap.size(); // index 1 past the end of the heap
heap.setSize(i+1);
percolateUp(i, o);
return true;
}
/**
* Returns <code>true</code> if this collection contains no elements, and
* <code>false</code> otherwise.
*/
@Override
public boolean isEmpty()
{
return heap.isEmpty();
}
/**
* Returns the element at the top of the heap; does not
* alter the heap.
*/
public T peek()
{
if (heap.size() > 0)
return heap.elementAt(TOP);
else
return null;
}
/**
* Removes the element at the top of this heap, and returns it.
* @deprecated Use {@link MapBinaryHeap#poll()}
* or {@link MapBinaryHeap#remove()} instead.
*/
@Deprecated
public T pop() throws NoSuchElementException
{
return this.remove();
}
/**
* Returns the size of this heap.
*/
@Override
public int size()
{
return heap.size();
}
/**
* Informs the heap that this object's internal key value has been
* updated, and that its place in the heap may need to be shifted
* (up or down).
* @param o
*/
public void update(T o)
{
// Since we don't know whether the key value increased or
// decreased, we just percolate up followed by percolating down;
// one of the two will have no effect.
int cur = object_indices.get(o).intValue(); // current index
int new_idx = percolateUp(cur, o);
percolateDown(new_idx);
}
/**
* @see Collection#contains(java.lang.Object)
*/
@Override
public boolean contains(Object o)
{
return object_indices.containsKey(o);
}
/**
* Moves the element at position <code>cur</code> closer to
* the bottom of the heap, or returns if no further motion is
* necessary. Calls itself recursively if further motion is
* possible.
*/
private void percolateDown(int cur)
{
int left = lChild(cur);
int right = rChild(cur);
int smallest;
if ((left < heap.size()) &&
(comp.compare(heap.elementAt(left), heap.elementAt(cur)) < 0)) {
smallest = left;
} else {
smallest = cur;
}
if ((right < heap.size()) &&
(comp.compare(heap.elementAt(right), heap.elementAt(smallest)) < 0)) {
smallest = right;
}
if (cur != smallest)
{
swap(cur, smallest);
percolateDown(smallest);
}
}
/**
* Moves the element <code>o</code> at position <code>cur</code>
* as high as it can go in the heap. Returns the new position of the
* element in the heap.
*/
private int percolateUp(int cur, T o)
{
int i = cur;
while ((i > TOP) && (comp.compare(heap.elementAt(parent(i)), o) > 0))
{
T parentElt = heap.elementAt(parent(i));
heap.setElementAt(parentElt, i);
object_indices.put(parentElt, new Integer(i)); // reset index to i (new location)
i = parent(i);
}
// place object in heap at appropriate place
object_indices.put(o, new Integer(i));
heap.setElementAt(o, i);
return i;
}
/**
* Returns the index of the left child of the element at
* index <code>i</code> of the heap.
* @param i
* @return the index of the left child of the element at
* index <code>i</code> of the heap
*/
private int lChild(int i)
{
return (i<<1) + 1;
}
/**
* Returns the index of the right child of the element at
* index <code>i</code> of the heap.
* @param i
* @return the index of the right child of the element at
* index <code>i</code> of the heap
*/
private int rChild(int i)
{
return (i<<1) + 2;
}
/**
* Returns the index of the parent of the element at
* index <code>i</code> of the heap.
* @param i
* @return the index of the parent of the element at index i of the heap
*/
private int parent(int i)
{
return (i-1)>>1;
}
/**
* Swaps the positions of the elements at indices <code>i</code>
* and <code>j</code> of the heap.
* @param i
* @param j
*/
private void swap(int i, int j)
{
T iElt = heap.elementAt(i);
T jElt = heap.elementAt(j);
heap.setElementAt(jElt, i);
object_indices.put(jElt, new Integer(i));
heap.setElementAt(iElt, j);
object_indices.put(iElt, new Integer(j));
}
/**
* Comparator used if none is specified in the constructor.
* @author Joshua O'Madadhain
*/
private class ComparableComparator implements Comparator<T>
{
/**
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
@SuppressWarnings("unchecked")
public int compare(T arg0, T arg1)
{
if (!(arg0 instanceof Comparable) || !(arg1 instanceof Comparable))
throw new IllegalArgumentException("Arguments must be Comparable");
return ((Comparable<T>)arg0).compareTo(arg1);
}
}
/**
* Returns an <code>Iterator</code> that does not support modification
* of the heap.
*/
@Override
public Iterator<T> iterator()
{
return IteratorUtils.<T>unmodifiableIterator(heap.iterator());
}
/**
* This data structure does not support the removal of arbitrary elements.
*/
@Override
public boolean remove(Object o)
{
throw new UnsupportedOperationException();
}
/**
* This data structure does not support the removal of arbitrary elements.
*/
@Override
public boolean removeAll(Collection<?> c)
{
throw new UnsupportedOperationException();
}
/**
* This data structure does not support the removal of arbitrary elements.
*/
@Override
public boolean retainAll(Collection<?> c)
{
throw new UnsupportedOperationException();
}
public T element() throws NoSuchElementException
{
T top = this.peek();
if (top == null)
throw new NoSuchElementException();
return top;
}
public boolean offer(T o)
{
return add(o);
}
public T poll()
{
T top = this.peek();
if (top != null)
{
T bottom_elt = heap.lastElement();
heap.setElementAt(bottom_elt, TOP);
object_indices.put(bottom_elt, new Integer(TOP));
heap.setSize(heap.size() - 1); // remove the last element
if (heap.size() > 1)
percolateDown(TOP);
object_indices.remove(top);
}
return top;
}
public T remove()
{
T top = this.poll();
if (top == null)
throw new NoSuchElementException();
return top;
}
}
| xiaohanz/softcontroller | third-party/net.sf.jung2/src/main/java/edu/uci/ics/jung/algorithms/util/MapBinaryHeap.java | Java | epl-1.0 | 10,002 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2494,
1010,
1996,
11810,
2622,
1998,
1996,
22832,
1997,
1996,
2118,
1008,
1997,
2662,
1008,
2035,
2916,
9235,
1012,
1008,
1008,
2023,
4007,
2003,
2330,
1011,
3120,
2104,
1996,
18667,
2094,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import os
import string
import random
import logging
from thug.ActiveX.modules import WScriptShell
from thug.ActiveX.modules import TextStream
from thug.ActiveX.modules import File
from thug.ActiveX.modules import Folder
from thug.OS.Windows import win32_files
from thug.OS.Windows import win32_folders
log = logging.getLogger("Thug")
def BuildPath(self, arg0, arg1): # pylint:disable=unused-argument
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] BuildPath("{arg0}", "{arg1}")')
return f"{arg0}\\{arg1}"
def CopyFile(self, source, destination, overwritefiles = False): # pylint:disable=unused-argument
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] CopyFile("{source}", "{destination}")')
log.TextFiles[destination] = log.TextFiles[source]
def DeleteFile(self, filespec, force = False): # pylint:disable=unused-argument
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] DeleteFile("{filespec}", {force})')
def CreateTextFile(self, filename, overwrite = False, _unicode = False): # pylint:disable=unused-argument
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] CreateTextFile("{filename}", '
f'"{overwrite}", '
f'"{_unicode}")')
stream = TextStream.TextStream()
stream._filename = filename
return stream
def CreateFolder(self, path): # pylint:disable=unused-argument
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] CreateFolder("{path}")')
return Folder.Folder(path)
def FileExists(self, filespec): # pylint:disable=unused-argument
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] FileExists("{filespec}")')
if not filespec:
return True
if filespec.lower() in win32_files:
return True
if getattr(log, "TextFiles", None) and filespec in log.TextFiles:
return True
return False
def FolderExists(self, folder): # pylint:disable=unused-argument
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] FolderExists("{folder}")')
return str(folder).lower() in win32_folders
def GetExtensionName(self, path): # pylint:disable=unused-argument
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] GetExtensionName("{path}")')
ext = os.path.splitext(path)[1]
return ext if ext else ""
def GetFile(self, filespec): # pylint:disable=unused-argument
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] GetFile("{filespec}")')
return File.File(filespec)
def GetSpecialFolder(self, arg):
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] GetSpecialFolder("{arg}")')
arg = int(arg)
folder = ''
if arg == 0:
folder = WScriptShell.ExpandEnvironmentStrings(self, "%windir%")
elif arg == 1:
folder = WScriptShell.ExpandEnvironmentStrings(self, "%SystemRoot%\\system32")
elif arg == 2:
folder = WScriptShell.ExpandEnvironmentStrings(self, "%TEMP%")
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] Returning {folder} for GetSpecialFolder("{arg}")')
return folder
def GetTempName(self): # pylint:disable=unused-argument
log.ThugLogging.add_behavior_warn('[Scripting.FileSystemObject ActiveX] GetTempName()')
return ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(8))
def MoveFile(self, source, destination): # pylint:disable=unused-argument
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] MoveFile("{source}", "{destination}")')
log.TextFiles[destination] = log.TextFiles[source]
del log.TextFiles[source]
def OpenTextFile(self, sFilePathAndName, ForWriting = True, flag = True):
log.ThugLogging.add_behavior_warn(f'[Scripting.FileSystemObject ActiveX] OpenTextFile("{sFilePathAndName}", '
f'"{ForWriting}" ,'
f'"{flag}")')
log.ThugLogging.log_exploit_event(self._window.url,
"Scripting.FileSystemObject ActiveX",
"OpenTextFile",
data = {
"filename" : sFilePathAndName,
"ForWriting": ForWriting,
"flag" : flag
},
forward = False)
if getattr(log, 'TextFiles', None) is None:
log.TextFiles = {}
if sFilePathAndName in log.TextFiles:
return log.TextFiles[sFilePathAndName]
stream = TextStream.TextStream()
stream._filename = sFilePathAndName
if log.ThugOpts.local and sFilePathAndName in (log.ThugLogging.url, ): # pragma: no cover
with open(sFilePathAndName, encoding = 'utf-8', mode = 'r') as fd:
data = fd.read()
stream.Write(data)
log.TextFiles[sFilePathAndName] = stream
return stream
| buffer/thug | thug/ActiveX/modules/ScriptingFileSystemObject.py | Python | gpl-2.0 | 5,185 | [
30522,
12324,
9808,
12324,
5164,
12324,
6721,
12324,
15899,
2013,
26599,
1012,
3161,
2595,
1012,
14184,
12324,
1059,
22483,
4095,
5349,
2013,
26599,
1012,
3161,
2595,
1012,
14184,
12324,
6981,
25379,
2013,
26599,
1012,
3161,
2595,
1012,
14184... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package eu.atos.sla.service.jpa;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.util.Date;
import java.util.UUID;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import eu.atos.sla.dao.IAgreementDAO;
import eu.atos.sla.dao.IViolationDAO;
import eu.atos.sla.dao.IViolationDAO.SearchParameters;
import eu.atos.sla.datamodel.IViolation;
import eu.atos.sla.datamodel.bean.Violation;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/sla-repository-db-JPA-test-context.xml")
public class ViolationDAOJpaTest extends
AbstractTransactionalJUnit4SpringContextTests {
@Autowired
IViolationDAO violationDAO;
@Autowired
IAgreementDAO agreementDAO;
@Test
public void notNull() {
if (violationDAO == null)
fail();
}
@Test
public void getById() {
String violationUuid = UUID.randomUUID().toString();
Date dateTime = new Date(2323L);
IViolation violation = new Violation();
IViolation violationSaved = new Violation();
violation.setUuid(violationUuid);
violation.setContractUuid(UUID.randomUUID().toString());
violation.setServiceName("Service name");
violation.setServiceScope("Service scope");
violation.setKpiName("response time");
violation.setDatetime(dateTime);
violation.setExpectedValue("3.0");
violation.setActualValue("5.0");
try {
violationSaved = violationDAO.save(violation);
} catch (Exception e) {
fail();
}
Long id = violationSaved.getId();
violationSaved = violationDAO.getById(id);
assertEquals("response time", violationSaved.getKpiName());
assertEquals("3.0", violationSaved.getExpectedValue());
IViolation nullBreach = violationDAO.getById(new Long(30000));
assertEquals(null, nullBreach);
}
@Test
public void testSearch() {
SearchParameters params = new IViolationDAO.SearchParameters();
params.setAgreementId(null);
params.setGuaranteeTermName(null);
params.setProviderUuid(null);
params.setBegin(null);
params.setEnd(null);
violationDAO.search(params);
}
}
| Atos-FiwareOps/sla-framework | sla-core/sla-repository/src/test/java/eu/atos/sla/service/jpa/ViolationDAOJpaTest.java | Java | apache-2.0 | 2,415 | [
30522,
7427,
7327,
1012,
2012,
2891,
1012,
22889,
2050,
1012,
2326,
1012,
16545,
2050,
1025,
12324,
10763,
8917,
1012,
12022,
4183,
1012,
20865,
1012,
20865,
2063,
26426,
2015,
1025,
12324,
10763,
8917,
1012,
12022,
4183,
1012,
20865,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
defined('IN_ADMIN') or exit('No permission resources.');
include $this->admin_tpl('header','admin');
?>
<div class="pad_10">
<div class="table-list">
<form name="searchform" action="" method="get" >
<input type="hidden" value="pay" name="m">
<input type="hidden" value="payment" name="c">
<input type="hidden" value="pay_stat" name="a">
<input type="hidden" value="<?php echo $_GET['menuid']?>" name="menuid">
<div class="explain-col search-form">
<?php echo L('username')?> <input type="text" value="<?php echo $username?>" class="input-text" name="info[username]">
<?php echo L('addtime')?> <?php echo form::date('info[start_addtime]',$start_addtime)?><?php echo L('to')?> <?php echo form::date('info[end_addtime]',$end_addtime)?>
<?php echo form::select($trade_status,$status,'name="info[status]"', L('all_status'))?>
<input type="submit" value="<?php echo L('search')?>" class="button" name="dosubmit">
</div>
</form>
<fieldset>
<legend><?php echo L('finance').L('totalize')?></legend>
<table width="100%" class="table_form">
<tbody>
<tr>
<th width="80"><?php echo L('total').L('transactions')?></th>
<td class="y-bg"><?php echo L('money')?> <span class="font-fixh green"><?php echo $total_amount_num?></span> <?php echo L('bi')?>(<?php echo L('trade_succ').L('trade')?> <span class="font-fixh"><?php echo $total_amount_num_succ?></span> <?php echo L('bi')?>)<br/><?php echo L('point')?> <span class="font-fixh green"><?php echo $total_point_num?></span> <?php echo L('bi')?>(<?php echo L('trade_succ').L('trade')?> <span class="font-fixh"><?php echo $total_point_num_succ?></span> <?php echo L('bi')?>)</td>
</tr>
<tr>
<th width="80"><?php echo L('total').L('amount')?></th>
<td class="y-bg"><span class="font-fixh green"><?php echo $total_amount?></span> <?php echo L('yuan')?>(<?php echo L('trade_succ').L('trade')?> <span class="font-fixh"><?php echo $total_amount_succ?></span><?php echo L('yuan')?>)<br/><span class="font-fixh green"><?php echo $total_point?></span><?php echo L('dian')?>(<?php echo L('trade_succ').L('trade')?> <span class="font-fixh"><?php echo $total_point_succ?></span><?php echo L('dian')?>)</td>
</tr>
</table>
</fieldset>
<div class="bk10"></div>
<fieldset>
<legend><?php echo L('query_stat')?></legend>
<table width="100%" class="table_form">
<tbody>
<?php if($num) {?>
<tr>
<th width="80"><?php echo L('total_transactions')?>:</th>
<td class="y-bg"><?php echo L('money')?>:<span class="font-fixh green"><?php echo $amount_num?></span> <?php echo L('bi')?>(<?php echo L('transactions_success')?>:<span class="font-fixh"><?php echo $amount_num_succ?></span> <?php echo L('bi')?>)<br/><?php echo L('point')?>:<span class="font-fixh green"><?php echo $point_num?></span> <?php echo L('bi')?>(<?php echo L('transactions_success')?>:<span class="font-fixh"><?php echo $point_num_succ?></span> <?php echo L('bi')?>)</td>
</tr>
<tr>
<th width="80"><?php echo L('total').L('amount')?>:</th>
<td class="y-bg"><span class="font-fixh green"><?php echo $amount?></span><?php echo L('yuan')?>(<?php echo L('transactions_success')?>:<span class="font-fixh"><?php echo $amount_succ?></span><?php echo L('yuan')?>)<br/><span class="font-fixh green"><?php echo $point?></span><?php echo L('dian')?>(<?php echo L('transactions_success')?>:<span class="font-fixh"><?php echo $point_succ?></span><?php echo L('dian')?>)</td>
</tr>
<?php }?>
</table>
</fieldset>
</div>
</div>
</form>
</body>
</html>
<script type="text/javascript">
<!--
function discount(id, name) {
window.top.art.dialog({title:'<?php echo L('discount')?>--'+name, id:'discount', iframe:'?m=pay&c=payment&a=public_discount&id='+id ,width:'500px',height:'200px'}, function(){var d = window.top.art.dialog({id:'discount'}).data.iframe;
var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'discount'}).close()});
}
function detail(id, name) {
window.top.art.dialog({title:'<?php echo L('discount')?>--'+name, id:'discount', iframe:'?m=pay&c=payment&a=public_pay_detail&id='+id ,width:'500px',height:'550px'});
}
//-->
</script> | johnshen/phpcms | phpcms/modules/pay/templates/pay_stat.tpl.php | PHP | apache-2.0 | 4,340 | [
30522,
1026,
1029,
25718,
4225,
1006,
1005,
1999,
1035,
4748,
10020,
1005,
1007,
2030,
6164,
1006,
1005,
2053,
6656,
4219,
1012,
1005,
1007,
1025,
2421,
1002,
2023,
1011,
1028,
4748,
10020,
1035,
1056,
24759,
1006,
1005,
20346,
1005,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _2.Rotate_and_Sum
{
class Program
{
static void Main(string[] args)
{
var array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
var rotation = int.Parse(Console.ReadLine());
int[] sum = new int[array.Length];
for (int i = 0; i < rotation; i++)
{
RotationArray(array, sum);
}
Console.WriteLine(string.Join(" ",sum));
}
public static void RotationArray (int[] input, int[] sum)
{
var last = input.Length - 1;
for (var i = 0; i < input.Length - 1; i += 1)
{
input[i] ^= input[last];
input[last] ^= input[i];
input[i] ^= input[last];
}
for (int i = 0; i < input.Length; i++)
{
sum[i] += input[i];
}
}
}
}
| vasilchavdarov/SoftUniHomework | Projects/Array Exercises/2. Rotate and Sum/Program.cs | C# | mit | 1,086 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
3415,
15327,
1035,
1016,
1012,
24357,
1035,
1998,
1035,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @license Copyright 2018 The Lighthouse Authors. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/
'use strict';
module.exports = {
collectCoverage: false,
coverageReporters: ['none'],
collectCoverageFrom: [
'**/lighthouse-core/**/*.js',
'**/lighthouse-cli/**/*.js',
'**/lighthouse-viewer/**/*.js',
],
coveragePathIgnorePatterns: [
'/test/',
'/scripts/',
],
setupFilesAfterEnv: ['./lighthouse-core/test/test-utils.js'],
testEnvironment: 'node',
testMatch: [
'**/lighthouse-core/**/*-test.js',
'**/lighthouse-cli/**/*-test.js',
'**/lighthouse-viewer/**/*-test.js',
'**/lighthouse-viewer/**/*-test-pptr.js',
'**/clients/test/**/*-test.js',
'**/docs/**/*.test.js',
],
};
| umaar/lighthouse | jest.config.js | JavaScript | apache-2.0 | 1,238 | [
30522,
1013,
1008,
1008,
1008,
1030,
6105,
9385,
2760,
1996,
10171,
6048,
1012,
2035,
2916,
9235,
1012,
1008,
7000,
2104,
1996,
15895,
6105,
1010,
2544,
1016,
1012,
1014,
1006,
1996,
1000,
6105,
1000,
1007,
1025,
2017,
2089,
2025,
2224,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* @package HikaShop for Joomla!
* @version 2.3.0
* @author hikashop.com
* @copyright (C) 2010-2014 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
function tableOrdering( order, dir, task ) {
var form = document.adminForm;
form.filter_order.value = order;
form.filter_order_Dir.value = dir;
submitform( task );
}
function submitform(pressbutton){
if (pressbutton) {
document.adminForm.task.value=pressbutton;
}
if( typeof(CodeMirror) == 'function'){
for (x in CodeMirror.instances){
document.getElementById(x).value = CodeMirror.instances[x].getCode();
}
}
if (typeof document.adminForm.onsubmit == "function") {
document.adminForm.onsubmit();
}
document.adminForm.submit();
return false;
}
function hikashopCheckChangeForm(type,form)
{
if(!form)
return true;
var varform = document[form];
if(typeof hikashopFieldsJs != 'undefined' && typeof hikashopFieldsJs['reqFieldsComp'] != 'undefined' && typeof hikashopFieldsJs['reqFieldsComp'][type] != 'undefined' && hikashopFieldsJs['reqFieldsComp'][type].length > 0)
{
for(var i =0;i<hikashopFieldsJs['reqFieldsComp'][type].length;i++)
{
elementName = 'data['+type+']['+hikashopFieldsJs['reqFieldsComp'][type][i]+']';
if( typeof varform.elements[elementName]=='undefined'){
elementName = type+'_'+hikashopFieldsJs['reqFieldsComp'][type][i];
}
elementToCheck = varform.elements[elementName];
elementId = 'hikashop_'+type+'_'+ hikashopFieldsJs['reqFieldsComp'][type][i];
el = document.getElementById(elementId);
if(elementToCheck && (typeof el == 'undefined' || el == null || typeof el.style == 'undefined' || el.style.display!='none') && !hikashopCheckField(elementToCheck,type,i,elementName,varform.elements)){
if(typeof hikashopFieldsJs['entry_id'] == 'undefined')
return false;
for(var j =1;j<=hikashop['entry_id'];j++){
elementName = 'data['+type+'][entry_'+j+']['+hikashopFieldsJs['reqFieldsComp'][type][i]+']';
elementToCheck = varform.elements[elementName];
elementId = 'hikashop_'+type+'_'+ hikashopFieldsJs['reqFieldsComp'][type][i] + '_' + j;
el = document.getElementById(elementId);
if(elementToCheck && (typeof el == 'undefined' || el == null || typeof el.style == 'undefined' || el.style.display!='none') && !hikashopCheckField(elementToCheck,type,i,elementName,varform.elements)){
return false;
}
}
}
}
if(type=='register'){
//check password
if(typeof varform.elements['data[register][password]'] != 'undefined' && typeof varform.elements['data[register][password2]'] != 'undefined'){
passwd = varform.elements['data[register][password]'];
passwd2 = varform.elements['data[register][password2]'];
if(passwd.value!=passwd2.value){
alert(hikashopFieldsJs['password_different']);
return false;
}
}
//check email
var emailField = varform.elements['data[register][email]'];
emailField.value = emailField.value.replace(/ /g,"");
var filter = /^([a-z0-9_'&\.\-\+])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,10})+$/i;
if(!emailField || !filter.test(emailField.value)){
alert(hikashopFieldsJs['valid_email']);
return false;
}
}else if(type=='address' && typeof varform.elements['data[address][address_telephone]'] != 'undefined'){
var phoneField = varform.elements['data[address][address_telephone]'], filter = /[0-9]+/i;
if(phoneField){
phoneField.value = phoneField.value.replace(/ /g,"");
if(phoneField.value.length > 0 && !filter.test(phoneField.value)){
alert(hikashopFieldsJs['valid_phone']);
return false;
}
}
}
}
return true;
}
function hikashopCheckField(elementToCheck,type,i,elementName,form){
if(elementToCheck){
var isValid = false;
if(typeof elementToCheck.value != 'undefined'){
if(elementToCheck.value==' ' && typeof form[elementName+'[]'] != 'undefined'){
if(form[elementName+'[]'].checked){
isValid = true;
}else{
for(var a=0; a < form[elementName+'[]'].length; a++){
if(form[elementName+'[]'][a].checked && form[elementName+'[]'][a].value.length>0) isValid = true;
}
}
}else{
if(elementToCheck.value.length>0) isValid = true;
}
}else{
for(var a=0; a < elementToCheck.length; a++){
if(elementToCheck[a].checked && elementToCheck[a].value.length>0) isValid = true;
}
}
//Case for the switcher display, ignore check according to the method selected
var simplified_pwd = document.getElementById('data[register][registration_method]3');
var simplified = document.getElementById('data[register][registration_method]1');
var guest = document.getElementById('data[register][registration_method]2');
if(!isValid && ((simplified && simplified.checked) || (guest && guest.checked) ) && (elementName=='data[register][password]' || elementName=='data[register][password2]')){
window.Oby.addClass(elementToCheck, 'invalid');
return true;
}
if (!isValid && ( (simplified && simplified.checked) || (guest && guest.checked) || (simplified_pwd && simplified_pwd.checked) ) && (elementName=='data[register][name]' || elementName=='data[register][username]'))
{
window.Oby.addClass(elementToCheck, 'invalid');
return true;
}
if(!isValid){
window.Oby.addClass(elementToCheck, 'invalid');
alert(hikashopFieldsJs['validFieldsComp'][type][i]);
return false;
}else{
window.Oby.removeClass(elementToCheck, 'invalid');
}
}
return true;
}
(function() {
function preventDefault() { this.returnValue = false; }
function stopPropagation() { this.cancelBubble = true; }
var Oby = {
version: 20140128,
ajaxEvents : {},
hasClass : function(o,n) {
if(o.className == '' ) return false;
var reg = new RegExp("(^|\\s+)"+n+"(\\s+|$)");
return reg.test(o.className);
},
addClass : function(o,n) {
if( !this.hasClass(o,n) ) {
if( o.className == '' ) {
o.className = n;
} else {
o.className += ' '+n;
}
}
},
trim : function(s) {
return (s ? '' + s : '').replace(/^\s*|\s*$/g, '');
},
removeClass : function(e, c) {
var t = this;
if( t.hasClass(e,c) ) {
var cn = ' ' + e.className + ' ';
e.className = t.trim(cn.replace(' '+c+' ',' '));
}
},
addEvent : function(d,e,f) {
if( d.attachEvent )
d.attachEvent('on' + e, f);
else if (d.addEventListener)
d.addEventListener(e, f, false);
else
d['on' + e] = f;
return f;
},
removeEvent : function(d,e,f) {
try {
if( d.detachEvent )
d.detachEvent('on' + e, f);
else if( d.removeEventListener)
d.removeEventListener(e, f, false);
else
d['on' + e] = null;
} catch(e) {}
},
cancelEvent : function(e) {
if( !e ) {
e = window.event;
if( !e )
return false;
}
if(e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
if( e.preventDefault )
e.preventDefault();
else
e.returnValue = false;
return false;
},
fireEvent : function(d,e) {
if(document.createEvent) {
var evt = document.createEvent('HTMLEvents');
evt.initEvent(e, false, true);
d.dispatchEvent(evt);
}
else
d.fireEvent("on"+e);
},
fireAjax : function(name,params) {
var t = this, ev;
if( t.ajaxEvents[name] === undefined )
return false;
for(var e in t.ajaxEvents[name]) {
if( e != '_id' ) {
ev = t.ajaxEvents[name][e];
ev(params);
}
}
return true;
},
registerAjax : function(name, fct) {
var t = this;
if( t.ajaxEvents[name] === undefined )
t.ajaxEvents[name] = {'_id':0};
var id = t.ajaxEvents[name]['_id'];
t.ajaxEvents[name]['_id'] += 1;
t.ajaxEvents[name][id] = fct;
return id;
},
unregisterAjax : function(name, id) {
if( t.ajaxEvents[name] === undefined || t.ajaxEvents[name][id] === undefined)
return false;
t.ajaxEvents[name][id] = null;
return true;
},
ready: function(fct) {
var w = window, d = document, t = this;
if(d.readyState === "complete") {
fct();
return;
}
var done = false, top = true, root = d.documentElement,
init = function(e) {
if(e.type == 'readystatechange' && d.readyState != 'complete') return;
t.removeEvent((e.type == 'load' ? w : d), e.type, init);
if(!done && (done = true))
fct();
},
poll = function() {
try{ root.doScroll('left'); } catch(e){ setTimeout(poll, 50); return; }
init('poll');
};
if(d.createEventObject && root.doScroll) {
try{ top = !w.frameElement; } catch(e){}
if(top) poll();
}
t.addEvent(d,'DOMContentLoaded',init);
t.addEvent(d,'readystatechange',init);
t.addEvent(w,'load',init);
},
evalJSON : function(text, secure) {
if( typeof(text) != "string" || !text.length) return null;
if( secure && !(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(text.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''))) return null;
return eval('(' + text + ')');
},
getXHR : function() {
var xhr = null, w = window;
if(w.XMLHttpRequest || w.ActiveXObject) {
if(w.ActiveXObject) {
try {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {}
} else
xhr = new w.XMLHttpRequest();
}
return xhr;
},
xRequest: function(url, options, cb, cbError) {
var t = this, xhr = t.getXHR();
if(!options) options = {};
if(!cb) cb = function(){};
options.mode = options.mode || 'GET';
options.update = options.update || false;
xhr.onreadystatechange = function() {
if(xhr.readyState == 4) {
if( xhr.status == 200 || (xhr.status == 0 && xhr.responseText > 0) || !cbError ) {
if(cb)
cb(xhr,options.params);
if(options.update)
t.updateElem(options.update, xhr.responseText);
} else {
cbError(xhr,options.params);
}
}
};
xhr.open(options.mode, url, true);
if( options.mode.toUpperCase() == 'POST' ) {
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
}
xhr.send( options.data );
},
getFormData : function(target) {
var d = document, ret = '';
if( typeof(target) == 'string' )
target = d.getElementById(target);
if( target === undefined )
target = d;
var typelist = ['input','select','textarea'];
for(var t in typelist ) {
t = typelist[t];
var inputs = target.getElementsByTagName(t);
for(var i = inputs.length - 1; i >= 0; i--) {
if( inputs[i].name && !inputs[i].disabled ) {
var evalue = inputs[i].value, etype = '';
if( t == 'input' )
etype = inputs[i].type.toLowerCase();
if( (etype == 'radio' || etype == 'checkbox') && !inputs[i].checked )
evalue = null;
if( (etype != 'file' && etype != 'submit') && evalue != null ) {
if( ret != '' ) ret += '&';
ret += encodeURI(inputs[i].name) + '=' + encodeURIComponent(evalue);
}
}
}
}
return ret;
},
updateElem : function(elem, data) {
var d = document, scripts = '';
if( typeof(elem) == 'string' )
elem = d.getElementById(elem);
var text = data.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi, function(all, code){
scripts += code + '\n';
return '';
});
elem.innerHTML = text;
if( scripts != '' ) {
var script = d.createElement('script');
script.setAttribute('type', 'text/javascript');
script.text = scripts;
d.head.appendChild(script);
d.head.removeChild(script);
}
}
};
if((typeof(window.Oby) == 'undefined') || window.Oby.version < Oby.version) {
window.Oby = Oby;
window.obscurelighty = Oby;
}
var oldHikaShop = window.hikashop || hikashop;
var hikashop = {
submitFct: null,
submitBox: function(data) {
var t = this, d = document, w = window;
if( t.submitFct ) {
try {
t.submitFct(data);
} catch(err) {}
}
t.closeBox();
},
deleteId: function(id) {
var t = this, d = document, el = id;
if( typeof(id) == "string") {
el = d.getElementById(id);
}
if(!el)
return;
el.parentNode.removeChild(el);
},
dup: function(tplName, htmlblocks, id, extraData, appendTo) {
var d = document, tplElem = d.getElementById(tplName),
container = tplElem.parentNode;
if(!tplElem) return;
elem = tplElem.cloneNode(true);
if(!appendTo) {
container.insertBefore(elem, tplElem);
} else {
if(typeof(appendTo) == "string")
appendTo = d.getElementById(appendTo);
appendTo.appendChild(elem);
}
elem.style.display = "";
elem.id = '';
if(id)
elem.id = id;
for(var k in htmlblocks) {
elem.innerHTML = elem.innerHTML.replace(new RegExp("{"+k+"}","g"), htmlblocks[k]);
elem.innerHTML = elem.innerHTML.replace(new RegExp("%7B"+k+"%7D","g"), htmlblocks[k]);
}
if(extraData) {
for(var k in extraData) {
elem.innerHTML = elem.innerHTML.replace(new RegExp('{'+k+'}','g'), extraData[k]);
elem.innerHTML = elem.innerHTML.replace(new RegExp('%7B'+k+'%7D','g'), extraData[k]);
}
}
},
deleteRow: function(id) {
var t = this, d = document, el = id;
if( typeof(id) == "string") {
el = d.getElementById(id);
} else {
while(el != null && el.tagName.toLowerCase() != 'tr') {
el = el.parentNode;
}
}
if(!el)
return;
var table = el.parentNode;
table.removeChild(el);
if( table.tagName.toLowerCase() == 'tbody' )
table = table.parentNode;
t.cleanTableRows(table);
return;
},
dupRow: function(tplName, htmlblocks, id, extraData) {
var d = document, tplLine = d.getElementById(tplName),
tableUser = tplLine.parentNode;
if(!tplLine) return;
trLine = tplLine.cloneNode(true);
tableUser.appendChild(trLine);
trLine.style.display = "";
trLine.id = "";
if(id)
trLine.id = id;
for(var i = tplLine.cells.length - 1; i >= 0; i--) {
if(trLine.cells[i]) {
for(var k in htmlblocks) {
trLine.cells[i].innerHTML = trLine.cells[i].innerHTML.replace(new RegExp("{"+k+"}","g"), htmlblocks[k]);
trLine.cells[i].innerHTML = trLine.cells[i].innerHTML.replace(new RegExp("%7B"+k+"%7D","g"), htmlblocks[k]);
}
if(extraData) {
for(var k in extraData) {
trLine.cells[i].innerHTML = trLine.cells[i].innerHTML.replace(new RegExp('{'+k+'}','g'), extraData[k]);
trLine.cells[i].innerHTML = trLine.cells[i].innerHTML.replace(new RegExp('%7B'+k+'%7D','g'), extraData[k]);
}
}
}
}
if(tplLine.className == "row0") tplLine.className = "row1";
else if(tplLine.className == "row1") tplLine.className = "row0";
},
cleanTableRows: function(id) {
var d = document, el = id;
if(typeof(id) == "string")
el = d.getElementById(id);
if(el == null || el.tagName.toLowerCase() != 'table')
return;
var k = 0, c = '', line = null, lines = el.getElementsByTagName('tr');
for(var i = 0; i < lines.length; i++) {
line = lines[i];
if( line.style.display != "none") {
c = ' '+line.className+' ';
if( c.indexOf(' row0 ') >= 0 || c.indexOf(' row1 ') >= 0 ) {
line.className = c.replace(' row'+(1-k)+' ', ' row'+k+' ').replace(/^\s*|\s*$/g, '');
k = 1 - k;
}
}
}
},
checkRow: function(id) {
var t = this, d = document, el = id;
if(typeof(id) == "string")
el = d.getElementById(id);
if(el == null || el.tagName.toLowerCase() != 'input')
return;
if(this.clicked) {
this.clicked = null;
t.isChecked(el);
return;
}
el.checked = !el.checked;
t.isChecked(el);
},
isChecked: function(id,cancel) {
var d = document, el = id;
if(typeof(id) == "string")
el = d.getElementById(id);
if(el == null || el.tagName.toLowerCase() != 'input')
return;
if(el.form.boxchecked) {
if(el.checked)
el.form.boxchecked.value++;
else
el.form.boxchecked.value--;
}
},
checkAll: function(checkbox, stub) {
stub = stub || 'cb';
if(checkbox.form) {
var cb = checkbox.form, c = 0;
for(var i = 0, n = cb.elements.length; i < n; i++) {
var e = cb.elements[i];
if (e.type == checkbox.type) {
if ((stub && e.id.indexOf(stub) == 0) || !stub) {
e.checked = checkbox.checked;
c += (e.checked == true ? 1 : 0);
}
}
}
if (cb.boxchecked) {
cb.boxchecked.value = c;
}
return true;
}
return false;
},
submitform: function(task, form, extra) {
var d = document;
if(typeof form == 'string') {
var f = d.getElementById(form);
if(!f)
f = d.forms[form];
if(!f)
return true;
form = f;
}
if(task) {
form.task.value = task;
}
if(typeof form.onsubmit == 'function')
form.onsubmit();
form.submit();
return false;
},
get: function(elem, target) {
window.Oby.xRequest(elem.getAttribute('href'), {update: target});
return false;
},
form: function(elem, target) {
var data = window.Oby.getFormData(target);
window.Oby.xRequest(elem.getAttribute('href'), {update: target, mode: 'POST', data: data});
return false;
},
openBox: function(elem, url, jqmodal) {
var w = window;
if(typeof(elem) == "string")
elem = document.getElementById(elem);
if(!elem)
return false;
try {
if(jqmodal === undefined)
jqmodal = false;
if(!jqmodal && w.SqueezeBox !== undefined) {
if(url !== undefined && url !== null) {
elem.href = url;
}
if(w.SqueezeBox.open !== undefined)
SqueezeBox.open(elem, {parse: 'rel'});
else if(w.SqueezeBox.fromElement !== undefined)
SqueezeBox.fromElement(elem);
} else if(typeof(jQuery) != "undefined") {
var id = elem.getAttribute('id');
jQuery('#modal-' + id).modal('show');
if(url) {
jQuery('#modal-' + id + '-container').find('iframe').attr('src', url);
}
}
} catch(e) {}
return false;
},
closeBox: function(parent) {
var d = document, w = window;
if(parent) {
d = window.parent.document;
w = window.parent;
}
try {
var e = d.getElementById('sbox-window');
if(e && typeof(e.close) != "undefined") {
e.close();
}else if(typeof(w.jQuery) != "undefined" && w.jQuery('div.modal.in') && w.jQuery('div.modal.in').hasClass('in')){
w.jQuery('div.modal.in').modal('hide');
}else if(w.SqueezeBox !== undefined) {
w.SqueezeBox.close();
}
} catch(err) {}
},
submitPopup: function(id, task, form) {
var d = document, t = this, el = d.getElementById('modal-'+id+'-iframe');
if(el && el.contentWindow.hikashop) {
if(task === undefined) task = null;
if(form === undefined) form = 'adminForm';
el.contentWindow.hikashop.submitform(task, form);
}
},
tabSelect: function(m,c,id) {
var d = document, sub = null;
if(typeof m == 'string')
m = d.getElementById(m);
if(!m) return;
if(typeof id == 'string')
id = d.getElementById(id);
sub = m.getElementsByTagName('div');
if(sub) {
for(var i = sub.length - 1; i >= 0; i--) {
if(sub[i].getAttribute('class') == c) {
sub[i].style.display = 'none';
}
}
}
if(id) id.style.display = '';
},
changeState: function(el, id, url) {
window.Oby.xRequest(url, null, function(xhr){
var w = window, d = document;
w.Oby.updateElem(id + '_container', xhr.responseText);
var defaultVal = '', defaultValInput = d.getElementById(id + '_default_value'), stateSelect = d.getElementById(id);
if(defaultValInput) { defaultVal = defaultValInput.value; }
if(stateSelect && w.hikashop.optionValueIndexOf(stateSelect.options, defaultVal) >= 0)
stateSelect.value = defaultVal;
if(typeof(jQuery) != "undefined" && jQuery().chosen) { jQuery('#'+id).chosen(); }
w.Oby.fireAjax('hikashop.stateupdated', {id: id, elem: stateSelect});
});
},
optionValueIndexOf: function(options, value) {
for(var i = options.length - 1; i >= 0; i--) {
if(options[i].value == value)
return i;
}
return -1;
},
getOffset: function(el) {
var x = 0, y = 0;
while(el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop )) {
x += el.offsetLeft - el.scrollLeft;
y += el.offsetTop - el.scrollTop;
el = el.offsetParent;
}
return { top: y, left: x };
},
dataStore: function(name, value) {
if(localStorage) {
localStorage.setItem(name, value);
} else {
var expire = new Date(); expire.setDate(expire.getDate() + 5);
document.cookie = name+"="+value+"; expires="+expire;
}
},
dataGet: function(name) {
if(localStorage) {
return localStorage.getItem(name);
}
if(document.cookie.length > 0 && document.cookie.indexOf(name+"=") != -1) {
var s = name+"=", o = document.cookie.indexOf(s) + s.length, e = document.cookie.indexOf(";",o);
if(e == -1) e = document.cookie.length;
return unescape(document.cookie.substring(o, e));
}
return null;
},
setArrayDisplay: function(fields, displayValue) {
var d = document, e = null;
for(var i = 0; i < fields.length; i++) {
e = d.getElementById(fields[i]);
if(e) e.style.display = displayValue;
}
},
ready: function(fct) {
var w = window, d = w.document;
if(w.jQuery !== undefined) {
jQuery(d).ready(fct);
} else if(window.addEvent) {
w.addEvent("domready", fct);
} else
w.Oby.ready(fct);
}
};
window.hikashop = hikashop;
if(oldHikaShop && oldHikaShop instanceof Object) {
for (var attr in oldHikaShop) {
if (obj.hasOwnProperty(attr) && !window.hikashop.hasOwnProperty(attr))
window.hikashop[attr] = obj[attr];
}
}
var nameboxes = {
simpleSearch: function(id, el) {
var d = document, s = d.getElementById(id+"_span");
if(typeof(el) == "string")
el = d.getElementById(el);
s.innerHTML = el.value;
window.oTrees[id].search(el.value);
el.style.width = s.offsetWidth + 30 + "px";
},
advSearch: function(id, el, url, keyword, min) {
var d = document, s = d.getElementById(id+"_span");
s.innerHTML = el.value;
if(el.value.length < min) {
if(!window['orign_data_'+id]) {
window.oTrees[id].lNodes = [];
window.oTrees[id].lNodes[0] = new window.oNode(0,-1);
window.oTrees[id].load(window['data_'+id]);
window.oTrees[id].render();
window['orign_data_'+id] = true;
}
window.oTrees[id].search(el.value);
} else {
window.Oby.xRequest(
url.replace(keyword, el.value),
null,
function(xhr,params) {
window['orign_data_'+id] = false;
window.oTrees[id].lNodes = [];
window.oTrees[id].lNodes[0] = new window.oNode(0,-1);
var json = window.Oby.evalJSON(xhr.responseText);
window.oTrees[id].load(json);
window.oTrees[id].render();
},
function(xhr, params) { }
);
}
el.style.width = s.offsetWidth + 30 + "px";
},
focus: function(id, el) {
var d = document, c = d.getElementById(id); e = d.getElementById(id+"_otree");
if(typeof(el) == "string")
el = d.getElementById(el);
el.focus();
window.oTrees[id].search(el.value);
if(e) {
e.style.display = "";
var f = function(evt) {
var e = d.getElementById(id+"_otree");
if (!evt) var evt = window.event;
var trg = (window.event) ? evt.srcElement : evt.target;
while(trg != null) {
if(trg == el || trg == e || trg == c)
return;
trg = trg.parentNode;
}
e.style.display = "none";
window.Oby.removeEvent(document, "mousedown", f);
};
window.Oby.addEvent(document, "mousedown", f);
}
},
clean: function(id, el, text) {
var d = document, s = d.getElementById(id+"_valuetext"), h = d.getElementById(id+'_valuehidden');
s.innerHTML = text;
h.value = '';
window.Oby.cancelEvent();
},
callbackFct: function(t,url,keyword,tree,node,ev) {
var o = window.Oby, n = null;
o.xRequest(
url.replace(keyword, node.value),
null,
function(xhr,params) {
var json = o.evalJSON(xhr.responseText);
if(json.length > 0) {
var s = json.length;
for(var i = 0; i < s; i++) {
n = json[i];
t.add(node.id, n.status, n.name, n.value, n.url, n.icon);
}
t.update(node);
if(t.selectOnOpen) {
var n = t.find(t.selectOnOpen);
if(n) { t.sel(n); }
t.selectOnOpen = null;
}
} else {
t.emptyDirectory(node);
}
},
function(xhr, params) {
t.add(node.id, 0, "error");
t.update(node);
}
);
return false;
}
};
window.nameboxes = nameboxes;
})();
if(window.jQuery && typeof(jQuery.noConflict) == "function" && !window.hkjQuery) {
window.hkjQuery = jQuery.noConflict();
}
| traintoproclaim/ttp-web | htdocs/media/com_hikashop/js/hikashop.js | JavaScript | gpl-3.0 | 24,511 | [
30522,
1013,
1008,
1008,
1008,
1030,
7427,
7632,
13716,
18471,
2005,
28576,
19968,
2050,
999,
1008,
1030,
2544,
1016,
1012,
1017,
1012,
1014,
1008,
1030,
3166,
7632,
13716,
18471,
1012,
4012,
1008,
1030,
9385,
1006,
1039,
1007,
2230,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package controllers
import com.thetestpeople.trt.json.JsonSerializers._
import com.thetestpeople.trt.model.Configuration
import com.thetestpeople.trt.service.Service
import com.thetestpeople.trt.utils.HasLogger
import play.api.libs.json.Json
import play.api.mvc.Action
import play.api.mvc.Controller
import play.api.Routes
/**
* Handle AJAX requests from the browser.
*/
class WebApiController(service: Service) extends Controller with HasLogger {
def testNames(query: String) = Action { implicit request ⇒
Ok(Json.toJson(service.getTestNames(query)))
}
def groups(query: String) = Action { implicit request ⇒
Ok(Json.toJson(service.getGroups(query)))
}
def categories(query: String) = Action { implicit request ⇒
Ok(Json.toJson(service.getCategoryNames(query)))
}
def configurationChart(configuration: Configuration) = Action { implicit request ⇒
val counts = service.getAllHistoricalTestCounts.getHistoricalTestCounts(configuration).map(_.counts).getOrElse(Seq())
Ok(Json.toJson(counts))
}
def javascriptRoutes = Action { implicit request ⇒
Ok(Routes.javascriptRouter("jsRoutes")(
routes.javascript.WebApiController.testNames,
routes.javascript.WebApiController.groups,
routes.javascript.WebApiController.categories,
routes.javascript.WebApiController.configurationChart)).as("text/javascript")
}
} | thetestpeople/trt | app/controllers/WebApiController.scala | Scala | mit | 1,388 | [
30522,
7427,
21257,
12324,
4012,
1012,
1996,
22199,
5051,
27469,
1012,
19817,
2102,
1012,
1046,
3385,
1012,
1046,
23345,
11610,
28863,
2015,
1012,
1035,
12324,
4012,
1012,
1996,
22199,
5051,
27469,
1012,
19817,
2102,
1012,
2944,
1012,
9563,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved
// Plugin written by Philipp Buerki. Copyright 2017. All Rights reserved..
#pragma once
#include "CoreMinimal.h"
#include "Interfaces/OnlineNotificationTransportInterface.h"
#include "OnlineSubsystemPackage.h"
struct FOnlineNotification;
//forward declare
typedef TSharedPtr<class IOnlineNotificationTransport, ESPMode::ThreadSafe> IOnlineNotificationTransportPtr;
class IOnlineNotificationTransportMessage;
struct FOnlineNotification;
/** This class is a static manager used to track notification transports and map the delivered notifications to subscribed notification handlers */
class ONLINESUBSYSTEMB3ATZ_API FOnlineNotificationTransportManager
{
protected:
/** Map from a transport type to the transport object */
TMap< FNotificationTransportId, IOnlineNotificationTransportPtr > TransportMap;
public:
/** Lifecycle is managed by OnlineSubSystem, all access should be through there */
FOnlineNotificationTransportManager()
{
}
/** Send a notification using a specific transport */
bool SendNotification(FNotificationTransportId TransportType, const FOnlineNotification& Notification);
/** Receive a message from a specific transport, convert to notification, and pass on for delivery */
bool ReceiveTransportMessage(FNotificationTransportId TransportType, const IOnlineNotificationTransportMessage& TransportMessage);
// NOTIFICATION TRANSPORTS
/** Get a notification transport of a specific type */
IOnlineNotificationTransportPtr GetNotificationTransport(FNotificationTransportId TransportType);
/** Add a notification transport */
void AddNotificationTransport(IOnlineNotificationTransportPtr Transport);
/** Remove a notification transport */
void RemoveNotificationTransport(FNotificationTransportId TransportType);
/** Resets all transports */
void ResetNotificationTransports();
};
typedef TSharedPtr<FOnlineNotificationTransportManager, ESPMode::ThreadSafe> FOnlineNotificationTransportManagerPtr;
| philippbb/OnlineSubsytemB3atZPlugin | OnlineSubsystemB3atZ/Source/Public/OnlineNotificationTransportManager.h | C | mit | 2,010 | [
30522,
1013,
1013,
9385,
2687,
1011,
2418,
8680,
2399,
1010,
4297,
1012,
2035,
2916,
9235,
1013,
1013,
13354,
2378,
2517,
2011,
20765,
20934,
2121,
3211,
1012,
9385,
2418,
1012,
2035,
2916,
9235,
1012,
1012,
1001,
10975,
8490,
2863,
2320,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Управление общими сведениями о сборке осуществляется с помощью
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("lexical")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("lexical")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Параметр ComVisible со значением FALSE делает типы в сборке невидимыми
// для COM-компонентов. Если требуется обратиться к типу в этой сборке через
// COM, задайте атрибуту ComVisible значение TRUE для этого типа.
[assembly: ComVisible(false)]
// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM
[assembly: Guid("a1f308d1-a37a-4415-b36c-46ed5052c828")]
// Сведения о версии сборки состоят из следующих четырех значений:
//
// Основной номер версии
// Дополнительный номер версии
// Номер построения
// Редакция
//
// Можно задать все значения или принять номер построения и номер редакции по умолчанию,
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| palexisru/pl2_rus | v01/pl2/lexical/lexical/Properties/AssemblyInfo.cs | C# | gpl-3.0 | 2,024 | [
30522,
2478,
2291,
1012,
9185,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
21624,
8043,
7903,
2229,
1025,
2478,
2291,
1012,
2448,
7292,
1012,
6970,
11923,
2121,
7903,
2229,
1025,
1013,
1013,
1198,
29746,
16856,
10260,
25529,
29436,
15290,
189... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$layout_defs['Opportunities'] = array(
// list of what Subpanels to show in the DetailView
'subpanel_setup' => array(
'activities' => array(
'order' => 10,
'sort_order' => 'desc',
'sort_by' => 'date_start',
'title_key' => 'LBL_ACTIVITIES_SUBPANEL_TITLE',
'type' => 'collection',
'subpanel_name' => 'activities', //this values is not associated with a physical file.
'module'=>'Activities',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateTaskButton'),
array('widget_class' => 'SubPanelTopScheduleMeetingButton'),
array('widget_class' => 'SubPanelTopScheduleCallButton'),
array('widget_class' => 'SubPanelTopComposeEmailButton'),
),
'collection_list' => array(
'meetings' => array(
'module' => 'Meetings',
'subpanel_name' => 'ForActivities',
'get_subpanel_data' => 'meetings',
),
'tasks' => array(
'module' => 'Tasks',
'subpanel_name' => 'ForActivities',
'get_subpanel_data' => 'tasks',
),
'calls' => array(
'module' => 'Calls',
'subpanel_name' => 'ForActivities',
'get_subpanel_data' => 'calls',
),
)
),
'history' => array(
'order' => 20,
'sort_order' => 'desc',
'sort_by' => 'date_entered',
'title_key' => 'LBL_HISTORY_SUBPANEL_TITLE',
'type' => 'collection',
'subpanel_name' => 'history', //this values is not associated with a physical file.
'module'=>'History',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateNoteButton'),
array('widget_class' => 'SubPanelTopArchiveEmailButton'),
array('widget_class' => 'SubPanelTopSummaryButton'),
),
'collection_list' => array(
'meetings' => array(
'module' => 'Meetings',
'subpanel_name' => 'ForHistory',
'get_subpanel_data' => 'meetings',
),
'tasks' => array(
'module' => 'Tasks',
'subpanel_name' => 'ForHistory',
'get_subpanel_data' => 'tasks',
),
'calls' => array(
'module' => 'Calls',
'subpanel_name' => 'ForHistory',
'get_subpanel_data' => 'calls',
),
'notes' => array(
'module' => 'Notes',
'subpanel_name' => 'ForHistory',
'get_subpanel_data' => 'notes',
),
'emails' => array(
'module' => 'Emails',
'subpanel_name' => 'ForHistory',
'get_subpanel_data' => 'emails',
),
)
),
'documents' => array(
'order' => 25,
'module' => 'Documents',
'subpanel_name' => 'default',
'sort_order' => 'asc',
'sort_by' => 'id',
'title_key' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
'get_subpanel_data' => 'documents',
'top_buttons' =>
array (
0 =>
array (
'widget_class' => 'SubPanelTopButtonQuickCreate',
),
1 =>
array (
'widget_class' => 'SubPanelTopSelectButton',
'mode' => 'MultiSelect',
),
),
),
'leads' => array(
'order' => 50,
'module' => 'Leads',
'sort_order' => 'asc',
'sort_by' => 'last_name, first_name',
'subpanel_name' => 'default',
'get_subpanel_data' => 'leads',
'add_subpanel_data' => 'lead_id',
'title_key' => 'LBL_LEADS_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateLeadNameButton'),
array('widget_class' => 'SubPanelTopSelectButton',
'popup_module' => 'Opportunities',
'mode' => 'MultiSelect',
),
),
),
'contacts' => array(
'order' => 30,
'module' => 'Contacts',
'sort_order' => 'asc',
'sort_by' => 'last_name, first_name',
'subpanel_name' => 'ForOpportunities',
'get_subpanel_data' => 'contacts',
'add_subpanel_data' => 'contact_id',
'title_key' => 'LBL_CONTACTS_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateAccountNameButton'),
array('widget_class' => 'SubPanelTopSelectButton',
'popup_module' => 'Opportunities',
'mode' => 'MultiSelect',
'initial_filter_fields' => array('account_id' => 'account_id', 'account_name' => 'account_name'),
),
),
),
'project' => array(
'order' => 70,
'module' => 'Project',
'get_subpanel_data' => 'project',
'sort_order' => 'asc',
'sort_by' => 'name',
'subpanel_name' => 'default',
'title_key' => 'LBL_PROJECTS_SUBPANEL_TITLE',
'top_buttons' => array(
array('widget_class' => 'SubPanelTopButtonQuickCreate'),
array('widget_class' => 'SubPanelTopSelectButton', 'mode'=>'MultiSelect')
),
),
),
);
?> | jmertic/sugarplatformdemo | upload/upgrades/patch/SugarCE-Upgrade-6.4.x-to-6.5.0RC1-restore/modules/Opportunities/metadata/subpaneldefs.php | PHP | agpl-3.0 | 6,770 | [
30522,
1026,
1029,
25718,
2065,
1006,
999,
4225,
1006,
1005,
5699,
4765,
2854,
1005,
1007,
1064,
1064,
999,
5699,
4765,
2854,
1007,
3280,
1006,
1005,
2025,
1037,
9398,
4443,
2391,
1005,
1007,
1025,
1013,
1008,
1008,
1008,
1008,
1008,
1008... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
## Microsoft.Azure.Services.AppAuthentication Library
### Purpose
Make it easy to authenticate to Azure Services (that support Azure AD Authentication), and help avoid credentials in source code and configuration files.
Enables a service to authenticate to Azure services using the developer's Azure Active Directory/ Microsoft account during development, and authenticate as itself (using OAuth 2.0 Client Credentials flow) when deployed to Azure. This reduces the need to manually create and distribute Azure AD App Credentials amongst developers in the team, which is both cumbersome, and increases the risk of compromise of credentials.
Provides a layer of abstraction over "get access token" to call Azure services (for service-to-service authentication scenarios), allowing for use of Visual Studio, Azure CLI, or Integrated Windows Authentication for local development,
and automatic switch to use of Managed Service Identity (MSI) when deployed to Azure (App Service or Azure VM), without any code or configuration change. It also supports use of service principals for scenarios where MSI is not available, or where the developer's security context cannot be used during local development.
### Documentation
Documentation can be found [here](https://go.microsoft.com/fwlink/p/?linkid=862452).
### Samples
1. [Fetch a secret from Azure Key Vault at run-time from an App Service with a Managed Service Identity (MSI).](https://github.com/Azure-Samples/app-service-msi-keyvault-dotnet)
2. [Programmatically deploy an ARM template from an Azure VM with a Managed Service Identity (MSI).](https://github.com/Azure-Samples/windowsvm-msi-arm-dotnet)
3. [.NET Core sample to programmatically call Azure Services from an Azure Linux VM with a Managed Service Identity.](https://github.com/Azure-Samples/linuxvm-msi-keyvault-arm-dotnet/)
### Code organization
The library is organized in these layers:
1. Calling application will call AzureServiceTokenProvider to get an access token to call an Azure Service.
2. AzureServiceTokenProvider will check if the token is available in a global in-memory cache. If so, will return it.
3. If not in cache, AzureServiceTokenProvider will call the next layer, which are a set of Token Providers. These are in the TokenProviders folder.
4. Each of the token providers then use a client to get the token. The client layer consists of
1. A Process Manager for calling Azure CLI. **az account get-access-token --resource https://vault.azure.net/**
2. ADAL for getting tokens using Client Secret, Certificate, or Integrated Windows Authentication.
3. HttpClient to get token using MSI.
The clients get the token from Azure AD, either directly (e.g. ADAL) or in-directly (MSI/ Azure CLI). The client layer is Mocked in the unit tests cases.
5. The token is returned up the layers and cached, before being returned to the calling application.
### Running test cases
**Unit Test Cases**
On Windows, open a command prompt, navigate to the unit test folder, and run **dotnet test**. This will run tests for both .NET 4.5.2 and .NET Standard 1.4.
On Linux, open a command prompt, navigate to the unit test folder, and run **dotnet test -f netcoreapp1.1**. This will run tests for .NET Standard 1.4.
**Integration Test Cases**
Integration test cases test the actual flow for Client Secret, Client Certificate, Azure CLI, and Integrated Windows Authentication. The Integrated Windows Authentication test can only be run on a domain joined machine, where domain is synced with Azure AD.
Before running these test cases, ensure that you
1. Have Azure CLI 2.0 installed.
2. Have logged into Azure CLI using **az login**
3. Set an environment variable named **AppAuthenticationTestCertUrl** to a certificate in Azure Key Vault e.g. https://myvault.vault.azure.net/secrets/cert1
4. Set an environment variable named **AppAuthenticationTestSqlDbEndpoint** to an Azure SQL database endpoint e.g. mydatabase.database.windows.net
Integration test cases use AzureServiceTokenProvider itself to get a token for Graph API (using Azure CLI), to create Azure AD applications and service principals, and then test those flows. Additionally, the integration test cases also use SqlAzureAppAuthProvider to get a token for SQL Azure and connect to the test database.
On Windows, open a command prompt, navigate to the integration test folder, and run **dotnet test**. This will run tests for both .NET 4.5.2 and .NET Standard 1.4.
On Linux, open a command prompt, navigate to the integration test folder, and run **dotnet test -f netcoreapp1.1**. This will run tests for .NET Standard 1.4. | shahabhijeet/azure-sdk-for-net | src/SdkCommon/AppAuthentication/README.md | Markdown | mit | 4,654 | [
30522,
1001,
1001,
7513,
1012,
24296,
1012,
2578,
1012,
10439,
4887,
10760,
16778,
10719,
3075,
1001,
1001,
1001,
3800,
2191,
2009,
3733,
2000,
14469,
3686,
2000,
24296,
2578,
1006,
2008,
2490,
24296,
4748,
27280,
1007,
1010,
1998,
2393,
44... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright (C) 2005-2011 MaNGOS <http://getmangos.com/>
* Copyright (C) 2009-2011 MaNGOSZero <https://github.com/mangos/zero>
* Copyright (C) 2011-2016 Nostalrius <https://nostalrius.org>
* Copyright (C) 2016-2017 Elysium Project <https://github.com/elysium-project>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "MovementGenerator.h"
#include "Unit.h"
MovementGenerator::~MovementGenerator()
{
}
bool MovementGenerator::IsActive(Unit& u)
{
// When movement generator list modified from Update movegen object erase delayed,
// so pointer still valid and be used for check
return !u.GetMotionMaster()->empty() && u.GetMotionMaster()->top() == this;
}
| jzcxw/core | src/game/Movement/MovementGenerator.cpp | C++ | gpl-2.0 | 1,356 | [
30522,
1013,
1008,
1008,
9385,
1006,
1039,
1007,
2384,
1011,
2249,
24792,
2015,
1026,
8299,
1024,
1013,
1013,
2131,
2386,
12333,
1012,
4012,
1013,
1028,
1008,
9385,
1006,
1039,
1007,
2268,
1011,
2249,
24792,
17112,
10624,
1026,
16770,
1024,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict'
const getNamespace = require('continuation-local-storage').getNamespace
const Promise = require('bluebird')
const WorkerStopError = require('error-cat/errors/worker-stop-error')
const Ponos = require('../')
/**
* A simple worker that will publish a message to a queue.
* @param {object} job Object describing the job.
* @param {string} job.queue Queue on which the message will be published.
* @returns {promise} Resolved when the message is put on the queue.
*/
function basicWorker (job) {
return Promise.try(() => {
const tid = getNamespace('ponos').get('tid')
if (!job.message) {
throw new WorkerStopError('message is required', { tid: tid })
}
console.log(`hello world: ${job.message}. tid: ${tid}`)
})
}
const server = new Ponos.Server({
tasks: {
'basic-queue-worker': basicWorker
},
events: {
'basic-event-worker': basicWorker
}
})
server.start()
.then(() => { console.log('server started') })
.catch((err) => { console.error('server error:', err.stack || err.message || err) })
process.on('SIGINT', () => {
server.stop()
.then(() => { console.log('server stopped') })
.catch((err) => { console.error('server error:', err.stack || err.message || err) })
})
| Runnable/ponos | examples/basic-worker.js | JavaScript | mit | 1,244 | [
30522,
30524,
1013,
10697,
1013,
7309,
1011,
2644,
1011,
7561,
1005,
1007,
9530,
3367,
13433,
15460,
1027,
5478,
1006,
1005,
1012,
1012,
1013,
1005,
1007,
1013,
1008,
1008,
1008,
1037,
3722,
7309,
2008,
2097,
10172,
1037,
4471,
2000,
1037,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# Poa densiflora Buckley SPECIES
#### Status
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | mdoering/backbone | life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Poa/Poa arachnifera/ Syn. Poa densiflora/README.md | Markdown | apache-2.0 | 179 | [
30522,
1001,
13433,
2050,
7939,
5332,
10258,
6525,
17898,
2427,
1001,
1001,
1001,
1001,
3570,
10675,
1001,
1001,
1001,
1001,
2429,
2000,
1996,
10161,
1997,
2166,
1010,
3822,
2254,
2249,
1001,
1001,
1001,
1001,
2405,
1999,
19701,
1001,
1001,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package com.survey.app.server.repository;
import com.athena.server.repository.SearchInterface;
import com.athena.annotation.Complexity;
import com.athena.annotation.SourceCodeAuthorClass;
import com.athena.framework.server.exception.repository.SpartanPersistenceException;
import java.util.List;
import com.athena.framework.server.exception.biz.SpartanConstraintViolationException;
@SourceCodeAuthorClass(createdBy = "john.doe", updatedBy = "", versionNumber = "1", comments = "Repository for Country Master table Entity", complexity = Complexity.LOW)
public interface CountryRepository<T> extends SearchInterface {
public List<T> findAll() throws SpartanPersistenceException;
public T save(T entity) throws SpartanPersistenceException;
public List<T> save(List<T> entity) throws SpartanPersistenceException;
public void delete(String id) throws SpartanPersistenceException;
public void update(T entity) throws SpartanConstraintViolationException, SpartanPersistenceException;
public void update(List<T> entity) throws SpartanPersistenceException;
public T findById(String countryId) throws Exception, SpartanPersistenceException;
}
| applifireAlgo/appDemoApps201115 | surveyportal/src/main/java/com/survey/app/server/repository/CountryRepository.java | Java | gpl-3.0 | 1,169 | [
30522,
7427,
4012,
1012,
5002,
1012,
10439,
1012,
8241,
1012,
22409,
30524,
21880,
1012,
7705,
1012,
8241,
1012,
6453,
1012,
22409,
1012,
20670,
7347,
27870,
5897,
10288,
24422,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
1025,
12324,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import * as React from 'react';
import { FormErrorMap } from './FormErrorMap';
import { ErrorMessagesContext } from './ErrorMessagesContext';
export interface ErrorMessagesProps {
errors?: FormErrorMap
children: React.ReactNode
}
export default function ErrorMessages({errors, children}: ErrorMessagesProps) {
return (
<ErrorMessagesContext.Provider value={{
errors: errors
}}>
{errors && children}
</ErrorMessagesContext.Provider>
)
}
| stephenleicht/ghoti | src/admin/client/forms/errors/ErrorMessages.tsx | TypeScript | mit | 524 | [
30522,
12324,
1008,
2004,
10509,
2013,
1005,
10509,
1005,
1025,
12324,
1063,
2280,
29165,
2863,
2361,
1065,
2013,
1005,
1012,
1013,
2280,
29165,
2863,
2361,
1005,
1025,
12324,
1063,
7561,
7834,
3736,
8449,
8663,
18209,
1065,
2013,
1005,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/***********************************************************************
* mt4j Copyright (c) 2008 - 2009 C.Ruff, Fraunhofer-Gesellschaft All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
***********************************************************************/
package org.mt4j.util.math;
/**
* The Class Ray.
*
* @author C.Ruff
*/
public class Ray {
/** The ray start point. */
private Vector3D rayStartPoint;
/** The point in ray direction. */
private Vector3D pointInRayDirection;
/** The ray direction. */
private Vector3D rayDirection;
/**
* Instantiates a new ray.
*
* @param ray the ray
*/
public Ray(Ray ray){
super();
this.rayStartPoint = ray.getRayStartPoint().getCopy();
this.pointInRayDirection = ray.getPointInRayDirection().getCopy();
}
/**
* Instantiates a new ray.
*
* @param rayStartPoint the ray start point
* @param pointInRayDirection the point in ray direction
*/
public Ray(Vector3D rayStartPoint, Vector3D pointInRayDirection) {
super();
this.rayStartPoint = rayStartPoint;
this.pointInRayDirection = pointInRayDirection;
}
/**
* Gets the ray direction.
*
* @return the ray direction
*/
public Vector3D getRayDirection(){
return pointInRayDirection.getSubtracted(rayStartPoint);
}
/**
* Gets the ray direction normalized.
*
* @return the ray direction normalized
*/
public Vector3D getRayDirectionNormalized(){
return getRayDirection().normalizeLocal();
}
/**
* Gets the point in ray direction.
*
* @return the point in ray direction
*/
public Vector3D getPointInRayDirection() {
return pointInRayDirection;
}
/**
* Sets the point in ray direction.
*
* @param pointInRayDirection the new point in ray direction
*/
public void setPointInRayDirection(Vector3D pointInRayDirection) {
this.pointInRayDirection = pointInRayDirection;
}
/**
* Gets the ray start point.
*
* @return the ray start point
*/
public Vector3D getRayStartPoint() {
return rayStartPoint;
}
/**
* Sets the ray start point.
*
* @param rayStartPoint the new ray start point
*/
public void setRayStartPoint(Vector3D rayStartPoint) {
this.rayStartPoint = rayStartPoint;
}
/**
* Transforms the ray.
* The direction vector is multiplied with the transpose of the matrix.
*
* @param m the m
*/
public void transform(Matrix m){
rayStartPoint.transform(m);
// pointInRayDirection.transformNormal(m);
// pointInRayDirection.normalize(); //FIXME TRIAL REMOVE? NO oder vielleicht gleich bei transformNOrmal mit rein?
//
// pointInRayDirection = rayStartPoint.plus(pointInRayDirection);
pointInRayDirection.transform(m);
}
/**
* Calculates and returns the direction vector.
* This is calced by subtracting the rayStartpoint from the point in the rays direction.
*
* @return the direction
*/
public Vector3D getDirection(){
return pointInRayDirection.getSubtracted(rayStartPoint);
}
/**
* Returns a new ray, transformed by the matrix.
*
* @param ray the ray
* @param m the m
*
* @return the transformed ray
*/
public static Ray getTransformedRay(Ray ray, Matrix m){
// if (!Matrix.equalIdentity(m)){
//Get a copy of the origonal ray
Ray transformedRay = new Ray(ray);
transformedRay.transform(m);
return transformedRay;
// }else{
// return ray;
// }
}
@Override
public String toString(){
return "Ray start: " + this.rayStartPoint + " PointInRayDirection: " + this.pointInRayDirection + " " + super.toString();
}
}
| Twelve-60/mt4j | src/org/mt4j/util/math/Ray.java | Java | gpl-2.0 | 4,363 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package kiiroo
import (
"bytes"
"fmt"
"runtime"
"testing"
"time"
"github.com/funjack/launchcontrol/protocol"
)
// Badish input scenario, contains dups and short timings
var scenario = "{1.00:1,1.50:4,1.51:4,1.51:3,1.52:4,1.66:1,1.84:2,1.85:3,1.90:4,1.95:1,2.00:2,2.20:4,2.45:2}"
func playerwithscenario(scenario string) (protocol.Player, error) {
b := bytes.NewBufferString(scenario)
return Load(b)
}
type actionValidator struct {
LastPostion int
LastTime time.Duration
}
// Validate takes a position and time and tests if that is allowed compared to
// previous values validated.
func (a *actionValidator) Validate(p int, t time.Duration) error {
defer func() {
a.LastPostion = p
a.LastTime = t
}()
if p == a.LastPostion {
return fmt.Errorf("received the same position in a row")
}
if a.LastTime > 0 && (t-a.LastTime) < (time.Millisecond*150) {
return fmt.Errorf("time between events not big enough: %s", t-a.LastTime)
}
return nil
}
func TestPlay(t *testing.T) {
// The runtime on darwin uses the wallclock for timeres. Timer tests
// running on TravisCI vm's where the clock is synced with ntp can
// cause 'false' positives.
// TODO remove with Go 1.9: https://go-review.googlesource.com/c/35292
if runtime.GOOS == "darwin" {
t.Skip("don't run timing tests on darwin #17610")
}
k, err := playerwithscenario(scenario)
if err != nil {
t.Error(err)
}
av := actionValidator{}
starttime := time.Now()
for a := range k.Play() {
eventtime := time.Now().Sub(starttime)
t.Logf("Action: %s: %d,%d", eventtime, a.Position, a.Speed)
if err := av.Validate(a.Position, eventtime); err != nil {
t.Error(err)
}
}
}
| funjack/launchcontrol | protocol/kiiroo/player_test.go | GO | bsd-3-clause | 1,669 | [
30522,
7427,
11382,
9711,
2080,
12324,
1006,
1000,
27507,
1000,
1000,
4718,
2102,
1000,
1000,
2448,
7292,
1000,
1000,
5604,
1000,
1000,
2051,
1000,
1000,
21025,
2705,
12083,
1012,
4012,
1013,
4569,
30524,
1007,
1013,
1013,
2919,
4509,
7953,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
export DEBIAN_FRONTEND=noninteractive
export CXX="g++-4.8"
export CC="gcc-4.8"
#
# Swig install
if [ -f $HOME/swig-install/bin/swig ] ; then
echo "Swig already built (and in travis cache)"
else
cd
wget https://github.com/swig/swig/archive/rel-3.0.10.tar.gz
tar zxvf rel-3.0.10.tar.gz
mkdir $HOME/swig-install
cd $HOME/swig-rel-3.0.10 && ./autogen.sh && ./configure --prefix=$HOME/swig-install && make && make install
fi
#
# Boost install
if [ -d $HOME/boost-install/include ] ; then
echo "Boost already built (and in travis cache)"
else
cd
wget https://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.bz2
tar -xjf boost_1_61_0.tar.bz2
mkdir $HOME/boost-install
echo "using gcc : 4.8 : gcc-4.8 ;" > ~/user-config.jam
cd $HOME/boost_1_61_0 && ./bootstrap.sh link=static variant=release address-model=64 cxxflags="-std=c++11 -fPIC" boost.locale.icu=off --with-libraries=filesystem,system,test,regex,python,random,thread,date_time --prefix=$HOME/boost-install && ./b2 install
fi
#
# WXWidget install
if [ -d $HOME/wxWidgets-install/include ] ; then
echo "wxWidget already built (and in travis cache)"
else
cd
wget https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.0/wxWidgets-3.1.0.tar.bz2
tar -xjf wxWidgets-3.1.0.tar.bz2
mkdir $HOME/wxWidgets-install
cd $HOME/wxWidgets-3.1.0 && ./configure --prefix=$HOME/wxWidgets-install --disable-shared && make && make install
fi
# check wxWidget install
export PATH=$HOME/wxWidgets-install/bin/:$PATH
echo "wxWidget version : "
wx-config --version
# Download CMake
cd
wget --no-check-certificate https://cmake.org/files/v3.6/cmake-3.6.1-Linux-x86_64.tar.gz
mkdir $HOME/cmake-install
tar zxvf cmake-3.6.1-Linux-x86_64.tar.gz -C $HOME/cmake-install --strip 1
| d-cooper/I-Simpa | ci/travis/linux/before_install.sh | Shell | gpl-3.0 | 1,755 | [
30522,
9167,
2139,
15599,
1035,
2392,
10497,
1027,
2512,
18447,
6906,
15277,
9167,
1039,
20348,
1027,
1000,
1043,
1009,
1009,
1011,
1018,
1012,
1022,
1000,
9167,
10507,
1027,
1000,
1043,
9468,
1011,
1018,
1012,
1022,
1000,
1001,
1001,
25430... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
.icons > [class^="icon-"] {
position: relative;
text-align: left;
font-size: 32px;
}
.icons > [class^="icon-"] > span {
display: none;
padding: 20px 23px 18px 23px;
background: #00101c;
width: auto;
color: #fff;
font-family: 'Roboto', Arial, sans-serif;
font-size: 16px;
}
.icons > [class^="icon-"]:hover > span {
display: block;
position: absolute;
top: -64px;
right: 35px;
white-space: nowrap;
z-index: 5;
}
.arrow-down {
width: 0;
height: 0;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
display: none;
border-top: 10px solid #00101c;
}
.icons > [class^="icon-"]:hover > .arrow-down {
display: block;
position: absolute;
top: -10px;
right: 50px;
} | vrch/efigence-camp | stylesheets/icons-temporary.css | CSS | mit | 740 | [
30522,
1012,
18407,
1028,
1031,
2465,
1034,
1027,
1000,
12696,
1011,
1000,
1033,
1063,
2597,
1024,
5816,
1025,
3793,
1011,
25705,
1024,
2187,
1025,
15489,
1011,
2946,
1024,
3590,
2361,
2595,
1025,
1065,
1012,
18407,
1028,
1031,
2465,
1034,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package foodtruck.geolocation;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import com.google.inject.BindingAnnotation;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* @author aviolette
* @since 5/19/16
*/
@BindingAnnotation
@Target({FIELD, PARAMETER, METHOD}) @Retention(RUNTIME)
@interface GoogleServerApiKey {
}
| aviolette/foodtrucklocator | main/src/main/java/foodtruck/geolocation/GoogleServerApiKey.java | Java | mit | 537 | [
30522,
7427,
2833,
16344,
12722,
1012,
20248,
4135,
10719,
1025,
12324,
9262,
1012,
11374,
1012,
5754,
17287,
3508,
1012,
20125,
1025,
12324,
9262,
1012,
11374,
1012,
5754,
17287,
3508,
1012,
4539,
1025,
12324,
4012,
1012,
8224,
1012,
1999,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module.exports = {
// Token you get from discord
"token": "",
// Prefix before your commands
"prefix": "",
// Port for webserver (Not working)
"port": 8080,
// Mongodb stuff
"mongodb": {
// Mongodb uri
"uri": ""
},
// Channel IDs
"channelIDs": {
// Where to announce the events in ACCF
"events": "",
// Where to announce online towns
"onlineTowns": "",
// Where to log the logs
"logs": ""
}
}
| rey2952/RoverBot | config.js | JavaScript | mit | 455 | [
30522,
11336,
1012,
14338,
1027,
1063,
1013,
1013,
19204,
2017,
2131,
2013,
12532,
4103,
1000,
19204,
1000,
1024,
1000,
1000,
1010,
1013,
1013,
17576,
2077,
2115,
10954,
1000,
17576,
1000,
1024,
1000,
1000,
1010,
1013,
1013,
3417,
2005,
477... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using NSubstitute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace PoshGit2.TabCompletion
{
public class TabCompletionTests
{
private readonly ITestOutputHelper _log;
public TabCompletionTests(ITestOutputHelper log)
{
_log = log;
}
[InlineData("gi")]
[InlineData("git")]
[InlineData("git.")]
[InlineData("git.exe")]
[Theory]
public async Task GitCommand(string cmd)
{
var repo = Substitute.For<IRepositoryStatus>();
var completer = new TabCompleter(Task.FromResult(repo));
var result = await completer.CompleteAsync(cmd, CancellationToken.None);
Assert.True(result.IsFailure);
}
[InlineData("git ", new string[] { "clone", "init" })]
[Theory]
public async Task NullStatus(string command, string[] expected)
{
var completer = new TabCompleter(Task.FromResult<IRepositoryStatus>(null));
var fullResult = await completer.CompleteAsync(command, CancellationToken.None);
var result = GetResult(fullResult);
Assert.Equal(result, expected.OrderBy(o => o, StringComparer.Ordinal));
}
[InlineData("git add ", new string[] { })]
[InlineData("git rm ", new string[] { })]
[Theory]
public async Task EmptyStatus(string command, string[] expected)
{
var repo = Substitute.For<IRepositoryStatus>();
var completer = new TabCompleter(Task.FromResult(repo));
var fullResult = await completer.CompleteAsync(command, CancellationToken.None);
var result = GetResult(fullResult);
Assert.Equal(result, expected.OrderBy(o => o, StringComparer.Ordinal));
}
[InlineData("git ", "stash")]
[InlineData("git s", "stash")]
[InlineData("git ", "push")]
[InlineData("git p", "push")]
[InlineData("git ", "pull")]
[InlineData("git p", "pull")]
[InlineData("git ", "bisect")]
[InlineData("git bis", "bisect")]
[InlineData("git ", "branch")]
[InlineData("git br", "branch")]
[InlineData("git ", "add")]
[InlineData("git a", "add")]
[InlineData("git ", "rm")]
[InlineData("git r", "rm")]
[InlineData("git ", "merge")]
[InlineData("git m", "merge")]
[InlineData("git ", "mergetool")]
[InlineData("git m", "mergetool")]
[Theory]
public async Task ResultContains(string command, string expected)
{
var completer = CreateTabCompleter();
var fullResult = await completer.CompleteAsync(command, CancellationToken.None);
var result = GetResult(fullResult);
Assert.Contains(expected, result);
}
// Verify command completion
[InlineData("git ", new[] { "add", "am", "annotate", "archive", "bisect", "blame", "branch", "bundle", "checkout", "cherry", "cherry-pick", "citool", "clean", "clone", "commit", "config", "describe", "diff", "difftool", "fetch", "format-patch", "gc", "grep", "gui", "help", "init", "instaweb", "log", "merge", "mergetool", "mv", "notes", "prune", "pull", "push", "rebase", "reflog", "remote", "rerere", "reset", "revert", "rm", "shortlog", "show", "stash", "status", "submodule", "svn", "tag", "whatchanged" })]
[InlineData("git.exe ", new[] { "add", "am", "annotate", "archive", "bisect", "blame", "branch", "bundle", "checkout", "cherry", "cherry-pick", "citool", "clean", "clone", "commit", "config", "describe", "diff", "difftool", "fetch", "format-patch", "gc", "grep", "gui", "help", "init", "instaweb", "log", "merge", "mergetool", "mv", "notes", "prune", "pull", "push", "rebase", "reflog", "remote", "rerere", "reset", "revert", "rm", "shortlog", "show", "stash", "status", "submodule", "svn", "tag", "whatchanged" })]
// git add
[InlineData("git add ", new[] { "working-duplicate", "working-modified", "working-added", "working-unmerged" })]
[InlineData("git add working-m", new[] { "working-modified" })]
// git rm
[InlineData("git rm ", new[] { "working-deleted", "working-duplicate" })]
[InlineData("git rm working-a", new string[] { })]
[InlineData("git rm working-d", new string[] { "working-deleted", "working-duplicate" })]
// git bisect
[InlineData("git bisect ", new[] { "start", "bad", "good", "skip", "reset", "visualize", "replay", "log", "run" })]
[InlineData("git bisect s", new[] { "start", "skip" })]
[InlineData("git bisect bad ", new string[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git bisect good ", new string[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git bisect reset ", new string[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git bisect skip ", new string[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git bisect bad f", new string[] { "feature1", "feature2" })]
[InlineData("git bisect good f", new string[] { "feature1", "feature2" })]
[InlineData("git bisect reset f", new string[] { "feature1", "feature2" })]
[InlineData("git bisect skip f", new string[] { "feature1", "feature2" })]
[InlineData("git bisect bad g", new string[] { })]
[InlineData("git bisect good g", new string[] { })]
[InlineData("git bisect reset g", new string[] { })]
[InlineData("git bisect skip g", new string[] { })]
[InlineData("git bisect skip H", new string[] { "HEAD" })]
// git notes
[InlineData("git notes ", new[] { "edit", "show" })]
[InlineData("git notes e", new[] { "edit" })]
// git reflog
[InlineData("git reflog ", new[] { "expire", "delete", "show" })]
[InlineData("git reflog e", new[] { "expire" })]
// git branch
[InlineData("git branch -d ", new string[] { "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git branch -D ", new string[] { "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git branch -m ", new string[] { "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git branch -M ", new string[] { "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git branch -d f", new string[] { "feature1", "feature2" })]
[InlineData("git branch -D f", new string[] { "feature1", "feature2" })]
[InlineData("git branch -m f", new string[] { "feature1", "feature2" })]
[InlineData("git branch -M f", new string[] { "feature1", "feature2" })]
[InlineData("git branch -d g", new string[] { })]
[InlineData("git branch -D g", new string[] { })]
[InlineData("git branch -m g", new string[] { })]
[InlineData("git branch -M g", new string[] { })]
[InlineData("git branch newBranch ", new string[] { "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git branch newBranch f", new string[] { "feature1", "feature2" })]
[InlineData("git branch newBranch g", new string[] { })]
// git push
[InlineData("git push ", new string[] { "origin", "other" })]
[InlineData("git push oth", new string[] { "other" })]
[InlineData("git push origin ", new string[] { "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git push origin fe", new string[] { "feature1", "feature2" })]
[InlineData("git push origin :", new string[] { ":remotefeature", ":cutfeature" })]
[InlineData("git push origin :re", new string[] { ":remotefeature" })]
// git pull
[InlineData("git pull ", new string[] { "origin", "other" })]
[InlineData("git pull oth", new string[] { "other" })]
[InlineData("git pull origin ", new string[] { "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git pull origin fe", new string[] { "feature1", "feature2" })]
// git fetch
[InlineData("git fetch ", new string[] { "origin", "other" })]
[InlineData("git fetch oth", new string[] { "other" })]
// git submodule
[InlineData("git submodule ", new string[] { "add", "status", "init", "update", "summary", "foreach", "sync" })]
[InlineData("git submodule s", new string[] { "status", "summary", "sync" })]
// git svn
[InlineData("git svn ", new string[] { "init", "fetch", "clone", "rebase", "dcommit", "branch", "tag", "log", "blame", "find-rev", "set-tree", "create-ignore", "show-ignore", "mkdirs", "commit-diff", "info", "proplist", "propget", "show-externals", "gc", "reset" })]
[InlineData("git svn f", new string[] { "fetch", "find-rev" })]
// git stash
[InlineData("git stash ", new string[] { "list", "save", "show", "drop", "pop", "apply", "branch", "clear", "create" })]
[InlineData("git stash s", new string[] { "save", "show" })]
[InlineData("git stash show ", new string[] { "stash", "wip" })]
[InlineData("git stash show w", new string[] { "wip" })]
[InlineData("git stash show d", new string[] { })]
[InlineData("git stash apply ", new string[] { "stash", "wip" })]
[InlineData("git stash apply w", new string[] { "wip" })]
[InlineData("git stash apply d", new string[] { })]
[InlineData("git stash drop ", new string[] { "stash", "wip" })]
[InlineData("git stash drop w", new string[] { "wip" })]
[InlineData("git stash drop d", new string[] { })]
[InlineData("git stash pop ", new string[] { "stash", "wip" })]
[InlineData("git stash pop w", new string[] { "wip" })]
[InlineData("git stash pop d", new string[] { })]
[InlineData("git stash branch ", new string[] { "stash", "wip" })]
[InlineData("git stash branch w", new string[] { "wip" })]
[InlineData("git stash branch d", new string[] { })]
// Tests for commit
[InlineData("git commit -C ", new string[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git commit -C O", new string[] { "ORIG_HEAD" })]
[InlineData("git commit -C o", new string[] { "origin/cutfeature", "origin/remotefeature" })]
// git remote
[InlineData("git remote ", new[] { "add", "rename", "rm", "set-head", "show", "prune", "update" })]
[InlineData("git remote r", new[] { "rename", "rm" })]
[InlineData("git remote rename ", new string[] { "origin", "other" })]
[InlineData("git remote rename or", new string[] { "origin" })]
[InlineData("git remote rm ", new string[] { "origin", "other" })]
[InlineData("git remote rm or", new string[] { "origin" })]
[InlineData("git remote set-head ", new string[] { "origin", "other" })]
[InlineData("git remote set-head or", new string[] { "origin" })]
[InlineData("git remote set-branches ", new string[] { "origin", "other" })]
[InlineData("git remote set-branches or", new string[] { "origin" })]
[InlineData("git remote set-url ", new string[] { "origin", "other" })]
[InlineData("git remote set-url or", new string[] { "origin" })]
[InlineData("git remote show ", new string[] { "origin", "other" })]
[InlineData("git remote show or", new string[] { "origin", })]
[InlineData("git remote prune ", new string[] { "origin", "other" })]
[InlineData("git remote prune or", new string[] { "origin" })]
// git help <cmd>
[InlineData("git help ", new[] { "add", "am", "annotate", "archive", "bisect", "blame", "branch", "bundle", "checkout", "cherry", "cherry-pick", "citool", "clean", "clone", "commit", "config", "describe", "diff", "difftool", "fetch", "format-patch", "gc", "grep", "gui", "help", "init", "instaweb", "log", "merge", "mergetool", "mv", "notes", "prune", "pull", "push", "rebase", "reflog", "remote", "rerere", "reset", "revert", "rm", "shortlog", "show", "stash", "status", "submodule", "svn", "tag", "whatchanged" })]
[InlineData("git help ch", new[] { "checkout", "cherry", "cherry-pick" })]
// git checkout -- <files>
[InlineData("git checkout -- ", new[] { "working-deleted", "working-duplicate", "working-modified", "working-unmerged" })]
[InlineData("git checkout -- working-d", new[] { "working-deleted", "working-duplicate" })]
// git merge|mergetool <files>
// TODO: Enable for merge state
//[InlineData("git merge ", new[] { "working-unmerged", "working-duplicate" })]
//[InlineData("git merge working-u", new[] { "working-unmerged" })]
//[InlineData("git merge j", new string[] { })]
//[InlineData("git mergetool ", new[] { "working-unmerged", "working-duplicate" })]
//[InlineData("git mergetool working-u", new[] { "working-unmerged" })]
//[InlineData("git mergetool j", new string[] { })]
// git checkout <branch>
[InlineData("git checkout ", new[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git cherry-pick <branch>
[InlineData("git cherry ", new[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git cherry-pick <branch>
[InlineData("git cherry-pick ", new[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git diff <branch>
[InlineData("git diff ", new[] { "index-modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git diff --cached ", new[] { "working-modified", "working-duplicate", "working-unmerged", "index-modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git diff --staged ", new[] { "index-modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git difftool <branch>
[InlineData("git difftool ", new[] { "index-modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git difftool --cached ", new[] { "working-modified", "working-duplicate", "working-unmerged", "index-modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git difftool --staged ", new[] { "index-modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git log <branch>
[InlineData("git log ", new[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git merge <branch>
[InlineData("git merge ", new[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git rebase <branch>
[InlineData("git rebase ", new[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git reflog <branch>
[InlineData("git reflog show ", new[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git reset <branch>
[InlineData("git reset ", new[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git reset HEAD <file>
[InlineData("git reset HEAD ", new[] { "index-added", "index-deleted", "index-modified", "index-unmerged" })]
[InlineData("git reset HEAD index-a", new[] { "index-added" })]
// git revert <branch>
[InlineData("git revert ", new[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git show<branch>
[InlineData("git show ", new[] { "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[Theory]
public async Task CheckCompletion(string cmd, string[] expected)
{
var completer = CreateTabCompleter();
await CompareAsync(completer, cmd, expected.OrderBy(o => o, StringComparer.Ordinal));
}
// git add
[InlineData("git add ", new[] { "working duplicate", "working modified", "working added", "working unmerged" })]
[InlineData("git add \"working m", new[] { "working modified" })]
[InlineData("git add \'working m", new[] { "working modified" })]
// git rm
[InlineData("git rm ", new[] { "working deleted", "working duplicate" })]
[InlineData("git rm \"working d", new string[] { "working deleted", "working duplicate" })]
[InlineData("git rm \'working d", new string[] { "working deleted", "working duplicate" })]
// git checkout -- <files>
[InlineData("git checkout -- ", new[] { "working deleted", "working duplicate", "working modified", "working unmerged" })]
[InlineData("git checkout -- \"wor", new[] { "working deleted", "working duplicate", "working modified", "working unmerged" })]
[InlineData("git checkout -- \"working d", new[] { "working deleted", "working duplicate" })]
[InlineData("git checkout -- \'working d", new[] { "working deleted", "working duplicate" })]
// git merge|mergetool <files>
// TODO: Enable for merge state
//[InlineData("git merge ", new[] { "working unmerged", "working duplicate" })]
//[InlineData("git merge working u", new[] { "working unmerged" })]
//[InlineData("git merge j", new string[] { })]
//[InlineData("git mergetool ", new[] { "working unmerged", "working duplicate" })]
//[InlineData("git mergetool working u", new[] { "working unmerged" })]
//[InlineData("git mergetool j", new string[] { })]
// git diff <branch>
[InlineData("git diff ", new[] { "index modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git diff --cached ", new[] { "working modified", "working duplicate", "working unmerged", "index modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git diff --staged ", new[] { "index modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git difftool <branch>
[InlineData("git difftool ", new[] { "index modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git difftool --cached ", new[] { "working modified", "working duplicate", "working unmerged", "index modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
[InlineData("git difftool --staged ", new[] { "index modified", "FETCH_HEAD", "HEAD", "MERGE_HEAD", "ORIG_HEAD", "feature1", "feature2", "master", "origin/cutfeature", "origin/remotefeature" })]
// git reset HEAD <file>
[InlineData("git reset HEAD ", new[] { "index added", "index deleted", "index modified", "index unmerged" })]
[InlineData("git reset HEAD \"index a", new[] { "index added" })]
[InlineData("git reset HEAD \'index a", new[] { "index added" })]
[Theory]
public async Task CheckCompletionWithQuotations(string cmd, string[] initialExpected)
{
const string quot = "\"";
var completer = CreateTabCompleter(" ");
var expected = initialExpected
.OrderBy(o => o, StringComparer.Ordinal)
.Select(o => o.Contains(" ") ? $"{quot}{o}{quot}" : o);
await CompareAsync(completer, cmd, expected);
}
private async Task CompareAsync(ITabCompleter completer, string cmd, IEnumerable<string> expected)
{
var fullResult = await completer.CompleteAsync(cmd, CancellationToken.None);
var result = GetResult(fullResult);
_log.WriteLine("Expected output:");
_log.WriteLine(string.Join(Environment.NewLine, expected));
_log.WriteLine(string.Empty);
_log.WriteLine("Actual output:");
_log.WriteLine(string.Join(Environment.NewLine, result));
Assert.Equal(expected, result);
}
private static ITabCompleter CreateTabCompleter(string join = "-")
{
var status = Substitute.For<IRepositoryStatus>();
var working = new ChangedItemsCollection
{
Added = new[] { $"working{join}added", $"working{join}duplicate" },
Deleted = new[] { $"working{join}deleted", $"working{join}duplicate" },
Modified = new[] { $"working{join}modified", $"working{join}duplicate" },
Unmerged = new[] { $"working{join}unmerged", $"working{join}duplicate" }
};
var index = new ChangedItemsCollection
{
Added = new[] { $"index{join}added" },
Deleted = new[] { $"index{join}deleted" },
Modified = new[] { $"index{join}modified" },
Unmerged = new[] { $"index{join}unmerged" }
};
status.Index.Returns(index);
status.Working.Returns(working);
status.LocalBranches.Returns(new[] { "master", "feature1", "feature2" });
status.Remotes.Returns(new[] { "origin", "other" });
status.RemoteBranches.Returns(new[] { "origin/remotefeature", "origin/cutfeature" });
status.Stashes.Returns(new[] { "stash", "wip" });
return new TabCompleter(Task.FromResult(status));
}
private IEnumerable<string> GetResult(TabCompletionResult fullResult)
{
Assert.True(fullResult.IsSuccess);
return (fullResult as TabCompletionResult.Success).Item;
}
}
}
| twsouthwick/poshgit2 | test/PoshGit2.TabCompletion.Tests/TabCompletionTests.cs | C# | mit | 24,041 | [
30522,
2478,
24978,
12083,
16643,
24518,
1025,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
11689,
2075,
1025,
2478,
2291,
1012,
11689,
2075,
1012,
8518,
1025,
2478,
159... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*
* Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
package com.sun.tools.internal.ws.wsdl.document;
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
import com.sun.tools.internal.ws.wsdl.framework.Entity;
import com.sun.tools.internal.ws.wsdl.framework.EntityAction;
import com.sun.tools.internal.ws.wsdl.framework.ExtensibilityHelper;
import com.sun.tools.internal.ws.wsdl.framework.ExtensionVisitor;
import org.xml.sax.Locator;
import javax.xml.namespace.QName;
/**
* Entity corresponding to the "types" WSDL element.
*
* @author WS Development Team
*/
public class Types extends Entity implements TWSDLExtensible {
public Types(Locator locator) {
super(locator);
_helper = new ExtensibilityHelper();
}
public QName getElementName() {
return WSDLConstants.QNAME_TYPES;
}
public Documentation getDocumentation() {
return _documentation;
}
public void setDocumentation(Documentation d) {
_documentation = d;
}
public void accept(WSDLDocumentVisitor visitor) throws Exception {
visitor.preVisit(this);
_helper.accept(visitor);
visitor.postVisit(this);
}
public void validateThis() {
}
/**
* wsdl:type does not have any name attribute
*/
public String getNameValue() {
return null;
}
public String getNamespaceURI() {
return parent.getNamespaceURI();
}
public QName getWSDLElementName() {
return getElementName();
}
public void addExtension(TWSDLExtension e) {
_helper.addExtension(e);
}
public Iterable<TWSDLExtension> extensions() {
return _helper.extensions();
}
public TWSDLExtensible getParent() {
return parent;
}
public void setParent(TWSDLExtensible parent) {
this.parent = parent;
}
public void withAllSubEntitiesDo(EntityAction action) {
_helper.withAllSubEntitiesDo(action);
}
public void accept(ExtensionVisitor visitor) throws Exception {
_helper.accept(visitor);
}
private TWSDLExtensible parent;
private ExtensibilityHelper _helper;
private Documentation _documentation;
}
| TheTypoMaster/Scaper | openjdk/jaxws/drop_included/jaxws_src/src/com/sun/tools/internal/ws/wsdl/document/Types.java | Java | gpl-2.0 | 3,415 | [
30522,
1013,
1008,
1008,
9385,
2384,
1011,
2294,
3103,
12702,
29390,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
1008,
2079,
2025,
11477,
2030,
6366,
9385,
14444,
2030,
2023,
5371,
20346,
1012,
1008,
1008,
2023,
3642,
2003,
2489,
4007,
1025,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LCL.Domain.Model;
using LCL.Domain.Specifications;
namespace LCL.Domain.Repositories.Specifications
{
public class SalesOrderIDEqualsSpecification : Specification<SalesOrder>
{
private readonly Guid orderID;
public SalesOrderIDEqualsSpecification(Guid orderID)
{
this.orderID = orderID;
}
public override System.Linq.Expressions.Expression<Func<SalesOrder, bool>> GetExpression()
{
return p => p.ID == orderID;
}
}
}
| luomingui/LCLFramework | LCLDemo/LCL.Domain/Specifications/SalesOrderIDEqualsSpecification.cs | C# | apache-2.0 | 635 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
12391,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3793,
1025,
2478,
29215,
2140,
1012,
5884,
1012,
2944,
1025,
2478,
29215,
2140,
1012,
5884,
1012,
15480,
1025,
3415,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
homepage: http://arc.semsol.org/
license: http://arc.semsol.org/license
class: ARC2 RDF/XML Serializer
author: Benjamin Nowack
version: 2009-02-12 (Fix: scheme-detection: scheme must have at least 2 chars, thanks to Eric Schoonover)
*/
ARC2::inc('RDFSerializer');
class ARC2_RDFXMLSerializer extends ARC2_RDFSerializer {
function __construct($a = '', &$caller) {
parent::__construct($a, $caller);
}
function ARC2_RDFXMLSerializer($a = '', &$caller) {
$this->__construct($a, $caller);
}
function __init() {
parent::__init();
$this->content_header = 'application/rdf+xml';
$this->pp_containers = $this->v('serializer_prettyprint_containers', 0, $this->a);
}
/* */
function getTerm($v, $type) {
if (!is_array($v)) {/* uri or bnode */
if (preg_match('/^\_\:(.*)$/', $v, $m)) {
return ' rdf:nodeID="' . $m[1] . '"';
}
if ($type == 's') {
return ' rdf:about="' . htmlspecialchars($v) . '"';
}
if ($type == 'p') {
if ($pn = $this->getPName($v)) {
return $pn;
}
return 0;
}
if ($type == 'o') {
$v = $this->expandPName($v);
if (!preg_match('/^[a-z0-9]{2,}\:[^\s]+$/is', $v)) return $this->getTerm(array('value' => $v, 'type' => 'literal'), $type);
return ' rdf:resource="' . htmlspecialchars($v) . '"';
}
if ($type == 'datatype') {
$v = $this->expandPName($v);
return ' rdf:datatype="' . htmlspecialchars($v) . '"';
}
if ($type == 'lang') {
return ' xml:lang="' . htmlspecialchars($v) . '"';
}
}
if ($v['type'] != 'literal') {
return $this->getTerm($v['value'], 'o');
}
/* literal */
$dt = isset($v['datatype']) ? $v['datatype'] : '';
$lang = isset($v['lang']) ? $v['lang'] : '';
if ($dt == 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral') {
return ' rdf:parseType="Literal">' . $v['value'];
}
elseif ($dt) {
return $this->getTerm($dt, 'datatype') . '>' . htmlspecialchars($v['value']);
}
elseif ($lang) {
return $this->getTerm($lang, 'lang') . '>' . htmlspecialchars($v['value']);
}
return '>' . htmlspecialchars($v['value']);
}
function getHead() {
$r = '';
$nl = "\n";
$r .= '<?xml version="1.0" encoding="UTF-8"?>';
$r .= $nl . '<rdf:RDF';
$first_ns = 1;
foreach ($this->used_ns as $v) {
$r .= $first_ns ? ' ' : $nl . ' ';
$r .= 'xmlns:' . $this->nsp[$v] . '="' .$v. '"';
$first_ns = 0;
}
$r .= '>';
return $r;
}
function getFooter() {
$r = '';
$nl = "\n";
$r .= $nl . $nl . '</rdf:RDF>';
return $r;
}
function getSerializedIndex($index, $raw = 0) {
$r = '';
$nl = "\n";
foreach ($index as $raw_s => $ps) {
$r .= $r ? $nl . $nl : '';
$s = $this->getTerm($raw_s, 's');
$tag = 'rdf:Description';
$sub_ps = 0;
/* pretty containers */
if ($this->pp_containers && ($ctag = $this->getContainerTag($ps))) {
$tag = 'rdf:' . $ctag;
list($ps, $sub_ps) = $this->splitContainerEntries($ps);
}
$r .= ' <' . $tag . '' .$s . '>';
$first_p = 1;
foreach ($ps as $p => $os) {
if (!$os) continue;
if ($p = $this->getTerm($p, 'p')) {
$r .= $nl . str_pad('', 4);
$first_o = 1;
if (!is_array($os)) {/* single literal o */
$os = array(array('value' => $os, 'type' => 'literal'));
}
foreach ($os as $o) {
$o = $this->getTerm($o, 'o');
$r .= $first_o ? '' : $nl . ' ';
$r .= '<' . $p;
$r .= $o;
$r .= preg_match('/\>/', $o) ? '</' . $p . '>' : '/>';
$first_o = 0;
}
$first_p = 0;
}
}
$r .= $r ? $nl . ' </' . $tag . '>' : '';
if ($sub_ps) $r .= $nl . $nl . $this->getSerializedIndex(array($raw_s => $sub_ps), 1);
}
if ($raw) {
return $r;
}
return $this->getHead() . $nl . $nl . $r . $this->getFooter();
}
/* */
function getContainerTag($ps) {
$rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
if (!isset($ps[$rdf . 'type'])) return '';
$types = $ps[$rdf . 'type'];
foreach ($types as $type) {
if (!in_array($type['value'], array($rdf . 'Bag', $rdf . 'Seq', $rdf . 'Alt'))) return '';
return str_replace($rdf, '', $type['value']);
}
}
function splitContainerEntries($ps) {
$rdf = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#';
$items = array();
$rest = array();
foreach ($ps as $p => $os) {
$p_short = str_replace($rdf, '', $p);
if ($p_short === 'type') continue;
if (preg_match('/^\_([0-9]+)$/', $p_short, $m)) {
$items = array_merge($items, $os);
}
else {
$rest[$p] = $os;
}
}
if ($items) return array(array($rdf . 'li' => $items), $rest);
return array($rest, 0);
}
/* */
}
| baxtree/OKBook | sites/all/modules/rdf/vendor/arc/serializers/ARC2_RDFXMLSerializer.php | PHP | gpl-2.0 | 5,008 | [
30522,
1026,
1029,
25718,
1013,
1008,
2188,
13704,
1024,
8299,
1024,
1013,
1013,
8115,
1012,
7367,
5244,
4747,
1012,
8917,
1013,
6105,
1024,
8299,
1024,
1013,
1013,
8115,
1012,
7367,
5244,
4747,
1012,
8917,
1013,
6105,
2465,
1024,
8115,
2... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
---
layout: post
title: Summer Sailing
excerpt: Random photos of summer sailing and favorite anchorages.
categories: 2016-LakeSuperior
date: 2016-07-27
published: true
image:
ogimage: "2016/DSCF3171.jpg"
images-array:
- path: 2016/DSCF3080.jpg
label:
- path: 2016/DSCF3095.jpg
label:
- path: 2016/DSCF3096.jpg
label:
- path: 2016/DSCF3100.jpg
label:
- path: 2016/DSCF3119.jpg
label:
- path: 2016/DSCF3121.jpg
label:
- path: 2016/DSCF3156.jpg
label: I like my rope rigging enough that I'm always taking pictures of it. Dead eyes and lashings with a huge ship in the background. Could it be more nautical?
- path: 2016/DSCF3159.jpg
label:
- path: 2016/DSCF3171.jpg
label:
---
I mysteriously lost most of the pictures from our summer circle tour. This is what I could find. Basically the sunset is from the day before we left and there are a few from the Apostle Islands just before we got home. That's it! | jilse/jilse.github.io | _posts/2016/2016-07-27-random-2016-Lake-Superior-sailing-picutres.md | Markdown | mit | 953 | [
30522,
1011,
1011,
1011,
9621,
1024,
2695,
2516,
1024,
2621,
8354,
28142,
1024,
6721,
7760,
1997,
2621,
8354,
1998,
5440,
21086,
2015,
1012,
7236,
1024,
2355,
1011,
6597,
6279,
11124,
2953,
3058,
1024,
2355,
1011,
5718,
1011,
2676,
2405,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package models.services
import java.util.UUID
import javax.inject.Inject
import com.mohiva.play.silhouette.api.LoginInfo
import com.mohiva.play.silhouette.impl.providers.CommonSocialProfile
import models.User
import models.daos.UserDAO
import play.api.libs.concurrent.Execution.Implicits._
import scala.concurrent.Future
/**
* Handles actions to users.
*
* @param userDAO The user DAO implementation.
*/
class UserServiceImpl @Inject() (userDAO: UserDAO) extends UserService {
/**
* Retrieves a user that matches the specified login info.
*
* @param loginInfo The login info to retrieve a user.
* @return The retrieved user or None if no user could be retrieved for the given login info.
*/
def retrieve(loginInfo: LoginInfo): Future[Option[User]] = userDAO.find(loginInfo)
/**
* Retrives a user that matches the specified userId.
* @param userId The user id to retriece a user.
* @return The retrieved user or None if no user could be retrieved for the given user id.
*/
def retrieve(userId: UUID): Future[Option[User]] = userDAO.find(userId)
/**
* Saves a user.
*
* @param user The user to save.
* @return The saved user.
*/
def save(user: User) = {
userDAO.find(user.userID).flatMap{
case Some(u) => // Update except User.userID
userDAO.update(u.copy(
loginInfo = user.loginInfo,
firstName = user.firstName,
lastName = user.lastName,
fullName = user.fullName,
email = user.email,
avatarURL = user.avatarURL,
mailConfirmed = user.mailConfirmed))
case None => userDAO.save(user)
}
}
/**
* Saves the social profile for a user.
*
* If a user exists for this profile then update the user, otherwise create a new user with the given profile.
*
* @param profile The social profile to save.
* @return The user for whom the profile was saved.
*/
def save(profile: CommonSocialProfile) = {
userDAO.find(profile.loginInfo).flatMap {
case Some(user) => // Update user with profile
userDAO.save(user.copy(
firstName = profile.firstName,
lastName = profile.lastName,
fullName = profile.fullName,
email = profile.email,
avatarURL = profile.avatarURL
))
case None => // Insert a new user
userDAO.save(User(
userID = UUID.randomUUID(),
loginInfo = profile.loginInfo,
firstName = profile.firstName,
lastName = profile.lastName,
fullName = profile.fullName,
email = profile.email,
avatarURL = profile.avatarURL,
mailConfirmed = None
))
}
}
}
| Biacco42/play-silhouette-mail-confirm-seed | app/models/services/UserServiceImpl.scala | Scala | apache-2.0 | 2,705 | [
30522,
7427,
4275,
1012,
2578,
12324,
9262,
1012,
21183,
4014,
1012,
1057,
21272,
12324,
9262,
2595,
1012,
1999,
20614,
1012,
1999,
20614,
12324,
4012,
1012,
9587,
4048,
3567,
1012,
2377,
1012,
21776,
1012,
17928,
1012,
8833,
5498,
2078,
14... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
#!/usr/bin/env python
# encoding: utf-8
"""
Make a grid of synths for a set of attenuations.
2015-04-30 - Created by Jonathan Sick
"""
import argparse
import numpy as np
from starfisher.pipeline import PipelineBase
from androcmd.planes import BasicPhatPlanes
from androcmd.phatpipeline import (
SolarZIsocs, SolarLockfile,
PhatGaussianDust, PhatCrowding)
from androcmd.phatpipeline import PhatCatalog
def main():
args = parse_args()
av_grid = np.arange(0., args.max_av, args.delta_av)
if args.av is not None:
av = float(args.av)
run_pipeline(brick=args.brick, av=av, run_fit=args.fit)
else:
for av in av_grid:
run_pipeline(brick=args.brick, av=av, run_fit=args.fit)
def parse_args():
parser = argparse.ArgumentParser(
description="Grid of synths for a set of Av")
parser.add_argument('brick', type=int)
parser.add_argument('--max-av', type=float, default=1.5)
parser.add_argument('--delta-av', type=float, default=0.1)
parser.add_argument('--fit', action='store_true', default=False)
parser.add_argument('--av', default=None)
return parser.parse_args()
def run_pipeline(brick=23, av=0., run_fit=False):
dataset = PhatCatalog(brick)
pipeline = Pipeline(root_dir="b{0:d}_{1:.2f}".format(brick, av),
young_av=av, old_av=av, av_sigma_ratio=0.25,
isoc_args=dict(isoc_kind='parsec_CAF09_v1.2S',
photsys_version='yang'))
print(pipeline)
print('av {0:.1f} done'.format(av))
if run_fit:
pipeline.fit('f475w_f160w', ['f475w_f160w'], dataset)
pipeline.fit('rgb', ['f475w_f814w_rgb'], dataset)
pipeline.fit('ms', ['f475w_f814w_ms'], dataset)
class Pipeline(BasicPhatPlanes, SolarZIsocs,
SolarLockfile, PhatGaussianDust, PhatCrowding, PipelineBase):
"""A pipeline for fitting PHAT bricks with solar metallicity isochrones."""
def __init__(self, **kwargs):
super(Pipeline, self).__init__(**kwargs)
if __name__ == '__main__':
main()
| jonathansick/androcmd | scripts/dust_grid.py | Python | mit | 2,095 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1001,
17181,
1024,
21183,
2546,
1011,
1022,
1000,
1000,
1000,
2191,
1037,
8370,
1997,
24203,
2015,
2005,
1037,
2275,
1997,
2012,
6528,
14505,
2015,
1012,
2325,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* sc1_sys.c: SC1 simulator interface
Copyright (c) 2005-2007, SiCortex, Inc. All rights reserved.
Based on SIMH; SIMH copyrights attached.
Copyright (c) 2005, Robert M Supnik
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Robert M Supnik shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Robert M Supnik.
12-Oct-07 RMS Added support for Mips64 R2 instructions
17-Jan-06 RMS Added I2C device
16-Jan-06 RMS Added TRACE capability
05-Dec-05 RMS Removed NVR device
16-Nov-05 RMS Fixed decoding of S?XC1 instructions
31-Oct-05 RMS Added disk to Windows configuration
24-Oct-05 RMS Fixed miscoding of DCLZ, DCLO
13-Oct-05 RMS Added pseudo-instructions li, move
09-Sep-05 RMS Fixed bug, sprintf of opcode (only) returned 0
23-Aug-05 ADB Adding NVRAM support, fixing cpu0/mem dependancy
23-Aug-05 RMS Added sprintf-like capability to disassembler
25-Jul-05 RMS Fixed problem printing 64b addresses
*/
#include <ctype.h>
#include <sys/stat.h>
#if !defined (_WIN32)
#include <elf.h>
#endif
#include "sc1_defs.h"
#include "sc1_sys.h"
#if defined (_WIN32)
# include "ice9_magic_spec_sw.h"
#elif defined (SIMX_NATIVE) /* Built into simx */
# include "ice9_magic_spec_sw.h"
#else
# include "sicortex/ice9/ice9_magic_spec_sw.h"
#endif
#ifdef USE_TAP
extern DEVICE eth_dev;
#endif
#ifdef SIMH_USE_PCIE
extern DEVICE pcie_dev;
extern DEVICE pmi_dev;
#endif
extern DEVICE mem_dev;
extern DEVICE cpu0_dev;
extern DEVICE uart_dev;
extern DEVICE i2c_dev;
extern DEVICE rom_dev;
extern DEVICE disk_dev;
extern DEVICE cac_dev;
extern DEVICE coh_dev[2];
#if defined(USE_MSP)
extern DEVICE scmsp_dev; /* supplied by sc1_scmsp.c */
#endif
extern DEVICE fsw_dev;
extern DEVICE qsc_dev;
extern DEVICE sdma_dev;
extern DEVICE flr_dev[3];
extern DEVICE flt_dev[3];
#if defined(USE_SCDMA) || defined(USE_NODMA) || defined(USE_HLMDMA)
extern DEVICE scdma_dev; /* supplied by either sc1_scdma.c, sc1_nodma.c, or sc1_dma.c */
#endif
#ifdef SIMH_CPUSIMH
extern DEVICE scx_dev;
#endif
extern DEVICE gdb_dev;
extern DEVICE scb_dev;
extern DEVICE ddr_dev;
extern REG cpu0_reg[];
extern int32 sim_switches;
extern CORECTX *cpu_ctx[NUM_CORES];
uint32 sprint_sym_m (char *cptr, t_addr addr, uint32 inst);
t_stat parse_sym_m (char *cptr, t_addr addr, t_value *inst);
int32 parse_reg (char *cptr, char **optr);
uint32 parse_imm (char *cptr, char **optr);
char *sprint_addr (char *cptr, t_uint64 ad);
extern UNIT mem_unit;
/* SCP data structures and interface routines
sim_name simulator name string
sim_PC pointer to saved PC register descriptor
sim_emax number of words for examine
sim_devices array of pointers to simulated devices
sim_stop_messages array of pointers to stop messages
sim_load binary loader
*/
char sim_name[] = "SC1";
REG *sim_PC = &cpu0_reg[0];
int32 sim_emax = 8;
DEVICE *sim_devices[DEV_MAX + 1] = {
&mem_dev,
&cpu0_dev,
&cac_dev,
&coh_dev[0],
&coh_dev[1],
&rom_dev,
&uart_dev,
&i2c_dev,
// &nvr_dev,
#ifdef USE_TAP
ð_dev,
#endif
&disk_dev,
#ifdef SIMH_USE_PCIE
&pcie_dev,
&pmi_dev,
#endif
#if !defined(_WIN32)
&fsw_dev,
&qsc_dev,
&sdma_dev,
&flr_dev[0],
&flr_dev[1],
&flr_dev[2],
&flt_dev[0],
&flt_dev[1],
&flt_dev[2],
#endif
#if defined(USE_SCDMA) || defined(USE_NODMA) || defined(USE_HLMDMA)
&scdma_dev,
#endif
#ifdef SIMH_CPUSIMH
&scx_dev,
#endif
#if defined(USE_MSP)
&scmsp_dev,
#endif
#if !defined(_WIN32)
&scb_dev,
&ddr_dev,
#endif
#if !defined (_WIN32)
&gdb_dev,
#endif
NULL
};
extern char sc1_stop_trap[];
char *sim_stop_messages[] = {
"Unknown error",
"HALT instruction",
"Breakpoint",
"Memory management error",
"Wait state",
"%Error: Test failed", // %Error is magic so vtest will exit with error
"Test passed",
sc1_stop_trap,
"Simulator hook detected",
};
/* Local routines to write either memory or ROM */
t_bool sim_load_WritePB (t_uint64 pa, t_uint64 dat, uint32 catr)
{
if (PA_IS_MEM (pa)) return CALL_LOAD_WRITEPB (NULL, pa, dat, catr);
else if (PA_IS_ROM (pa)) return CALL_LOAD_WRITEIO (NULL, pa, dat, L_BYTE);
return FALSE;
}
t_bool sim_load_WritePW (t_uint64 pa, t_uint64 dat, uint32 catr)
{
if (PA_IS_MEM (pa)) return CALL_LOAD_WRITEPW (NULL, pa, dat, catr);
else if (PA_IS_ROM (pa)) return CALL_LOAD_WRITEIO (NULL, pa, dat, L_WORD);
return FALSE;
}
t_stat sim_load_WritePtr (t_uint64 pa, unsigned char* datap, t_uint64 size)
{
t_uint64 leftpa = pa;
t_uint64 leftsize = size;
unsigned char* leftdatap = datap;
while (leftsize) {
if (!sim_load_WritePB(leftpa, *leftdatap, 0)) return SCPE_NXM;
leftpa += 1;
leftsize -= 1;
leftdatap += 1;
}
return SCPE_OK;
}
/*
* YAMON style argument / environment loader
* str - string containing value to be stored
* loc - where to store str
* ent - the entry in which to store the pointer to loc
*/
static t_stat yamon_arg_env(char *str, t_uint64 loc, t_uint64 ent)
{
unsigned int i;
if( str ) {
for(i=0; i<=strlen(str); i++) {
if (!sim_load_WritePB(loc+i, str[i], 0)) {
return SCPE_NXM;
}
}
if( !sim_load_WritePW(ent, (XKSEG_COMP + loc) & M32, 0) ) {
return SCPE_NXM;
}
} else {
if( !sim_load_WritePW(ent, 0, 0) ) {
return SCPE_NXM;
}
}
return SCPE_OK;
}
#if defined (_WIN32)
static t_stat sim_load_elf (FILE *fileref, char *cptr, char *fnam, int flag)
{
return SCPE_NOFNC;
}
#else
static t_stat sim_load_elf (FILE *fileref, char *cptr, char *fnam, int flag)
{
struct stat statbuf;
unsigned char *mappedfilep;
unsigned char *loadblockp;
Elf64_Ehdr* ehdrp;
// Suck the whole file in (mmap isn't on all systems)
fstat (fileno(fileref), &statbuf);
mappedfilep = (unsigned char*)malloc(statbuf.st_size);
loadblockp = (unsigned char*)malloc(statbuf.st_size);
fread (mappedfilep, statbuf.st_size, 1, fileref);
// First is the header
ehdrp = (Elf64_Ehdr*) mappedfilep;
if (strncmp((char*)ehdrp->e_ident, "\177ELF",3)) {
fprintf(stderr, "%s is not an ELF (exe) file\n", fnam);
return SCPE_FMT;
}
if (ehdrp->e_ident[EI_CLASS]!=ELFCLASS64
|| ehdrp->e_ident[EI_DATA]!=ELFDATA2LSB) {
fprintf(stderr, "%s is not 64-bit little endian ELF\n", fnam);
return SCPE_FMT;
}
// Now through each loader section...
#define LOADER_NTOHS(x) (x)
#define LOADER_NTOHL(x) (x)
#define LOADER_NTOHLL(x) (x)
Elf64_Phdr* phdrp = (Elf64_Phdr*) &mappedfilep[LOADER_NTOHL(ehdrp->e_phoff)];
for (int i=0; i < LOADER_NTOHS(ehdrp->e_phnum); i++, phdrp++) {
int off = LOADER_NTOHL(phdrp->p_offset);
t_uint64 loadaddr = LOADER_NTOHLL(phdrp->p_vaddr);
if (phdrp->p_memsz) {
int loadsize = 0;
//int memsz = LOADER_NTOHL(phdrp->p_memsz);
int filesz = LOADER_NTOHL(phdrp->p_filesz);
if (LOADER_NTOHL(phdrp->p_type) & PT_LOAD) {
t_uint64 adr;
if (filesz > statbuf.st_size) {
fprintf(stderr, "Elf specified load larger then ELF file!\n");
return SCPE_FMT;
}
if (loadaddr == ~0ULL) loadaddr=0;
for (adr = loadaddr; adr < (loadaddr + filesz); adr++, off++) {
unsigned char data = *((unsigned char *) (mappedfilep + off));
loadblockp[loadsize++] = data;
}
if (loadsize) {
// Write to destination
t_uint64 pa = loadaddr & 0x3fffffff; // Cheap virtual->physical conversion
sim_load_WritePtr(pa, loadblockp, loadsize);
}
// Note if filesz<memsz, then there are ZEROs to load.
// For speed, memory already is zeroed, so we can skip that part of the section.
}
}
}
// Entry address
if (ehdrp->e_entry) {
int j;
for (j = 0; j < NUM_CORES; j++) {
cpu_ctx[j]->PC = ehdrp->e_entry | ~((t_uint64) M32);
}
}
free(mappedfilep); mappedfilep=NULL;
free(loadblockp); loadblockp=NULL;
return SCPE_OK;
}
#endif
/* Binary loader
The binary loader handles absolute system images. Supported switches:
-b simple binary byte stream
-h Mips hex test format (# comments, otherwise address data)
-o for memory, specify origin
-s swap bytes
-m Motorola SREC format
-e ELF
*/
t_stat sim_load (FILE *fileref, char *cptr, char *fnam, int flag)
{
t_stat r;
char gbuf[CBUFSIZE];
uint32 addr, dat;
int32 i, j;
t_uint64 origin=0;
if (flag) return SCPE_ARG; /* dump? */
if (sim_switches & SWMASK ('O')) { /* origin? */
origin = get_uint (cptr, 16, PA_MAX, &r);
if (r != SCPE_OK) return SCPE_ARG;
}
if ((sim_switches & SWMASK ('H')) || /* HEX format? */
(match_ext (fnam, "HEX") && !(sim_switches & SWMASK ('B')))) {
while (fgets (gbuf, CBUFSIZE - 1, fileref) != NULL) {
if (gbuf[0] == '#') continue;
if (sscanf (gbuf, "%X%X", &addr, &dat) != 2) return SCPE_FMT;
if (!sim_load_WritePW (((t_uint64) addr) << 2, dat, 0)) return SCPE_NXM;
}
} else if( sim_switches & SWMASK ('M') ) { /* Motorola SREC format */
char line[1024];
unsigned int i, count;
int bigendian = 0;
long ori;
long byte;
while(fgets(line, 1024, fileref)) {
switch(line[0]) {
/* We do not currently check the checksum */
case '!':
switch(line[1]) {
case 'L': bigendian = 0;
break;
case 'B': bigendian = 1;
break;
default: return SCPE_FMT;
}
break;
case 'S':
switch(line[1]) {
case '0': break; /* We don't read this currently */
case '1': break; /* We don't read this currently */
case '2': break; /* We don't read this currently */
case '3': /* 32-bit entry */
sscanf(line, "S3%2X", &count);
sscanf(&line[4], "%8lX", &ori);
ori &= ~XKSEG_COMP;
for(i=0; i<(count-5); i++) {
sscanf(&line[12+(i*2)], "%2lX", &byte);
if( bigendian ) {
if (!sim_load_WritePB ((ori+i)+3-2*((ori+i)%4), byte, 0)) {
return SCPE_NXM;
}
} else {
if (!sim_load_WritePB (ori+i, byte, 0)) {
return SCPE_NXM;
}
}
}
break;
case '4': break; /* We don't read this currently */
case '5': break; /* We don't read this currently */
case '6': return SCPE_FMT; break; /* UNUSED */
case '7': /* 32-bit Entry point address */
// If there are multiple S7 records, only the last one sticks...
sscanf(&line[4], "%8lX", &ori);
for (j = 0; j < NUM_CORES; j++) {
cpu_ctx[j]->PC = ori | ~((t_uint64) M32);
}
// printf("S7 entry point: ffffffff%.8s\n", &line[4]);
break;
case '8': break; /* We don't read this currently */
case '9': break; /* We don't read this currently */
default:
return SCPE_FMT;
break;
}
break;
default:
return SCPE_FMT;
}
}
} else if( sim_switches & SWMASK ('E') ) { /* ELF format */
return sim_load_elf (fileref, cptr, fnam, flag);
} else if( sim_switches & SWMASK ('A') ) { /* Kernel arguments in a string */
char line[1024];
t_uint64 argc, argv, argp;
argc = argv = argp = 0;
if( origin == 0 ) {
argv = 0x1000;
} else {
argv = (origin & M32);
}
printf("Storing args at %#08Lx\r\n", argv);
argp = argv + (4 * 256);
while(fgets(line, 1024, fileref) && (argc < 256)) {
line[strlen(line)-1] = '\0';
r = yamon_arg_env(line, argp, argv+(4*argc));
if(r != SCPE_OK) return r;
argp += strlen(line) + 1;
argc++;
}
// ARGC
*(t_uint64 *)cpu0_reg[6].loc = argc;
// ARGV
*(t_uint64 *)cpu0_reg[7].loc = XKSEG_COMP + argv;
// ENVP
*(t_uint64 *)cpu0_reg[8].loc = XKSEG_COMP + argv+(4*argc);
// Store "memsize" environment name
sprintf(line, "memsize");
r = yamon_arg_env(line, argp, argv+(4*argc));
if(r != SCPE_OK) return r;
argp += strlen(line) + 1;
argc++;
// Store "memsize" environment value
sprintf(line, "%lld", MEMSIZE);
r = yamon_arg_env(line, argp, argv+(4*argc));
if(r != SCPE_OK) return r;
argp += strlen(line) + 1;
argc++;
// Be sure that the argument list is terminated
r = yamon_arg_env(NULL, argp, argv+(4*argc));
if(r != SCPE_OK) return r;
argp += strlen(line) + 1;
argc++;
r = yamon_arg_env(NULL, argp, argv+(4*argc));
if(r != SCPE_OK) return r;
#if DEBUG
printf("END : %#08Lx\r\n", argp);
printf("ARGC: %#08Lx\r\n", *(t_uint64 *)cpu0_reg[6].loc);
printf("ARGV: %#08Lx\r\n", *(t_uint64 *)cpu0_reg[7].loc);
printf("ENVP: %#08Lx\r\n", *(t_uint64 *)cpu0_reg[8].loc);
#endif
} else {
while ((i = getc (fileref)) != EOF) { /* read byte stream */
if (sim_switches & SWMASK ('S')) {
/* The below kludge writes bytes in reverse-endian order */
if (!sim_load_WritePB ( origin + 3 - 2*(origin%4) , i, 0)) return SCPE_NXM;
} else {
if (!sim_load_WritePB (origin, i, 0)) return SCPE_NXM;
}
origin = origin + 1;
}
}
return SCPE_OK;
}
static const uint32 fld_shift[16] = {
0, I_V_RS, I_V_RT, I_V_RD, I_V_SA, I_V_FNC, 0, 0,
I_V_SA, 0, 0, 0, 0, 0, 0, 0
};
struct opcode {
char* name;
uint32 val;
uint32 mask;
uint32 flg;
};
/* Instruction table */
struct opcode opc[] = {
{ "NOP", 0x00000000, M_NOP, F_NOP }, /* special */
{ "SSNOP", 0x00000040, M_NOP, F_NOP },
{ "EHB", 0x000000C0, M_NOP, F_NOP }, // R2
{ "SLL", 0x00000000, M_SH3, F_SH3 },
{ "MOVF", 0x00000001, M_MCG, F_MCG },
{ "MOVT", 0x00010001, M_MCG, F_MCG },
{ "SRL", 0x00000002, M_SH3, F_SH3 },
{ "ROTR", 0x00200002, M_SH3, F_SH3 }, // R2
{ "SRA", 0x00000003, M_SH3, F_SH3 },
{ "SLLV", 0x00000004, M_SV3, F_SV3 },
{ "SRLV", 0x00000006, M_SV3, F_SV3 },
{ "ROTRV", 0x00000046, M_SV3, F_SV3 }, // R2
{ "SRAV", 0x00000007, M_SV3, F_SV3 },
{ "JR", 0x00000008, M_OR1, F_OR1 },
{ "JALR", 0x00000009, M_CJ2, F_CJ2 },
{ "MOVZ", 0x0000000A, M_OP3, F_OP3 },
{ "MOVN", 0x0000000B, M_OP3, F_OP3 },
{ "SYSCALL",0x0000000C, M_COD, F_COD },
{ "BREAK", 0x0000000D, M_COD, F_COD },
{ "SYNC", 0x0000000F, M_COD, F_COD },
{ "MFHI", 0x00000010, M_OW1, F_OW1 },
{ "MTHI", 0x00000011, M_OR1, F_OR1 },
{ "MFLO", 0x00000012, M_OW1, F_OW1 },
{ "MTLO", 0x00000013, M_OR1, F_OR1 },
{ "DSLLV", 0x00000014, M_SV3, F_SV3 },
{ "DSRLV", 0x00000016, M_SV3, F_SV3 },
{ "DROTRV", 0x00000056, M_SV3, F_SV3 }, // R2
{ "DSRAV", 0x00000017, M_SV3, F_SV3 },
{ "MULT", 0x00000018, M_OR2, F_OR2 },
{ "MULTU", 0x00000019, M_OR2, F_OR2 },
{ "DIV", 0x0000001A, M_OR2, F_OR2 },
{ "DIVU", 0x0000001B, M_OR2, F_OR2 },
{ "DMULT", 0x0000001C, M_OR2, F_OR2 },
{ "DMULTU", 0x0000001D, M_OR2, F_OR2 },
{ "DDIV", 0x0000001E, M_OR2, F_OR2 },
{ "DDIVU", 0x0000001F, M_OR2, F_OR2 },
{ "ADD", 0x00000020, M_OP3, F_OP3 },
{ "ADDU", 0x00000021, M_OP3, F_OP3 },
{ "SUB", 0x00000022, M_OP3, F_OP3 },
{ "SUBU", 0x00000023, M_OP3, F_OP3 },
{ "AND", 0x00000024, M_OP3, F_OP3 },
{ "MOVE", 0x00000025, M_OP2, F_OP2 }, /* must preceed or */
{ "OR", 0x00000025, M_OP3, F_OP3 },
{ "XOR", 0x00000026, M_OP3, F_OP3 },
{ "NOR", 0x00000027, M_OP3, F_OP3 },
{ "SLT", 0x0000002A, M_OP3, F_OP3 },
{ "SLTU", 0x0000002B, M_OP3, F_OP3 },
{ "DADD", 0x0000002C, M_OP3, F_OP3 },
{ "DADDU", 0x0000002D, M_OP3, F_OP3 },
{ "DSUB", 0x0000002E, M_OP3, F_OP3 },
{ "DSUBU", 0x0000002F, M_OP3, F_OP3 },
{ "TGE", 0x00000030, M_OR2, F_OR2 },
{ "TGEU", 0x00000031, M_OR2, F_OR2 },
{ "TLT", 0x00000032, M_OR2, F_OR2 },
{ "TLTU", 0x00000033, M_OR2, F_OR2 },
{ "TEQ", 0x00000034, M_OR2, F_OR2 },
{ "TNE", 0x00000036, M_OR2, F_OR2 },
{ "DSLL", 0x00000038, M_SH3, F_SH3 },
{ "DSRL", 0x0000003A, M_SH3, F_SH3 },
{ "DROTR", 0x0020003A, M_SH3, F_SH3 }, // R2
{ "DSRA", 0x0000003B, M_SH3, F_SH3 },
{ "DSLL32", 0x0000003C, M_SH3, F_SH3 },
{ "DSRL32", 0x0000003E, M_SH3, F_SH3 },
{ "DROTR32",0x0020003E, M_SH3, F_SH3 }, // R2
{ "DSRA32", 0x0000003F, M_SH3, F_SH3 },
{ "BLTZ", 0x04000000, M_BR1, F_BR1 }, /* regimm */
{ "BGEZ", 0x04010000, M_BR1, F_BR1 },
{ "BLTZL", 0x04020000, M_BR1, F_BR1 },
{ "BGEZL", 0x04030000, M_BR1, F_BR1 },
{ "TGEI", 0x04080000, M_RGI, F_RGI },
{ "TGEIU", 0x04090000, M_RGI, F_RGI },
{ "TLTI", 0x040A0000, M_RGI, F_RGI },
{ "TLTIU", 0x040B0000, M_RGI, F_RGI },
{ "TEQI", 0x040C0000, M_RGI, F_RGI },
{ "TNEI", 0x040E0000, M_RGI, F_RGI },
{ "BLTZAL", 0x04000000, M_BR1, F_BR1 },
{ "BAL", 0x04110000, M_BR0, F_BR0 },
{ "BGEZAL", 0x04110000, M_BR1, F_BR1 },
{ "BLTZALL",0x04120000, M_BR1, F_BR1 },
{ "BGEZALL",0x04130000, M_BR1, F_BR1 },
{ "SYNCI", 0x041F0000, M_SYI, F_SYI },
{ "J", 0x08000000, M_JMP, F_JMP },
{ "JAL", 0x0C000000, M_JMP, F_JMP },
{ "B", 0x10000000, M_BRU, F_BRU },
{ "BEQ", 0x10000000, M_BR2, F_BR2 },
{ "BNE", 0x14000000, M_BR2, F_BR2 },
{ "BLEZ", 0x18000000, M_BR1, F_BR1 },
{ "BGTZ", 0x1C000000, M_BR1, F_BR1 },
{ "ADDI", 0x20000000, M_IMM, F_IMM },
{ "LI", 0x24000000, M_LI, F_LI }, /* must preceed ADDIU */
{ "ADDIU", 0x24000000, M_IMM, F_IMM },
{ "SLTI", 0x28000000, M_IMM, F_IMM },
{ "TEST_FAIL", ICE9_E_MipsMagicInstrs_HALTFAIL, M_NOP, F_NOP },
{ "TEST_PASS", ICE9_E_MipsMagicInstrs_HALTPASS, M_NOP, F_NOP },
{ "TRACE_ON", ICE9_E_MipsMagicInstrs_SIMHTRACEON, M_NOP, F_NOP },
{ "TRACE_OFF", ICE9_E_MipsMagicInstrs_SIMHTRACEOFF, M_NOP, F_NOP },
{ "SLTIU", 0x2C000000, M_IMM, F_IMM },
{ "ANDI", 0x30000000, M_IMM, F_IMM },
{ "ORI", 0x34000000, M_IMM, F_IMM },
{ "XORI", 0x38000000, M_IMM, F_IMM },
{ "LUI", 0x3C000000, M_LUI, F_LUI },
{ "MFC0", 0x40000000, M_MXC, F_MXC }, /* cop0 */
{ "DMFC0", 0x40200000, M_MXC, F_MXC },
{ "MTC0", 0x40800000, M_MXC, F_MXC },
{ "DMTC0", 0x40A00000, M_MXC, F_MXC },
{ "DI", 0x41606000, M_MFM, F_MFM }, // R2
{ "EI", 0x41606020, M_MFM, F_MFM }, // R2
{ "TLBR", 0x42000001, M_NOP, F_NOP },
{ "TLBWI", 0x42000002, M_NOP, F_NOP },
{ "TLBWR", 0x42000006, M_NOP, F_NOP },
{ "TLBP", 0x42000008, M_NOP, F_NOP },
{ "ERET", 0x42000018, M_NOP, F_NOP },
{ "DERET", 0x4200001F, M_NOP, F_NOP },
{ "WAIT", 0x42000020, M_NOP, F_NOP },
{ "MFC1", 0x44000000, M_MVF, F_MVF }, /* cop1 (fp) */
{ "DMFC1", 0x44200000, M_MVF, F_MVF },
{ "CFC1", 0x44400000, M_MVF, F_MVF },
{ "MFHC1", 0x44600000, M_MVF, F_MVF }, // R2
{ "MTC1", 0x44800000, M_MVF, F_MVF },
{ "DMTC1", 0x44A00000, M_MVF, F_MVF },
{ "CTC1", 0x44C00000, M_MVF, F_MVF },
{ "MTHC1", 0x44E00000, M_MVF, F_MVF }, // R2
{ "BC1F", 0x45000000, M_BCO, F_BCO },
{ "BC1T", 0x45010000, M_BCO, F_BCO },
{ "BC1FL", 0x45020000, M_BCO, F_BCO },
{ "BC1TL", 0x45030000, M_BCO, F_BCO },
{ "ADD.S", 0x46000000, M_FP3, F_FP3 },
{ "SUB.S", 0x46000001, M_FP3, F_FP3 },
{ "MUL.S", 0x46000002, M_FP3, F_FP3 },
{ "DIV.S", 0x46000003, M_FP3, F_FP3 },
{ "SQRT.S", 0x46000004, M_FP2, F_FP2 },
{ "ABS.S", 0x46000005, M_FP2, F_FP2 },
{ "MOV.S", 0x46000006, M_FP2, F_FP2 },
{ "NEG.S", 0x46000007, M_FP2, F_FP2 },
{ "ROUND.L.S",0x46000008, M_FP2, F_FP2 },
{ "TRUNC.L.S",0x46000009, M_FP2, F_FP2 },
{ "CEIL.L.S", 0x4600000A, M_FP2, F_FP2 },
{ "FLOOR.L.S",0x4600000B, M_FP2, F_FP2 },
{ "ROUND.W.S",0x4600000C, M_FP2, F_FP2 },
{ "TRUNC.W.S",0x4600000D, M_FP2, F_FP2 },
{ "CEIL.W.S", 0x4600000E, M_FP2, F_FP2 },
{ "FLOOR.W.S",0x4600000F, M_FP2, F_FP2 },
{ "MOVF.S", 0x46000011, M_MCF, F_MCF },
{ "MOVT.S", 0x46010011, M_MCF, F_MCF },
{ "MOVZ.S", 0x46000012, M_MFI, F_MFI },
{ "MOVN.S", 0x46000013, M_MFI, F_MFI },
{ "RECIP.S" ,0x46000015, M_FP2, F_FP2 },
{ "RSQRT.S" ,0x46000016, M_FP2, F_FP2 },
{ "CVT.D.S", 0x46000021, M_FP2, F_FP2 },
{ "CVT.W.S", 0x46000024, M_FP2, F_FP2 },
{ "CVT.L.S", 0x46000025, M_FP2, F_FP2 },
{ "CVT.PS.S", 0x46000026, M_FP3, F_FP3 },
{ "C.F.S", 0x46000030, M_FCP, F_FCP },
{ "C.UN.S", 0x46000031, M_FCP, F_FCP },
{ "C.EQ.S", 0x46000032, M_FCP, F_FCP },
{ "C.UEQ.S", 0x46000033, M_FCP, F_FCP },
{ "C.OLT.S", 0x46000034, M_FCP, F_FCP },
{ "C.ULT.S", 0x46000035, M_FCP, F_FCP },
{ "C.OLE.S", 0x46000036, M_FCP, F_FCP },
{ "C.ULE.S", 0x46000037, M_FCP, F_FCP },
{ "C.SF.S", 0x46000038, M_FCP, F_FCP },
{ "C.NGLE.S", 0x46000039, M_FCP, F_FCP },
{ "C.SEQ.S", 0x4600003A, M_FCP, F_FCP },
{ "C.NGL.S", 0x4600003B, M_FCP, F_FCP },
{ "C.LT.S", 0x4600003C, M_FCP, F_FCP },
{ "C.NGE.S", 0x4620003D, M_FCP, F_FCP },
{ "C.LE.S", 0x4620003E, M_FCP, F_FCP },
{ "C.BGT.S", 0x4620003F, M_FCP, F_FCP },
{ "ADD.D", 0x46200000, M_FP3, F_FP3 },
{ "SUB.D", 0x46200001, M_FP3, F_FP3 },
{ "MUL.D", 0x46200002, M_FP3, F_FP3 },
{ "DIV.D", 0x46200003, M_FP3, F_FP3 },
{ "SQRT.D", 0x46200004, M_FP2, F_FP2 },
{ "ABS.D", 0x46200005, M_FP2, F_FP2 },
{ "MOV.D", 0x46200006, M_FP2, F_FP2 },
{ "NEG.D", 0x46200007, M_FP2, F_FP2 },
{ "ROUND.L.D",0x46200008, M_FP2, F_FP2 },
{ "TRUNC.L.D",0x46200009, M_FP2, F_FP2 },
{ "CEIL.L.D", 0x4620000A, M_FP2, F_FP2 },
{ "FLOOR.L.D",0x4620000B, M_FP2, F_FP2 },
{ "ROUND.W.D",0x4620000C, M_FP2, F_FP2 },
{ "TRUNC.W.D",0x4620000D, M_FP2, F_FP2 },
{ "CEIL.W.D", 0x4620000E, M_FP2, F_FP2 },
{ "FLOOR.W.D",0x4620000F, M_FP2, F_FP2 },
{ "MOVF.D", 0x46200011, M_MCF, F_MCF },
{ "MOVT.D", 0x46210011, M_MCF, F_MCF },
{ "MOVZ.D", 0x46200012, M_MFI, F_MFI },
{ "MOVN.D", 0x46200013, M_MFI, F_MFI },
{ "RECIP.D" ,0x46200015, M_FP2, F_FP2 },
{ "RSQRT.D" ,0x46200016, M_FP2, F_FP2 },
{ "CVT.S.D", 0x46200020, M_FP2, F_FP2 },
{ "CVT.W.D", 0x46200024, M_FP2, F_FP2 },
{ "CVT.L.D", 0x46200025, M_FP2, F_FP2 },
{ "C.F.D", 0x46200030, M_FCP, F_FCP },
{ "C.UN.D", 0x46200031, M_FCP, F_FCP },
{ "C.EQ.D", 0x46200032, M_FCP, F_FCP },
{ "C.UEQ.D", 0x46200033, M_FCP, F_FCP },
{ "C.OLT.D", 0x46200034, M_FCP, F_FCP },
{ "C.ULT.D", 0x46200035, M_FCP, F_FCP },
{ "C.OLE.D", 0x46200036, M_FCP, F_FCP },
{ "C.ULE.D", 0x46200037, M_FCP, F_FCP },
{ "C.DF.D", 0x46200038, M_FCP, F_FCP },
{ "C.NGLE.D", 0x46200039, M_FCP, F_FCP },
{ "C.DEQ.D", 0x4620003A, M_FCP, F_FCP },
{ "C.NGL.D", 0x4620003B, M_FCP, F_FCP },
{ "C.LT.D", 0x4620003C, M_FCP, F_FCP },
{ "C.NGE.D", 0x4620003D, M_FCP, F_FCP },
{ "C.LE.D", 0x4620003E, M_FCP, F_FCP },
{ "C.BGT.D", 0x4620003F, M_FCP, F_FCP },
{ "CVT.S.W", 0x46800020, M_FP2, F_FP2 },
{ "CVT.D.W", 0x46800021, M_FP2, F_FP2 },
{ "CVT.S.L", 0x46A00020, M_FP2, F_FP2 },
{ "CVT.D.L", 0x46A00021, M_FP2, F_FP2 },
{ "ADD.PS", 0x46C00000, M_FP3, F_FP3 },
{ "SUB.PS", 0x46C00001, M_FP3, F_FP3 },
{ "MUL.PS", 0x46C00002, M_FP3, F_FP3 },
{ "ABS.PS", 0x46C00005, M_FP2, F_FP2 },
{ "MOV.PS", 0x46C00006, M_FP2, F_FP2 },
{ "NEG.PS", 0x46C00007, M_FP2, F_FP2 },
{ "MOVF.PS", 0x46C00011, M_MCF, F_MCF },
{ "MOVT.PS", 0x46C10011, M_MCF, F_MCF },
{ "MOVZ.PS", 0x46C00012, M_MFI, F_MFI },
{ "MOVN.PS", 0x46C00013, M_MFI, F_MFI },
{ "CVT.S.PU", 0x46C00020, M_FP2, F_FP2 },
{ "CVT.S.PL", 0x46C00028, M_FP2, F_FP2 },
{ "PLL.PS", 0x46C0002C, M_FP3, F_FP3 },
{ "PLU.PS", 0x46C0002D, M_FP3, F_FP3 },
{ "PUL.PS", 0x46C0002E, M_FP3, F_FP3 },
{ "PUU.PS", 0x46C0002F, M_FP3, F_FP3 },
{ "C.F.PS", 0x46C00030, M_FCP, F_FCP },
{ "C.UN.PS", 0x46C00031, M_FCP, F_FCP },
{ "C.EQ.PS", 0x46C00032, M_FCP, F_FCP },
{ "C.UEQ.PS", 0x46C00033, M_FCP, F_FCP },
{ "C.OLT.PS", 0x46C00034, M_FCP, F_FCP },
{ "C.ULT.PS", 0x46C00035, M_FCP, F_FCP },
{ "C.OLE.PS", 0x46C00036, M_FCP, F_FCP },
{ "C.ULE.PS", 0x46C00037, M_FCP, F_FCP },
{ "C.DF.PS", 0x46C00038, M_FCP, F_FCP },
{ "C.NGLE.PS",0x46C00039, M_FCP, F_FCP },
{ "C.DEQ.PS", 0x46C0003A, M_FCP, F_FCP },
{ "C.NGL.PS", 0x46C0003B, M_FCP, F_FCP },
{ "C.LT.PS", 0x46C0003C, M_FCP, F_FCP },
{ "C.NGE.PS", 0x46C0003D, M_FCP, F_FCP },
{ "C.LE.PS", 0x46C0003E, M_FCP, F_FCP },
{ "C.BGT.PS", 0x46C0003F, M_FCP, F_FCP },
{ "LWXC1", 0x4C000000, M_LFX, F_LFX }, /* cop1x */
{ "LDXC1", 0x4C000001, M_LFX, F_LFX },
{ "LUXC1", 0x4C000005, M_LFX, F_LFX },
{ "SWXC1", 0x4C000008, M_SFX, F_SFX },
{ "SDXC1", 0x4C000009, M_SFX, F_SFX },
{ "SUXC1", 0x4C00000D, M_SFX, F_SFX },
{ "PREF", 0x4C00000F, M_LFX, F_LFX },
{ "ALNV.PS", 0x4C00001E, M_ALNV,F_ALNV},
{ "MADD.S", 0x4C000020, M_MAC, F_MAC },
{ "MADD.D", 0x4C000021, M_MAC, F_MAC },
{ "MADD.PS", 0x4C000026, M_MAC, F_MAC },
{ "MSUB.S", 0x4C000028, M_MAC, F_MAC },
{ "MSUB.D", 0x4C000029, M_MAC, F_MAC },
{ "MSUB.PS", 0x4C00002E, M_MAC, F_MAC },
{ "NMADD.S", 0x4C000030, M_MAC, F_MAC },
{ "NMADD.D", 0x4C000031, M_MAC, F_MAC },
{ "NMADD.PS", 0x4C000036, M_MAC, F_MAC },
{ "NMSUB.S", 0x4C000038, M_MAC, F_MAC },
{ "NMSUB.D", 0x4C000039, M_MAC, F_MAC },
{ "NMSUB.PS", 0x4C00003E, M_MAC, F_MAC },
{ "BEQL", 0x50000000, M_BR2, F_BR2 },
{ "BNEL", 0x54000000, M_BR2, F_BR2 },
{ "BLEZL", 0x58000000, M_BR1, F_BR1 },
{ "BGTZL", 0x5C000000, M_BR1, F_BR1 },
{ "DADDI", 0x60000000, M_IMM, F_IMM },
{ "DADDIU", 0x64000000, M_IMM, F_IMM },
{ "LDL", 0x68000000, M_MRF, F_MRF },
{ "LDR", 0x6C000000, M_MRF, F_MRF },
{ "MADD", 0x70000000, M_OR2, F_OR2 }, /* special2 */
{ "MADDU", 0x70000001, M_OR2, F_OR2 },
{ "MUL", 0x70000002, M_OP3, F_OP3 },
{ "MSUB", 0x70000004, M_OR2, F_OR2 },
{ "MSUBU", 0x70000005, M_OR2, F_OR2 },
{ "CLZ", 0x70000020, M_SP2, F_SP2 },
{ "CLO", 0x70000021, M_SP2, F_SP2 },
{ "DCLZ", 0x70000024, M_SP2, F_SP2 },
{ "DCLO", 0x70000025, M_SP2, F_SP2 },
{ "POP", 0x7000002C, M_POP, F_POP },
{ "DPOP", 0x7000002D, M_POP, F_POP },
{ "SDBBP", 0x7000003F, M_COD, F_COD },
{ "EXT", 0x7C000000, M_FLD, F_FLD }, // special3 - R2
{ "DEXTU", 0x7C000001, M_FLD, F_FLD },
{ "DEXTM", 0x7C000002, M_FLD, F_FLD },
{ "DEXT", 0x7C000003, M_FLD, F_FLD },
{ "INS", 0x7C000004, M_FLD, F_FLD },
{ "DINSU", 0x7C000005, M_FLD, F_FLD },
{ "DINSM", 0x7C000006, M_FLD, F_FLD },
{ "DINS", 0x7C000007, M_FLD, F_FLD },
{ "SEB", 0x7C000420, M_OP2, F_OP2 },
{ "SEW", 0x7C000620, M_OP2, F_OP2 },
{ "RDHWR", 0x7C00003B, M_OP2, F_OP2 },
{ "WSBH", 0x7C0000A0, M_OP2, F_OP2 },
{ "DSBH", 0x7C0000A4, M_OP2, F_OP2 },
{ "DSHD", 0x7C0001A4, M_OP2, F_OP2 },
{ "LB", 0x80000000, M_MRF, F_MRF },
{ "LH", 0x84000000, M_MRF, F_MRF },
{ "LWL", 0x88000000, M_MRF, F_MRF },
{ "LW", 0x8C000000, M_MRF, F_MRF },
{ "LBU", 0x90000000, M_MRF, F_MRF },
{ "LHU", 0x94000000, M_MRF, F_MRF },
{ "LWR", 0x98000000, M_MRF, F_MRF },
{ "LWU", 0x9C000000, M_MRF, F_MRF },
{ "SB", 0xA0000000, M_MRF, F_MRF },
{ "SH", 0xA4000000, M_MRF, F_MRF },
{ "SWL", 0xA8000000, M_MRF, F_MRF },
{ "SW", 0xAC000000, M_MRF, F_MRF },
{ "SDL", 0xB0000000, M_MRF, F_MRF },
{ "SDR", 0xB4000000, M_MRF, F_MRF },
{ "SWR", 0xB8000000, M_MRF, F_MRF },
{ "CACHE", 0xBC000000, M_MRF, F_MRF },
{ "LL", 0xC0000000, M_MRF, F_MRF },
{ "LWC1", 0xC4000000, M_MRF, F_MRF },
{ "LWC2", 0xC8000000, M_MRF, F_MRF },
{ "PREF", 0xCC000000, M_MRF, F_MRF },
{ "LLD", 0xD0000000, M_MRF, F_MRF },
{ "LDC1", 0xD4000000, M_MRF, F_MRF },
{ "LDC2", 0xD8000000, M_MRF, F_MRF },
{ "LD", 0xDC000000, M_MRF, F_MRF },
{ "SC", 0xE0000000, M_MRF, F_MRF },
{ "SWC1", 0xE4000000, M_MRF, F_MRF },
{ "SWC2", 0xE8000000, M_MRF, F_MRF },
{ "SCD", 0xF0000000, M_MRF, F_MRF },
{ "SDC1", 0xF4000000, M_MRF, F_MRF },
{ "SDC2", 0xF8000000, M_MRF, F_MRF },
{ "SD", 0xFC000000, M_MRF, F_MRF },
{ NULL, 0, M_NOP, F_NOP }
};
/* Symbolic decode
Inputs:
*of = output stream
addr = current PC
*val = values to decode
*uptr = pointer to unit
sw = switches
Outputs:
return = if >= 0, error code
if < 0, number of extra bytes retired
*/
t_stat fprint_sym (FILE *of, t_addr addr, t_value *val,
UNIT *uptr, int32 sw)
{
int32 c, sc, rdx, def_rdx;
char in_st[CBUFSIZE];
DEVICE *dptr;
if (uptr) {
dptr = find_dev_from_unit (uptr); /* find dev */
if (dptr == NULL) return SCPE_IERR;
if ((dptr->flags & DEV_64B) == 0) return SCPE_ARG; /* CPU only */
def_rdx = dptr->dradix;
}
else def_rdx = 16;
if (sw & SWMASK ('T')) rdx = 10; /* get radix */
else if (sw & SWMASK ('O')) rdx = 8;
else if (sw & SWMASK ('S')) rdx = 16;
else rdx = def_rdx;
if (sw & SWMASK ('A')) { /* ASCII? */
sc = (uint32) (addr & 0x7) * 8; /* shift count */
c = (uint32) (val[0] >> sc) & 0x7F;
fprintf (of, (c < 0x20)? "<%02X>": "%c", c);
return 0;
}
if (sw & SWMASK ('B')) { /* byte? */
sc = (uint32) (addr & 0x7) * 8; /* shift count */
c = (uint32) (val[0] >> sc) & M8;
fprintf (of, "%02X", c);
return 0;
}
if (sw & SWMASK ('H')) { /* halfword? */
sc = (uint32) (addr & 0x6) * 8; /* shift count */
c = (uint32) (val[0] >> sc) & M16;
fprintf (of, "%04X", c);
return -1;
}
if (sw & SWMASK ('W')) { /* word? */
if (addr & 4) c = (uint32) (val[0] >> 32) & M32;
else c = (uint32) val[0] & M32;
fprintf (of, "%08X", c);
return -3;
}
if (sw & SWMASK ('C')) { /* char format? */
for (sc = 0; sc < 64; sc = sc + 8) { /* print string */
c = (uint32) (val[0] >> sc) & 0x7F;
fprintf (of, (c < 0x20)? "<%02X>": "%c", c);
}
return -7;
}
if (sw & SWMASK ('M')) { /* inst format? */
if (addr & 4) c = (uint32) (val[0] >> 32) & M32;
else c = (uint32) val[0] & M32;
if (sprint_sym_m (in_st, addr, c)) /* decode inst */
fputs (in_st, of);
else fprintf (of, "%08X", c);
return -3;
}
fprint_val (of, val[0], rdx, 64, PV_RZRO);
return -7;
}
/* Symbolic decode for -m
Inputs:
cptr = output string
addr = current PC
inst = instruction to decode
Outputs:
return = if >= 0, error code
if < 0, number of extra bytes retired (-3)
*/
uint32 sprint_sym_m (char *cptr, t_addr addr, uint32 inst)
{
uint32 i, k, fl, fld[16], any;
char *optr, *oldptr;
oldptr = cptr; /* save start */
for (i = 0; opc[i].name != NULL; i++) { /* loop thru ops */
if (((inst ^ opc[i].val) & opc[i].mask) == 0) {
fl = opc[i].flg; /* flags */
fld[F_RS] = I_GETRS (inst); /* all fields */
fld[F_RT] = I_GETRT (inst);
fld[F_RD] = I_GETRD (inst);
fld[F_SA] = I_GETSA (inst);
fld[F_FNC] = I_GETFNC (inst);
fld[F_JT] = I_GETJT (inst);
fld[F_DISP] = I_GETDISP (inst);
fld[F_CODE] = (inst >> I_V_SA) & 0xFFFFF;
fld[F_Z] = 0;
any = 0;
for (optr = opc[i].name; *optr; optr++) { /* copy op, lc */
if (isupper (*optr)) *cptr++ = tolower (*optr);
else *cptr++ = *optr;
}
*cptr = 0;
for (k = 0; k < 4; k++) { /* up to 4 fields */
uint32 fmt = SYM_GETFMT (fl, k); /* get format */
uint32 val = fld[SYM_GETFLD (fl, k)]; /* get field */
t_uint64 v64 = val;
switch (fmt) { /* case fmt */
case FMT_RC: /* cond ret reg */
if (val == 31) break; /* dont print 31 */
case FMT_R: /* int reg */
case FMT_FR: /* flt reg */
any = sprintf (cptr, (any? ",$%d": " $%d"), val);
break;
case FMT_SA: /* shift amt */
any = sprintf (cptr, (any? ",%d": " %d"), val);
break;
case FMT_CC: /* cond code */
val = (val >> 2) & 0x7; /* don't print 0 */
if (val) any = sprintf (cptr, (any? ",%d": " %d"), val);
break;
case FMT_SEL: /* select */
val = val & 0x7; /* don't print 0 */
if (val) any = sprintf (cptr, (any? ",%d": " %d"), val);
break;
case FMT_CODE: /* code */
if (val) any = sprintf (cptr, (any? ",%X": " %X"), val);
break;
case FMT_IMM: /* immediate */
any = sprintf (cptr, (any? ",%X": " %X"), val);
break;
case FMT_JA: /* jump */
addr = ((addr + 4) & J_REGION) | (v64 << 2);
any = sprintf (cptr, (any? ",": " "));
cptr = cptr + strlen (cptr);
sprint_addr (cptr, addr);
break;
case FMT_BA: /* branch */
addr = addr + (SEXT_DISP (v64) << 2) + 4;
any = sprintf (cptr, (any? ",": " "));
cptr = cptr + strlen (cptr);
sprint_addr (cptr, addr);
break;
case FMT_MA: /* mem ref */
if (val & SIGN_DISP)
any = sprintf (cptr, (any? ",-%X": " -%X"), 0x10000 - val);
else any = sprintf (cptr, (any? ",%X": " %X"), val);
if (fld[F_RS]) {
cptr = cptr + strlen (cptr);
sprintf (cptr, "($%d)", fld[F_RS]);
}
break;
case FMT_XA: /* XA */
any = sprintf (cptr, (any? ",$%d": " $%d"), val);
if (fld[F_RT]) {
cptr = cptr + strlen (cptr);
sprintf (cptr, "($%d)", fld[F_RT]);
}
break;
} /* end case */
cptr = cptr + strlen (cptr);
} /* end for k */
return strlen (oldptr);
} /* end if */
} /* end for i */
return 0;
}
/* Symbolic input
Inputs:
*cptr = pointer to input string
addr = current PC
*uptr = pointer to unit
*val = pointer to output values
sw = switches
Outputs:
status = > 0 error code
<= 0 -number of extra words
*/
t_stat parse_sym (char *cptr, t_addr addr, UNIT *uptr, t_value *val, int32 sw)
{
t_value num;
uint32 i, sc, rdx, def_rdx;
t_stat r;
DEVICE *dptr;
if (uptr) {
dptr = find_dev_from_unit (uptr); /* find dev */
if (dptr == NULL) return SCPE_IERR;
if ((dptr->flags & DEV_64B) == 0) return SCPE_ARG; /* CPU only */
def_rdx = dptr->dradix;
}
else def_rdx = 16;
if (sw & SWMASK ('T')) rdx = 10; /* get radix */
else if (sw & SWMASK ('O')) rdx = 8;
else if (sw & SWMASK ('S')) rdx = 16;
else rdx = def_rdx;
if ((sw & SWMASK ('A')) || ((*cptr == '\'') && cptr++)) { /* ASCII char? */
if (cptr[0] == 0) return SCPE_ARG; /* must have 1 char */
sc = (uint32) (addr & 0x7) * 8; /* shift count */
val[0] = (val[0] & ~(((t_uint64) M8) << sc)) |
(((t_uint64) cptr[0]) << sc);
return 0;
}
if (sw & SWMASK ('B')) { /* byte? */
num = get_uint (cptr, rdx, M8, &r); /* get byte */
if (r != SCPE_OK) return SCPE_ARG;
sc = (uint32) (addr & 0x7) * 8; /* shift count */
val[0] = (val[0] & ~(((t_uint64) M8) << sc)) |
(num << sc);
return 0;
}
if (sw & SWMASK ('H')) { /* halfword? */
num = get_uint (cptr, rdx, M16, &r); /* get halfword */
if (r != SCPE_OK) return SCPE_ARG;
sc = (uint32) (addr & 0x6) * 8; /* shift count */
val[0] = (val[0] & ~(((t_uint64) M16) << sc)) |
(num << sc);
return -1;
}
if (sw & SWMASK ('W')) { /* word? */
num = get_uint (cptr, rdx, M32, &r); /* get word */
if (r != SCPE_OK) return SCPE_ARG;
sc = (uint32) (addr & 0x4) * 8; /* shift count */
val[0] = (val[0] & ~(((t_uint64) M32) << sc)) |
(num << sc);
return -3;
}
if ((sw & SWMASK ('C')) || ((*cptr == '"') && cptr++)) { /* ASCII chars? */
if (cptr[0] == 0) return SCPE_ARG; /* must have 1 char */
for (i = 0; i < 8; i++) {
if (cptr[i] == 0) break;
sc = i * 8;
val[0] = (val[0] & ~(((t_uint64) M8) << sc)) |
(((t_uint64) cptr[i]) << sc);
}
return -7;
}
if ((addr & 3) == 0) { /* aligned only */
r = parse_sym_m (cptr, addr, &num); /* try to parse inst */
if (r <= 0) { /* ok? */
sc = (uint32) (addr & 0x4) * 8; /* shift count */
val[0] = (val[0] & ~(((t_uint64) M32) << sc)) | (num << sc);
return -3;
}
}
val[0] = get_uint (cptr, rdx, M64, &r); /* get number */
if (r != SCPE_OK) return r;
return -7;
}
/* Symbolic input
Inputs:
*cptr = pointer to input string
addr = current PC
*val = pointer to output values
Outputs:
status = > 0 error code
<= 0 -number of extra words
*/
t_stat parse_sym_m (char *cptr, t_addr addr, t_value *inst)
{
uint32 i, k, fl, num_fmt, num_glyph;
int32 fldv=0, reg;
t_uint64 jba, df, db;
t_stat r;
char *tptr, gbuf[CBUFSIZE];
cptr = get_glyph (cptr, gbuf, 0); /* get opcode */
for (i = 0; opc[i].name != NULL; i++) { /* loop thru opcodes */
if (strcmp (opc[i].name, gbuf) == 0) { /* string match? */
*inst = opc[i].val; /* save base op */
fl = opc[i].flg; /* get parse data */
for (k = num_fmt = 0; k < 4; k++) { /* count #formats */
if ((fl >> (k * 8)) & 0xFF) num_fmt++;
}
for (tptr = cptr, num_glyph = 0; /* count #fields */
*tptr != 0;
tptr = get_glyph (tptr, gbuf, ',')) num_glyph++;
for (k = 0; k < 4; k++) { /* up to 4 fields */
uint32 fn = SYM_GETFLD (fl, k); /* get field # */
uint32 fmt = SYM_GETFMT (fl, k); /* get format */
switch (fmt) {
case FMT_RC: /* cond ret reg */
if (num_glyph < num_fmt) { /* not enough fields? */
fldv = 31; /* default value */
break;
} /* otherwise fall thru */
case FMT_R: /* int reg */
case FMT_FR: /* flt reg */
cptr = get_glyph (cptr, gbuf, ','); /* get glyph */
if ((fldv = parse_reg (gbuf, NULL)) < 0) return SCPE_ARG;
break;
case FMT_SA: /* 5b literal */
cptr = get_glyph (cptr, gbuf, ','); /* get glyph */
fldv = (int32) get_uint (gbuf, 10, 31, &r);
if (r != SCPE_OK) return r;
break;
case FMT_CC: /* cc */
if (num_glyph < num_fmt) fldv = 0; /* not enough fields? */
else {
cptr = get_glyph (cptr, gbuf, ',');
fldv = (int32) (get_uint (gbuf, 10, 7, &r) << 2);
if (r != SCPE_OK) return r;
}
break;
case FMT_SEL: /* select */
if (num_glyph < num_fmt) fldv = 0; /* not enough fields? */
else {
cptr = get_glyph (cptr, gbuf, ',');
fldv = (int32) get_uint (gbuf, 10, 7, &r);
if (r != SCPE_OK) return r;
}
break;
case FMT_IMM: /* 16b literal */
cptr = get_glyph (cptr, gbuf, 0);
fldv = parse_imm (gbuf, &tptr);
if (tptr == gbuf) return SCPE_ARG;
break;
case FMT_CODE: /* 20b code */
if (num_glyph < num_fmt) fldv = 0; /* not enough fields? */
else {
cptr = get_glyph (cptr, gbuf, 0);
fldv = (int32) get_uint (gbuf, 16, 0xFFFFF, &r);
if (r != SCPE_OK) return r;
fldv = fldv << I_V_SA;
}
break;
case FMT_JA: /* jump addr */
cptr = get_glyph (cptr, gbuf, 0); /* get glyph */
jba = get_uint (gbuf, 16, M64, &r);
if ((r != SCPE_OK) || (jba & 3) ||
(((addr + 4) ^ jba) & J_REGION))
return SCPE_ARG;
fldv = ((uint32) (jba & ~J_REGION)) >> 2;
break;
case FMT_BA: /* branch addr */
cptr = get_glyph (cptr, gbuf, 0);
jba = get_uint (gbuf, 16, M64, &r);
if ((r != SCPE_OK) || (jba & 3)) return SCPE_ARG;
df = ((jba - (addr + 4)) >> 2) & I_M_DISP;
db = ((addr + 4 - jba) >> 2) & I_M_DISP;
if (jba == (addr + 4 + (SEXT_DISP (df) << 2)))
fldv = (uint32) df;
else if (jba == (addr + 4 + (SEXT_DISP (db) << 2)))
fldv = (uint32) db;
else return SCPE_ARG;
break;
case FMT_MA: /* mem ref? */
cptr = get_glyph (cptr, gbuf, 0);
fldv = parse_imm (gbuf, &tptr);
if (tptr == gbuf) return SCPE_ARG;
if (*tptr == '(') {
tptr = get_glyph (tptr + 1, gbuf, 0);
if ((reg = parse_reg (gbuf, &tptr)) < 0) return SCPE_ARG;
if (*tptr++ != ')') return SCPE_ARG;
fldv |= (reg << I_V_RS);
}
if (*tptr != 0) return SCPE_ARG;
break;
case FMT_XA: /* reg indexed? */
cptr = get_glyph (cptr, gbuf, 0);
if ((fldv = parse_reg (cptr, &tptr)) < 0) return SCPE_ARG;
if (*tptr == '(') {
if ((reg = parse_reg (tptr, &tptr)) < 0) return SCPE_ARG;
if (*tptr != ')') return SCPE_ARG;
fldv |= (reg << 5);
}
else if (*tptr) return SCPE_ARG;
break;
case FMT_NOPARSE: /* do nothing */
if (fn == F_Z) fldv = 0;
break;
} /* end case */
*inst |= (fldv << fld_shift[fn]); /* move into place */
} /* end for k */
if (*cptr != 0) return SCPE_ARG; /* any leftovers? */
return -3;
} /* end if */
} /* end for */
return SCPE_ARG;
}
/* Parse a register */
int32 parse_reg (char *cptr, char **optr)
{
uint32 reg;
char *tptr;
if ((*cptr == 'R') || (*cptr == 'r') || (*cptr == '$')) cptr++;
reg = (uint32) strtotv (cptr, &tptr, 10);
if ((cptr == tptr) || (reg > 31)) return -1;
if (optr) *optr = tptr;
else if (*tptr != 0) return -1;
return reg;
}
/* Parse an immediate */
uint32 parse_imm (char *cptr, char **optr)
{
uint32 sign;
t_value imm;
static const t_value maxv[3] = {
0xFFFF, 0x7FFF, 0x8000
};
if (*cptr == '+') {
sign = 1;
cptr++;
}
else if (*cptr == '-') {
sign = 2;
cptr++;
}
else sign = 0;
imm = strtotv (cptr, optr, 16);
if (cptr == *optr) return 0;
if (imm > maxv[sign]) *optr = cptr;
else if (sign == 2) imm = ~imm + 1;
return ((uint32) imm) & M16;
}
/* String format a 64b address, suppress leading zeroes */
char *sprint_addr (char *cptr, t_uint64 ad)
{
uint32 i, nz;
char c;
for (i = 0, nz = 0; i < 16; i++) {
c = (char) ((ad >> ((15 - i) * 4)) & 0xF);
if (c || (i == 15)) nz = 1;
if (nz) *cptr++ = (c < 10)? (c + '0'): (c - 10 + 'A');
}
*cptr = 0;
return cptr;
}
/* Routine to fetch int/flt registers for tracing,
based on opcode */
uint32 trace_fetch_reg (CORECTX *ctx, uint32 inst, t_uint64 *reg)
{
uint32 i, j, k, fl, fld[16];
for (k = 0; k < 4; k++)
reg[k] = 0;
for (i = 0; opc[i].name != NULL; i++) { /* loop thru ops */
if (((inst ^ opc[i].val) & opc[i].mask) == 0) {
fl = opc[i].flg; /* flags */
fld[F_RS] = I_GETRS (inst); /* all reg fields */
fld[F_RT] = I_GETRT (inst);
fld[F_RD] = I_GETRD (inst);
fld[F_SA] = I_GETSA (inst);
for (j = k = 0; k < 4; k++) { /* up to 4 reg */
uint32 fmt = SYM_GETFMT (fl, k); /* get format */
uint32 fsl = SYM_GETFLD (fl, k); /* get field select */
if ((fsl >= F_RS) && (fsl <= F_SA)) {
if ((fmt == FMT_R) || (fmt == FMT_RC)) /* R? */
reg[j++] = gpr(fld[fsl]); /* get int */
else if (fmt == FMT_FR) /* F? */
reg[j++] = fpr(fld[fsl]); /* get flt */
} /* end if fsl */
} /* end for k */
return fl; /* return flags */
} /* end if */
} /* end for i */
return 0;
}
/* Routine to print one line for tracing */
void trace_fprint_one_inst (FILE *st, uint32 inst, t_uint64 pc,
uint32 fl, t_uint64 *reg, uint32 coreno)
{
uint32 fld[16], cnt, j, k, t;
t_uint64 ea, sim_val;
#ifdef SIMH_CPUSIMH
extern t_uint64 ScxGetCurrentSimTime();
fprintf (st, "[%lld] ", ScxGetCurrentSimTime());
#endif
if (coreno) fprintf (st, "#%d: ", coreno - 1);
pc = pc & ~3;
fprint_val (st, pc, 16, 64, PV_RZRO); /* print pc */
fputc (' ', st);
fld[F_RS] = I_GETRS (inst); /* all reg sels */
fld[F_RT] = I_GETRT (inst);
fld[F_RD] = I_GETRD (inst);
fld[F_SA] = I_GETSA (inst);
for (cnt = j = k = 0; k < 4; k++) { /* up to 4 fields */
uint32 fmt = SYM_GETFMT (fl, k); /* get format */
uint32 fsl = SYM_GETFLD (fl, k); /* get reg pos */
switch (fmt) { /* case fmt */
case FMT_RC: /* cond ret reg */
case FMT_R: /* int reg */
case FMT_FR: /* flt reg */
if ((fsl >= F_RS) && (fsl <= F_SA)) { /* valid sel? */
uint32 rn = fld[fsl];
if (fmt == FMT_FR)
fprintf (st, (rn < 10)? " F%d=":"F%d=", rn);
else fprintf (st, (rn < 10)? " R%d=":"R%d=", rn);
fprint_val (st, reg[j++], 16, 64, PV_RZRO);
fputc (' ', st);
cnt++;
}
break;
case FMT_IMM: /* immediate */
t = inst & M16;
if (t & H_SIGN)
fprintf (st, " -%4X", 0x10000 - t);
else fprintf (st, " %4X", t);
fputc (' ', st);
cnt++;
break;
case FMT_JA: /* jump */
ea = (pc & J_REGION) | (I_GETJT (inst) << 2);
fputs (" ea=", st);
fprint_val (st, ea, 16, 64, PV_RZRO);
fputc (' ', st);
cnt++;
break;
case FMT_BA: /* branch */
ea = pc + 4 + (SEXT_DISP (inst) << 2);
fputs (" ea=", st);
fprint_val (st, ea, 16, 64, PV_RZRO);
fputc (' ', st);
cnt++;
break;
case FMT_MA: /* mem ref */
ea = reg[1] + SEXT_DISP (I_GETDISP (inst));
fputs (" ea=", st);
fprint_val (st, ea, 16, 64, PV_RZRO);
fputc (' ', st);
cnt++;
break;
} /* end case */
} /* end for */
for ( ; cnt < 4; cnt++)
fputs (" ", st);
if (pc & 4)
sim_val = ((t_uint64) inst) << 32;
else sim_val = inst;
if ((fprint_sym (st, pc, &sim_val, NULL, SWMASK ('M'))) > 0)
fprintf (st, "(undefined) %08X", inst);
fputc ('\r', st); /* end line */
fputc ('\n', st); /* end line */
return;
}
| sergev/SiCortex-sc1 | sc1_sys.c | C | apache-2.0 | 54,332 | [
30522,
1013,
1008,
8040,
2487,
1035,
25353,
2015,
1012,
1039,
1024,
8040,
2487,
25837,
8278,
9385,
1006,
1039,
1007,
2384,
1011,
2289,
1010,
14387,
11589,
10288,
1010,
4297,
1012,
2035,
2916,
9235,
1012,
2241,
2006,
21934,
2232,
1025,
21934... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="es">
<head>
<!-- Generated by javadoc (1.8.0_122-ea) on Thu Jan 19 17:37:21 CET 2017 -->
<title>Uses of Class me.Bn32w.Bn32wEngine.entity.collision.CollisionBox</title>
<meta name="date" content="2017-01-19">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Uses of Class me.Bn32w.Bn32wEngine.entity.collision.CollisionBox";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../me/Bn32w/Bn32wEngine/entity/collision/CollisionBox.html" title="class in me.Bn32w.Bn32wEngine.entity.collision">Class</a></li>
<li class="navBarCell1Rev">Use</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>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?me/Bn32w/Bn32wEngine/entity/collision/class-use/CollisionBox.html" target="_top">Frames</a></li>
<li><a href="CollisionBox.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">
<h2 title="Uses of Class me.Bn32w.Bn32wEngine.entity.collision.CollisionBox" class="title">Uses of Class<br>me.Bn32w.Bn32wEngine.entity.collision.CollisionBox</h2>
</div>
<div class="classUseContainer">
<ul class="blockList">
<li class="blockList">
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
<caption><span>Packages that use <a href="../../../../../../me/Bn32w/Bn32wEngine/entity/collision/CollisionBox.html" title="class in me.Bn32w.Bn32wEngine.entity.collision">CollisionBox</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="#me.Bn32w.Bn32wEngine.entity">me.Bn32w.Bn32wEngine.entity</a></td>
<td class="colLast"> </td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="me.Bn32w.Bn32wEngine.entity">
<!-- -->
</a>
<h3>Uses of <a href="../../../../../../me/Bn32w/Bn32wEngine/entity/collision/CollisionBox.html" title="class in me.Bn32w.Bn32wEngine.entity.collision">CollisionBox</a> in <a href="../../../../../../me/Bn32w/Bn32wEngine/entity/package-summary.html">me.Bn32w.Bn32wEngine.entity</a></h3>
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
<caption><span>Constructors in <a href="../../../../../../me/Bn32w/Bn32wEngine/entity/package-summary.html">me.Bn32w.Bn32wEngine.entity</a> with parameters of type <a href="../../../../../../me/Bn32w/Bn32wEngine/entity/collision/CollisionBox.html" title="class in me.Bn32w.Bn32wEngine.entity.collision">CollisionBox</a></span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../me/Bn32w/Bn32wEngine/entity/Entity.html#Entity-me.Bn32w.Bn32wEngine.entity.collision.CollisionBox-java.lang.String-me.Bn32w.Bn32wEngine.states.State-boolean-">Entity</a></span>(<a href="../../../../../../me/Bn32w/Bn32wEngine/entity/collision/CollisionBox.html" title="class in me.Bn32w.Bn32wEngine.entity.collision">CollisionBox</a> pCollisionBox,
java.lang.String identifier,
<a href="../../../../../../me/Bn32w/Bn32wEngine/states/State.html" title="class in me.Bn32w.Bn32wEngine.states">State</a> state,
boolean solid)</code>
<div class="block">Creates a new entity, initializing all the bounds data by the information given in the parameter, the speed and acceleration is 0.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
</li>
</ul>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li><a href="../package-summary.html">Package</a></li>
<li><a href="../../../../../../me/Bn32w/Bn32wEngine/entity/collision/CollisionBox.html" title="class in me.Bn32w.Bn32wEngine.entity.collision">Class</a></li>
<li class="navBarCell1Rev">Use</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>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?me/Bn32w/Bn32wEngine/entity/collision/class-use/CollisionBox.html" target="_top">Frames</a></li>
<li><a href="CollisionBox.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>
| Bn32w/Bn32wEngine | doc/me/Bn32w/Bn32wEngine/entity/collision/class-use/CollisionBox.html | HTML | agpl-3.0 | 7,104 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
16129,
1018,
1012,
5890,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
8917,
1013,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
define(['views/Index','views/Cart','views/CategoryEdit','views/Categories','views/Product','views/Products','views/ProductEdit','views/ProductDetail','views/admin/Index','models/Product','models/Category','models/CartCollection','models/ProductCollection','models/CategoryCollection'], function(IndexView,CartView,CategoryEditView,CategoriesView,ProductView,ProductsView,ProductEditView,ProductDetailView,AdminIndexView,Product,Category,CartCollection,ProductCollection,CategoryCollection){
var BizRouter = Backbone.Router.extend({
currentView : null,
routes: {
'': 'index',
'index': 'index',
'cart': 'myCart',
'products(/:id)': 'products',
'product/add(/:cid)': 'productAdd',
'product/edit/:id': 'productEdit',
'product/view/:id': 'productView',
'categories(/:id)': 'categories',
'category/add(/:pid)': 'categoryAdd',
'category/edit/:id': 'categoryEdit',
'admin/index': 'adminIndex',
},
changeView: function(view){
if(null != this.currentView){
this.currentView.undelegateEvents();
}
this.currentView = view;
this.currentView.render();
},
index: function(){
this.changeView(new IndexView());
},
myCart: function(){
var cartCollection = new CartCollection();
cartCollection.url = '/cart';
this.changeView(new CartView({collection:cartCollection}));
cartCollection.fetch();
},
/** product related */
products: function(id){
var cid = id || '';
var productCollection = new ProductCollection();
productCollection.url = '/products?cid=' + cid;;
this.changeView(new ProductsView({collection: productCollection}));
productCollection.fetch();
},
productAdd: function(categoryId){
var cid = categoryId || '';
var productModel = new Product({
main_cat_id: cid,
});
this.changeView(new ProductEditView({model: productModel}));
},
productEdit: function(id){
var product = new Product();
product.url = '/products/' + id;
this.changeView(new ProductEditView({model: product}));
product.fetch();
},
productView: function(id){
var product = new Product();
product.url = '/products/' + id;
this.changeView(new ProductDetailView({model: product}));
product.fetch();
},
/** category related */
categories: function(id){
var pid = id || '';
var categoryCollection = new CategoryCollection();
categoryCollection.url = '/categories?pid=' + pid;
this.changeView(new CategoriesView({collection: categoryCollection}));
categoryCollection.fetch();
},
categoryAdd: function(parentId){
var pid = parentId || '';
var categoryModel = new Category({
parent: pid
});
this.changeView(new CategoryEditView({model: categoryModel}));
},
categoryEdit: function(id){
var category = new Category();
category.url = '/categories/' + id;
this.changeView(new CategoryEditView({model: category}));
category.fetch();
},
adminIndex: function(){
this.changeView(new AdminIndexView());
}
});
return new BizRouter();
}); | williambai/beyond-webapp | e-biz/public/js/router.js | JavaScript | mit | 3,019 | [
30522,
9375,
1006,
1031,
1005,
5328,
1013,
5950,
1005,
1010,
1005,
5328,
1013,
11122,
1005,
1010,
1005,
5328,
1013,
4696,
2098,
4183,
1005,
1010,
1005,
5328,
1013,
7236,
1005,
1010,
1005,
5328,
1013,
4031,
1005,
1010,
1005,
5328,
1013,
36... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
jsonp({"cep":"72237350","logradouro":"\u00c1rea ADE Quadra 3 Conjunto E","bairro":"\u00c1rea de Desenvolvimento Econ\u00f4mico (Ceil\u00e2ndia)","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
| lfreneda/cepdb | api/v1/72237350.jsonp.js | JavaScript | cc0-1.0 | 211 | [
30522,
1046,
3385,
2361,
1006,
1063,
1000,
8292,
2361,
1000,
1024,
1000,
5824,
21926,
2581,
19481,
2692,
1000,
1010,
1000,
8833,
12173,
8162,
2080,
1000,
1024,
1000,
1032,
1057,
8889,
2278,
2487,
16416,
4748,
2063,
17718,
2527,
1017,
9530,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/** @file
An example program which illustrates adding and manipulating an
HTTP response MIME header:
Usage: response_header_1.so
add read_resp_header hook
get http response header
if 200, then
add mime extension header with count of zero
add mime extension header with date response was received
add "Cache-Control: public" header
else if 304, then
retrieve cached header
get old value of mime header count
increment mime header count
store mime header with new count
@section license License
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed
with this work for additional information regarding copyright
ownership. The ASF licenses this file to you under the Apache
License, Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "ts/ts.h"
#include "ts/ink_defs.h"
#define PLUGIN_NAME "response_header_1"
static int init_buffer_status;
static char *mimehdr1_name;
static char *mimehdr2_name;
static char *mimehdr1_value;
static TSMBuffer hdr_bufp;
static TSMLoc hdr_loc;
static TSMLoc field_loc;
static TSMLoc value_loc;
static void
modify_header(TSHttpTxn txnp)
{
TSMBuffer resp_bufp;
TSMBuffer cached_bufp;
TSMLoc resp_loc;
TSMLoc cached_loc;
TSHttpStatus resp_status;
TSMLoc new_field_loc;
TSMLoc cached_field_loc;
time_t recvd_time;
const char *chkptr;
int chklength;
int num_refreshes = 0;
if (!init_buffer_status) {
return; /* caller reenables */
}
if (TSHttpTxnServerRespGet(txnp, &resp_bufp, &resp_loc) != TS_SUCCESS) {
TSError("[%s] Couldn't retrieve server response header", PLUGIN_NAME);
return; /* caller reenables */
}
/* TSqa06246/TSqa06144 */
resp_status = TSHttpHdrStatusGet(resp_bufp, resp_loc);
if (TS_HTTP_STATUS_OK == resp_status) {
TSDebug(PLUGIN_NAME, "Processing 200 OK");
TSMimeHdrFieldCreate(resp_bufp, resp_loc, &new_field_loc); /* Probably should check for errors */
TSDebug(PLUGIN_NAME, "Created new resp field with loc %p", new_field_loc);
/* copy name/values created at init
* ( "x-num-served-from-cache" ) : ( "0" )
*/
TSMimeHdrFieldCopy(resp_bufp, resp_loc, new_field_loc, hdr_bufp, hdr_loc, field_loc);
/*********** Unclear why this is needed **************/
TSMimeHdrFieldAppend(resp_bufp, resp_loc, new_field_loc);
/* Cache-Control: Public */
TSMimeHdrFieldCreate(resp_bufp, resp_loc, &new_field_loc); /* Probably should check for errors */
TSDebug(PLUGIN_NAME, "Created new resp field with loc %p", new_field_loc);
TSMimeHdrFieldAppend(resp_bufp, resp_loc, new_field_loc);
TSMimeHdrFieldNameSet(resp_bufp, resp_loc, new_field_loc, TS_MIME_FIELD_CACHE_CONTROL, TS_MIME_LEN_CACHE_CONTROL);
TSMimeHdrFieldValueStringInsert(resp_bufp, resp_loc, new_field_loc, -1, TS_HTTP_VALUE_PUBLIC, TS_HTTP_LEN_PUBLIC);
/*
* mimehdr2_name = TSstrdup( "x-date-200-recvd" ) : CurrentDateTime
*/
TSMimeHdrFieldCreate(resp_bufp, resp_loc, &new_field_loc); /* Probably should check for errors */
TSDebug(PLUGIN_NAME, "Created new resp field with loc %p", new_field_loc);
TSMimeHdrFieldAppend(resp_bufp, resp_loc, new_field_loc);
TSMimeHdrFieldNameSet(resp_bufp, resp_loc, new_field_loc, mimehdr2_name, strlen(mimehdr2_name));
recvd_time = time(NULL);
TSMimeHdrFieldValueDateInsert(resp_bufp, resp_loc, new_field_loc, recvd_time);
TSHandleMLocRelease(resp_bufp, resp_loc, new_field_loc);
TSHandleMLocRelease(resp_bufp, TS_NULL_MLOC, resp_loc);
} else if (TS_HTTP_STATUS_NOT_MODIFIED == resp_status) {
TSDebug(PLUGIN_NAME, "Processing 304 Not Modified");
/* N.B.: Protect writes to data (hash on URL + mutex: (ies)) */
/* Get the cached HTTP header */
if (TSHttpTxnCachedRespGet(txnp, &cached_bufp, &cached_loc) != TS_SUCCESS) {
TSError("[%s] STATUS 304, TSHttpTxnCachedRespGet():", PLUGIN_NAME);
TSError("[%s] Couldn't retrieve cached response header", PLUGIN_NAME);
TSHandleMLocRelease(resp_bufp, TS_NULL_MLOC, resp_loc);
return; /* Caller reenables */
}
/* Get the cached MIME field name for this HTTP header */
cached_field_loc = TSMimeHdrFieldFind(cached_bufp, cached_loc, (const char *)mimehdr1_name, strlen(mimehdr1_name));
if (TS_NULL_MLOC == cached_field_loc) {
TSError("[%s] Can't find header %s in cached document", PLUGIN_NAME, mimehdr1_name);
TSHandleMLocRelease(resp_bufp, TS_NULL_MLOC, resp_loc);
TSHandleMLocRelease(cached_bufp, TS_NULL_MLOC, cached_loc);
return; /* Caller reenables */
}
/* Get the cached MIME value for this name in this HTTP header */
chkptr = TSMimeHdrFieldValueStringGet(cached_bufp, cached_loc, cached_field_loc, -1, &chklength);
if (NULL == chkptr || !chklength) {
TSError("[%s] Could not find value for cached MIME field name %s", PLUGIN_NAME, mimehdr1_name);
TSHandleMLocRelease(resp_bufp, TS_NULL_MLOC, resp_loc);
TSHandleMLocRelease(cached_bufp, TS_NULL_MLOC, cached_loc);
TSHandleMLocRelease(cached_bufp, cached_loc, cached_field_loc);
return; /* Caller reenables */
}
TSDebug(PLUGIN_NAME, "Header field value is %s, with length %d", chkptr, chklength);
/* Get the cached MIME value for this name in this HTTP header */
/*
TSMimeHdrFieldValueUintGet(cached_bufp, cached_loc, cached_field_loc, 0, &num_refreshes);
TSDebug(PLUGIN_NAME,
"Cached header shows %d refreshes so far", num_refreshes );
num_refreshes++ ;
*/
/* txn origin server response for this transaction stored
* in resp_bufp, resp_loc
*
* Create a new MIME field/value. Cached value has been incremented.
* Insert new MIME field/value into the server response buffer,
* allow HTTP processing to continue. This will update
* (indirectly invalidates) the cached HTTP headers MIME field.
* It is apparently not necessary to update all of the MIME fields
* in the in-process response in order to have the cached response
* become invalid.
*/
TSMimeHdrFieldCreate(resp_bufp, resp_loc, &new_field_loc); /* Probaby should check for errrors */
/* mimehdr1_name : TSstrdup( "x-num-served-from-cache" ) ; */
TSMimeHdrFieldAppend(resp_bufp, resp_loc, new_field_loc);
TSMimeHdrFieldNameSet(resp_bufp, resp_loc, new_field_loc, mimehdr1_name, strlen(mimehdr1_name));
TSMimeHdrFieldValueUintInsert(resp_bufp, resp_loc, new_field_loc, -1, num_refreshes);
TSHandleMLocRelease(resp_bufp, resp_loc, new_field_loc);
TSHandleMLocRelease(cached_bufp, cached_loc, cached_field_loc);
TSHandleMLocRelease(cached_bufp, TS_NULL_MLOC, cached_loc);
TSHandleMLocRelease(resp_bufp, TS_NULL_MLOC, resp_loc);
} else {
TSDebug(PLUGIN_NAME, "other response code %d", resp_status);
}
/*
* Additional 200/304 processing can go here, if so desired.
*/
/* Caller reneables */
}
static int
modify_response_header_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
{
TSHttpTxn txnp = (TSHttpTxn)edata;
switch (event) {
case TS_EVENT_HTTP_READ_RESPONSE_HDR:
TSDebug(PLUGIN_NAME, "Called back with TS_EVENT_HTTP_READ_RESPONSE_HDR");
modify_header(txnp);
TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
/* fall through */
default:
break;
}
return 0;
}
void
TSPluginInit(int argc, const char *argv[])
{
TSMLoc chk_field_loc;
TSPluginRegistrationInfo info;
info.plugin_name = PLUGIN_NAME;
info.vendor_name = "Apache Software Foundation";
info.support_email = "dev@trafficserver.apache.org";
if (TSPluginRegister(&info) != TS_SUCCESS) {
TSError("[%s] Plugin registration failed", PLUGIN_NAME);
}
init_buffer_status = 0;
if (argc > 1) {
TSError("[%s] usage: %s", PLUGIN_NAME, argv[0]);
TSError("[%s] warning: too many args %d", PLUGIN_NAME, argc);
TSError("[%s] warning: ignoring unused arguments beginning with %s", PLUGIN_NAME, argv[1]);
}
/*
* The following code sets up an "init buffer" containing an extension header
* and its initial value. This will be the same for all requests, so we try
* to be efficient and do all of the work here rather than on a per-transaction
* basis.
*/
hdr_bufp = TSMBufferCreate();
TSMimeHdrCreate(hdr_bufp, &hdr_loc);
mimehdr1_name = TSstrdup("x-num-served-from-cache");
mimehdr1_value = TSstrdup("0");
/* Create name here and set DateTime value when o.s.
* response 200 is received
*/
mimehdr2_name = TSstrdup("x-date-200-recvd");
TSDebug(PLUGIN_NAME, "Inserting header %s with value %s into init buffer", mimehdr1_name, mimehdr1_value);
TSMimeHdrFieldCreate(hdr_bufp, hdr_loc, &field_loc); /* Probably should check for errors */
TSMimeHdrFieldAppend(hdr_bufp, hdr_loc, field_loc);
TSMimeHdrFieldNameSet(hdr_bufp, hdr_loc, field_loc, mimehdr1_name, strlen(mimehdr1_name));
TSMimeHdrFieldValueStringInsert(hdr_bufp, hdr_loc, field_loc, -1, mimehdr1_value, strlen(mimehdr1_value));
TSDebug(PLUGIN_NAME, "init buffer hdr, field and value locs are %p, %p and %p", hdr_loc, field_loc, value_loc);
init_buffer_status = 1;
TSHttpHookAdd(TS_HTTP_READ_RESPONSE_HDR_HOOK, TSContCreate(modify_response_header_plugin, NULL));
/*
* The following code demonstrates how to extract the field_loc from the header.
* In this plugin, the init buffer and thus field_loc never changes. Code
* similar to this may be used to extract header fields from any buffer.
*/
if (TS_NULL_MLOC == (chk_field_loc = TSMimeHdrFieldGet(hdr_bufp, hdr_loc, 0))) {
TSError("[%s] Couldn't retrieve header field from init buffer", PLUGIN_NAME);
TSError("[%s] Marking init buffer as corrupt; no more plugin processing", PLUGIN_NAME);
init_buffer_status = 0;
/* bail out here and reenable transaction */
} else {
if (field_loc != chk_field_loc) {
TSError("[%s] Retrieved buffer field loc is %p when it should be %p", PLUGIN_NAME, chk_field_loc, field_loc);
}
}
}
| persiaAziz/trafficserver | example/response_header_1/response_header_1.c | C | apache-2.0 | 10,717 | [
30522,
1013,
1008,
1008,
1030,
5371,
2019,
2742,
2565,
2029,
24899,
5815,
1998,
26242,
2019,
8299,
3433,
2771,
4168,
20346,
1024,
8192,
1024,
3433,
1035,
20346,
1035,
1015,
1012,
2061,
5587,
3191,
1035,
24501,
2361,
1035,
20346,
8103,
2131,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// Template Source: BaseEntityCollectionResponse.java.tt
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.termstore.requests;
import com.microsoft.graph.termstore.models.Store;
import com.microsoft.graph.http.BaseCollectionResponse;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The class for the Store Collection Response.
*/
public class StoreCollectionResponse extends BaseCollectionResponse<Store> {
}
| microsoftgraph/msgraph-sdk-java | src/main/java/com/microsoft/graph/termstore/requests/StoreCollectionResponse.java | Java | mit | 752 | [
30522,
1013,
1013,
23561,
3120,
1024,
2918,
4765,
3012,
26895,
18491,
6072,
26029,
3366,
1012,
9262,
1012,
23746,
1013,
1013,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
const messages = defineMessages({
placeholder: { id: 'search.placeholder', defaultMessage: 'Search' },
});
class Search extends React.PureComponent {
static propTypes = {
value: PropTypes.string.isRequired,
submitted: PropTypes.bool,
onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
onClear: PropTypes.func.isRequired,
onShow: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
};
handleChange = (e) => {
this.props.onChange(e.target.value);
}
handleClear = (e) => {
e.preventDefault();
if (this.props.value.length > 0 || this.props.submitted) {
this.props.onClear();
}
}
handleKeyDown = (e) => {
if (e.key === 'Enter') {
e.preventDefault();
this.props.onSubmit();
}
}
noop () {
}
handleFocus = () => {
this.props.onShow();
}
render () {
const { intl, value, submitted } = this.props;
const hasValue = value.length > 0 || submitted;
return (
<div className='search'>
<input
className='search__input'
type='text'
placeholder={intl.formatMessage(messages.placeholder)}
value={value}
onChange={this.handleChange}
onKeyUp={this.handleKeyDown}
onFocus={this.handleFocus}
/>
<div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}>
<i className={`fa fa-search ${hasValue ? '' : 'active'}`} />
<i aria-label={intl.formatMessage(messages.placeholder)} className={`fa fa-times-circle ${hasValue ? 'active' : ''}`} />
</div>
</div>
);
}
}
export default injectIntl(Search);
| h-izumi/mastodon | app/javascript/mastodon/features/compose/components/search.js | JavaScript | agpl-3.0 | 1,817 | [
30522,
12324,
10509,
2013,
1005,
10509,
1005,
1025,
12324,
17678,
13874,
2015,
2013,
1005,
17678,
1011,
4127,
1005,
1025,
12324,
1063,
9375,
7834,
3736,
8449,
1010,
1999,
20614,
18447,
2140,
1065,
2013,
1005,
10509,
1011,
20014,
2140,
1005,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
namespace PxS\PeerReviewingBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/hello/Fabien');
$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
}
}
| joekukish/PeerReviewingSuite | src/PxS/PeerReviewingBundle/Tests/Controller/DefaultControllerTest.php | PHP | mit | 406 | [
30522,
1026,
1029,
25718,
3415,
15327,
1052,
2595,
2015,
1032,
8152,
2890,
8584,
2075,
27265,
2571,
1032,
5852,
1032,
11486,
1025,
2224,
25353,
2213,
14876,
4890,
1032,
14012,
1032,
7705,
27265,
2571,
1032,
3231,
1032,
4773,
22199,
18382,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// I used to use `util.format()` which was massive, then I switched to
// format-util, although when using rollup I discovered that the index.js
// just exported `require('util').format`, and then had the below contents
// in another file. at any rate all I want is this function:
function format(fmt) {
fmt = String(fmt); // this is closer to util.format() behavior
var re = /(%?)(%([jds]))/g
, args = Array.prototype.slice.call(arguments, 1);
if(args.length) {
if(Array.isArray(args[0]))
args = args[0];
fmt = fmt.replace(re, function(match, escaped, ptn, flag) {
var arg = args.shift();
switch(flag) {
case 's':
arg = '' + arg;
break;
case 'd':
arg = Number(arg);
break;
case 'j':
arg = JSON.stringify(arg);
break;
}
if(!escaped) {
return arg;
}
args.unshift(arg);
return match;
})
}
// arguments remain after formatting
if(args.length) {
fmt += ' ' + args.join(' ');
}
// update escaped %% values
fmt = fmt.replace(/%{2,2}/g, '%');
return '' + fmt;
}
export default format;
| sprjr/react-localize | src/util.format.js | JavaScript | isc | 1,165 | [
30522,
1013,
1013,
1045,
2109,
2000,
2224,
1036,
21183,
4014,
1012,
4289,
1006,
1007,
1036,
2029,
2001,
5294,
1010,
2059,
1045,
7237,
2000,
1013,
1013,
4289,
1011,
21183,
4014,
1010,
2348,
2043,
2478,
4897,
6279,
1045,
3603,
2008,
1996,
5... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package bio.terra.cli.serialization.userfacing.input;
import bio.terra.workspace.model.GcpGcsBucketDefaultStorageClass;
/**
* This enum defines the possible storage classes for buckets, and maps these classes to the
* corresponding {@link GcpGcsBucketDefaultStorageClass} enum in the WSM client library. The CLI
* defines its own version of this enum so that:
*
* <p>- The CLI syntax does not change when WSM API changes. In this case, the syntax affected is
* the structure of the user-provided JSON file to specify a lifecycle rule.
*
* <p>- The CLI can more easily control the JSON mapping behavior of the enum. In this case, the WSM
* client library version of the enum provides a @JsonCreator fromValue method that is case
* sensitive, and the CLI may want to allow case insensitive deserialization.
*/
public enum GcsStorageClass {
STANDARD(GcpGcsBucketDefaultStorageClass.STANDARD),
NEARLINE(GcpGcsBucketDefaultStorageClass.NEARLINE),
COLDLINE(GcpGcsBucketDefaultStorageClass.COLDLINE),
ARCHIVE(GcpGcsBucketDefaultStorageClass.ARCHIVE);
private GcpGcsBucketDefaultStorageClass wsmEnumVal;
GcsStorageClass(GcpGcsBucketDefaultStorageClass wsmEnumVal) {
this.wsmEnumVal = wsmEnumVal;
}
public GcpGcsBucketDefaultStorageClass toWSMEnum() {
return this.wsmEnumVal;
}
}
| DataBiosphere/terra-cli | src/main/java/bio/terra/cli/serialization/userfacing/input/GcsStorageClass.java | Java | bsd-3-clause | 1,313 | [
30522,
7427,
16012,
30524,
4270,
26266,
1025,
1013,
1008,
1008,
1008,
2023,
4372,
2819,
11859,
1996,
2825,
5527,
4280,
2005,
13610,
2015,
1010,
1998,
7341,
2122,
4280,
2000,
1996,
1008,
7978,
1063,
1030,
4957,
1043,
21906,
18195,
19022,
127... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module Vagrant
class VM
include Vagrant::Util
attr_reader :env
attr_reader :name
attr_reader :vm
class << self
# Finds a virtual machine by a given UUID and either returns
# a Vagrant::VM object or returns nil.
def find(uuid, env=nil, name=nil)
vm = VirtualBox::VM.find(uuid)
new(:vm => vm, :env => env, :name => name)
end
end
def initialize(opts=nil)
defaults = {
:vm => nil,
:env => nil,
:name => nil
}
opts = defaults.merge(opts || {})
@vm = opts[:vm]
@name = opts[:name]
if !opts[:env].nil?
# We have an environment, so we create a new child environment
# specifically for this VM. This step will load any custom
# config and such.
@env = Vagrant::Environment.new({
:cwd => opts[:env].cwd,
:parent => opts[:env],
:vm => self
}).load!
# Load the associated system.
load_system!
end
@loaded_system_distro = false
end
# Loads the system associated with the VM. The system class is
# responsible for OS-specific functionality. More information
# can be found by reading the documentation on {Vagrant::Systems::Base}.
#
# **This method should never be called manually.**
def load_system!(system=nil)
system ||= env.config.vm.system
env.logger.info("vm: #{name}") { "Loading system: #{system}" }
if system.is_a?(Class)
raise Errors::VMSystemError, :_key => :invalid_class, :system => system.to_s if !(system <= Systems::Base)
@system = system.new(self)
elsif system.is_a?(Symbol)
# Hard-coded internal systems
mapping = {
:debian => Systems::Debian,
:ubuntu => Systems::Ubuntu,
:freebsd => Systems::FreeBSD,
:gentoo => Systems::Gentoo,
:redhat => Systems::Redhat,
:suse => Systems::Suse,
:linux => Systems::Linux,
:solaris => Systems::Solaris,
:arch => Systems::Arch
}
raise Errors::VMSystemError, :_key => :unknown_type, :system => system.to_s if !mapping.has_key?(system)
@system = mapping[system].new(self)
else
raise Errors::VMSystemError, :unspecified
end
end
# Returns the system for this VM, loading the distro of the system if
# we can.
def system
if !@loaded_system_distro && created? && vm.running?
# Load the system distro for the first time
result = @system.distro_dispatch
load_system!(result)
@loaded_system_distro = true
end
@system
end
# Access the {Vagrant::SSH} object associated with this VM.
# On the initial call, this will initialize the object. On
# subsequent calls it will reuse the existing object.
def ssh
@ssh ||= SSH.new(env)
end
# Returns a boolean true if the VM has been created, otherwise
# returns false.
#
# @return [Boolean]
def created?
!vm.nil?
end
# Sets the currently active VM for this VM. If the VM is a valid,
# created virtual machine, then it will also update the local data
# to persist the VM. Otherwise, it will remove itself from the
# local data (if it exists).
def vm=(value)
@vm = value
env.local_data[:active] ||= {}
if value && value.uuid
env.local_data[:active][name.to_s] = value.uuid
else
env.local_data[:active].delete(name.to_s)
end
# Commit the local data so that the next time vagrant is initialized,
# it realizes the VM exists
env.local_data.commit
end
def uuid
vm ? vm.uuid : nil
end
def reload!
@vm = VirtualBox::VM.find(@vm.uuid)
end
def package(options=nil)
env.actions.run(:package, { "validate" => false }.merge(options || {}))
end
def up(options=nil)
env.actions.run(:up, options)
end
def start(options=nil)
return if @vm.running?
return resume if @vm.saved?
env.actions.run(:start, options)
end
def halt(options=nil)
env.actions.run(:halt, options)
end
def reload
env.actions.run(:reload)
end
def provision
env.actions.run(:provision)
end
def destroy
env.actions.run(:destroy)
end
def suspend
env.actions.run(:suspend)
end
def resume
env.actions.run(:resume)
end
def saved?
@vm.saved?
end
def powered_off?; @vm.powered_off? end
end
end
| simonsd/vagrant | lib/vagrant/vm.rb | Ruby | mit | 4,595 | [
30522,
11336,
12436,
18980,
2465,
1058,
2213,
2421,
12436,
18980,
1024,
1024,
21183,
4014,
2012,
16344,
1035,
8068,
1024,
4372,
2615,
2012,
16344,
1035,
8068,
1024,
2171,
2012,
16344,
1035,
8068,
1024,
1058,
2213,
2465,
1026,
1026,
2969,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text.RegularExpressions;
using JetBrains.Annotations;
using static JetBrains.Annotations.AssertionConditionType;
namespace Ccr.Core.Extensions
{
public static class StringExtensions
{
public static bool IsNullOrWhiteSpace(
this string @this)
{
return string.IsNullOrWhiteSpace(@this);
}
/// <summary>
/// Assertion method that ensures that <paramref name="this"/> is not null
/// </summary>
/// <param name="this">
/// The object in which to ensure non-nullability upon
/// </param>
[ContractAnnotation("this:null => true"), AssertionMethod]
public static bool IsNullOrEmptyEx(
[AssertionCondition(IS_NULL)] this string @this)
{
return string.IsNullOrEmpty(@this);
}
/// <summary>
/// Assertion method that ensures that <paramref name="this"/> is not null
/// </summary>
/// <param name="this">
/// The object in which to ensure non-nullability upon
/// </param>
[ContractAnnotation("this:null => false"), AssertionMethod]
public static bool IsNotNullOrEmptyEx(
[AssertionCondition(IS_NOT_NULL)] this string @this)
{
return !string.IsNullOrEmpty(@this);
}
//IsNotNullOrEmptyEx
public static string Surround(
this string @this,
char c)
{
return $"{c}{@this}{c}";
}
public static string SQuote(
this char @this)
{
return @this.ToString().Surround('\'');
}
public static string Quote(
this char @this)
{
return @this.ToString().Surround('\"');
}
public static string SQuote(
this string @this)
{
return @this.Surround('\'');
}
public static string Quote(
this string @this)
{
return @this.Surround('\"');
}
public static string Limit(
this string @this,
int length)
{
return @this.Length > length
? @this.Substring(0, length)
: @this;
}
private static TextInfo _textInfo;
internal static TextInfo TextInfo
{
get => _textInfo
?? (_textInfo = new CultureInfo("en-US", false).TextInfo);
}
public static string ToTitleCase(
this string @this)
{
return TextInfo.ToTitleCase(@this);
}
public static bool ContainsCaseInsensitive(
this string @this,
string toCheck)
{
return @this
.IndexOf(toCheck, StringComparison.OrdinalIgnoreCase) >= 0;
}
public static bool IsExclusivelyHex(
this string source)
{
return Regex.IsMatch(
source,
@"\A\b[0-9a-fA-F]+\b\Z");
}
public static bool IsCStyleCompilerHexLiteral(
this string source)
{
return Regex.IsMatch(
source,
@"\A\b(0[xX])?[0-9a-fA-F]+\b\Z");
}//
// definition of a valid C# identifier: http://msdn.microsoft.com/en-us/library/aa664670(v=vs.71).aspx
/// <summary>
/// Information on the standards of how the language specificiation
/// consitutes a valid C# member identifier.
/// </summary>
// ReSharper disable once RedundantArrayCreationExpression
private static readonly List<string> _csharpLanguageKeywords
= new List<string>
{
"abstract", "event", "new", "struct",
"as", "explicit", "null", "switch",
"base", "extern", "object", "this",
"bool", "false", "operator", "throw",
"breal", "finally", "out", "true",
"byte", "fixed", "override", "try",
"case", "float", "params", "typeof",
"catch", "for", "private", "uint",
"char", "foreach", "protected", "ulong",
"checked", "goto", "public", "unchekeced",
"class", "if", "readonly", "unsafe",
"const", "implicit", "ref", "ushort",
"continue", "in", "return", "using",
"decimal", "int", "sbyte", "virtual",
"default", "interface", "sealed", "volatile",
"delegate", "internal", "short", "void",
"do", "is", "sizeof", "while",
"double", "lock", "stackalloc",
"else", "long", "static",
"enum", "namespace", "string"
};
private const string formattingCharacter = @"\p{Cf}";
private const string connectingCharacter = @"\p{Pc}";
private const string decimalDigitCharacter = @"\p{Nd}";
private const string combiningCharacter = @"\p{Mn}|\p{Mc}";
private const string letterCharacter = @"\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}";
private const string identifierPartCharacter =
letterCharacter + "|" +
decimalDigitCharacter + "|" +
connectingCharacter + "|" +
combiningCharacter + "|" +
formattingCharacter;
private const string identifierPartCharacters =
"(" + identifierPartCharacter + ")";
private const string identifierStartCharacter =
"(" + letterCharacter + "|_)";
private const string identifierOrKeyword =
identifierStartCharacter + "(" + identifierPartCharacters + ")*";
public static bool IsValidCSharpIdentifier(
this string @this)
{
if (@this.IsNullOrEmptyEx())
return false;
var validIdentifierRegex = new Regex(
$"^{identifierOrKeyword}$",
RegexOptions.Compiled);
var normalizedIdentifier = @this.Normalize();
if (validIdentifierRegex.IsMatch(normalizedIdentifier) &&
!_csharpLanguageKeywords.Contains(normalizedIdentifier))
return true;
return normalizedIdentifier.StartsWith("@") &&
validIdentifierRegex.IsMatch(
normalizedIdentifier.Substring(1));
}
//public static string ToCommaSeparatedList(
// this object[] series,
// CoordinatingConjunction coordinatingConjunction = CoordinatingConjunction.None)
//{
// var stringBuilder = new StringBuilder();
// var seriesLength = series.Length;
// for (var i = 0; i < seriesLength - 2; i++)
// {
// stringBuilder.Append(series[i]);
// stringBuilder.Append(", ");
// }
// stringBuilder.Append(series[seriesLength - 1]);
// return stringBuilder.ToString();
//}
/// <summary>
/// Converts the specified input string to Pascal Case.
/// </summary>
/// <param name="this">
/// The subject <see cref="string"/> in which to convert.
/// </param> c
/// <returns>
/// The value of the provided <paramref name="this"/> converted to Pascal Case.
/// </returns>
public static string ToPascalCase(
[NotNull] this string @this)
{
@this.IsNotNull(nameof(@this));
return Regex.Replace(
@this,
"(?:^|_)(.)",
match => match
.Groups[1]
.Value
.ToUpper());
}
/// <summary>
/// Converts the specified input string to Camel Case.
/// </summary>
/// <param name="this">
/// The subject <see cref="string"/> in which to convert.
/// </param>
/// <returns>
/// The value of the provided <paramref name="this"/> converted to Camel Case.
/// </returns>
public static string ToCamelCase(
[NotNull] this string @this)
{
@this.IsNotNull(nameof(@this));
var pascalCase = @this.ToPascalCase();
return pascalCase.Substring(0, 1).ToLower() +
pascalCase.Substring(1);
}
/// <summary>
/// Separates the input words with underscore.
/// </summary>
/// <param name="this">
/// The subject <see cref="string"/> in which to convert.
/// </param>
/// <returns>
/// The provided <paramref name="this"/> with the words separated by underscores.
/// </returns>
public static string Underscore(
[NotNull] this string @this)
{
@this.IsNotNull(nameof(@this));
return
Regex.Replace(
Regex.Replace(
Regex.Replace(
@this, "([A-Z]+)([A-Z][a-z])", "$1_$2"),
"([a-z\\d])([A-Z])", "$1_$2"),
"[-\\s]", "_")
.ToLower();
}
}
}
| vreniose95/Ccr | Ccr.Core/Core/Extensions/StringExtensions.cs | C# | mit | 7,785 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
6407,
1012,
30524,
2478,
6892,
10024,
7076,
1012,
5754,
17287,
9285,
1025,
2478,
10763,
6892,
10024,
7076,
1012,
5754,
17287,
9285,
1012,
23617,
8663,
20562,
13874,
1025,
3415,
15327,
10507,
2099,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
'use strict';
describe('myApp.view3 module', function() {
var scope, view3Ctrl;
beforeEach(module('myApp.view3'));
beforeEach(module('matchingServices'));
beforeEach(inject(function ($controller, $rootScope) { // inject $rootScope
scope = $rootScope.$new();
view3Ctrl = $controller('View3Ctrl',{$scope : scope});
}));
describe('view3 controller', function(){
it('should ....', function() {
//spec body
expect(view3Ctrl).toBeDefined();
});
});
}); | johandoornenbal/matchingfront | app/view3/view3_test.js | JavaScript | apache-2.0 | 498 | [
30522,
1005,
2224,
9384,
1005,
1025,
6235,
1006,
1005,
2026,
29098,
1012,
3193,
2509,
11336,
1005,
1010,
3853,
1006,
1007,
1063,
13075,
9531,
1010,
3193,
2509,
6593,
12190,
1025,
2077,
5243,
2818,
1006,
11336,
1006,
1005,
2026,
29098,
1012,... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<?php
/*
* This file is part of the Eventum (Issue Tracking System) package.
*
* @copyright (c) Eventum Team
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
namespace Eventum\Controller;
use Auth;
use AuthCookie;
use Eventum\Controller\Helper\MessagesHelper;
use Setup;
use User;
class SignupController extends BaseController
{
/** @var string */
protected $tpl_name = 'signup.tpl.html';
/** @var string */
private $cat;
/**
* {@inheritdoc}
*/
protected function configure()
{
$request = $this->getRequest();
$this->cat = $request->request->get('cat');
}
/**
* {@inheritdoc}
*/
protected function canAccess()
{
// log anonymous users out so they can use the signup form
if (AuthCookie::hasAuthCookie() && Auth::isAnonUser()) {
Auth::logout();
}
return true;
}
/**
* {@inheritdoc}
*/
protected function defaultAction()
{
if ($this->cat == 'signup') {
$this->createVisitorAccountAction();
}
}
private function createVisitorAccountAction()
{
$setup = Setup::get();
if ($setup['open_signup'] != 'enabled') {
$error = ev_gettext('Sorry, but this feature has been disabled by the administrator.');
$this->error($error);
}
$res = User::createVisitorAccount($setup['accounts_role'], $setup['accounts_projects']);
$this->tpl->assign('signup_result', $res);
// TODO: translate
$map = [
1 => ['Thank you, your account creation request was processed successfully. For security reasons a confirmation email was sent to the provided email address with instructions on how to confirm your request and activate your account.', MessagesHelper::MSG_INFO],
-1 => ['Error: An error occurred while trying to run your query.', MessagesHelper::MSG_ERROR],
-2 => ['Error: The email address specified is already associated with an user in the system.', MessagesHelper::MSG_ERROR],
];
$this->messages->mapMessages($res, $map);
}
/**
* {@inheritdoc}
*/
protected function prepareTemplate()
{
}
}
| mariadb-corporation/eventum | src/Controller/SignupController.php | PHP | gpl-2.0 | 2,410 | [
30522,
1026,
1029,
25718,
1013,
1008,
1008,
2023,
5371,
2003,
2112,
1997,
1996,
2724,
2819,
1006,
3277,
9651,
2291,
1007,
7427,
1012,
1008,
1008,
1030,
9385,
1006,
1039,
1007,
2724,
2819,
2136,
1008,
1030,
6105,
27004,
2236,
2270,
30524,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
//
// Constants.h
//
//
#define LANGUAGES_API @"https://api.unfoldingword.org/obs/txt/1/obs-catalog.json"
#define SELECTION_BLUE_COLOR [UIColor colorWithRed:76.0/255.0 green:185.0/255.0 blue:224.0/255.0 alpha:1.0]
#define TEXT_COLOR_NORMAL [UIColor colorWithRed:32.0/255.0 green:27.0/255.0 blue:22.0/255.0 alpha:1.0]
#define BACKGROUND_GRAY [UIColor colorWithRed:42.0/255.0 green:34.0/255.0 blue:26.0/255.0 alpha:1.0]
#define BACKGROUND_GREEN [UIColor colorWithRed:170.0/255.0 green:208.0/255.0 blue:0.0/255.0 alpha:1.0]
#define TABBAR_COLOR_TRANSPARENT [UIColor colorWithRed:42.0/255.0 green:34.0/255.0 blue:26.0/255.0 alpha:0.7]
#define FONT_LIGHT [UIFont fontWithName:@"HelveticaNeue-Light" size:17]
#define FONT_NORMAL [UIFont fontWithName:@"HelveticaNeue" size:17]
#define FONT_MEDIUM [UIFont fontWithName:@"HelveticaNeue-Medium" size:17]
#define LEVEL_1_DESC NSLocalizedString(@"Level 1: internal — Translator (or team) affirms that translation is in line with Statement of Faith and Translation Guidelines.", nil)
#define LEVEL_2_DESC NSLocalizedString(@"Level 2: external — Translation is independently checked and confirmed by at least two others not on the translation team.", nil)
#define LEVEL_3_DESC NSLocalizedString(@"Level 3: authenticated — Translation is checked and confirmed by leadership of at least one Church network with native speakers of the language.", nil)
#define LEVEL_1_IMAGE @"level1Cell"
#define LEVEL_2_IMAGE @"level2Cell"
#define LEVEL_3_IMAGE @"level3Cell"
#define LEVEL_1_REVERSE @"level1"
#define LEVEL_2_REVERSE @"level2"
#define LEVEL_3_REVERSE @"level3"
#define IMAGE_VERIFY_GOOD @"verifyGood"
#define IMAGE_VERIFY_FAIL @"verifyFail.png"
#define IMAGE_VERIFY_EXPIRE @"verifyExpired.png"
// Allows us to track the verse for each part of an attributed string
static NSString *const USFM_VERSE_NUMBER = @"USFMVerseNumber";
static NSString *const SignatureFileAppend = @".sig"; // Duplicated in UWConstants.swift
static NSString *const FileExtensionUFW = @"ufw"; /// Duplicated in UWConstants.swift
// Duplicated in UWConstants.swift
static NSString *const BluetoothSend = @"BluetoothSend";
static NSString *const BluetoothReceive = @"BluetoothReceive";
static NSString *const MultiConnectSend = @"MultiConnectSend";
static NSString *const MultiConnectReceive = @"MultiConnectReceive";
static NSString *const iTunesSend = @"iTunesSend";
static NSString *const iTunesReceive = @"iTunesReceive";
static NSString *const IMAGE_DIGLOT = @"diglot"; | unfoldingWord-dev/uw-ios | app/UnfoldingWord/UnfoldingWord/Constants.h | C | mit | 2,540 | [
30522,
1013,
1013,
1013,
1013,
5377,
2015,
1012,
1044,
1013,
1013,
1013,
1013,
1001,
9375,
4155,
1035,
17928,
1030,
1000,
16770,
1024,
1013,
1013,
17928,
1012,
4895,
21508,
18351,
1012,
8917,
1013,
27885,
2015,
1013,
19067,
2102,
1013,
1015... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="refresh" content="0;URL=../../lock_api/trait.RawMutex.html">
</head>
<body>
<p>Redirecting to <a href="../../lock_api/trait.RawMutex.html">../../lock_api/trait.RawMutex.html</a>...</p>
<script>location.replace("../../lock_api/trait.RawMutex.html" + location.search + location.hash);</script>
</body>
</html> | malept/guardhaus | main/lock_api/mutex/trait.RawMutex.html | HTML | mit | 377 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
25416,
21898,
1000,
4180,
1027,
1000,
1014,
1025,
24471,
2140,
1027,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/*************************************************************************
> File Name: random.cpp
> Author: qiaoyihan
> Email: yihqiao@126
> Created Time: Sun May 15 11:20:00 2016
************************************************************************/
#include<iostream>
#include<string>
#include<cstdlib>
#include<ctime>
using std::cout;
using std::endl;
using std::string;
int main()
{
std::srand(std::time(0)); // use current time as seed for random generator
cout << std::rand() % 3 << endl;
return 0;
}
| Evanqiao/LeetCode-qyh | 53_MaximumSubarray/random.cpp | C++ | gpl-2.0 | 536 | [
30522,
1013,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
1008,
100... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
# !/usr/bin/env python
"""Testing a sprite.
The ball should bounce off the sides of the window. You may resize the
window.
This test should just run without failing.
"""
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import os
import unittest
from pyglet.gl import glClear
import pyglet.window
import pyglet.window.event
from pyglet import clock
from scene2d import Sprite, Image2d, FlatView
from scene2d.image import TintEffect
from scene2d.camera import FlatCamera
ball_png = os.path.join(os.path.dirname(__file__), 'ball.png')
class BouncySprite(Sprite):
def update(self):
# move, check bounds
p = self.properties
self.x += p['dx']
self.y += p['dy']
if self.left < 0:
self.left = 0
p['dx'] = -p['dx']
elif self.right > 320:
self.right = 320
p['dx'] = -p['dx']
if self.bottom < 0:
self.bottom = 0
p['dy'] = -p['dy']
elif self.top > 320:
self.top = 320
p['dy'] = -p['dy']
class SpriteOverlapTest(unittest.TestCase):
def test_sprite(self):
w = pyglet.window.Window(width=320, height=320)
image = Image2d.load(ball_png)
ball1 = BouncySprite(0, 0, 64, 64, image, properties=dict(dx=10, dy=5))
ball2 = BouncySprite(288, 0, 64, 64, image,
properties=dict(dx=-10, dy=5))
view = FlatView(0, 0, 320, 320, sprites=[ball1, ball2])
view.fx, view.fy = 160, 160
clock.set_fps_limit(60)
e = TintEffect((.5, 1, .5, 1))
while not w.has_exit:
clock.tick()
w.dispatch_events()
ball1.update()
ball2.update()
if ball1.overlaps(ball2):
if 'overlap' not in ball2.properties:
ball2.properties['overlap'] = e
ball2.add_effect(e)
elif 'overlap' in ball2.properties:
ball2.remove_effect(e)
del ball2.properties['overlap']
view.clear()
view.draw()
w.flip()
w.close()
unittest.main()
| bitcraft/pyglet | contrib/scene2d/tests/scene2d/SPRITE_OVERLAP.py | Python | bsd-3-clause | 2,162 | [
30522,
1001,
999,
1013,
2149,
2099,
1013,
8026,
1013,
4372,
2615,
18750,
1000,
1000,
1000,
5604,
1037,
11867,
17625,
1012,
1996,
3608,
2323,
17523,
2125,
1996,
3903,
1997,
1996,
3332,
1012,
2017,
2089,
24501,
4697,
1996,
3332,
1012,
2023,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var path = require('path')
module.exports = {
// Webpack aliases
aliases: {
quasar: path.resolve(__dirname, '../node_modules/quasar-framework/'),
src: path.resolve(__dirname, '../src'),
assets: path.resolve(__dirname, '../src/assets'),
components: path.resolve(__dirname, '../src/components')
},
// Progress Bar Webpack plugin format
// https://github.com/clessg/progress-bar-webpack-plugin#options
progressFormat: ' [:bar] ' + ':percent'.bold + ' (:msg)',
// Default theme to build with ('ios' or 'mat')
defaultTheme: 'mat',
build: {
env: require('./prod.env'),
index: path.resolve(__dirname, '../dist/index.html'),
publicPath: '',
productionSourceMap: false,
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css']
},
dev: {
env: require('./dev.env'),
cssSourceMap: true,
// auto open browser or not
openBrowser: true,
publicPath: '/',
port: 8081,
// If for example you are using Quasar Play
// to generate a QR code then on each dev (re)compilation
// you need to avoid clearing out the console, so set this
// to "false", otherwise you can set it to "true" to always
// have only the messages regarding your last (re)compilation.
clearConsoleOnRebuild: false,
// Proxy your API if using any.
// Also see /build/script.dev.js and search for "proxy api requests"
// https://github.com/chimurai/http-proxy-middleware
proxyTable: {}
}
}
/*
* proxyTable example:
*
proxyTable: {
// proxy all requests starting with /api
'/api': {
target: 'https://some.address.com/api',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
*/
| agustincl/AclBoilerplate | config/index.js | JavaScript | gpl-3.0 | 1,969 | [
30522,
13075,
4130,
1027,
5478,
1006,
1005,
4130,
1005,
1007,
11336,
1012,
14338,
1027,
1063,
1013,
1013,
4773,
23947,
14593,
2229,
14593,
2229,
1024,
1063,
24209,
16782,
2099,
1024,
4130,
1012,
10663,
1006,
1035,
1035,
16101,
18442,
1010,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<style>
/* Loading Spinner */
.spinner {
margin: 0;
width: 70px;
height: 18px;
margin: -35px 0 0 -9px;
position: absolute;
top: 50%;
left: 50%;
text-align: center
}
.spinner > div {
width: 18px;
height: 18px;
background-color: #333;
border-radius: 100%;
display: inline-block;
-webkit-animation: bouncedelay 1.4s infinite ease-in-out;
animation: bouncedelay 1.4s infinite ease-in-out;
-webkit-animation-fill-mode: both;
animation-fill-mode: both
}
.spinner .bounce1 {
-webkit-animation-delay: -.32s;
animation-delay: -.32s
}
.spinner .bounce2 {
-webkit-animation-delay: -.16s;
animation-delay: -.16s
}
@-webkit-keyframes bouncedelay {
0%,
80%,
100% {
-webkit-transform: scale(0.0)
}
40% {
-webkit-transform: scale(1.0)
}
}
@keyframes bouncedelay {
0%,
80%,
100% {
transform: scale(0.0);
-webkit-transform: scale(0.0)
}
40% {
transform: scale(1.0);
-webkit-transform: scale(1.0)
}
}
</style>
<meta charset="UTF-8">
<!--[if IE]><meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'><![endif]-->
<title> Error 500 </title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<script type="text/javascript">
// $(window).load(function(){
// setTimeout(function() {
// $('#loading').fadeOut( 400, "linear" );
// }, 300);
// });
</script>
<link rel="stylesheet" type="text/css" href="../static/style/admin-all-demo.css">
</head>
<body>
<!-- <div id="loading">
<div class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
</div> -->
<style type="text/css">
html,
body {
height: 100%;
}
body {
overflow: hidden;
background: #fff;
}
</style>
<div class="center-vertical">
<div class="center-content row">
<div class="col-md-6 center-margin">
<div class="server-message wow bounceInDown">
<h1>Error 500</h1>
<h2>Internal Server Error</h2>
<p style="margin-bottom: 16px;">The server encountered a syntax error and could not complete your request.<br/>Try again in a few minutes or contact the website administrator.</p>
<button class="btn btn-lg btn-success">Return to previous page</button>
</div>
</div>
</div>
</div>
</body>
</html> | allotory/basilinna | app/templates/error_500.html | HTML | mit | 3,263 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
2806,
1028,
1013,
1008,
10578,
6714,
3678,
1008,
1013,
1012,
6714,
3678,
1063,
7785,
1024,
1014,
1025,
9381,
1024,
3963,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
package ru.mos.polls.ourapps.ui.adapter;
import java.util.ArrayList;
import java.util.List;
import ru.mos.polls.base.BaseRecyclerAdapter;
import ru.mos.polls.base.RecyclerBaseViewModel;
import ru.mos.polls.ourapps.model.OurApplication;
import ru.mos.polls.ourapps.vm.item.OurApplicationVM;
public class OurAppsAdapter extends BaseRecyclerAdapter<RecyclerBaseViewModel> {
public void add(List<OurApplication> list) {
List<RecyclerBaseViewModel> rbvm = new ArrayList<>();
for (OurApplication ourApp : list) {
rbvm.add(new OurApplicationVM(ourApp));
}
addData(rbvm);
}
}
| active-citizen/android.java | app/src/main/java/ru/mos/polls/ourapps/ui/adapter/OurAppsAdapter.java | Java | gpl-3.0 | 625 | [
30522,
7427,
21766,
1012,
9587,
2015,
1012,
14592,
1012,
2256,
29098,
2015,
1012,
21318,
1012,
15581,
2121,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
9140,
9863,
1025,
12324,
9262,
1012,
21183,
4014,
1012,
2862,
1025,
12324,
21766,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" />
<title>Coverage for remixvr/user/models.py: 100%</title>
<link rel="stylesheet" href="style.css" type="text/css">
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.hotkeys.js"></script>
<script type="text/javascript" src="jquery.isonscreen.js"></script>
<script type="text/javascript" src="coverage_html.js"></script>
<script type="text/javascript">
jQuery(document).ready(coverage.pyfile_ready);
</script>
</head>
<body class="pyfile">
<div id="header">
<div class="content">
<h1>Coverage for <b>remixvr/user/models.py</b> :
<span class="pc_cov">100%</span>
</h1>
<img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" />
<h2 class="stats">
27 statements
<span class="run hide_run shortkey_r button_toggle_run">27 run</span>
<span class="mis shortkey_m button_toggle_mis">0 missing</span>
<span class="exc shortkey_x button_toggle_exc">0 excluded</span>
<span class="par run hide_run shortkey_p button_toggle_par">0 partial</span>
</h2>
</div>
</div>
<div class="help_panel">
<img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" />
<p class="legend">Hot-keys on this page</p>
<div>
<p class="keyhelp">
<span class="key">r</span>
<span class="key">m</span>
<span class="key">x</span>
<span class="key">p</span> toggle line displays
</p>
<p class="keyhelp">
<span class="key">j</span>
<span class="key">k</span> next/prev highlighted chunk
</p>
<p class="keyhelp">
<span class="key">0</span> (zero) top of page
</p>
<p class="keyhelp">
<span class="key">1</span> (one) first highlighted chunk
</p>
</div>
</div>
<div id="source">
<table>
<tr>
<td class="linenos">
<p id="n1" class="pln"><a href="#n1">1</a></p>
<p id="n2" class="stm run hide_run"><a href="#n2">2</a></p>
<p id="n3" class="stm run hide_run"><a href="#n3">3</a></p>
<p id="n4" class="pln"><a href="#n4">4</a></p>
<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p>
<p id="n6" class="pln"><a href="#n6">6</a></p>
<p id="n7" class="stm run hide_run"><a href="#n7">7</a></p>
<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p>
<p id="n9" class="pln"><a href="#n9">9</a></p>
<p id="n10" class="pln"><a href="#n10">10</a></p>
<p id="n11" class="stm run hide_run"><a href="#n11">11</a></p>
<p id="n12" class="pln"><a href="#n12">12</a></p>
<p id="n13" class="stm run hide_run"><a href="#n13">13</a></p>
<p id="n14" class="stm run hide_run"><a href="#n14">14</a></p>
<p id="n15" class="stm run hide_run"><a href="#n15">15</a></p>
<p id="n16" class="stm run hide_run"><a href="#n16">16</a></p>
<p id="n17" class="stm run hide_run"><a href="#n17">17</a></p>
<p id="n18" class="stm run hide_run"><a href="#n18">18</a></p>
<p id="n19" class="stm run hide_run"><a href="#n19">19</a></p>
<p id="n20" class="stm run hide_run"><a href="#n20">20</a></p>
<p id="n21" class="pln"><a href="#n21">21</a></p>
<p id="n22" class="stm run hide_run"><a href="#n22">22</a></p>
<p id="n23" class="pln"><a href="#n23">23</a></p>
<p id="n24" class="stm run hide_run"><a href="#n24">24</a></p>
<p id="n25" class="stm run hide_run"><a href="#n25">25</a></p>
<p id="n26" class="stm run hide_run"><a href="#n26">26</a></p>
<p id="n27" class="pln"><a href="#n27">27</a></p>
<p id="n28" class="stm run hide_run"><a href="#n28">28</a></p>
<p id="n29" class="pln"><a href="#n29">29</a></p>
<p id="n30" class="stm run hide_run"><a href="#n30">30</a></p>
<p id="n31" class="pln"><a href="#n31">31</a></p>
<p id="n32" class="stm run hide_run"><a href="#n32">32</a></p>
<p id="n33" class="pln"><a href="#n33">33</a></p>
<p id="n34" class="stm run hide_run"><a href="#n34">34</a></p>
<p id="n35" class="pln"><a href="#n35">35</a></p>
<p id="n36" class="stm run hide_run"><a href="#n36">36</a></p>
<p id="n37" class="pln"><a href="#n37">37</a></p>
<p id="n38" class="stm run hide_run"><a href="#n38">38</a></p>
<p id="n39" class="pln"><a href="#n39">39</a></p>
<p id="n40" class="stm run hide_run"><a href="#n40">40</a></p>
<p id="n41" class="pln"><a href="#n41">41</a></p>
<p id="n42" class="stm run hide_run"><a href="#n42">42</a></p>
<p id="n43" class="pln"><a href="#n43">43</a></p>
<p id="n44" class="stm run hide_run"><a href="#n44">44</a></p>
</td>
<td class="text">
<p id="t1" class="pln"><span class="com"># -*- coding: utf-8 -*-</span><span class="strut"> </span></p>
<p id="t2" class="stm run hide_run"><span class="str">"""User models."""</span><span class="strut"> </span></p>
<p id="t3" class="stm run hide_run"><span class="key">import</span> <span class="nam">datetime</span> <span class="key">as</span> <span class="nam">dt</span><span class="strut"> </span></p>
<p id="t4" class="pln"><span class="strut"> </span></p>
<p id="t5" class="stm run hide_run"><span class="key">from</span> <span class="nam">flask_jwt</span> <span class="key">import</span> <span class="nam">_default_jwt_encode_handler</span><span class="strut"> </span></p>
<p id="t6" class="pln"><span class="strut"> </span></p>
<p id="t7" class="stm run hide_run"><span class="key">from</span> <span class="nam">remixvr</span><span class="op">.</span><span class="nam">database</span> <span class="key">import</span> <span class="nam">Column</span><span class="op">,</span> <span class="nam">Model</span><span class="op">,</span> <span class="nam">SurrogatePK</span><span class="op">,</span> <span class="nam">db</span><span class="strut"> </span></p>
<p id="t8" class="stm run hide_run"><span class="key">from</span> <span class="nam">remixvr</span><span class="op">.</span><span class="nam">extensions</span> <span class="key">import</span> <span class="nam">bcrypt</span><span class="strut"> </span></p>
<p id="t9" class="pln"><span class="strut"> </span></p>
<p id="t10" class="pln"><span class="strut"> </span></p>
<p id="t11" class="stm run hide_run"><span class="key">class</span> <span class="nam">User</span><span class="op">(</span><span class="nam">SurrogatePK</span><span class="op">,</span> <span class="nam">Model</span><span class="op">)</span><span class="op">:</span><span class="strut"> </span></p>
<p id="t12" class="pln"><span class="strut"> </span></p>
<p id="t13" class="stm run hide_run"> <span class="nam">__tablename__</span> <span class="op">=</span> <span class="str">'users'</span><span class="strut"> </span></p>
<p id="t14" class="stm run hide_run"> <span class="nam">username</span> <span class="op">=</span> <span class="nam">Column</span><span class="op">(</span><span class="nam">db</span><span class="op">.</span><span class="nam">String</span><span class="op">(</span><span class="num">80</span><span class="op">)</span><span class="op">,</span> <span class="nam">unique</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">nullable</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t15" class="stm run hide_run"> <span class="nam">email</span> <span class="op">=</span> <span class="nam">Column</span><span class="op">(</span><span class="nam">db</span><span class="op">.</span><span class="nam">String</span><span class="op">(</span><span class="num">100</span><span class="op">)</span><span class="op">,</span> <span class="nam">unique</span><span class="op">=</span><span class="key">True</span><span class="op">,</span> <span class="nam">nullable</span><span class="op">=</span><span class="key">False</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t16" class="stm run hide_run"> <span class="nam">password</span> <span class="op">=</span> <span class="nam">Column</span><span class="op">(</span><span class="nam">db</span><span class="op">.</span><span class="nam">Binary</span><span class="op">(</span><span class="num">128</span><span class="op">)</span><span class="op">,</span> <span class="nam">nullable</span><span class="op">=</span><span class="key">True</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t17" class="stm run hide_run"> <span class="nam">created_at</span> <span class="op">=</span> <span class="nam">Column</span><span class="op">(</span><span class="nam">db</span><span class="op">.</span><span class="nam">DateTime</span><span class="op">,</span> <span class="nam">nullable</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="nam">default</span><span class="op">=</span><span class="nam">dt</span><span class="op">.</span><span class="nam">datetime</span><span class="op">.</span><span class="nam">utcnow</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t18" class="stm run hide_run"> <span class="nam">updated_at</span> <span class="op">=</span> <span class="nam">Column</span><span class="op">(</span><span class="nam">db</span><span class="op">.</span><span class="nam">DateTime</span><span class="op">,</span> <span class="nam">nullable</span><span class="op">=</span><span class="key">False</span><span class="op">,</span> <span class="nam">default</span><span class="op">=</span><span class="nam">dt</span><span class="op">.</span><span class="nam">datetime</span><span class="op">.</span><span class="nam">utcnow</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t19" class="stm run hide_run"> <span class="nam">bio</span> <span class="op">=</span> <span class="nam">Column</span><span class="op">(</span><span class="nam">db</span><span class="op">.</span><span class="nam">String</span><span class="op">(</span><span class="num">300</span><span class="op">)</span><span class="op">,</span> <span class="nam">nullable</span><span class="op">=</span><span class="key">True</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t20" class="stm run hide_run"> <span class="nam">image</span> <span class="op">=</span> <span class="nam">Column</span><span class="op">(</span><span class="nam">db</span><span class="op">.</span><span class="nam">String</span><span class="op">(</span><span class="num">120</span><span class="op">)</span><span class="op">,</span> <span class="nam">nullable</span><span class="op">=</span><span class="key">True</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t21" class="pln"><span class="strut"> </span></p>
<p id="t22" class="stm run hide_run"> <span class="key">def</span> <span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">username</span><span class="op">,</span> <span class="nam">email</span><span class="op">,</span> <span class="nam">password</span><span class="op">=</span><span class="key">None</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span><span class="op">:</span><span class="strut"> </span></p>
<p id="t23" class="pln"> <span class="str">"""Create instance."""</span><span class="strut"> </span></p>
<p id="t24" class="stm run hide_run"> <span class="nam">db</span><span class="op">.</span><span class="nam">Model</span><span class="op">.</span><span class="nam">__init__</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">username</span><span class="op">=</span><span class="nam">username</span><span class="op">,</span> <span class="nam">email</span><span class="op">=</span><span class="nam">email</span><span class="op">,</span> <span class="op">**</span><span class="nam">kwargs</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t25" class="stm run hide_run"> <span class="key">if</span> <span class="nam">password</span><span class="op">:</span><span class="strut"> </span></p>
<p id="t26" class="stm run hide_run"> <span class="nam">self</span><span class="op">.</span><span class="nam">set_password</span><span class="op">(</span><span class="nam">password</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t27" class="pln"> <span class="key">else</span><span class="op">:</span><span class="strut"> </span></p>
<p id="t28" class="stm run hide_run"> <span class="nam">self</span><span class="op">.</span><span class="nam">password</span> <span class="op">=</span> <span class="key">None</span><span class="strut"> </span></p>
<p id="t29" class="pln"><span class="strut"> </span></p>
<p id="t30" class="stm run hide_run"> <span class="key">def</span> <span class="nam">set_password</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">password</span><span class="op">)</span><span class="op">:</span><span class="strut"> </span></p>
<p id="t31" class="pln"> <span class="str">"""Set password."""</span><span class="strut"> </span></p>
<p id="t32" class="stm run hide_run"> <span class="nam">self</span><span class="op">.</span><span class="nam">password</span> <span class="op">=</span> <span class="nam">bcrypt</span><span class="op">.</span><span class="nam">generate_password_hash</span><span class="op">(</span><span class="nam">password</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t33" class="pln"><span class="strut"> </span></p>
<p id="t34" class="stm run hide_run"> <span class="key">def</span> <span class="nam">check_password</span><span class="op">(</span><span class="nam">self</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="op">:</span><span class="strut"> </span></p>
<p id="t35" class="pln"> <span class="str">"""Check password."""</span><span class="strut"> </span></p>
<p id="t36" class="stm run hide_run"> <span class="key">return</span> <span class="nam">bcrypt</span><span class="op">.</span><span class="nam">check_password_hash</span><span class="op">(</span><span class="nam">self</span><span class="op">.</span><span class="nam">password</span><span class="op">,</span> <span class="nam">value</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t37" class="pln"><span class="strut"> </span></p>
<p id="t38" class="stm run hide_run"> <span class="op">@</span><span class="nam">property</span><span class="strut"> </span></p>
<p id="t39" class="pln"> <span class="key">def</span> <span class="nam">token</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span><span class="strut"> </span></p>
<p id="t40" class="stm run hide_run"> <span class="key">return</span> <span class="nam">_default_jwt_encode_handler</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">'utf-8'</span><span class="op">)</span><span class="strut"> </span></p>
<p id="t41" class="pln"><span class="strut"> </span></p>
<p id="t42" class="stm run hide_run"> <span class="key">def</span> <span class="nam">__repr__</span><span class="op">(</span><span class="nam">self</span><span class="op">)</span><span class="op">:</span><span class="strut"> </span></p>
<p id="t43" class="pln"> <span class="str">"""Represent instance as a unique string."""</span><span class="strut"> </span></p>
<p id="t44" class="stm run hide_run"> <span class="key">return</span> <span class="str">'<User({username!r})>'</span><span class="op">.</span><span class="nam">format</span><span class="op">(</span><span class="nam">username</span><span class="op">=</span><span class="nam">self</span><span class="op">.</span><span class="nam">username</span><span class="op">)</span><span class="strut"> </span></p>
</td>
</tr>
</table>
</div>
<div id="footer">
<div class="content">
<p>
<a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.io">coverage.py v4.5.1</a>,
created at 2018-10-12 21:32
</p>
</div>
</div>
</body>
</html>
| viewportvr/daysinvr | backend/htmlcov/remixvr_user_models_py.html | HTML | mit | 16,792 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
1028,
1026,
2132,
1028,
1026,
18804,
8299,
1011,
1041,
15549,
2615,
1027,
1000,
4180,
1011,
2828,
1000,
4180,
1027,
1000,
3793,
1013,
16129,
1025,
25869,
13462,
1027,
21183,
2546,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
module Admin::BaseHelper
include ActionView::Helpers::DateHelper
def subtabs_for(current_module)
output = []
AccessControl.project_module(current_user.profile.label, current_module).submenus.each_with_index do |m,i|
current = (m.url[:controller] == params[:controller] && m.url[:action] == params[:action]) ? "current" : ""
output << subtab(_(m.name), current, m.url)
end
content_for(:tasks) { output.join("\n") }
end
def subtab(label, style, options = {})
content_tag :li, link_to(label, options, { "class"=> style })
end
def show_page_heading
content_tag(:h2, @page_heading, :class => 'mb20') unless @page_heading.blank?
end
def cancel(url = {:action => 'index'})
link_to _("Cancel"), url
end
def save(val = _("Store"))
'<input type="submit" value="' + val + '" class="save" />'
end
def confirm_delete(val = _("Delete"))
'<input type="submit" value="' + val + '" />'
end
def link_to_show(record, controller = @controller.controller_name)
if record.published?
link_to image_tag('admin/show.png', :alt => _("show"), :title => _("Show content")),
{:controller => controller, :action => 'show', :id => record.id},
{:class => "lbOn"}
end
end
def link_to_edit(label, record, controller = @controller.controller_name)
link_to label, :controller => controller, :action => 'edit', :id => record.id
end
def link_to_edit_with_profiles(label, record, controller = @controller.controller_name)
if current_user.admin? || current_user.id == record.user_id
link_to label, :controller => controller, :action => 'edit', :id => record.id
end
end
def link_to_destroy(record, controller = @controller.controller_name)
link_to image_tag('admin/delete.png', :alt => _("delete"), :title => _("Delete content")),
:controller => controller, :action => 'destroy', :id => record.id
end
def link_to_destroy_with_profiles(record, controller = @controller.controller_name)
if current_user.admin? || current_user.id == record.user_id
link_to(_("delete"),
{ :controller => controller, :action => 'destroy', :id => record.id }, :confirm => _("Are you sure?"), :method => :post, :title => _("Delete content"))
end
end
def text_filter_options
TextFilter.find(:all).collect do |filter|
[ filter.description, filter ]
end
end
def text_filter_options_with_id
TextFilter.find(:all).collect do |filter|
[ filter.description, filter.id ]
end
end
def alternate_class
@class = @class != '' ? '' : 'class="shade"'
end
def reset_alternation
@class = nil
end
def task_quickpost(title)
link_to_function(title, toggle_effect('quick-post', 'Effect.BlindUp', "duration:0.4", "Effect.BlindDown", "duration:0.4"))
end
def task_overview
content_tag :li, link_to(_('Back to overview'), :action => 'index')
end
def task_add_resource_metadata(title,id)
link_to_function(title, toggle_effect('add-resource-metadata-' + id.to_s, 'Effect.BlindUp', "duration:0.4", "Effect.BlindDown", "duration:0.4"))
end
def task_edit_resource_metadata(title,id)
link_to_function(title, toggle_effect('edit-resource-metadata-' + id.to_s, 'Effect.BlindUp', "duration:0.4", "Effect.BlindDown", "duration:0.4"))
end
def task_edit_resource_mime(title,id)
link_to_function(title, toggle_effect('edit-resource-mime-' + id.to_s, 'Effect.BlindUp', "duration:0.4", "Effect.BlindDown", "duration:0.4"))
end
def class_write
if controller.controller_name == "content" or controller.controller_name == "pages"
"current" if controller.action_name == "new"
end
end
def class_content
if controller.controller_name =~ /content|pages|categories|resources|feedback/
"current" if controller.action_name =~ /list|index|show/
end
end
def class_themes
"current" if controller.controller_name =~ /themes|sidebar/
end
def class_users
controller.controller_name =~ /users/ ? "current right" : "right"
end
def class_dashboard
controller.controller_name =~ /dashboard/ ? "current right" : "right"
end
def class_settings
controller.controller_name =~ /settings|textfilter/ ? "current right" : "right"
end
def class_profile
controller.controller_name =~ /profiles/ ? "current right" : "right"
end
def alternate_editor
return 'visual' if current_user.editor == 'simple'
return 'simple'
end
def collection_select_with_current(object, method, collection, value_method, text_method, current_value, prompt=false)
result = "<select name='#{object}[#{method}]'>\n"
if prompt == true
result << "<option value=''>" << _("Please select") << "</option>"
end
for element in collection
if current_value and current_value == element.send(value_method)
result << "<option value='#{element.send(value_method)}' selected='selected'>#{element.send(text_method)}</option>\n"
else
result << "<option value='#{element.send(value_method)}'>#{element.send(text_method)}</option>\n"
end
end
result << "</select>\n"
return result
end
def render_void_table(size, cols)
if size == 0
"<tr>\n<td colspan=#{cols}>" + _("There are no %s yet. Why don't you start and create one?", _(controller.controller_name)) + "</td>\n</tr>\n"
end
end
def cancel_or_save
result = '<p class="right">'
result << cancel
result << " "
result << _("or")
result << " "
result << save( _("Save") + " »")
result << '</p>'
return result
end
def link_to_published(item)
item.published? ? link_to_permalink(item, _("published"), '', 'published') : "<span class='unpublished'>#{_("unpublished")}</span>"
end
def macro_help_popup(macro, text)
unless current_user.editor == 'visual'
"<a rel='lightbox' href=\"#{url_for :controller => 'textfilters', :action => 'macro_help', :id => macro.short_name}\" onclick=\"return popup(this, 'Typo Macro Help')\">#{text}</a>"
end
end
def render_macros(macros)
result = link_to_function _("Show help on Typo macros") + " (+/-)",update_page { |page| page.visual_effect(:toggle_blind, "macros", :duration => 0.2) }
result << "<table id='macros' style='display: none;'>"
result << "<tr>"
result << "<th>#{_('Name')}</th>"
result << "<th>#{_('Description')}</th>"
result << "<th>#{_('Tag')}</th>"
result << "</tr>"
for macro in macros.sort_by { |f| f.short_name }
result << "<tr #{alternate_class}>"
result << "<td>#{macro_help_popup macro, macro.display_name}</td>"
result << "<td>#{h macro.description}</td>"
result << "<td><code><typo:#{h macro.short_name}></code></td>"
result << "</tr>"
end
result << "</table>"
end
def build_editor_link(label, action, id, update, editor)
link = link_to_remote(label,
:url => { :action => action, 'editor' => editor},
:loading => "new Element.show('update_spinner_#{id}')",
:success => "new Element.toggle('update_spinner_#{id}')",
:update => "#{update}")
link << image_tag("spinner-blue.gif", :id => "update_spinner_#{id}", :style => 'display:none;')
end
def display_pagination(collection, cols)
if WillPaginate::ViewHelpers.total_pages_for_collection(collection) > 1
return "<tr><td colspan=#{cols} class='paginate'>#{will_paginate(collection)}</td></tr>"
end
end
def show_thumbnail_for_editor(image)
thumb = "#{RAILS_ROOT}/public/files/thumb_#{image.filename}"
picture = "#{this_blog.base_url}/files/#{image.filename}"
image.create_thumbnail unless File.exists? thumb
# If something went wrong with thumbnail generation, we just display a place holder
thumbnail = (File.exists? thumb) ? "#{this_blog.base_url}/files/thumb_#{image.filename}" : "#{this_blog.base_url}/images/thumb_blank.jpg"
picture = "<img class='tumb' src='#{thumbnail}' "
picture << "alt='#{this_blog.base_url}/files/#{image.filename}' "
picture << " onclick=\"edInsertImageFromCarousel('article_body_and_extended', '#{this_blog.base_url}/files/#{image.filename}');\" />"
return picture
end
end
| jasondew/cola.rb | app/helpers/admin/base_helper.rb | Ruby | mit | 8,319 | [
30522,
11336,
4748,
10020,
1024,
1024,
2918,
16001,
4842,
2421,
2895,
8584,
1024,
1024,
2393,
2545,
1024,
1024,
3058,
16001,
4842,
13366,
4942,
2696,
5910,
1035,
2005,
1006,
2783,
1035,
11336,
1007,
6434,
1027,
1031,
1033,
3229,
8663,
13181... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
\*\* Task group: vulnerability scanning \*\*
# Context
Automated scanning for vulnerabilities. Determining by hand if you developed a secure application is quite a burden. OWASP has a project called ZAP (Zed Attack Proxy) which you can use to test your application for vulnerabilities. When developing your web application (pages en REST API) you can use ZAP in the test pipeline, before you release a new version.
ZAP has some nice introduction video's here: [https://www.zaproxy.org/zap-in-ten/](https://www.zaproxy.org/zap-in-ten/)
# Deliverables
- Show a report of the ZAP findings of scanning the hackshop (BBT VM)
- Show countermeasures: give an overview of what should be fixed.
# Task
1. Start the BBT VM
2. Start the Kali VM
3. Kali: Start ZAP
4. Do a vulnerability scan with ZAP on the hackshop.
# Done | roelofr/ClientSideTechnology | docs/security/task-5-7-scan-web-app.md | Markdown | agpl-3.0 | 848 | [
30522,
1032,
1008,
1032,
1008,
4708,
2177,
1024,
18130,
13722,
1032,
1008,
1032,
1008,
1001,
6123,
12978,
13722,
2005,
24728,
19666,
6906,
14680,
1012,
12515,
2011,
2192,
2065,
2017,
2764,
1037,
5851,
4646,
2003,
3243,
1037,
10859,
1012,
27... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.Management.Kusto.Models
{
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Class representing a read write database.
/// </summary>
[Newtonsoft.Json.JsonObject("ReadWrite")]
[Rest.Serialization.JsonTransformation]
public partial class ReadWriteDatabase : Database
{
/// <summary>
/// Initializes a new instance of the ReadWriteDatabase class.
/// </summary>
public ReadWriteDatabase()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the ReadWriteDatabase class.
/// </summary>
/// <param name="id">Fully qualified resource ID for the resource. Ex -
/// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}</param>
/// <param name="name">The name of the resource</param>
/// <param name="type">The type of the resource. E.g.
/// "Microsoft.Compute/virtualMachines" or
/// "Microsoft.Storage/storageAccounts"</param>
/// <param name="location">Resource location.</param>
/// <param name="provisioningState">The provisioned state of the
/// resource. Possible values include: 'Running', 'Creating',
/// 'Deleting', 'Succeeded', 'Failed', 'Moving'</param>
/// <param name="softDeletePeriod">The time the data should be kept
/// before it stops being accessible to queries in TimeSpan.</param>
/// <param name="hotCachePeriod">The time the data should be kept in
/// cache for fast queries in TimeSpan.</param>
/// <param name="statistics">The statistics of the database.</param>
/// <param name="isFollowed">Indicates whether the database is
/// followed.</param>
public ReadWriteDatabase(string id = default(string), string name = default(string), string type = default(string), string location = default(string), string provisioningState = default(string), System.TimeSpan? softDeletePeriod = default(System.TimeSpan?), System.TimeSpan? hotCachePeriod = default(System.TimeSpan?), DatabaseStatistics statistics = default(DatabaseStatistics), bool? isFollowed = default(bool?))
: base(id, name, type, location)
{
ProvisioningState = provisioningState;
SoftDeletePeriod = softDeletePeriod;
HotCachePeriod = hotCachePeriod;
Statistics = statistics;
IsFollowed = isFollowed;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets the provisioned state of the resource. Possible values
/// include: 'Running', 'Creating', 'Deleting', 'Succeeded', 'Failed',
/// 'Moving'
/// </summary>
[JsonProperty(PropertyName = "properties.provisioningState")]
public string ProvisioningState { get; private set; }
/// <summary>
/// Gets or sets the time the data should be kept before it stops being
/// accessible to queries in TimeSpan.
/// </summary>
[JsonProperty(PropertyName = "properties.softDeletePeriod")]
public System.TimeSpan? SoftDeletePeriod { get; set; }
/// <summary>
/// Gets or sets the time the data should be kept in cache for fast
/// queries in TimeSpan.
/// </summary>
[JsonProperty(PropertyName = "properties.hotCachePeriod")]
public System.TimeSpan? HotCachePeriod { get; set; }
/// <summary>
/// Gets the statistics of the database.
/// </summary>
[JsonProperty(PropertyName = "properties.statistics")]
public DatabaseStatistics Statistics { get; private set; }
/// <summary>
/// Gets indicates whether the database is followed.
/// </summary>
[JsonProperty(PropertyName = "properties.isFollowed")]
public bool? IsFollowed { get; private set; }
}
}
| Azure/azure-sdk-for-net | sdk/kusto/Microsoft.Azure.Management.Kusto/src/Generated/Models/ReadWriteDatabase.cs | C# | mit | 4,575 | [
30522,
1013,
1013,
1026,
8285,
1011,
7013,
1028,
1013,
1013,
9385,
1006,
1039,
1007,
7513,
3840,
1012,
2035,
2916,
9235,
1012,
1013,
1013,
7000,
2104,
1996,
10210,
6105,
1012,
2156,
6105,
1012,
19067,
2102,
1999,
1996,
2622,
7117,
2005,
1... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
var fusepm = require('./fusepm');
module.exports = fixunoproj;
function fixunoproj () {
var fn = fusepm.local_unoproj(".");
fusepm.read_unoproj(fn).then(function (obj) {
var inc = [];
if (obj.Includes) {
var re = /\//;
for (var i=0; i<obj.Includes.length;i++) {
if (obj.Includes[i] === '*') {
inc.push('./*.ux');
inc.push('./*.uno');
inc.push('./*.uxl');
}
else if (!obj.Includes[i].match(re)) {
inc.push('./' + obj.Includes[i]);
}
else {
inc.push(obj.Includes[i]);
}
}
}
else {
inc = ['./*.ux', './*.uno', './*.uxl'];
}
if (!obj.Version) {
obj.Version = "0.0.0";
}
obj.Includes = inc;
fusepm.save_unoproj(fn, obj);
}).catch(function (e) {
console.log(e);
});
} | bolav/fusepm | lib/fixunoproj.js | JavaScript | isc | 752 | [
30522,
13075,
19976,
9737,
1027,
5478,
1006,
1005,
1012,
1013,
19976,
9737,
1005,
1007,
1025,
11336,
1012,
14338,
1027,
8081,
27819,
21572,
3501,
1025,
3853,
8081,
27819,
21572,
3501,
1006,
1007,
1063,
13075,
1042,
2078,
1027,
19976,
9737,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>gSOAP WS-Security: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">gSOAP WS-Security <span id="projectnumber">2.8 Stable</span></div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="headertitle">
<div class="title">xenc__EncryptedKeyType Member List</div> </div>
</div>
<div class="contents">
This is the complete list of members for <a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a>, including all inherited members.<table>
<tr class="memlist"><td><a class="el" href="structxenc_____encrypted_key_type.html#adc9fc94cf0479eb44d7801a64089723f">CarriedKeyName</a></td><td><a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="structxenc_____encrypted_key_type.html#a91ee2b9167d90f1de1acec080b1e51f7">CipherData</a></td><td><a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="structxenc_____encrypted_key_type.html#aa440ed741a83b8fa554aa337544b0c0e">ds__KeyInfo</a></td><td><a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="structxenc_____encrypted_key_type.html#a1161a0b9d57408c5e46f8543cc2711dd">Encoding</a></td><td><a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="structxenc_____encrypted_key_type.html#aa8caa30a288970bd64b100dd5a15ab7e">EncryptionMethod</a></td><td><a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="structxenc_____encrypted_key_type.html#adbaafb9c71715ec1375d10b31b3098d6">EncryptionProperties</a></td><td><a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="structxenc_____encrypted_key_type.html#a47b0a90fd56858749e6d83e0a84b671b">Id</a></td><td><a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="structxenc_____encrypted_key_type.html#a80d8bd1749477cdb06b0782024143d14">MimeType</a></td><td><a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="structxenc_____encrypted_key_type.html#a953fb48c799007ee175534a68448c6f5">Recipient</a></td><td><a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="structxenc_____encrypted_key_type.html#ae31aee0f9732098f9a7991cff77875f9">ReferenceList</a></td><td><a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a></td><td></td></tr>
<tr class="memlist"><td><a class="el" href="structxenc_____encrypted_key_type.html#a87aa201ec543db4a4c4331cfd3d0708e">Type</a></td><td><a class="el" href="structxenc_____encrypted_key_type.html">xenc__EncryptedKeyType</a></td><td></td></tr>
</table></div>
<hr class="footer"/><address class="footer"><small>Generated on Sat Aug 18 2012 13:54:15 for gSOAP WS-Security by 
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>
| TangCheng/ionvif | gsoap-2.8/gsoap/doc/wsse/html/structxenc_____encrypted_key_type-members.html | HTML | gpl-3.0 | 4,675 | [
30522,
1026,
999,
9986,
13874,
16129,
2270,
1000,
1011,
1013,
1013,
1059,
2509,
2278,
1013,
1013,
26718,
2094,
1060,
11039,
19968,
1015,
1012,
1014,
17459,
1013,
1013,
4372,
1000,
1000,
8299,
1024,
1013,
1013,
7479,
1012,
1059,
2509,
1012,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/**
* See Copyright Notice in picrin.h
*/
#include "picrin.h"
static void
setup_default_env(pic_state *pic, struct pic_env *env)
{
pic_put_variable(pic, env, pic_obj_value(pic->sDEFINE_LIBRARY), pic->uDEFINE_LIBRARY);
pic_put_variable(pic, env, pic_obj_value(pic->sIMPORT), pic->uIMPORT);
pic_put_variable(pic, env, pic_obj_value(pic->sEXPORT), pic->uEXPORT);
pic_put_variable(pic, env, pic_obj_value(pic->sCOND_EXPAND), pic->uCOND_EXPAND);
}
struct pic_lib *
pic_make_library(pic_state *pic, pic_value name)
{
struct pic_lib *lib;
struct pic_env *env;
struct pic_dict *exports;
if ((lib = pic_find_library(pic, name)) != NULL) {
pic_errorf(pic, "library name already in use: ~s", name);
}
env = pic_make_env(pic, NULL);
exports = pic_make_dict(pic);
setup_default_env(pic, env);
lib = (struct pic_lib *)pic_obj_alloc(pic, sizeof(struct pic_lib), PIC_TT_LIB);
lib->name = name;
lib->env = env;
lib->exports = exports;
/* register! */
pic->libs = pic_acons(pic, name, pic_obj_value(lib), pic->libs);
return lib;
}
struct pic_lib *
pic_find_library(pic_state *pic, pic_value spec)
{
pic_value v;
v = pic_assoc(pic, spec, pic->libs, NULL);
if (pic_false_p(v)) {
return NULL;
}
return pic_lib_ptr(pic_cdr(pic, v));
}
void
pic_import(pic_state *pic, struct pic_lib *lib)
{
pic_sym *name, *realname, *uid;
khiter_t it;
pic_dict_for_each (name, lib->exports, it) {
realname = pic_sym_ptr(pic_dict_ref(pic, lib->exports, name));
if ((uid = pic_find_variable(pic, lib->env, pic_obj_value(realname))) == NULL) {
pic_errorf(pic, "attempted to export undefined variable '~s'", pic_obj_value(realname));
}
pic_put_variable(pic, pic->lib->env, pic_obj_value(name), uid);
}
}
void
pic_export(pic_state *pic, pic_sym *name)
{
pic_dict_set(pic, pic->lib->exports, name, pic_obj_value(name));
}
static pic_value
pic_lib_make_library(pic_state *pic)
{
pic_value name;
pic_get_args(pic, "o", &name);
return pic_obj_value(pic_make_library(pic, name));
}
static pic_value
pic_lib_find_library(pic_state *pic)
{
pic_value name;
struct pic_lib *lib;
pic_get_args(pic, "o", &name);
if ((lib = pic_find_library(pic, name)) == NULL) {
return pic_false_value();
}
return pic_obj_value(lib);
}
static pic_value
pic_lib_current_library(pic_state *pic)
{
pic_value lib;
int n;
n = pic_get_args(pic, "|o", &lib);
if (n == 0) {
return pic_obj_value(pic->lib);
}
else {
pic_assert_type(pic, lib, lib);
pic->lib = pic_lib_ptr(lib);
return pic_undef_value();
}
}
static pic_value
pic_lib_library_import(pic_state *pic)
{
pic_value lib_opt;
pic_sym *name, *realname, *uid, *alias = NULL;
struct pic_lib *lib;
pic_get_args(pic, "om|m", &lib_opt, &name, &alias);
pic_assert_type(pic, lib_opt, lib);
if (alias == NULL) {
alias = name;
}
lib = pic_lib_ptr(lib_opt);
if (! pic_dict_has(pic, lib->exports, name)) {
pic_errorf(pic, "attempted to import undefined variable '~s'", pic_obj_value(name));
} else {
realname = pic_sym_ptr(pic_dict_ref(pic, lib->exports, name));
}
if ((uid = pic_find_variable(pic, lib->env, pic_obj_value(realname))) == NULL) {
pic_errorf(pic, "attempted to export undefined variable '~s'", pic_obj_value(realname));
} else {
pic_put_variable(pic, pic->lib->env, pic_obj_value(alias), uid);
}
return pic_undef_value();
}
static pic_value
pic_lib_library_export(pic_state *pic)
{
pic_sym *name, *alias = NULL;
pic_get_args(pic, "m|m", &name, &alias);
if (alias == NULL) {
alias = name;
}
pic_dict_set(pic, pic->lib->exports, alias, pic_obj_value(name));
return pic_undef_value();
}
static pic_value
pic_lib_library_exports(pic_state *pic)
{
pic_value lib, exports = pic_nil_value();
pic_sym *sym;
khiter_t it;
pic_get_args(pic, "o", &lib);
pic_assert_type(pic, lib, lib);
pic_dict_for_each (sym, pic_lib_ptr(lib)->exports, it) {
pic_push(pic, pic_obj_value(sym), exports);
}
return exports;
}
static pic_value
pic_lib_library_environment(pic_state *pic)
{
pic_value lib;
pic_get_args(pic, "o", &lib);
pic_assert_type(pic, lib, lib);
return pic_obj_value(pic_lib_ptr(lib)->env);
}
void
pic_init_lib(pic_state *pic)
{
pic_defun(pic, "make-library", pic_lib_make_library);
pic_defun(pic, "find-library", pic_lib_find_library);
pic_defun(pic, "library-exports", pic_lib_library_exports);
pic_defun(pic, "library-environment", pic_lib_library_environment);
pic_defun(pic, "current-library", pic_lib_current_library);
pic_defun(pic, "library-import", pic_lib_library_import);
pic_defun(pic, "library-export", pic_lib_library_export);
}
| ktakashi/picrin | extlib/benz/lib.c | C | mit | 4,713 | [
30522,
1013,
1008,
1008,
1008,
2156,
9385,
5060,
1999,
27263,
6657,
1012,
1044,
1008,
1013,
1001,
2421,
1000,
27263,
6657,
1012,
1044,
1000,
10763,
11675,
16437,
1035,
12398,
1035,
4372,
2615,
1006,
27263,
1035,
2110,
1008,
27263,
1010,
235... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
describe('dev-radiolist', function() {
beforeEach(function() {
browser().navigateTo(mainUrl);
});
it('should show radio options and submit new value', function() {
var s = '[ng-controller="DevRadiolistCtrl"] ';
expect(element(s+'a.normal ').text()).toMatch('status1');
element(s+'a.normal ').click();
expect(element(s+'a.normal ').css('display')).toBe('none');
expect(element(s+'form[editable-form="$form"]').count()).toBe(1);
expect(element(s+'form input[type="radio"]:visible:enabled').count()).toBe(2);
expect(using(s+'label:eq(0)').input('$parent.$parent.$data').val()).toBe('true');
expect(using(s+'label:eq(1)').input('$parent.$parent.$data').val()).toBe('false');
// select status2
using(s+'label:eq(1)').input('$parent.$parent.$data').select('false');
element(s+'form button[type="submit"]').click();
expect(element(s+'a.normal ').css('display')).not().toBe('none');
expect(element(s+'a.normal ').text()).toMatch('status2');
expect(element(s+'form').count()).toBe(0);
});
it('should show radio options and call on-change event', function() {
var s = '[ng-controller="DevRadiolistCtrl"] ';
expect(element(s+'a.nobuttons ').text()).toMatch('status1');
element(s+'a.nobuttons ').click();
expect(element(s+'a.nobuttons ').css('display')).toBe('none');
expect(element(s+'form[editable-form="$form"]').count()).toBe(1);
expect(element(s+'form input[type="radio"]:visible:enabled').count()).toBe(2);
expect(element(s+'form input[type="radio"]').attr('ng-change')).toBeDefined();
expect(using(s+'label:eq(0)').input('$parent.$parent.$data').val()).toBe('true');
expect(using(s+'label:eq(1)').input('$parent.$parent.$data').val()).toBe('false');
// select status2
using(s+'label:eq(1)').input('$parent.$parent.$data').select('false');
element(s).click();
expect(element(s+'a.nobuttons ').css('display')).not().toBe('none');
expect(element(s+'a.nobuttons ').text()).toMatch('status1');
expect(element(s+'form').count()).toBe(0);
});
}); | arielcr/angular-xeditable | docs/demos/dev-radiolist/test.js | JavaScript | mit | 2,080 | [
30522,
6235,
1006,
1005,
16475,
1011,
2557,
9863,
1005,
1010,
3853,
1006,
1007,
1063,
2077,
5243,
2818,
1006,
3853,
1006,
1007,
1063,
16602,
1006,
1007,
1012,
22149,
3406,
1006,
2364,
3126,
2140,
1007,
1025,
1065,
1007,
1025,
2009,
1006,
... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
using System;
using System.Linq;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Rendering;
using SolutionsUtilities.UI.WPF.Highlighting;
namespace Barings.Controls.WPF.CodeEditors.Highlighting
{
public class HighlightMatchingWords : DocumentColorizingTransformer
{
public string Word { private get; set; }
//public string Theme { get; set; }
public HighlightMatchingWords(string word = null)
{
Word = word ?? "testing";
}
private bool ValidateWord(int startOffset, int endOffset)
{
// Validate that a word at the given offset is equal ONLY to the current Word
var document = CurrentContext.Document;
// If the text before or after is at the beginning or end of the text, set it to a space to make it a stop character
var textBeforeOffset = startOffset - 1 < 0 ? " " : document.GetText(startOffset - 1, 1);
var textAfterOffset = endOffset + 1 > document.TextLength ? " " : document.GetText(endOffset, 1);
// Return the result of this expression
return AvalonEditExtensions.StopCharacters.Any(textBeforeOffset.Contains)
&& AvalonEditExtensions.StopCharacters.Any(textAfterOffset.Contains);
}
protected override void ColorizeLine(DocumentLine line)
{
if (string.IsNullOrEmpty(Word) || Word == Environment.NewLine) return;
int lineStartOffset = line.Offset;
string text = CurrentContext.Document.GetText(line);
int start = 0;
int index;
var backgroundBrush = new SolidColorBrush(Color.FromArgb(80, 124, 172, 255));
while ((index = text.IndexOf(Word, start, StringComparison.OrdinalIgnoreCase)) >= 0)
{
int startOffset = lineStartOffset + index;
int endOffset = lineStartOffset + index + Word.Length;
if (!ValidateWord(startOffset, endOffset))
{
start = index + 1;
continue;
}
ChangeLinePart(
startOffset, // startOffset
endOffset, // endOffset
element =>
{
// This lambda gets called once for every VisualLineElement
// between the specified offsets.
element.TextRunProperties.SetBackgroundBrush(backgroundBrush);
});
start = index + 1; // search for next occurrence
}
}
}
}
| Barings/Barings.Controls.WPF | Barings.Controls.WPF/CodeEditors/Highlighting/HighlightMatchingWords.cs | C# | mit | 2,681 | [
30522,
2478,
2291,
1025,
2478,
2291,
1012,
11409,
4160,
1025,
2478,
2291,
1012,
3645,
1012,
2865,
1025,
2478,
24582,
7377,
14536,
16044,
1012,
18973,
2098,
4183,
1012,
6254,
1025,
2478,
24582,
7377,
14536,
16044,
1012,
18973,
2098,
4183,
10... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* ------------------------------------------------------------------
* GEM - Graphics Environment for Multimedia
*
* Copyright (c) 2002-2011 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at
* zmoelnig@iem.kug.ac.at
* For information on usage and redistribution, and for a DISCLAIMER
* OF ALL WARRANTIES, see the file, "GEM.LICENSE.TERMS"
*
* this file has been generated...
* ------------------------------------------------------------------
*/
#ifndef _INCLUDE__GEM_OPENGL_GEMGLCLEARSTENCIL_H_
#define _INCLUDE__GEM_OPENGL_GEMGLCLEARSTENCIL_H_
#include "Base/GemGLBase.h"
/*
CLASS
GEMglClearStencil
KEYWORDS
openGL 0
DESCRIPTION
wrapper for the openGL-function
"glClearStencil( GLint s)"
*/
class GEM_EXTERN GEMglClearStencil : public GemGLBase
{
CPPEXTERN_HEADER(GEMglClearStencil, GemGLBase);
public:
// Constructor
GEMglClearStencil (t_float); // CON
protected:
// Destructor
virtual ~GEMglClearStencil ();
// Do the rendering
virtual void render (GemState *state);
// variables
GLint s; // VAR
virtual void sMess(t_float); // FUN
private:
// we need some inlets
t_inlet *m_inlet[1];
// static member functions
static void sMessCallback (void*, t_floatarg);
};
#endif // for header file
| rvega/morphasynth | vendors/pd-extended-0.43.4/externals/Gem/src/openGL/GEMglClearStencil.h | C | gpl-3.0 | 1,292 | [
30522,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Login Page - Photon Admin Panel Theme</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<link rel="shortcut icon" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/favicon.ico" />
<link rel="apple-touch-icon" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/iosicon.png" />
<!-- DEVELOPMENT LESS -->
<!-- <link rel="stylesheet/less" href="css/photon.less" media="all" />
<link rel="stylesheet/less" href="css/photon-responsive.less" media="all" />
--> <!-- PRODUCTION CSS -->
<link rel="stylesheet" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/css/css_compiled/photon-min.css?v1.1" media="all" />
<link rel="stylesheet" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/css/css_compiled/photon-min-part2.css?v1.1" media="all" />
<link rel="stylesheet" href="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/css/css_compiled/photon-responsive-min.css?v1.1" media="all" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/css_compiled/ie-only-min.css?v1.1" />
<![endif]-->
<!--[if lt IE 9]>
<link rel="stylesheet" type="text/css" href="css/css_compiled/ie8-only-min.css?v1.1" />
<script type="text/javascript" src="js/plugins/excanvas.js"></script>
<script type="text/javascript" src="js/plugins/html5shiv.js"></script>
<script type="text/javascript" src="js/plugins/respond.min.js"></script>
<script type="text/javascript" src="js/plugins/fixFontIcons.js"></script>
<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/modernizr.custom.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.pnotify.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/less-1.3.1.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/xbreadcrumbs.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.maskedinput-1.3.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.autotab-1.1b.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/charCount.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.textareaCounter.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/elrte.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/elrte.en.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/select2.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery-picklist.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.validate.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/additional-methods.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.form.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.metadata.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.mockjax.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.uniform.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.rating.pack.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/farbtastic.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.jstree.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.mousewheel.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.mCustomScrollbar.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.flot.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.flot.stack.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.flot.pie.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.flot.resize.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/raphael.2.1.0.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/justgage.1.0.1.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.qrcode.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.clock.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.countdown.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.jqtweet.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/jquery.cookie.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/bootstrap-fileupload.min.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/prettify/prettify.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/bootstrapSwitch.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/plugins/mfupload.js"></script>
<script type="text/javascript" src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/js/common.js"></script>
</head>
<body class="body-login">
<div class="nav-fixed-topright" style="visibility: hidden">
<ul class="nav nav-user-menu">
<li class="user-sub-menu-container">
<a href="javascript:;">
<i class="user-icon"></i><span class="nav-user-selection">Theme Options</span><i class="icon-menu-arrow"></i>
</a>
<ul class="nav user-sub-menu">
<li class="light">
<a href="javascript:;">
<i class='icon-photon stop'></i>Light Version
</a>
</li>
<li class="dark">
<a href="javascript:;">
<i class='icon-photon stop'></i>Dark Version
</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-photon mail"></i>
</a>
</li>
<li>
<a href="javascript:;">
<i class="icon-photon comment_alt2_stroke"></i>
<div class="notification-count">12</div>
</a>
</li>
</ul>
</div>
<script>
$(function(){
setTimeout(function(){
$('.nav-fixed-topright').removeAttr('style');
}, 300);
$(window).scroll(function(){
if($('.breadcrumb-container').length){
var scrollState = $(window).scrollTop();
if (scrollState > 0) $('.nav-fixed-topright').addClass('nav-released');
else $('.nav-fixed-topright').removeClass('nav-released')
}
});
$('.user-sub-menu-container').on('click', function(){
$(this).toggleClass('active-user-menu');
});
$('.user-sub-menu .light').on('click', function(){
if ($('body').is('.light-version')) return;
$('body').addClass('light-version');
setTimeout(function() {
$.cookie('themeColor', 'light', {
expires: 7,
path: '/'
});
}, 500);
});
$('.user-sub-menu .dark').on('click', function(){
if ($('body').is('.light-version')) {
$('body').removeClass('light-version');
$.cookie('themeColor', 'dark', {
expires: 7,
path: '/'
});
}
});
});
</script>
<div class="container-login">
<div class="form-centering-wrapper">
<div class="form-window-login">
<div class="form-window-login-logo">
<div class="login-logo">
<img src="http://photonui.orangehilldev.com/css/css_compiled/@%7BphotonImagePath%7Dplugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/images/photon/login-logo@2x.png" alt="Photon UI"/>
</div>
<h2 class="login-title">Welcome to Photon UI!</h2>
<div class="login-member">Not a Member? <a href="jquery.tagsinput.min.js.html#">Sign Up »</a>
<a href="jquery.tagsinput.min.js.html#" class="btn btn-facebook"><i class="icon-fb"></i>Login with Facebook<i class="icon-fb-arrow"></i></a>
</div>
<div class="login-or">Or</div>
<div class="login-input-area">
<form method="POST" action="dashboard.php">
<span class="help-block">Login With Your Photon Account</span>
<input type="text" name="email" placeholder="Email">
<input type="password" name="password" placeholder="Password">
<button type="submit" class="btn btn-large btn-success btn-login">Login</button>
</form>
<a href="jquery.tagsinput.min.js.html#" class="forgot-pass">Forgot Your Password?</a>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1936460-27']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
| user-tony/photon-rails | lib/assets/css/css_compiled/@{photonImagePath}plugins/elrte/css/css_compiled/js/bootstrap/css/css_compiled/js/plugins/jquery.tagsinput.min.js.html | HTML | mit | 17,015 | [
30522,
1026,
999,
9986,
13874,
16129,
1028,
1026,
16129,
11374,
1027,
1000,
4372,
1000,
1028,
1026,
2132,
1028,
1026,
18804,
25869,
13462,
1027,
1000,
21183,
2546,
1011,
1022,
1000,
1028,
1026,
2516,
1028,
8833,
2378,
3931,
1011,
26383,
474... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
/* -----------------------------------------------------------------------------
*
* (c) The GHC Team, 2001
* Author: Sungwoo Park
*
* Retainer profiling interface.
*
* ---------------------------------------------------------------------------*/
#ifndef RETAINERPROFILE_H
#define RETAINERPROFILE_H
#ifdef PROFILING
#include "RetainerSet.h"
#include "BeginPrivate.h"
void initRetainerProfiling ( void );
void endRetainerProfiling ( void );
void retainerProfile ( void );
void resetStaticObjectForRetainerProfiling( StgClosure *static_objects );
// flip is either 1 or 0, changed at the beginning of retainerProfile()
// It is used to tell whether a retainer set has been touched so far
// during this pass.
extern StgWord flip;
// extract the retainer set field from c
#define RSET(c) ((c)->header.prof.hp.rs)
#define isRetainerSetFieldValid(c) \
((((StgWord)(c)->header.prof.hp.rs & 1) ^ flip) == 0)
static inline RetainerSet *
retainerSetOf( StgClosure *c )
{
ASSERT( isRetainerSetFieldValid(c) );
// StgWord has the same size as pointers, so the following type
// casting is okay.
return (RetainerSet *)((StgWord)RSET(c) ^ flip);
}
// Used by Storage.c:memInventory()
#ifdef DEBUG
extern W_ retainerStackBlocks ( void );
#endif
#include "EndPrivate.h"
#endif /* PROFILING */
#endif /* RETAINERPROFILE_H */
// Local Variables:
// mode: C
// fill-column: 80
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// End:
| lukexi/ghc | rts/RetainerProfile.h | C | bsd-3-clause | 1,502 | [
30522,
1013,
1008,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
1011,
101... | [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0... | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1... | [
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.