text stringlengths 2 1.04M | meta dict |
|---|---|
using System;
using Reusable.MarkupBuilder;
using Reusable.MarkupBuilder.Html;
using Reusable.OmniLog.Abstractions;
namespace Reusable.OmniLog
{
public static class ConsoleLoggerExtensions
{
public static ILogger Write(this ILogger logger, Func<HtmlElement, HtmlElement> paragraphAction)
{
var html = paragraphAction(HtmlElement.Builder.span()).ToHtml(HtmlFormatting.Empty);
return logger.Log(LogLevel.Information, log => log.With(ColoredConsoleRx.TemplatePropertyName, html));
}
public static ILogger WriteLine(this ILogger logger, Func<HtmlElement, HtmlElement> paragraphAction)
{
var html = paragraphAction(HtmlElement.Builder.p()).ToHtml(HtmlFormatting.Empty);
return logger.Log(LogLevel.Information, log => log.With(ColoredConsoleRx.TemplatePropertyName, html));
}
}
} | {
"content_hash": "9116793bf80a5e344c916bbb034cd2cd",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 114,
"avg_line_length": 37.541666666666664,
"alnum_prop": 0.7036625971143174,
"repo_name": "he-dev/Reusable",
"id": "0a952c4a8160f1c0e968e9176d116e05f1077acb",
"size": "903",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Reusable.OmniLog.ColoredConsoleRx/src/ConsoleLoggerExtensions.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "1047239"
},
{
"name": "CSS",
"bytes": "588"
},
{
"name": "HTML",
"bytes": "1757"
}
],
"symlink_target": ""
} |
""" Rally OVS command: deployment """
from __future__ import print_function
import json
import os
import sys
import jsonschema
from six.moves.urllib import parse
import yaml
from rally import api
from rally.cli import cliutils
from rally.cli import envutils
from rally.common import fileutils
from rally.common.i18n import _
from rally.common import utils
from rally.common import db
from rally.common import objects
from rally import exceptions
from rally_ovs import plugins
class DeploymentCommands(object):
"""Set of commands that allow you to manage ovs deployments."""
@cliutils.args("--name", type=str, required=True,
help="A name of the ovs deployment.")
@cliutils.args("--filename", type=str, required=True, metavar="<path>",
help="A path to the configuration file of the ovs deployment.")
@cliutils.args("--no-use", action="store_false", dest="do_use",
help="Don't set new deployment as default for"
" future operations.")
@plugins.ensure_plugins_are_loaded
def create(self, name, filename, do_use=False):
"""Create new deployment.
This command will create a new deployment record in rally ovs
database.
"""
filename = os.path.expanduser(filename)
print("file:" + filename)
with open(filename, "rb") as deploy_file:
config = yaml.safe_load(deploy_file.read())
try:
deployment = api.Deployment.create(config, name)
except jsonschema.ValidationError:
print(_("Config schema validation error: %s.") % sys.exc_info()[1])
return(1)
except exceptions.DeploymentNameExists:
print(_("Error: %s") % sys.exc_info()[1])
return(1)
self.list(deployment_list=[deployment])
if do_use:
self.use(deployment["uuid"])
@cliutils.args("--deployment", dest="deployment", type=str,
metavar="<uuid>", required=False,
help="UUID or name of the deployment.")
@envutils.with_default_deployment()
@plugins.ensure_plugins_are_loaded
def recreate(self, deployment=None):
"""Destroy and create an existing deployment.
Unlike 'deployment destroy', the deployment database record
will not be deleted, so the deployment UUID stays the same.
:param deployment: UUID or name of the deployment
"""
api.Deployment.recreate(deployment)
@cliutils.args("--deployment", dest="deployment", type=str,
metavar="<uuid>", required=False,
help="UUID or name of the deployment.")
@envutils.with_default_deployment()
@plugins.ensure_plugins_are_loaded
def destroy(self, deployment=None):
"""Destroy existing deployment.
This will delete all ovs sandboxes created during Rally deployment
creation. Also it will remove the deployment record from the
Rally database.
:param deployment: UUID or name of the deployment
"""
dep = objects.Deployment.get(deployment)
tasks = db.task_list(deployment=dep["uuid"])
for task in tasks:
api.Task.delete(task["uuid"], True)
api.Deployment.destroy(deployment)
def list(self, deployment_list=None):
"""List existing deployments."""
headers = ["uuid", "created_at", "name", "status", "active"]
current_deployment = envutils.get_global("RALLY_DEPLOYMENT")
deployment_list = deployment_list or api.Deployment.list()
table_rows = []
if deployment_list:
for t in deployment_list:
r = [str(t[column]) for column in headers[:-1]]
r.append("" if t["uuid"] != current_deployment else "*")
table_rows.append(utils.Struct(**dict(zip(headers, r))))
cliutils.print_list(table_rows, headers,
sortby_index=headers.index("created_at"))
else:
print(_("There are no deployments. "
"To create a new deployment, use:"
"\nrally deployment create"))
@cliutils.args("--deployment", dest="deployment", type=str,
metavar="<uuid>", required=False,
help="UUID or name of the deployment.")
@envutils.with_default_deployment()
@cliutils.suppress_warnings
def config(self, deployment=None):
"""Display configuration of the deployment.
Output is the configuration of the deployment in a
pretty-printed JSON format.
:param deployment: UUID or name of the deployment
"""
deploy = api.Deployment.get(deployment)
result = deploy["config"]
print(json.dumps(result, sort_keys=True, indent=4))
@cliutils.args("--deployment", dest="deployment", type=str,
metavar="<uuid>", required=False,
help="UUID or name of a deployment.")
def use(self, deployment):
"""Set active deployment.
:param deployment: UUID or name of the deployment
"""
try:
deployment = api.Deployment.get(deployment)
print("Using deployment: %s" % deployment["uuid"])
fileutils.update_globals_file("RALLY_DEPLOYMENT",
deployment["uuid"])
except exceptions.DeploymentNotFound:
print("Deployment %s is not found." % deployment)
return 1
| {
"content_hash": "9eeecc96e7fe27a82c26caa6db587015",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 79,
"avg_line_length": 33.203592814371255,
"alnum_prop": 0.6077547339945897,
"repo_name": "sivakom/ovn-scale-test",
"id": "721a8c4c02d3440e95c8d9e45f42f632b45798bd",
"size": "6118",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "rally_ovs/cli/commands/deployment.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Makefile",
"bytes": "1037"
},
{
"name": "Python",
"bytes": "93588"
},
{
"name": "Shell",
"bytes": "80179"
}
],
"symlink_target": ""
} |
package goncalves.com.readinglist.Fragment;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import com.google.inject.Inject;
import java.util.List;
import goncalves.com.readinglist.Activities.BookAddActivity;
import goncalves.com.readinglist.Entities.Abstract.TransientBook;
import goncalves.com.readinglist.GeneralClasses.NotificationPreseter.Abstract.NotificationPresenter;
import goncalves.com.readinglist.GeneralClasses.ProgressPresenter.Abstract.ProgressPresenter;
import goncalves.com.readinglist.R;
import goncalves.com.readinglist.Server.Proxy.Abstract.ServiceProxy;
import goncalves.com.readinglist.Server.Requests.Concrete.SearchBooksRequest;
import goncalves.com.readinglist.Server.Response.ServiceResponse;
import goncalves.com.readinglist.ViewAdapters.Concrete.TransientBookListView;
import goncalves.com.readinglist.ViewAdapters.Delegates.TransientBookListViewDelegate;
import roboguice.fragment.RoboFragment;
import roboguice.inject.InjectView;
public class RecommendedBooksFragment extends RoboFragment implements TransientBookListViewDelegate, TextView.OnEditorActionListener {
//region UI
@InjectView(R.id.searchTextField) EditText searchEditText;
@InjectView(R.id.searchBookListView) TransientBookListView searchBookListView;
//endregion
//region Properties
@Inject ServiceProxy serviceProxy;
@Inject NotificationPresenter notificationPresenter;
@Inject ProgressPresenter progressPresenter;
//endregion
//region Lifecycle
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_recommended_books, container, false);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
}
@Override
public void onResume() {
super.onResume();
searchBookListView.setDelegate(this);
searchEditText.setOnEditorActionListener(this);
}
//endregion
//region Service
private void callService() {
SearchBooksRequest request = new SearchBooksRequest(searchEditText.getText().toString());
progressPresenter.showProgress("Searching...", getActivity());
serviceProxy.callServiceWithRequest(request, new ServiceResponse() {
public void onSuccess(Object data) {
progressPresenter.stop();
SearchBooksRequest request = new SearchBooksRequest(searchEditText.getText().toString());
List<TransientBook> transientBookList = (List<TransientBook>) data;
searchBookListView.setBooks(transientBookList);
}
public void onFailure(String errorMessage) {
notificationPresenter.showError(errorMessage, getActivity().getApplicationContext(), getActivity());
progressPresenter.stop();
}
});
}
//endregion
//region Delegates
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
if (v.getText().length() > 1) {
callService();
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
}
return true;
}
@Override
public void transientListViewWantsToAddTransientBook(TransientBook transientBook) {
Intent intent = new Intent(getActivity(), BookAddActivity.class);
intent.putExtra(BookAddActivity.TRANSIENT_BOOK_ADD_ID, transientBook);
getActivity().startActivity(intent);
}
//endregion
}
| {
"content_hash": "15d3fbf243b5247337e0717556ebbafb",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 134,
"avg_line_length": 38.440366972477065,
"alnum_prop": 0.7393794749403342,
"repo_name": "rafagonc/Reading-List-Android",
"id": "0856f8307459e84a63e0b7b802525f7eacadfee9",
"size": "4190",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/src/main/java/goncalves/com/readinglist/Fragment/RecommendedBooksFragment.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "105482"
}
],
"symlink_target": ""
} |
<?php
namespace Frontend\CumpleaniosBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class CumpleaniosExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
}
| {
"content_hash": "57ffc1fda7bd5393d5f4b56dc02cc029",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 105,
"avg_line_length": 31.75,
"alnum_prop": 0.7300337457817773,
"repo_name": "valeraovalles/sait",
"id": "52499f1e8d69676dfa5733b2ebdedddb490e84ca",
"size": "889",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Frontend/CumpleaniosBundle/DependencyInjection/CumpleaniosExtension.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "270692"
},
{
"name": "Erlang",
"bytes": "4333"
},
{
"name": "Java",
"bytes": "65391"
},
{
"name": "JavaScript",
"bytes": "1449856"
},
{
"name": "PHP",
"bytes": "6514811"
},
{
"name": "Perl",
"bytes": "41836"
},
{
"name": "Shell",
"bytes": "5701"
}
],
"symlink_target": ""
} |
from wtforms.fields import TextAreaField
from wtforms.fields.html5 import URLField
from wtforms.validators import URL, Optional
from indico.util.i18n import _
from indico.web.forms.base import IndicoForm
from indico.web.forms.widgets import CKEditorWidget
class LegalMessagesForm(IndicoForm):
network_protected_disclaimer = TextAreaField(_("Network-protected information disclaimer"), widget=CKEditorWidget())
restricted_disclaimer = TextAreaField(_("Restricted information disclaimer"), widget=CKEditorWidget())
tos_url = URLField(_('URL'), [Optional(), URL()],
description=_("The URL to an external page with terms and conditions"))
tos = TextAreaField(_("Text"), widget=CKEditorWidget(),
description=_('Only used if no URL is provided'))
privacy_policy_url = URLField(_('URL'), [Optional(), URL()],
description=_("The URL to an external page with the privacy policy"))
privacy_policy = TextAreaField(_("Text"), widget=CKEditorWidget(),
description=_('Only used if no URL is provided'))
| {
"content_hash": "62d05454de0680c1136d4e4efd7efc6a",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 120,
"avg_line_length": 56.6,
"alnum_prop": 0.6757950530035336,
"repo_name": "pferreir/indico",
"id": "e610f50459113a2c8fc4346dfc123b142778148e",
"size": "1346",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "indico/modules/legal/forms.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "34704"
},
{
"name": "HTML",
"bytes": "1394116"
},
{
"name": "JavaScript",
"bytes": "2078347"
},
{
"name": "Mako",
"bytes": "1527"
},
{
"name": "Python",
"bytes": "4993798"
},
{
"name": "SCSS",
"bytes": "475126"
},
{
"name": "Shell",
"bytes": "3877"
},
{
"name": "TeX",
"bytes": "23327"
},
{
"name": "XSLT",
"bytes": "1504"
}
],
"symlink_target": ""
} |
namespace AbpCompanyName.AbpProjectName.Migrations
{
using System.CodeDom.Compiler;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
[GeneratedCode("EntityFramework.Migrations", "6.1.3-40302")]
public sealed partial class AbpZero_Initial : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(AbpZero_Initial));
string IMigrationMetadata.Id
{
get { return "201701271145151_AbpZero_Initial"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
| {
"content_hash": "a55b38c835fb00ba8ae05eceee1abffb",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 98,
"avg_line_length": 29.428571428571427,
"alnum_prop": 0.6286407766990292,
"repo_name": "s-takatsu/module-zero-template",
"id": "8a64dcd8bea05ef7b60256f633ca7f0f34a4be29",
"size": "846",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/AbpCompanyName.AbpProjectName.EntityFramework/Migrations/201701271145151_AbpZero_Initial.Designer.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ASP",
"bytes": "261"
},
{
"name": "Batchfile",
"bytes": "412"
},
{
"name": "C#",
"bytes": "271213"
},
{
"name": "CSS",
"bytes": "197495"
},
{
"name": "HTML",
"bytes": "1456"
},
{
"name": "JavaScript",
"bytes": "1654086"
}
],
"symlink_target": ""
} |
#pragma once
#include "GeomExport.h"
#include "maxheap.h"
#include <wtypes.h>
#include <limits.h>
#include "maxtypes.h"
#include "assert1.h"
// forward declarations
class ILoad;
class ISave;
/*! \sa Class BitArray.\n\n
\par Description:
This class is available in release 3.0 and later only.\n\n
This is the callback object for the method <b>BitArray::EnumSet()</b>. The proc
method is called for each "1" in the BitArray. */
class BitArrayCallback: public MaxHeapOperators
{
public:
/*! \remarks This method is called for each "1" in the BitArray.
\par Parameters:
<b>int n</b>\n\n
This is the zero based index into the BitArray of the element which is "1".
*/
virtual void proc(int n)=0;
};
// Direction indicators for BitArray::Rotate and BitArray::Shift
enum
{
LEFT_BITSHIFT = 0,
RIGHT_BITSHIFT = 1,
};
// Generate statistics on bitarrays created. Requires a complete rebuild to toggle
// on and off.
// #define DL_BITARRAY_STATS
/*! \sa Template Class Tab, Class BitArrayCallback.\n\n
\par Description:
This class allows the developer to define a set of bit flags that may be
treated as a virtual array and are stored in an efficient manner. The class has
methods to set, clear and return the i-th bit, resize the BitArray, etc. All
methods are implemented by the system. */
class BitArray: public MaxHeapOperators {
enum
{
kMAX_LOCALBITS = CHAR_BIT * sizeof(DWORD_PTR),
};
union
{
// numBits cannot be put into a DWORD_PTR so memory had to be allocated.
DWORD_PTR* bits;
// bits fit into a DWORD_PTR object; no memory allocation needed.
DWORD_PTR localBits;
};
long numBits;
public:
class NumberSetProxy : public MaxHeapOperators
{
public:
inline operator bool() const // if( array.NumberSet() )
{
return !mArray.IsEmpty();
}
inline bool operator !() const // if( !array.NumberSet() )
{
return mArray.IsEmpty();
}
inline operator int() const // int n = array.NumberSet();
{
return mArray.NumberSetImpl();
}
inline operator DWORD_PTR() const
{
return mArray.NumberSetImpl();
}
inline operator float() const
{
return (float)mArray.NumberSetImpl();
}
#ifdef WIN64
inline operator DWORD() const
{
return mArray.NumberSetImpl();
}
#endif
inline bool operator <(int n) const // if( array.NumberSet() < 3 )
{
// if( NumberSet() < 0 ) or a negative, always returns false.
// if( NumberSet() < 1 ), basically mean "IsEmpty()".
// if( NumberSet() < n ), we use !(NumberSet() >= n)
return (n <= 0) ? false : ((n == 1) ? mArray.IsEmpty() : !mArray.NumberSetAtLeastImpl(n));
}
inline bool operator <=(int n) const // if( array.NumberSet() <= 3 )
{
// if( x <= n ) ==> if( !(x >= (n+1)) )
return !mArray.NumberSetAtLeastImpl(n+1);
}
inline bool operator >(int n) const // if( array.NumberSet() > 3 )
{
// if( x > 0 ) ==> !IsEmpty()
// if( x > n ) ==> if( x >= (n+1) )
return n ? mArray.NumberSetAtLeastImpl(n+1) : !mArray.IsEmpty();
}
inline bool operator >=(int n) const // if( array.NumberSet() >= 3 )
{
return mArray.NumberSetAtLeastImpl(n);
}
inline bool operator ==(int n) const // if( array.NumberSet() == 3 )
{
return mArray.NumberSetEqualImpl(n);
}
inline bool operator !=(int n) const // if( array.NumberSet() != 3 )
{
return !mArray.NumberSetEqualImpl(n);
}
inline int operator +(int n) const // int n = array.NumberSet() + 3;
{
return mArray.NumberSetImpl() + n;
}
inline int operator -(int n) const // int n = array.NumberSet() + 3;
{
return mArray.NumberSetImpl() - n;
}
inline int operator *(int n) const // int n = array.NumberSet() * 3;
{
return mArray.NumberSetImpl() * n;
}
inline int operator /(int n) const // int n = array.NumberSet() / 3;
{
return mArray.NumberSetImpl() / n;
}
inline int operator %(int n) const // int n = array.NumberSet() % 3;
{
return mArray.NumberSetImpl() % n;
}
inline int operator +(const NumberSetProxy& proxy) const
{
return mArray.NumberSetImpl() + int(proxy);
}
inline int operator -(const NumberSetProxy& proxy) const
{
return mArray.NumberSetImpl() - int(proxy);
}
inline int operator *(const NumberSetProxy& proxy) const
{
return mArray.NumberSetImpl() * int(proxy);
}
private:
const BitArray& mArray;
friend class BitArray;
// Can only be created by the BitArray itself.
inline NumberSetProxy(const BitArray& a) : mArray(a) {}
NumberSetProxy& operator = (const NumberSetProxy& rhs);
};
friend class NumberSetProxy;
public:
/*! \remarks Default constructor. Sets the number of bits to 0. */
inline BitArray() { bits = NULL; numBits = 0; BitArrayAllocated(); }
/*! \remarks Constructor.
\par Parameters:
<b>int i</b>\n\n
The size of the BitArray in bits. */
inline BitArray(int n)
{
DbgAssert( n >= 0 );
if (n < 0)
{
n = 0;
}
if( UseLocalBits(n) )
{
numBits = n;
localBits = 0;
BitArrayAllocated();
}
else
{
CreateBitArrayImpl(n);
}
}
/*! \remarks Constructor. Duplicates the BitArray passed.
\par Parameters:
<b>const BitArray\& b</b>\n\n
The BitArray to duplicate. */
inline BitArray(const BitArray& b)
{
if( b.UseLocalBits() )
{
localBits = b.localBits;
numBits = b.numBits;
BitArrayAllocated();
}
else
{
SetBitsFromImpl(b);
}
}
inline ~BitArray()
{
if( !UseLocalBits() )
FreeBitsImpl();
else
BitArrayDeallocated();
}
/*! \remarks Sets the number of bits used.
\param n - The number of bits in to be in the array. If this value is a negative number, or
equal to the current size of the BitArray then nothing will happen.
\param save=0 - If passed as 1, the old bit values will be preserved when the array is resized. */
GEOMEXPORT void SetSize(int n, int save=0); // save=1:preserve old bit values
/*! \remarks Returns the size of the bit array in bits. */
inline int GetSize() const { return numBits; }
/*! \remarks Clears all the bits in the array (sets them to 0). */
inline void ClearAll()
{
UseLocalBits() ? localBits = 0 : ClearAllImpl();
}
/*! \remarks Sets all the bits in the array to 1. */
inline void SetAll() // Only set used bits; leave the others at zero.
{
UseLocalBits() ? localBits = BitMask(numBits) - 1 : SetAllImpl();
}
/*! \remarks Set the i-th bit to 1.
\param i - The array index of the bit to set. */
inline void Set(int i)
{
DbgAssert(i>-1 && i<numBits);
if ((i > -1) && (i < numBits))
{
UseLocalBits() ? localBits |= BitMask(i) : SetImpl(i);
}
}
/*! \remarks Sets the i-th bit to 0.
\par Parameters:
<b>int i</b>\n\n
The array index of the bit to clear. */
inline void Clear(int i)
{
DbgAssert(i>-1 && i<numBits);
if ((i > -1) && (i < numBits))
{
UseLocalBits() ? localBits &= ~BitMask(i) : ClearImpl(i);
}
}
/*! \remarks Set the i-th bit to b.
\param i - The index of the bit to set.
\param b - The value to set, either 1 or 0. */
inline void Set(int i, int b) { b ? Set(i) : Clear(i); }
/*! \remarks Gets the i-th bit.
\param i - The index of the bit. If the index is a negative or bigger than the array size, it returns 0 */
inline int operator[](int i) const
{
DbgAssert (i>-1);
DbgAssert (i<numBits);
if ((i > -1) && (i < numBits))
return UseLocalBits() ? (localBits & BitMask(i) ? 1 : 0) : GetNthBitImpl(i);
else
return 0;
}
/*! \remarks Returns true if no bits are set; otherwise false. This method is much faster
than checking if <b>NumberSet()</b> returns 0. */
inline bool IsEmpty() const { return UseLocalBits() ? !localBits : IsEmptyImpl(); }
inline bool AnyBitSet() const { return !IsEmpty(); }
/*! \remarks how many bits are 1's? use IsEmpty() for faster checks
\return Returns a proxy object which can optimize client code depending on the type
of access required (ie: != 0 would call IsEmpty(), etc)*/
inline NumberSetProxy NumberSet() const
{
return NumberSetProxy(*this);
}
/*! \remarks This is not currently implemented and is reserved for
future use. */
GEOMEXPORT void Compress();
/*! \remarks This is not currently implemented and is reserved for
future use. */
GEOMEXPORT void Expand();
/*! \remarks Reverses the bits in the BitArray.
\par Parameters:
<b>BOOL keepZero = FALSE</b>\n\n
If TRUE the zero bit is kept where it is. */
GEOMEXPORT void Reverse(BOOL keepZero = FALSE); // keepZero=TRUE keeps zero bit where it is
/*! \remarks Rotates the bits in the BitArray (with wraparound).
\par Parameters:
<b>int direction</b>\n\n
The direction to rotate.\n\n
<b>int count</b>\n\n
The number of bits to rotate. */
GEOMEXPORT void Rotate(int direction, int count); // With wraparound
/*! \remarks Shifts the bits in the BitArray (without wraparound).
\par Parameters:
<b>int direction</b>\n\n
One of the following values:\n\n
<b>LEFT_BITSHIFT</b>\n\n
<b>RIGHT_BITSHIFT</b>\n\n
<b>int count</b>\n\n
The number of bits to shift.\n\n
<b>int where=0</b>\n\n
This indicates where the shift will begin. For example, if you have a
<b>BitArray</b> containing: <b>10101010</b>\n\n
and you <b>Shift(LEFT_BITSHIFT, 1, 4)</b> you'll get: <b>10100100</b>\n\n
All the bits from 4 to 8 are shifted one bit left, with zeroes shifted in
from the right. The first bit affected is the <b>where</b> bit. If you
leave off the <b>where</b> parameter you'd get the usual:
<b>01010100</b>\n\n
The <b>RIGHT_BITSHIFT</b> starts at that bit; it is unaffected because
the operation proceeds to the right: <b>10101010</b>.\n\n
<b>Shift(RIGHT_BITSHIFT, 1, 4)</b> results in: <b>10101101</b>. */
GEOMEXPORT void Shift(int direction, int count, int where=0); // Without wraparound
/*! \remarks This method is used to enumerate all the elements that have a "1" value,
and call the callback <b>proc()</b> with the index of the element.
\par Parameters:
<b>BitArrayCallback \&cb</b>\n\n
The callback object whose <b>proc()</b> method is called. */
GEOMEXPORT void EnumSet(BitArrayCallback &cb); // enumerates elements that are 1's
/*! \remarks This method allows you to delete a selection of elements from this
BitArray. This is useful, for instance, if you're deleting a set of
vertices from a mesh and wish to keep the vertSel and vertHide arrays up
to date.
\par Parameters:
<b>BitArray \& dset</b>\n\n
This is a bit array which represents which elements should be deleted.
Typically (if mult==1) dset will have the same size as (this).\n\n
<b>int mult=1</b>\n\n
This is a multiplier which indicates how many elements in (*this) are
deleted for each entry in dset. For instance, when deleting faces in a
mesh, you also need to delete the corresponding edge selection data.
Since edgeSel[f*3], edgeSel[f*3+1], and edgeSel[f*3+2] correspond to face
f, you'd use mult=3:\n\n
<b>faceSel.DeleteSet (fdel);</b>\n\n
<b>edgeSel.DeleteSet (fdel, 3);</b> */
GEOMEXPORT void DeleteSet (BitArray & dset, int mult=1);
/*! \remarks Saves the BitArray to the 3ds Max file. */
GEOMEXPORT IOResult Save(ISave* isave);
/*! \remarks Loads the BitArray from the 3ds Max file.
\par Operators:
*/
GEOMEXPORT IOResult Load(ILoad* iload);
/*! \remarks This operator is available in release 3.0 and later only.\n\n
Comparison operator.
\par Parameters:
<b>const BitArray\& b</b>\n\n
The BitArray to compare with this one.
\return true if the BitArrays are 'equal' (same size and same bits set);
otherwise false. */
inline bool operator==(const BitArray& b) const
{
return (numBits == b.numBits) && (UseLocalBits() ? (localBits == b.localBits) : CompareBitsImpl(b));
}
// Assignment operators
/*! \remarks Assignment operator. */
GEOMEXPORT BitArray& operator=(const BitArray& b);
// Assignment operators: These require arrays of the same size!
/*! \remarks AND= this BitArray with the specified BitArray. */
GEOMEXPORT BitArray& operator&=(const BitArray& b); // AND=
/*! \remarks OR= this BitArray with the specified BitArray. */
GEOMEXPORT BitArray& operator|=(const BitArray& b); // OR=
/*! \remarks XOR= this BitArray with the specified BitArray. */
GEOMEXPORT BitArray& operator^=(const BitArray& b); // XOR=
// Binary operators: These require arrays of the same size!
/*! \remarks AND two BitArrays */
GEOMEXPORT BitArray operator&(const BitArray&) const; // AND
/*! \remarks OR two BitArrays */
GEOMEXPORT BitArray operator|(const BitArray&) const; // OR
/*! \remarks XOR two BitArrays */
GEOMEXPORT BitArray operator^(const BitArray&) const; // XOR
// Unary operators
/*! \remarks Unary NOT function */
inline BitArray operator~() const
{
return UseLocalBits() ? BitArray(~localBits, numBits, true) : OperatorNotImpl();
}
//! \brief Swap the contents of two bitarrays.
/*! This is an efficient way of transfering the contents of a temporary bitarray
object into a more permanent instance, such as a data member. For instance:
\code
{
BitArray tmp(size);
// do something with tmp...
m_MyBitArray.Swap(tmp);
}
\endcode
would be more efficient than using operator= in this case.
\param[in, out] other The contents of 'other' will be swaped with the contents of 'this' */
GEOMEXPORT void Swap(BitArray& other);
private:
inline BitArray(DWORD_PTR localBits_, long numBits_, bool zeroHighBits = false) :
localBits(localBits_), numBits(numBits_)
{
DbgAssert( UseLocalBits() );
if( zeroHighBits )
ZeroUnusedBitsImpl();
BitArrayAllocated();
}
inline bool UseLocalBits() const { return numBits <= kMAX_LOCALBITS; }
inline bool UseLocalBits(int n) const { return n <= kMAX_LOCALBITS; }
inline DWORD_PTR BitMask(int i) const
// NOTE: Shifting by kMAX_LOCALBITS will give an undefined behavior; the
// chip actually limits the shift from 0 to kMAX_LOCALBITS-1, so most likely
// you simply return '1' when what you wanted was zero.
{ return (i < kMAX_LOCALBITS) ? (DWORD_PTR(1) << i) : DWORD_PTR(0); }
// Used internally to treat the bit array the same way whether it's new'ed or
// simply local.
inline const DWORD_PTR* GetBitPtr() const
{
return UseLocalBits() ? &localBits : bits;
}
inline DWORD_PTR* GetBitPtr()
{
return UseLocalBits() ? &localBits : bits;
}
// Called from the ctor only; initializes an array filled with zeroes.
GEOMEXPORT void CreateBitArrayImpl(int n);
// Called from the ctor only; initializes from an array of bits.
GEOMEXPORT void SetBitsFromImpl(const BitArray&);
GEOMEXPORT void ClearAllImpl();
GEOMEXPORT void SetAllImpl();
GEOMEXPORT void SetImpl(int i);
GEOMEXPORT void ClearImpl(int i);
GEOMEXPORT void SetImpl(int i, int b);
GEOMEXPORT int GetNthBitImpl(int i) const;
GEOMEXPORT int NumberSetImpl() const;
GEOMEXPORT bool IsEmptyImpl() const;
GEOMEXPORT BitArray OperatorNotImpl() const;
GEOMEXPORT bool CompareBitsImpl(const BitArray&) const;
GEOMEXPORT void FreeBitsImpl();
#ifndef DL_BITARRAY_STATS
inline void BitArrayAllocated() {}
inline void BitArrayDeallocated() {}
#else
class BitArrayStats;
friend class BitArrayStats;
GEOMEXPORT void BitArrayAllocated();
GEOMEXPORT void BitArrayDeallocated();
#endif
GEOMEXPORT bool NumberSetImpl(int n) const; // Exhaustive count; can be dead slow
GEOMEXPORT bool NumberSetEqualImpl(int n) const; // Stops as soon as count will be higher
GEOMEXPORT bool NumberSetAtLeastImpl(int n) const; // Stops as soon as count reaches limit.
// Zeroes out bits over numBits so we can always use fast comparisons (memcmp,
// ==, etc) without having to mask out the last chunk.
GEOMEXPORT void ZeroUnusedBitsImpl();
};
// Help the compiler out when the array.NumberSet is on the right-hand of the equation
template <typename T> inline T operator +(T n, const BitArray::NumberSetProxy& proxy)
{
return n + proxy.operator int();
}
template <typename T> inline T operator -(T n, const BitArray::NumberSetProxy& proxy)
{
return n - proxy.operator int();
}
template <typename T> inline T operator *(T n, const BitArray::NumberSetProxy& proxy)
{
return proxy.operator *(n);
}
template <typename T> inline T operator /(T n, const BitArray::NumberSetProxy& proxy)
{
return n / proxy.operator int();
}
template <typename T> inline T operator %(T n, const BitArray::NumberSetProxy& proxy)
{
return n % proxy.operator int();
}
template <typename T> inline bool operator <=(T n, const BitArray::NumberSetProxy& proxy)
{
return proxy.operator >=(n);
}
template <typename T> inline bool operator <(T n, const BitArray::NumberSetProxy& proxy)
{
return proxy.operator >(n);
}
template <typename T> inline bool operator >(T n, const BitArray::NumberSetProxy& proxy)
{
return proxy.operator <(n);
}
template <typename T> inline bool operator >=(T n, const BitArray::NumberSetProxy& proxy)
{
return proxy.operator <=(n);
}
template <typename T> inline bool operator ==(T n, const BitArray::NumberSetProxy& proxy)
{
return proxy.operator ==(n);
}
template <typename T> inline bool operator !=(T n, const BitArray::NumberSetProxy& proxy)
{
return proxy.operator !=(n);
}
template <typename T> inline void operator +=(T& n, const BitArray::NumberSetProxy& proxy)
{
n += proxy.operator int();
}
template <typename T> inline void operator -=(T& n, const BitArray::NumberSetProxy& proxy)
{
n -= proxy.operator int();
}
| {
"content_hash": "38a57647b86121719b9b5cf2b109a5cd",
"timestamp": "",
"source": "github",
"line_count": 577,
"max_line_length": 107,
"avg_line_length": 30.043327556325824,
"alnum_prop": 0.6824343813094895,
"repo_name": "LiangYue1981816/CrossEngine",
"id": "20b46e598f665f5e9d7c604e19e28922c30cbdfb",
"size": "17592",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Tools/MaxExporter/MaxSDKs/2012/include/bitarray.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "30761"
},
{
"name": "C",
"bytes": "84933432"
},
{
"name": "C++",
"bytes": "92458842"
},
{
"name": "CMake",
"bytes": "10937"
},
{
"name": "Cuda",
"bytes": "319314"
},
{
"name": "GLSL",
"bytes": "108168"
},
{
"name": "HTML",
"bytes": "174058"
},
{
"name": "Java",
"bytes": "563"
},
{
"name": "LLVM",
"bytes": "3292"
},
{
"name": "Makefile",
"bytes": "7764848"
},
{
"name": "Objective-C",
"bytes": "304372"
},
{
"name": "Objective-C++",
"bytes": "90267"
},
{
"name": "PAWN",
"bytes": "15882"
},
{
"name": "R",
"bytes": "14754"
},
{
"name": "Shell",
"bytes": "14659"
},
{
"name": "Visual Basic",
"bytes": "3046"
}
],
"symlink_target": ""
} |
package io.realm;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import io.realm.entities.PrimaryKeyRequiredAsBoxedByte;
import io.realm.entities.PrimaryKeyRequiredAsBoxedInteger;
import io.realm.entities.PrimaryKeyRequiredAsBoxedLong;
import io.realm.entities.PrimaryKeyRequiredAsBoxedShort;
import io.realm.entities.PrimaryKeyRequiredAsString;
import io.realm.objectid.NullPrimaryKey;
import io.realm.rule.TestRealmConfigurationFactory;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@RunWith(Parameterized.class)
public class RealmPrimaryKeyTests {
@Rule
public final TestRealmConfigurationFactory configFactory = new TestRealmConfigurationFactory();
protected Realm realm;
@Before
public void setUp() {
RealmConfiguration realmConfig = configFactory.createConfiguration();
realm = Realm.getInstance(realmConfig);
}
@After
public void tearDown() {
if (realm != null) {
realm.close();
}
}
/**
* Base parameters for testing null/not-null primary key value. The parameters are aligned in an
* order of 1) a test target class, 2) a primary key field class, 3) a primary Key value, 4) a
* secondary field class, and 5) a secondary field value, accommodating {@interface NullPrimaryKey}
* to condense unit tests.
*/
@Parameterized.Parameters
public static Iterable<Object[]> data() {
return Arrays.asList(new Object[][]{
// 1) Test target class 2) PK Class 3) PK value 4) 2nd Class 5) 2nd field value
{PrimaryKeyRequiredAsString.class, String.class, "424123", String.class, "SomeSecondaryValue"},
{PrimaryKeyRequiredAsBoxedByte.class, Byte.class, Byte.valueOf("67"), String.class, "This-Is-Second-One"},
{PrimaryKeyRequiredAsBoxedShort.class, Short.class, Short.valueOf("1729"), String.class, "AnyValueIsAccepted"},
{PrimaryKeyRequiredAsBoxedInteger.class, Integer.class, Integer.valueOf("19"), String.class, "PlayWithSeondFied!"},
{PrimaryKeyRequiredAsBoxedLong.class, Long.class, Long.valueOf("62914"), String.class, "Let's name a value"}
});
}
final private Class<? extends RealmObject> testClazz;
final private Class primaryKeyFieldType;
final private Object primaryKeyFieldValue;
final private Class secondaryFieldType;
final private Object secondaryFieldValue;
public RealmPrimaryKeyTests(Class<? extends RealmObject> testClazz, Class primaryKeyFieldType, Object primaryKeyFieldValue, Class secondaryFieldType, Object secondaryFieldValue) {
this.testClazz = testClazz;
this.primaryKeyFieldType = primaryKeyFieldType;
this.primaryKeyFieldValue = primaryKeyFieldValue;
this.secondaryFieldType = secondaryFieldType;
this.secondaryFieldValue = secondaryFieldValue;
}
// @PrimaryKey + @Required annotation accept not-null value properly as a primary key value for Realm version 0.89.1+.
@Test
public void copyToRealmOrUpdate_requiredPrimaryKey() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
RealmObject obj = (RealmObject)testClazz.getConstructor(primaryKeyFieldType, secondaryFieldType).newInstance(primaryKeyFieldValue, secondaryFieldValue);
realm.beginTransaction();
realm.copyToRealmOrUpdate(obj);
realm.commitTransaction();
RealmResults results = realm.where(testClazz).findAll();
assertEquals(1, results.size());
assertEquals(primaryKeyFieldValue, ((NullPrimaryKey)results.first()).getId());
assertEquals(secondaryFieldValue, ((NullPrimaryKey)results.first()).getName());
}
// @PrimaryKey + @Required annotation does accept null as a primary key value for Realm version 0.89.1+.
@Test
public void copyToRealmOrUpdate_requiredPrimaryKeyThrows() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
RealmObject obj = (RealmObject)testClazz.getConstructor(primaryKeyFieldType, secondaryFieldType).newInstance(null, null);
realm.beginTransaction();
try {
realm.copyToRealmOrUpdate(obj);
fail("@PrimaryKey + @Required field cannot be null");
} catch (RuntimeException expected) {
if (testClazz.equals(PrimaryKeyRequiredAsString.class)) {
assertTrue(expected instanceof IllegalArgumentException);
} else {
assertTrue(expected instanceof NullPointerException);
}
} finally {
realm.cancelTransaction();
}
}
// @PrimaryKey + @Required annotation does not accept null as a primary key value for Realm version 0.89.1+.
@Test
public void createObject_nullPrimaryKeyValueThrows() throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
realm.beginTransaction();
try {
realm.createObject(testClazz, null);
fail("@PrimaryKey + @Required field cannot be null");
} catch (RuntimeException expected) {
assertTrue(expected instanceof IllegalArgumentException);
} finally {
realm.cancelTransaction();
}
}
}
| {
"content_hash": "63be41f9ff370aa8379d0c5b0247e18e",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 183,
"avg_line_length": 44.488188976377955,
"alnum_prop": 0.7111504424778761,
"repo_name": "weiwenqiang/GitHub",
"id": "9484310bd489fc4d96b07bd1f2e569d8dddaf984",
"size": "6239",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "expert/realm-java/realm/realm-library/src/androidTest/java/io/realm/RealmPrimaryKeyTests.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "87"
},
{
"name": "C",
"bytes": "42062"
},
{
"name": "C++",
"bytes": "12137"
},
{
"name": "CMake",
"bytes": "202"
},
{
"name": "CSS",
"bytes": "75087"
},
{
"name": "Clojure",
"bytes": "12036"
},
{
"name": "FreeMarker",
"bytes": "21704"
},
{
"name": "Groovy",
"bytes": "55083"
},
{
"name": "HTML",
"bytes": "61549"
},
{
"name": "Java",
"bytes": "42222825"
},
{
"name": "JavaScript",
"bytes": "216823"
},
{
"name": "Kotlin",
"bytes": "24319"
},
{
"name": "Makefile",
"bytes": "19490"
},
{
"name": "Perl",
"bytes": "280"
},
{
"name": "Prolog",
"bytes": "1030"
},
{
"name": "Python",
"bytes": "13032"
},
{
"name": "Scala",
"bytes": "310450"
},
{
"name": "Shell",
"bytes": "27802"
}
],
"symlink_target": ""
} |
module Cat.Decorators ( decorate ) where
import Cat.Types
import Control.Applicative ((<*>))
import Data.ByteString.Char8 (ByteString, append, concat,
concatMap, empty, null, pack,
singleton, split)
import qualified Data.ByteString.Lazy.Char8 as BL
import qualified Data.ByteString.Search.DFA as S
import Data.Char (chr, ord)
import Data.List (intersperse)
import Prelude hiding (concat, concatMap, null,
unlines)
decorate :: ByteString -> Option -> ByteString
decorate content NumberNonBlank = splitting content (format . enumerateNonBlank)
decorate content ShowEnds = replace "\n" "$\n" content
decorate content Number = splitting content (format . enumerate)
decorate content SqueezeBlank = splitting content removeRepeatedBlankLines
decorate content ShowTabs = replace "\t" "^I" content
decorate content ShowNonprinting = splitting content $ map (concatMap np)
replace :: String -> String -> ByteString -> ByteString
replace from to content = toStrict $ S.replace (pack from) (pack to) content
toStrict :: BL.ByteString -> ByteString
toStrict = concat . BL.toChunks
splitting :: ByteString -> ([ByteString] -> [ByteString]) -> ByteString
splitting byteString f = unlines $ f $ split '\n' byteString
unlines :: [ByteString] -> ByteString
unlines [] = empty
unlines ss = concat $ intersperse nl ss
where nl = singleton '\n'
np :: Char -> ByteString
np ch
| ord ch >= 32 && ord ch < 127 = pack [ch]
| ord ch == 127 = pack "^?"
| ord ch >= 128 + 32 && ord ch < 128 + 127 = pack $ "M-" ++ [chr $ ord ch - 128]
| ord ch >= 128 + 32 = pack "M-^?"
| ord ch >= 32 = pack $ "M-^" ++ [chr $ ord ch - 128 + 64]
| ch == '\t' = pack [ch]
| ch == '\n' = pack [ch] -- should break.
| otherwise = pack $ '^':[chr $ ord ch + 64]
removeRepeatedBlankLines :: [ByteString] -> [ByteString]
removeRepeatedBlankLines [] = []
removeRepeatedBlankLines [x] = [x]
removeRepeatedBlankLines (x:y:rest) | null x && null y = removeRepeatedBlankLines (x:rest)
removeRepeatedBlankLines (x:rest) = x:removeRepeatedBlankLines rest
enumerateNonBlank :: [ByteString] -> [(Maybe Int, ByteString)]
enumerateNonBlank = numerator 1
numerator :: Int -> [ByteString] -> [(Maybe Int, ByteString)]
numerator _ [] = []
numerator n (l:rest) | null l = (Nothing, l) : numerator n rest
| otherwise = (Just n, l) : numerator (n+1) rest
enumerate :: [ByteString] -> [(Maybe Int, ByteString)]
enumerate = zip ([Just] <*> [1..])
format :: [(Maybe Int, ByteString)] -> [ByteString]
format numbersWithRows = map (formatLine padding) numbersWithRows
where padding = calculatePadding $ fromIntegral $ length numbersWithRows
calculatePadding :: Double -> Int
calculatePadding = ceiling . log
formatLine :: Int -> (Maybe Int, ByteString) -> ByteString
formatLine paddingWidth (lineNumber, line) = append (pad lineNumber paddingWidth) line
pad :: Maybe Int -> Int -> ByteString
pad Nothing _ = pack ""
pad (Just number) maxPaddingWidth = foldl1 append [padding, pack shownNumber, pack "\t"]
where
padding = pack $ replicate paddingWidth ' '
paddingWidth = (maxPaddingWidth - length shownNumber)
shownNumber = show number
| {
"content_hash": "b5b8076d1fcfd33d8bffb9d45d6a69b2",
"timestamp": "",
"source": "github",
"line_count": 94,
"max_line_length": 90,
"avg_line_length": 36.723404255319146,
"alnum_prop": 0.6329663962920047,
"repo_name": "shockone/coreutils",
"id": "d0cb7998b8ae2c4744a5d20babf89f8f28e26122",
"size": "3452",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/cat/decorators.hs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Haskell",
"bytes": "9966"
}
],
"symlink_target": ""
} |
module ApplicationHelper
def logged_in?
!!current_user
end
end
| {
"content_hash": "5ec295b3d586ff4989f319380206ce38",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 24,
"avg_line_length": 14.2,
"alnum_prop": 0.7183098591549296,
"repo_name": "PhreeMason/my-cal",
"id": "13c0807693588a7a4d8b440dc9f987339349a8a4",
"size": "71",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/helpers/application_helper.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "7916"
},
{
"name": "HTML",
"bytes": "19683"
},
{
"name": "JavaScript",
"bytes": "5739"
},
{
"name": "Ruby",
"bytes": "56486"
}
],
"symlink_target": ""
} |
using System.Collections.Generic;
namespace SourceCode.Chasm
{
public static class ChasmExtensions
{
public static TreeNodeMap? Merge(this TreeNodeMap? first, in TreeNodeMap? second)
{
if (!first.HasValue) return second;
if (!second.HasValue) return first;
return first.Value.Merge(second.Value);
}
public static TreeNodeMap? Merge(this TreeNodeMap? first, in ICollection<TreeNode> second)
{
if (!first.HasValue) return new TreeNodeMap(second);
return first.Value.Merge(second);
}
public static TreeNodeMap? Merge(this TreeNodeMap? first, in TreeNode second)
{
if (!first.HasValue) return new TreeNodeMap(second);
return first.Value.Add(second);
}
public static bool TryGetValue(this TreeNodeMap? map, string key, out TreeNode value)
{
if (!map.HasValue)
{
value = default;
return false;
}
return map.Value.TryGetValue(key, out value);
}
public static bool TryGetValue(this TreeNodeMap? map, string key, NodeKind kind, out TreeNode value)
{
if (!map.HasValue)
{
value = default;
return false;
}
return map.Value.TryGetValue(key, kind, out value);
}
}
}
| {
"content_hash": "3184926722a2c0ec766187bacfc71a2e",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 108,
"avg_line_length": 31.17391304347826,
"alnum_prop": 0.5655509065550907,
"repo_name": "k2workflow/Chasm",
"id": "ca545baadeb6b7c70738dda5190b65aa3ce2465c",
"size": "1434",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/SourceCode.Chasm/ChasmExtensions.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "423"
},
{
"name": "C#",
"bytes": "230534"
},
{
"name": "PowerShell",
"bytes": "1931"
}
],
"symlink_target": ""
} |
require File.dirname(__FILE__) + '/../test_helper.rb'
class SessionSettingsTest < ActiveSupport::TestCase
must "RPX API key is set" do
assert UserSession.rpx_key, "the RPX API key must be set in the Authlogic::Session class configuration"
end
must "auto_register default is enabled" do
UserSession.auto_register
assert_true UserSession.auto_register_value
end
must "auto_register set disabled" do
UserSession.auto_register false
assert_false UserSession.auto_register_value
end
must "auto_register set enabled" do
UserSession.auto_register true
assert_true UserSession.auto_register_value
end
must "rpx_extended_info default is disbled" do
assert_false UserSession.rpx_extended_info_value
end
must "rpx_extended_info set enabled" do
UserSession.rpx_extended_info true
assert_true UserSession.rpx_extended_info_value
end
must "rpx_extended_info set disabled" do
UserSession.rpx_extended_info false
assert_false UserSession.rpx_extended_info_value
end
end | {
"content_hash": "46d5638574084f641a468e3faebf7cee",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 107,
"avg_line_length": 27.57894736842105,
"alnum_prop": 0.7404580152671756,
"repo_name": "tardate/authlogic_rpx",
"id": "e7dbb14e6ae5426a5210953ff32cbf35a882ce1f",
"size": "1048",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "test/unit/session_settings_test.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "44977"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
namespace Sakura.AspNetCore.Mvc.TagHelpers
{
/// <inheritdoc />
/// <summary>
/// Generate the item list for a "select" element with all items defined in an enum type.
/// </summary>
public abstract class EnumSelectTagHelper : TagHelper
{
#region Constructor
/// <summary>
/// Create a new instance of <see cref="EnumSelectTagHelper" />.
/// </summary>
/// <param name="serviceProvider">The <see cref="IServiceProvider"/> instance used to find dependent services.</param>
protected EnumSelectTagHelper(IServiceProvider serviceProvider)
{
StringLocalizerFactory = serviceProvider.GetService<IStringLocalizerFactory>();
}
#endregion
/// <summary>
/// The serivce used to provide text localization.
/// </summary>
private IStringLocalizerFactory StringLocalizerFactory { get; }
#region Services
/// <summary>
/// Get the <see cref="IStringLocalizer" /> object used for localization.
/// </summary>
protected IStringLocalizer EnumTypeStringLocalizer => StringLocalizerFactory?.Create(GetEnumType());
#endregion
#region Abstract Methods
/// <summary>
/// When derived, return the actual enum type for generating the list.
/// </summary>
/// <returns></returns>
protected abstract Type GetEnumType();
#endregion
/// <summary>
/// Generate a list of <see cref="SelectListItem" /> for a specified enum type.
/// </summary>
/// <returns>The generated list.</returns>
protected virtual IEnumerable<SelectListItem> GenerateListForEnumType()
{
return GetEnumType()
.GetMembers(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Static)
.Select(GetItemForMember);
}
#region Constants for attributes
/// <summary>
/// Get the HTML name associated with the <see cref="TextSource" /> property. This field is constant.
/// </summary>
[PublicAPI] public const string TextSourceAttributeName = "asp-text-source";
/// <summary>
/// Get the HTML name associated with the <see cref="ValueSource" /> property. This field is constant.
/// </summary>
[PublicAPI] public const string ValueSourceAttributeName = "asp-value-source";
/// <summary>
/// Get or set the text source for the generated options. The default value of this property is
/// <see cref="TagHelpers.TextSource.MemberNameOnly" />.
/// </summary>
[HtmlAttributeName(TextSourceAttributeName)]
public TextSource TextSource { get; set; } = TextSource.MemberNameOnly;
/// <summary>
/// Get or set the value source for the generated options. The default value of this property is
/// <see cref="EnumOptionValueSource.Name" />.
/// </summary>
[HtmlAttributeName(ValueSourceAttributeName)]
public EnumOptionValueSource ValueSource { get; set; } = EnumOptionValueSource.Name;
#endregion
#region Helper Method
/// <summary>
/// Get the text of the option associated with the specified enum item.
/// </summary>
/// <param name="memberInfo">The <see cref="MemberInfo" /> object represents as the enum item.</param>
/// <returns><paramref name="memberInfo" />The option text associated with <paramref name="memberInfo" />.</returns>
protected virtual string GetTextForMember(MemberInfo memberInfo)
{
var memberText = memberInfo.GetTextForMember(TextSource);
return EnumTypeStringLocalizer.TryGetLocalizedText(memberText);
}
/// <summary>
/// Get the value of the option associated with the specified enum item.
/// </summary>
/// <param name="memberInfo">The <see cref="MemberInfo" /> object represents as the enum item.</param>
/// <returns><paramref name="memberInfo" />The option value associated with <paramref name="memberInfo" />.</returns>
protected virtual string GetValueForMember(MemberInfo memberInfo)
{
return memberInfo.GetValueForEnumMember(ValueSource);
}
/// <summary>
/// Generate a <see cref="SelectListItem" /> for a specified <see cref="MemberInfo" />.
/// </summary>
/// <param name="memberInfo">The <see cref="MemberInfo" /> object represents as the enum item.</param>
/// <returns></returns>
protected virtual SelectListItem GetItemForMember(MemberInfo memberInfo)
{
return new SelectListItem
{
Text = GetTextForMember(memberInfo),
Value = GetValueForMember(memberInfo)
};
}
#endregion
}
} | {
"content_hash": "f391ce8bccd14a6a542367b590df7715",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 120,
"avg_line_length": 34.36296296296296,
"alnum_prop": 0.7124380254365165,
"repo_name": "sgjsakura/AspNetCore",
"id": "ae7b33611630c224c7c0f197b1b9e18963f24a91",
"size": "4641",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Sakura.AspNetCore.Extensions/Sakura.AspNetCore.Mvc.TagHelpers/EnumSelectTagHelper.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "922147"
}
],
"symlink_target": ""
} |
import React, { PureComponent } from 'react'
import { connect } from 'react-redux'
import Link from 'react-router-dom/Link'
import Collapse from 'material-ui/transitions/Collapse'
import {
ListItem,
ListItemText
} from 'material-ui/List'
export default connect(mapStateToProps)(class extends PureComponent {
constructor () {
super()
this.state = {
open: false
}
}
render () {
const {
open
} = this.state
const {
tournament,
toggle
} = this.props
return (
<div>
<ListItem
button
onClick={() => this.setState({ open: !open })}
color={'inherit'}
>
<ListItemText
primary={'Standings'}
/>
</ListItem>
<Collapse
in={this.state.open}
unmountOnExit
>
<ListItem
button
component={Link}
to={`/asians/tab-controls/${tournament._id}/standings-teams`}
color={'inherit'}
onClick={toggle}
>
<ListItemText
inset
primary={'Teams'}
/>
</ListItem>
<ListItem
button
component={Link}
to={`/asians/tab-controls/${tournament._id}/standings-debaters`}
color={'inherit'}
onClick={toggle}
>
<ListItemText
inset
primary={'Debaters'}
/>
</ListItem>
<ListItem
button
component={Link}
to={`/asians/tab-controls/${tournament._id}/standings-adjudicators`}
color={'inherit'}
onClick={toggle}
>
<ListItemText
inset
primary={'Adjudicators'}
/>
</ListItem>
</Collapse>
</div>
)
}
})
function mapStateToProps (state, ownProps) {
return {
tournament: state.tournaments.current.data
}
}
| {
"content_hash": "5fe943fca0928fe3f33f8c7b13adddcf",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 80,
"avg_line_length": 22.244444444444444,
"alnum_prop": 0.48801198801198803,
"repo_name": "westoncolemanl/tabbr-web",
"id": "b4ae8637750945ad567a0ad2df2c270f893d8d8f",
"size": "2002",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/containers/Asians/TabControls/_components/AppBar/SmallAppBar/StandingsButton/index.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "86"
},
{
"name": "HTML",
"bytes": "2252"
},
{
"name": "JavaScript",
"bytes": "1463186"
}
],
"symlink_target": ""
} |
{- This model uses a boxed vector of residue -> score maps. There is one map per
- position in the modeled region (corresponding to columns in the multiple
- alignments the model is made from). -
-}
-- TODO: once it works, restrict exports to the minimal needed set.
module PepModel where
import Data.Vector ((!))
import qualified Data.Vector as V
import qualified Data.Map.Strict as M
import qualified Data.Text as T
import qualified Data.Set as S
import Data.List (intersperse, intercalate, sortBy)
import Data.Ord (comparing)
import Data.Binary
import Data.Vector.Binary
import Data.Text.Binary
import Text.Printf
import MlgscTypes
import Alignment
import PWMModelAux
data PepModel = PepModel {
clade :: CladeName
, matrix :: V.Vector (M.Map Residue Int)
, smallScore :: Int
, modelLength :: Int
} deriving (Show, Eq)
--Remember: sequence positions start -- at 1, but vector indexes (sensibly)
-- start at 0.
pepScoreOf :: PepModel -> Residue -> Position -> Int
pepScoreOf (PepModel _ _ smallScore 0) _ _ = smallScore -- empty models
pepScoreOf _ '.' _ = 0 -- masked residues have a score of 0
pepScoreOf mod res pos = M.findWithDefault (smallScore mod) res posMap
where posMap = (matrix mod) V.! (pos - 1)
-- TODO: try to rewrite this in applicative style
pepScoreSeq :: PepModel -> Sequence -> Int
pepScoreSeq (PepModel _ _ smallScore 0) seq = smallScore * T.length seq
pepScoreSeq mod seq = sum $ map (\(res,pos) -> pepScoreOf mod res pos) seqWithPos
where seqWithPos = zip (T.unpack seq) [1..] -- eg [('A',1), ...], etc.
pepModLength = modelLength
pepAbsentResScore = smallScore
pepCladeName = clade
pepPrettyPrint :: PepModel -> String
pepPrettyPrint mod = intercalate "\n" [taxonName, modStr, "\n"]
where taxonName = if T.null $ clade mod
then "(unnamed)"
else T.unpack $ clade mod
modStr = prettyPrintWM mod
prettyPrintWM :: PepModel -> String
prettyPrintWM mod = concatMap (\n -> ppMatPos n) [1 .. modelLength mod]
where ppMatPos n = printf "%3d | %s\n" n posScores
where posScores = intercalate ", " $
map ppTuple sortedScores :: String
ppTuple (res, score) =
printf "%c: %d" res score
sortedScores = reverse $ sortBy (comparing snd) $
M.assocs pMap
pMap = (matrix mod) ! (n-1)
pepTablePrint :: PepModel -> String
pepTablePrint mod = intercalate "\n" [taxonName, modHdr, modStr, "\n"]
where taxonName = if T.null $ clade mod
then "(unnamed)"
else T.unpack $ clade mod
modHdr = "pos | " ++ (intersperse ' ' $ S.toList amino_acids)
modStr = tablePrintWM mod
tablePrintWM :: PepModel -> String
tablePrintWM mod = concatMap (\n -> ppMatPos n) [1 .. modelLength mod]
where ppMatPos n = printf "%3d | %s\n" n posScores
where posScores = intercalate " " $
map matScore $ S.toList amino_acids
matScore aa = show $ case M.lookup aa pMap of
Just score -> score
Nothing -> smallScore mod
pMap = (matrix mod) ! (n-1)
instance Binary PepModel where
put mod = do
put $ clade mod
put $ matrix mod
put $ smallScore mod
put $ modelLength mod
get = do
cladeName <- get :: Get CladeName
mat <- get :: Get (V.Vector (M.Map Residue Int))
smallScore <- get :: Get Int
modelLength <- get :: Get Int
return $ PepModel cladeName mat smallScore modelLength
-- Builds a PepMOdel from a (weighted) Alignment
-- G, T are ignored, but gaps (-) are modelled.
alnToPepModel :: SmallProb -> ScaleFactor -> CladeName -> Alignment
-> PepModel
alnToPepModel smallProb scale name [] = PepModel name V.empty smallScore 0
where smallScore = round (scale * (logBase 10 smallProb))
alnToPepModel smallProb scale name aln = PepModel name scoreMapVector smallScore length
where scoreMapVector = V.fromList scoreMapList
scoreMapList = fmap (freqMapToScoreMap scale
. countsMapToRelFreqMap wsize
. weightedColToCountsMap weights)
$ T.transpose sequences
smallScore = round (scale * (logBase 10 smallProb))
wsize = fromIntegral $ sum weights
sequences = map rowSeq aln
weights = map rowWeight aln
length = T.length $ rowSeq $ head aln
| {
"content_hash": "6b83059e09b484b7848c9459fddf9d8a",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 87,
"avg_line_length": 40.483333333333334,
"alnum_prop": 0.5891313297653356,
"repo_name": "tjunier/mlgsc",
"id": "4d7529bbf667a53011cbe147e59be2e2a04d5e63",
"size": "4929",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/PepModel.hs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "AMPL",
"bytes": "1048930"
},
{
"name": "Haskell",
"bytes": "191355"
},
{
"name": "Lua",
"bytes": "936"
},
{
"name": "Makefile",
"bytes": "2104"
},
{
"name": "Shell",
"bytes": "2150"
}
],
"symlink_target": ""
} |
using namespace std;
class HUMAN
{
public:
HUMAN(){};
virtual ~HUMAN(){};
vector<float> iniTranslate; //for initialize
vector < vector<float> > Matrix; //dependent matrix for this object
HUMAN *parent;
void set_iniTranslate(float x , float y, float z)
{
iniTranslate.push_back(x);
iniTranslate.push_back(y);
iniTranslate.push_back(z);
}
private:
protected:
};
#endif // HUMAN_H_INCLUDED
| {
"content_hash": "aabfd915e62c9ab7919cbe51673d3737",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 75,
"avg_line_length": 26,
"alnum_prop": 0.5442307692307692,
"repo_name": "jlyharia/Computer_Animation",
"id": "9d21b0625b8e05cef56d5ab3419befcab55c0f57",
"size": "591",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lab 2/lab 2 - redundant/HUMAN.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "7710"
},
{
"name": "C++",
"bytes": "212993"
}
],
"symlink_target": ""
} |
function suggest_no_verify() {
sleep 0.01 # wait for git to print its error
echo 'If you want to push without linting, use:'
tput setaf 7 # white
echo
echo ' git push --no-verify'
echo
tput sgr0 # reset
}
if which swiftlint >/dev/null; then
SCRIPTDIR=$(cd "$(dirname $0)" ; pwd)
STRIPE_IOS_ROOT=$(cd "$SCRIPTDIR/../../"; pwd)
START=`date +%s`
remote="$1"
url="$2"
z40=0000000000000000000000000000000000000000
while read local_ref local_sha remote_ref remote_sha
do
if [ "$local_sha" = $z40 ]
then
# This is a delete push, don't do anything
exit 0
else
echo "Linting before pushing (use $(tput setaf 7)git push --no-verify$(tput sgr0) to skip)."
echo ""
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
count=0
if [ "$CURRENT_BRANCH" == "master" ]; then
echo "This path (linting pre-push to master) has not been fully tested. Good luck! :)"
for file in $(git diff --diff-filter=AM --name-only "$remote_sha" "$local_sha" ':!Pods' | grep ".swift$"); do
export SCRIPT_INPUT_FILE_$count=$file
count=$((count + 1))
done
else
for file in $(git diff --diff-filter=AM --name-only origin/master ':!Pods' | grep ".swift$"); do
export SCRIPT_INPUT_FILE_$count=$file
count=$((count + 1))
done
fi
export SCRIPT_INPUT_FILE_COUNT=$count
if [ "$count" -ne 0 ]; then
swiftlint --strict --use-script-input-files --config "$STRIPE_IOS_ROOT"/.swiftlint.yml
fi
EXIT_CODE=$?
END=`date +%s`
echo ""
echo "Linted in $(($END - $START))s."
if [ "$EXIT_CODE" != '0' ]; then
suggest_no_verify &
else
echo 'All lints passed.'
fi
exit $EXIT_CODE
fi
done
else
echo "swiftlint is not installed! Use:"
tput setaf 7 # white
echo
echo ' brew install swiftlint'
echo
tput sgr0 # reset
exit 1
fi
| {
"content_hash": "b7e5a090decedc7ed1cada36d361844e",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 117,
"avg_line_length": 26.053333333333335,
"alnum_prop": 0.5849539406345957,
"repo_name": "stripe/stripe-ios",
"id": "bbbeb9b6071e21e728aecbac8633368a609198cf",
"size": "2108",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ci_scripts/lint_before_push.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "663"
},
{
"name": "HTML",
"bytes": "259541"
},
{
"name": "JavaScript",
"bytes": "76560"
},
{
"name": "Mustache",
"bytes": "9421"
},
{
"name": "Objective-C",
"bytes": "1387115"
},
{
"name": "Ruby",
"bytes": "106095"
},
{
"name": "SCSS",
"bytes": "31808"
},
{
"name": "Shell",
"bytes": "36821"
},
{
"name": "Swift",
"bytes": "6061875"
}
],
"symlink_target": ""
} |
module RubyLint
module Analysis
##
# The UndefinedVariables class checks for the use of undefined variables
# (such as instance variables and constants). The order of definition and
# use of a variable does not matter.
#
# This analysis class does *not* check for undefined local variables. Ruby
# treats these as method calls and as result they are handled by
# {RubyLint::Analysis::UndefinedMethods} instead.
#
class UndefinedVariables < Base
register 'undefined_variables'
##
# Hash containing the various variable types to add errors for whenever
# they are used but not defined.
#
# @return [Hash]
#
VARIABLE_TYPES = {
:gvar => 'global variable',
:ivar => 'instance variable',
:cvar => 'class variable'
}
VARIABLE_TYPES.each do |type, label|
define_method("on_#{type}") do |node|
unless current_scope.has_definition?(type, node.name)
error("undefined #{label} #{node.name}", node)
end
end
end
##
# Handles regular constants as well as constant paths.
#
# @param [RubyLint::AST::Node] node
#
def on_const(node)
path = ConstantPath.new(node)
variable = path.resolve(current_scope)
name = path.to_s
error("undefined constant #{name}", node) unless variable
end
end # UndefinedVariables
end # Analysis
end # RubyLint
| {
"content_hash": "e50813da4c84888b36035b9542e15d67",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 30.46938775510204,
"alnum_prop": 0.608841259209645,
"repo_name": "bbatsov/ruby-lint",
"id": "5e3e67ac16431eee3105e77651c2071c74c1eb37",
"size": "1493",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "lib/ruby-lint/analysis/undefined_variables.rb",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
This example consists of two parts, the first part uses JWT to authenticate and fetch a list of apps from QRS,
and then enigma.js to connect to the first app found in that list.
## Prerequisites
You need to follow the instructions for JWT setup in your Sense Enterprise found in the
[JWT authentication example](/examples/authentication/sense-using-jwt#prerequisites).
Once JWT is set up, modify the code to match your environment (highlighted with comments in the
example code).
## Runnable code
* [QRS](./qrs.js)
---
[Back to examples](/examples/README.md#runnable-examples)
| {
"content_hash": "5533d2023b626037ed993f4252bb83b7",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 110,
"avg_line_length": 32.44444444444444,
"alnum_prop": 0.7722602739726028,
"repo_name": "qlik-oss/enigma.js",
"id": "6792a5bf5bfb466907f2acc21b8d26e00cfdaaca",
"size": "636",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "examples/basics/documents/README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "169881"
},
{
"name": "Shell",
"bytes": "1556"
}
],
"symlink_target": ""
} |
'use strict';
var gulp = require('gulp');
var concat = require('gulp-concat');
var plumber = require('gulp-plumber');
var uglify = require('gulp-uglify');
var merge = require('merge-stream');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('libjs', function () {
return gulp.src([
'bower_components/ace-builds/src/ace.js',
'bower_components/remarkable/dist/remarkable.js',
'bower_components/ace-builds/src/mode-markdown.js',
'src/custom_ace/mode-markdowneditor.js',
'src/custom_ace/gutter_toolbar.js',
'bower_components/ace-builds/src/ext-language_tools.js',
'bower_components/jquery/dist/jquery.min.js',
'bower_components/cropper/dist/cropper.min.js',
'bower_components/diff-dom/diffDOM.js'
])
.pipe(plumber())
.pipe(concat('dependencies.js'))
.pipe(gulp.dest('../../assets/components/markdowneditor/js/mgr'));
});
gulp.task('acethemes', function () {
return gulp.src([
'bower_components/ace-builds/src/theme-*.js'
])
.pipe(plumber())
.pipe(concat('acethemes.js'))
.pipe(gulp.dest('../../assets/components/markdowneditor/js/mgr'));
});
gulp.task('js-highlight', function () {
return gulp.src([
'src/vendor/highlight/highlight.pack.js'
])
.pipe(plumber())
.pipe(concat('highlight.pack.js'))
.pipe(gulp.dest('../../assets/components/markdowneditor/js'));
});
gulp.task('js', function () {
return gulp.src(['src/*.js'])
.pipe(sourcemaps.init())
.pipe(plumber())
.pipe(concat('app.js'))
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest('../../assets/components/markdowneditor/js/mgr'));
});
gulp.task('js:watch', ['js'], function () {
gulp.watch('src/*.js', ['js'])
});
| {
"content_hash": "347314fa03e3c8d275e02ab688dd6ba1",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 78,
"avg_line_length": 35.24561403508772,
"alnum_prop": 0.5510204081632653,
"repo_name": "jpdevries/markdown-editor",
"id": "d0a8dfac2b70a8935719e0115cdf1bbfefe4298b",
"size": "2009",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_build/assets/gulp/js.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "88626"
},
{
"name": "HTML",
"bytes": "16489"
},
{
"name": "JavaScript",
"bytes": "1397570"
},
{
"name": "PHP",
"bytes": "65804"
}
],
"symlink_target": ""
} |
module NLP.LexemeClustering.Dist
( Dist
, toDist
, entropy
) where
import Control.Arrow (second)
import qualified Data.Map.Strict as M
-- | A random distribution over elements of type @a@.
type Dist a = M.Map a Double
-- | Convert a map with occurence numbers to a map
-- with frequencies (empirical distribution).
toDist :: Ord a => M.Map a Int -> Dist a
toDist m =
let n = fromIntegral $ sum $ M.elems m
norm = second $ (/n) . fromIntegral
in M.fromList $ map norm $ M.toList m
-- | Entropy of the distribution.
-- Assumption: there are no 0-probability elements in the distribution.
entropy :: Ord a => Dist a -> Double
entropy dist = negate $ sum
[ p * logBase 2 p
| (_, p) <- M.toList dist ]
| {
"content_hash": "647b00f7a5ff119fe6e36647f0456c0d",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 71,
"avg_line_length": 24.666666666666668,
"alnum_prop": 0.6581081081081082,
"repo_name": "kawu/lexeme-clustering",
"id": "6146e5fa71d5be24e38ab23ad906fe6f69967b66",
"size": "740",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/NLP/LexemeClustering/Dist.hs",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Haskell",
"bytes": "18241"
}
],
"symlink_target": ""
} |
const SkyBuildSetup = require('sky-build-setup');
const PackageJson = require('./package.json');
const path = require('path');
module.exports = SkyBuildSetup(
PackageJson,
path.resolve(__dirname)
); | {
"content_hash": "b235036897d772e559528eb50a2af20e",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 49,
"avg_line_length": 25.125,
"alnum_prop": 0.7313432835820896,
"repo_name": "skybrud/sky-scroll",
"id": "7ed9e41e6f9fd3bb3dbb776aad4a21fd120320d0",
"size": "201",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "rollup.config.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "8225"
}
],
"symlink_target": ""
} |
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="app_name">CENP Revista</string>
<string name="launcher_name">@string/app_name</string>
<string name="activity_name">@string/launcher_name</string>
</resources>
| {
"content_hash": "62cf17c731dc99440bcdc24ae2cd6d9a",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 63,
"avg_line_length": 39.5,
"alnum_prop": 0.6877637130801688,
"repo_name": "alansystem/cenp_revista",
"id": "f0f1915981dcb6562bea69077d2e2695f0d8b841",
"size": "237",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "platforms/android/res/values/strings.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "17908"
},
{
"name": "C",
"bytes": "662375"
},
{
"name": "C#",
"bytes": "164030"
},
{
"name": "C++",
"bytes": "115105"
},
{
"name": "CSS",
"bytes": "139488"
},
{
"name": "HTML",
"bytes": "123025"
},
{
"name": "Java",
"bytes": "946706"
},
{
"name": "JavaScript",
"bytes": "2623376"
},
{
"name": "Objective-C",
"bytes": "930724"
},
{
"name": "QML",
"bytes": "4777"
},
{
"name": "Shell",
"bytes": "1927"
}
],
"symlink_target": ""
} |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.app.coolweather.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
| {
"content_hash": "4878c4d0f5fd5c72cd98798c06aa33f1",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 41.8125,
"alnum_prop": 0.7324364723467862,
"repo_name": "Benweii/coolWeather",
"id": "72ff7fb605ee934f22b85b4e26fed765b402e448",
"size": "669",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "res/layout/activity_main.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "24689"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<module codename="org.netbeans.modules.html.navigator">
<module_version install_time="1370465405948" last="true" origin="installer" specification_version="1.3.1">
<file crc="1936636399" name="config/Modules/org-netbeans-modules-html-navigator.xml"/>
<file crc="262846151" name="modules/locale/org-netbeans-modules-html-navigator_ja.jar"/>
<file crc="397065793" name="modules/locale/org-netbeans-modules-html-navigator_pt_BR.jar"/>
<file crc="3545159656" name="modules/locale/org-netbeans-modules-html-navigator_ru.jar"/>
<file crc="2750533220" name="modules/locale/org-netbeans-modules-html-navigator_zh_CN.jar"/>
<file crc="2173367502" name="modules/org-netbeans-modules-html-navigator.jar"/>
</module_version>
</module>
| {
"content_hash": "0e2540bf392f1647e478574b0ba15dcd",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 110,
"avg_line_length": 74.27272727272727,
"alnum_prop": 0.7135862913096696,
"repo_name": "samini/gort-public",
"id": "b6e27a3d547c5893169a8f9bf2bcf4f645406343",
"size": "817",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Source/GortGUIv2/Platform/NetBeans731/ide/update_tracking/org-netbeans-modules-html-navigator.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "36395"
},
{
"name": "Groff",
"bytes": "1577"
},
{
"name": "HTML",
"bytes": "15840"
},
{
"name": "Java",
"bytes": "1292597"
},
{
"name": "Makefile",
"bytes": "4963"
},
{
"name": "Python",
"bytes": "532008"
},
{
"name": "Shell",
"bytes": "118901"
},
{
"name": "XSLT",
"bytes": "221100"
}
],
"symlink_target": ""
} |

## Installation
### Install the `loot_tables` directory:
1. [Download](https://github.com/liam4/mc-treasuretrove/archive/master.zip) this repository.
2. [Unzip](https://answers.stanford.edu/solution/how-do-i-zip-and-unzip-files-and-folders-do-i-need-winzip-or-stuffit) the file you downloaded.
3. Rename the new folder to `loot_tables`.
4. [Find](http://gaming.stackexchange.com/a/14703/116361) your world save.
5. Inside of that folder, open up the `data` folder.
6. Move `loot_tables` into `data`.
7. If your world was opened as you were installing:
* Reload Minecraft's resources (`F3+t` on Windows, `fn+f3+t` on OS X).
* Else, open up your world.
8. ???
9. Profit!
### Create scoreboard variables:
In order for Treasure Trove to work properly, you will need to initialize some scoreboard variables. To do so, simply run each of these commands (i.e. paste into the chat):
/scoreboard objectives add sMobKills stat.mobKills
## Documentation
You can find documentation within [`treasuretrove/docs`](treasuretrove/docs).
## Troubleshooting
**Running the commands you gave me shows red text saying I don't have permission to run this command.** This is because your world does not have cheats enabled. To enable them temporarily, simply pause the game (`esc`), click on the big **Open to LAN** button, click on **Allow Cheats**, and finally click on **Start LAN world**. Then run the commands. You can disable cheats and close the LAN server by exiting the world (and then entering).
| {
"content_hash": "043041bd65e4bffae4f3e006cf561d05",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 442,
"avg_line_length": 61.857142857142854,
"alnum_prop": 0.7644341801385681,
"repo_name": "liam4/mc-treasuretrove",
"id": "e5cb32b3a0ff3eeeceb2686ef7bd6e6586d2f2da",
"size": "1732",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
// 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.requests;
import com.microsoft.graph.models.ManagedMobileLobApp;
import com.microsoft.graph.http.BaseCollectionResponse;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The class for the Managed Mobile Lob App Collection Response.
*/
public class ManagedMobileLobAppCollectionResponse extends BaseCollectionResponse<ManagedMobileLobApp> {
}
| {
"content_hash": "d91a22dce7a68d8e2f288de0efec62e0",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 152,
"avg_line_length": 43.94444444444444,
"alnum_prop": 0.638432364096081,
"repo_name": "microsoftgraph/msgraph-sdk-java",
"id": "f85d7f7d815643bfbebbf5c4c48c07ce89521545",
"size": "791",
"binary": false,
"copies": "1",
"ref": "refs/heads/dev",
"path": "src/main/java/com/microsoft/graph/requests/ManagedMobileLobAppCollectionResponse.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "27286837"
},
{
"name": "PowerShell",
"bytes": "5635"
}
],
"symlink_target": ""
} |
/**
* @author Manish Shanker
*/
(function() {
"use strict";
function RSG(options) {
var paper;
var radius;
var nodes = {};
var nodesCount = 0;
var aRadian;
var centerXY;
function plotNode(item) {
var nodeObject = nodes[item.replace(/ /g, "")];
if (!nodeObject) {
var x = Math.cos(aRadian*nodesCount) * radius + centerXY;
var y = Math.sin(aRadian*nodesCount) * radius + centerXY;
var node = paper.circle(x, y, 5);
paper.text(x+10 , y+10, item);
//var node = paper.path(Raphael.format("M {0} {1} T {2} {3}", lastCordinate.x, lastCordinate.y, x, y));
node.attr({fill: "red"});
nodeObject = {
node: node,
x: x,
y: y,
nodeConnectors: [],
label: item
};
nodes[item.replace(/ /g, "")] = nodeObject;
nodesCount++;
node.hover(nodeHoverIn, nodeHoverOut, nodeObject, nodeObject);
}
return nodeObject;
}
function nodeHoverIn() {
//this.node.attr({stroke: "red"}) // = this.node.glow();
for (var i= 0, l = this.nodeConnectors.length; i<l; i++) {
this.nodeConnectors[i].oldAlpha = this.nodeConnectors[i].attr("opacity");
this.nodeConnectors[i].animate({"opacity": 1}, 500);
this.nodeConnectors[i].animate({stroke: "red"}, 500);
}
}
function nodeHoverOut() {
//this.node.attr({stroke: "black"});
for (var i= 0, l = this.nodeConnectors.length; i<l; i++) {
this.nodeConnectors[i].animate({"opacity": this.nodeConnectors[i].oldAlpha}, 500);
this.nodeConnectors[i].animate({stroke: "#CCCCCC"}, 500);
}
}
function plotNodeConnector(nodeFrom, nodeTo, strength) {
var nodeConnector = paper.path(Raphael.format("M {0} {1} Q {2} {2} {3} {4}", nodeFrom.x, nodeFrom.y, centerXY, nodeTo.x, nodeTo.y));
//nodeConnector.attr({stroke: "#CCCCCC", opacity: strength/options.maxStrength});
//nodeConnector.attr({stroke: "#CCCCCC", "stroke-width": strength, opacity: 0.5});
nodeConnector.attr({stroke: "#CCCCCC", "stroke-width": (strength/options.maxStrength)*5, opacity: 0.6});
nodeConnector.toBack();
nodeFrom.nodeConnectors.push(nodeConnector);
nodeTo.nodeConnectors.push(nodeConnector);
return nodeConnector;
}
function plot() {
paper = Raphael("relationshipChart", options.widthAndHeight, options.widthAndHeight);
radius = options.widthAndHeight/2-20;
centerXY = radius+20;
aRadian = (2*Math.PI)/options.uniqueNodeCount;
//paper.circle(centerXY, centerXY, radius);
for (var i= 0, l = options.relationships.length; i<l; i++) {
var nodeFrom = plotNode(options.relationships[i].from);
var nodeTo = plotNode(options.relationships[i].to);
plotNodeConnector(nodeFrom, nodeTo, options.relationships[i].strength);
}
}
return {
plot: plot
};
}
window.RSG = RSG;
}()); | {
"content_hash": "32df91d0d255a7a46b95102354d1da6d",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 138,
"avg_line_length": 30.692307692307693,
"alnum_prop": 0.6376655925528106,
"repo_name": "manishshanker/circularRelationshipGraph",
"id": "2e8bc1372be341d36b02fabfd8fa549a1d15ce59",
"size": "3391",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "circular-relationship-graph.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "3391"
}
],
"symlink_target": ""
} |
title: Minimize Zone
page_title: Minimize Zone - RadWindow
description: Check our Web Forms article about Minimize Zone.
slug: window/getting-started/minimize-zone
tags: minimize,zone
published: True
position: 9
---
# Minimize Zone
Popup windows in most Web applications can't be treated like regular windows. They may or may not allow resizing, and certainly not minimizing or maximizing.RadWindow-based popup windows can be minimized as long as the **Behaviors** property includes "Minimize". By default, when the user clicks on the minimize icon on the window's title bar, the window is minimized in its current location:

You can change this default behavior by providing your windows with an area that acts like a task bar. This area is called a minimize zone. The minimize zone can be any HTML element such as a div or Panel control. You can tailor the element to look like a task bar, to run vertically along the left side, or any other configuration you like.
To use use a minimize zone:
1. Add a control to your form that hold the minimized windows.
1. In the **RadWindowManager** or **RadWindow** control, set the **MinimizeZoneId** property to the ID for the control you added in step 1.

>tip If you have several windows that all minimize to the same minimize zone, set the **MinimizeZoneID** property of the **RadWindowManager** rather than setting the property for each individual **RadWindow** .
1. When you run the application, click on the Minimize button on your windows. They move to the minimize zone:

>tip To restore a minimized window, simply double-click on it. It returns to the size and position it held before it was minimized.
| {
"content_hash": "699b377043e04efcf7721031bed9293e",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 392,
"avg_line_length": 53.35294117647059,
"alnum_prop": 0.762954796030871,
"repo_name": "telerik/ajax-docs",
"id": "999a889af89a7c225268c34b01658bba40794d86",
"size": "1819",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "controls/window/getting-started/minimize-zone.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ASP.NET",
"bytes": "2253"
},
{
"name": "C#",
"bytes": "6026"
},
{
"name": "HTML",
"bytes": "2240"
},
{
"name": "JavaScript",
"bytes": "3052"
},
{
"name": "Ruby",
"bytes": "3275"
}
],
"symlink_target": ""
} |
package com.google.zxing.client.android.wifi;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
import android.os.AsyncTask;
import android.util.Log;
import java.util.List;
import java.util.regex.Pattern;
import com.google.zxing.client.result.WifiParsedResult;
/**
* @author Vikram Aggarwal
* @author Sean Owen
*/
public final class WifiConfigManager extends AsyncTask<WifiParsedResult,Object,Object> {
private static final String TAG = WifiConfigManager.class.getSimpleName();
private static final Pattern HEX_DIGITS = Pattern.compile("[0-9A-Fa-f]+");
private final WifiManager wifiManager;
public WifiConfigManager(WifiManager wifiManager) {
this.wifiManager = wifiManager;
}
@Override
protected Object doInBackground(WifiParsedResult... args) {
WifiParsedResult theWifiResult = args[0];
// Start WiFi, otherwise nothing will work
if (!wifiManager.isWifiEnabled()) {
Log.i(TAG, "Enabling wi-fi...");
if (wifiManager.setWifiEnabled(true)) {
Log.i(TAG, "Wi-fi enabled");
} else {
Log.w(TAG, "Wi-fi could not be enabled!");
return null;
}
// This happens very quickly, but need to wait for it to enable. A little busy wait?
int count = 0;
while (!wifiManager.isWifiEnabled()) {
if (count >= 10) {
Log.i(TAG, "Took too long to enable wi-fi, quitting");
return null;
}
Log.i(TAG, "Still waiting for wi-fi to enable...");
try {
Thread.sleep(1000L);
} catch (InterruptedException ie) {
// continue
}
count++;
}
}
String networkTypeString = theWifiResult.getNetworkEncryption();
NetworkType networkType;
try {
networkType = NetworkType.forIntentValue(networkTypeString);
} catch (IllegalArgumentException ignored) {
Log.w(TAG, "Bad network type; see NetworkType values: " + networkTypeString);
return null;
}
if (networkType == NetworkType.NO_PASSWORD) {
changeNetworkUnEncrypted(wifiManager, theWifiResult);
} else {
String password = theWifiResult.getPassword();
if (password != null && !password.isEmpty()) {
if (networkType == NetworkType.WEP) {
changeNetworkWEP(wifiManager, theWifiResult);
} else if (networkType == NetworkType.WPA) {
changeNetworkWPA(wifiManager, theWifiResult);
}
}
}
return null;
}
/**
* Update the network: either create a new network or modify an existing network
* @param config the new network configuration
*/
private static void updateNetwork(WifiManager wifiManager, WifiConfiguration config) {
Integer foundNetworkID = findNetworkInExistingConfig(wifiManager, config.SSID);
if (foundNetworkID != null) {
Log.i(TAG, "Removing old configuration for network " + config.SSID);
wifiManager.removeNetwork(foundNetworkID);
wifiManager.saveConfiguration();
}
int networkId = wifiManager.addNetwork(config);
if (networkId >= 0) {
// Try to disable the current network and start a new one.
if (wifiManager.enableNetwork(networkId, true)) {
Log.i(TAG, "Associating to network " + config.SSID);
wifiManager.saveConfiguration();
} else {
Log.w(TAG, "Failed to enable network " + config.SSID);
}
} else {
Log.w(TAG, "Unable to add network " + config.SSID);
}
}
private static WifiConfiguration changeNetworkCommon(WifiParsedResult wifiResult) {
WifiConfiguration config = new WifiConfiguration();
config.allowedAuthAlgorithms.clear();
config.allowedGroupCiphers.clear();
config.allowedKeyManagement.clear();
config.allowedPairwiseCiphers.clear();
config.allowedProtocols.clear();
// Android API insists that an ascii SSID must be quoted to be correctly handled.
config.SSID = quoteNonHex(wifiResult.getSsid());
config.hiddenSSID = wifiResult.isHidden();
return config;
}
// Adding a WEP network
private static void changeNetworkWEP(WifiManager wifiManager, WifiParsedResult wifiResult) {
WifiConfiguration config = changeNetworkCommon(wifiResult);
config.wepKeys[0] = quoteNonHex(wifiResult.getPassword(), 10, 26, 58);
config.wepTxKeyIndex = 0;
config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP104);
updateNetwork(wifiManager, config);
}
// Adding a WPA or WPA2 network
private static void changeNetworkWPA(WifiManager wifiManager, WifiParsedResult wifiResult) {
WifiConfiguration config = changeNetworkCommon(wifiResult);
// Hex passwords that are 64 bits long are not to be quoted.
config.preSharedKey = quoteNonHex(wifiResult.getPassword(), 64);
config.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
config.allowedProtocols.set(WifiConfiguration.Protocol.WPA); // For WPA
config.allowedProtocols.set(WifiConfiguration.Protocol.RSN); // For WPA2
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_EAP);
config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
updateNetwork(wifiManager, config);
}
// Adding an open, unsecured network
private static void changeNetworkUnEncrypted(WifiManager wifiManager, WifiParsedResult wifiResult) {
WifiConfiguration config = changeNetworkCommon(wifiResult);
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
updateNetwork(wifiManager, config);
}
private static Integer findNetworkInExistingConfig(WifiManager wifiManager, String ssid) {
List<WifiConfiguration> existingConfigs = wifiManager.getConfiguredNetworks();
for (WifiConfiguration existingConfig : existingConfigs) {
if (existingConfig.SSID.equals(ssid)) {
return existingConfig.networkId;
}
}
return null;
}
private static String quoteNonHex(String value, int... allowedLengths) {
return isHexOfLength(value, allowedLengths) ? value : convertToQuotedString(value);
}
/**
* Encloses the incoming string inside double quotes, if it isn't already quoted.
* @param s the input string
* @return a quoted string, of the form "input". If the input string is null, it returns null
* as well.
*/
private static String convertToQuotedString(String s) {
if (s == null || s.isEmpty()) {
return null;
}
// If already quoted, return as-is
if (s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"') {
return s;
}
return '\"' + s + '\"';
}
/**
* @param value input to check
* @param allowedLengths allowed lengths, if any
* @return true if value is a non-null, non-empty string of hex digits, and if allowed lengths are given, has
* an allowed length
*/
private static boolean isHexOfLength(CharSequence value, int... allowedLengths) {
if (value == null || !HEX_DIGITS.matcher(value).matches()) {
return false;
}
if (allowedLengths.length == 0) {
return true;
}
for (int length : allowedLengths) {
if (value.length() == length) {
return true;
}
}
return false;
}
}
| {
"content_hash": "a60438fbae1b92af5f5de14c79557bb7",
"timestamp": "",
"source": "github",
"line_count": 210,
"max_line_length": 111,
"avg_line_length": 37.18571428571428,
"alnum_prop": 0.7009860417467025,
"repo_name": "peterdocter/zxing",
"id": "0efd47efc2c6e4736f855330bb6b9be3544c55aa",
"size": "8410",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "android/src/com/google/zxing/client/android/wifi/WifiConfigManager.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "ActionScript",
"bytes": "1305291"
},
{
"name": "C",
"bytes": "70781"
},
{
"name": "C++",
"bytes": "1302341"
},
{
"name": "CMake",
"bytes": "5581"
},
{
"name": "CSS",
"bytes": "3747"
},
{
"name": "HTML",
"bytes": "102888"
},
{
"name": "Java",
"bytes": "2211624"
},
{
"name": "JavaScript",
"bytes": "66378"
},
{
"name": "Makefile",
"bytes": "2290"
},
{
"name": "Objective-C",
"bytes": "408620"
},
{
"name": "Objective-C++",
"bytes": "6090"
},
{
"name": "Python",
"bytes": "1726266"
},
{
"name": "Ruby",
"bytes": "4508"
},
{
"name": "Shell",
"bytes": "1222"
}
],
"symlink_target": ""
} |
#region License
#endregion
namespace HidSharp.Reports.Encodings
{
public enum GlobalItemTag : byte
{
UsagePage = 0,
LogicalMinimum,
LogicalMaximum,
PhysicalMinimum,
PhysicalMaximum,
UnitExponent,
Unit,
ReportSize,
ReportID,
ReportCount,
Push,
Pop
}
} | {
"content_hash": "fe3ccd9e7b052773281302fe1c49e008",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 36,
"avg_line_length": 16.40909090909091,
"alnum_prop": 0.5595567867036011,
"repo_name": "OpenStreamDeck/StreamDeckSharp",
"id": "b1ae16d5ce0b28d839f182f5b0493e2d0e36afd9",
"size": "997",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/HidSharp/HidSharp/Reports/Encodings/GlobalItemTag.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C#",
"bytes": "732362"
}
],
"symlink_target": ""
} |
class AddProcessedAtToFutureActions < ActiveRecord::Migration[5.0]
def change
add_column :rules_future_actions, :processed_at, :datetime
end
end | {
"content_hash": "dfd8d328170531eaadeab64982338011",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 66,
"avg_line_length": 30.4,
"alnum_prop": 0.7763157894736842,
"repo_name": "deevis/business_rules",
"id": "9aabd1299096e786b035fd572534d548d18bfacd",
"size": "152",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "db/migrate/20150417154856_add_processed_at_to_future_actions.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "15030"
},
{
"name": "HTML",
"bytes": "97324"
},
{
"name": "JavaScript",
"bytes": "1852858"
},
{
"name": "Ruby",
"bytes": "315630"
},
{
"name": "Shell",
"bytes": "561"
}
],
"symlink_target": ""
} |
#pragma once
#ifndef VOTCA_CSG_BEADMOTIFCONNECTOR_H
#define VOTCA_CSG_BEADMOTIFCONNECTOR_H
// Standard includes
#include <unordered_set>
#include <vector>
// Third party includes
#include <boost/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/bimap/set_of.hpp>
// VOTCA includes
#include <votca/tools/edge.h>
namespace votca {
namespace csg {
/**
* @brief Maps a reduced edge to all the edges that make up the reduced edge
*
* Reduced edge
*
* 0 - 4
*
* Will point to explicit edges:
*
* 0 - 1 - 2 - 3 - 4
*
* Each of these explicit edges will point back to the reduced edge
*
* Explicit Edges Reduced Edge
*
* 0 - 1 -> 0 - 4
* 1 - 2 -> 0 - 4
* 2 - 3 -> 0 - 4
* 3 - 4 -> 0 - 4
*/
typedef boost::bimap<boost::bimaps::multiset_of<tools::Edge>,
boost::bimaps::set_of<tools::Edge>>
reduced_edge_to_edges_map;
/**
* \brief Simple class for storing the connections between motifs and the
* underlying beads that are part of the connection.
*
* A graph like this
*
* 1 - 2 - 3 - 4
* | |
* 5 - 6
*
* Will be broken up into two motifs a line motif and a loop motif the
* BeadMotifConnector tracks the connections between the now independ motifs
*
* Motif 0 Motif 1
*
* 1 - 2 3 - 4
* | |
* 5 - 6
*
* The motif connection is stored as edge: 0 - 1
* The corresbonding bead connection as edge: 2 - 3
*
**/
class BeadMotifConnector {
public:
void AddMotifAndBeadEdge(const tools::Edge& motif_edge,
const tools::Edge& bead_edge);
/// Returns the bead edges connecting the motifs specified by motif_edge
std::vector<tools::Edge> getBeadEdges(const tools::Edge& motif_edge) const;
/// Returns all the bead edges connecting the motifs
std::vector<tools::Edge> getBeadEdges() const noexcept;
/// Returns the motifs involved between two beads given by bead_edge
tools::Edge getMotifEdge(const tools::Edge& bead_edge) const;
/// Returns all the motif edges
std::unordered_set<tools::Edge> getMotifEdges() const noexcept;
private:
reduced_edge_to_edges_map motif_and_bead_edges_;
};
} // namespace csg
} // namespace votca
#endif // VOTCA_CSG_BEADMOTIFCONNECTOR_H
| {
"content_hash": "94165f5fdf060be46782d10cf9654d07",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 77,
"avg_line_length": 26.07777777777778,
"alnum_prop": 0.6250532594801875,
"repo_name": "MrTheodor/csg",
"id": "7b444ab8d6f489e6b23d1576c760cc0b0e091aab",
"size": "2987",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "include/votca/csg/beadmotifconnector.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C++",
"bytes": "514276"
},
{
"name": "CMake",
"bytes": "33508"
},
{
"name": "Makefile",
"bytes": "121293"
},
{
"name": "Matlab",
"bytes": "153"
},
{
"name": "Perl",
"bytes": "85497"
},
{
"name": "Prolog",
"bytes": "5967"
},
{
"name": "Python",
"bytes": "390425"
},
{
"name": "Shell",
"bytes": "242722"
}
],
"symlink_target": ""
} |
require 'hg/weather/temperature'
require 'hg/weather/speed'
require 'hg/weather/locale'
module HG
module Weather
class Condition
ONE_DAY = 86_400
# Public: Temperature
attr_accessor :temperature
# Public: Max Temperature
attr_accessor :max_temperature
# Public: Min Temperature
attr_accessor :min_temperature
# Public: Humidity
attr_accessor :humidity
# Public: Image ID
attr_accessor :image_id
# Public: Description
attr_accessor :description
# Public: Slug
attr_accessor :slug
# Public: Wind speedy
attr_accessor :wind_speed
# Public: Sunrise
attr_accessor :sunrise
# Public: Sunset
attr_accessor :sunset
# Public: Currently, day or night
attr_accessor :currently
# Public: Datetime, if forecast time is always midnight
attr_accessor :datetime
# Public: Is forecast
attr_accessor :is_forecast
def initialize(options = {})
if options.count != 0
@temperature = Temperature.new(options[:temperature]) if options[:temperature]
@max_temperature = Temperature.new(options[:max_temperature]) if options[:max_temperature]
@min_temperature = Temperature.new(options[:min_temperature]) if options[:min_temperature]
@humidity = options[:humidity].to_i if options[:humidity]
@image_id = options[:image_id] if options[:image_id]
@description = options[:description] if options[:description]
@slug = options[:slug].to_sym if options[:slug]
@wind_speed = Speed.new(options[:wind_speed]) if options[:wind_speed]
@currently = (options[:currently] == Locale.get_format(:day).to_s ? :day : :night) if options[:currently]
@datetime = process_datetime(options[:date], options[:time]) if options[:date]
@sunrise = process_sunrise(options[:sunrise]) if options[:sunrise]
@sunset = process_sunset(options[:sunset]) if options[:sunset]
@is_forecast = options[:is_forecast] if options[:is_forecast]
end
end
def is_day?
return nil if self.currently.nil?
self.currently == :day
end
def is_night?
return nil if self.currently.nil?
self.currently == :night
end
def to_s separator = ' - '
to_return = []
to_return << self.datetime.strftime(Locale.get_format(:short_date)) if self.datetime && self.datetime.kind_of?(Time) && self.is_forecast
to_return << self.temperature.to_s if self.temperature
to_return << 'Max: ' + self.max_temperature.to_s if self.max_temperature
to_return << 'Min: ' + self.min_temperature.to_s if self.min_temperature
to_return << self.humidity.to_s + ' %' if self.humidity
to_return << self.wind_speed.to_s if self.wind_speed
to_return << "#{Locale.get_format(:sunrise).to_s.capitalize}: " + self.sunrise.strftime('%H:%M') if self.sunrise && self.sunrise.kind_of?(Time)
to_return << "#{Locale.get_format(:sunset).to_s.capitalize}: " + self.sunset.strftime('%H:%M') if self.sunset && self.sunset.kind_of?(Time)
to_return << self.description.to_s if self.description
return to_return.join(separator)
end
def inspect
self.to_s
end
protected
def process_datetime date, time = nil
return Time.now if date.nil?
return Time.strptime((date + ' ' + (time ? time : '00:00')), Locale.get_format(:datetime))
end
def process_sunset sunset
return nil if sunrise.nil? || self.datetime.nil?
sunset = Time.parse(sunset)
return (sunset > midnight_of(self.datetime + ONE_DAY) ? sunset - ONE_DAY : sunset)
end
def process_sunrise sunrise
return nil if sunrise.nil? || self.datetime.nil?
sunrise = Time.parse(sunrise)
return (sunrise < midnight_of(self.datetime + ONE_DAY) ? sunrise + ONE_DAY : sunrise)
end
def midnight_of time
time = Time.now if time.nil?
Time.new(time.year, time.month, time.day)
end
end
end
end
| {
"content_hash": "0d45a1cfa826051fc4a6b3179ab896cb",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 151,
"avg_line_length": 32.707692307692305,
"alnum_prop": 0.610065851364064,
"repo_name": "hugodemiglio/hg-weather-gem",
"id": "3dd2121846c57a2419d9d2b44d01a30eb21781d8",
"size": "4252",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/hg/weather/condition.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "12510"
},
{
"name": "Shell",
"bytes": "115"
}
],
"symlink_target": ""
} |
[MitRadGelegenheiten](http://mitradgelegenheit.org/) in der
(Metropol-)Region Stuttgart.
## Local builds
1. Create development environment
1. Clone [git](http://git-scm.com/) repository
```
git clone https://github.com/mitradstuttgart/mitradstuttgart.github.io.git
```
2. Install [Ruby](https://www.ruby-lang.org/en/downloads/) `>= 1.9.3`
3. Install [Bundler](http://bundler.io/)
```
gem install bundler
```
4. Install [Jekyll](http://jekyllrb.com/)
```
bundle install
```
5. Install [Node.js and npm](https://docs.npmjs.com/getting-started/installing-node)
6. Install javascript dependencies
```
$ npm install -g grunt-cli
$ npm install -g bower
$ npm install
$ grunt
```
2. Run Jekyll
```
bundle exec jekyll serve
```
3. Open [`http://localhost:4000/`](http://localhost:4000/) in your browser
## License
All code is licensed under the MIT License.
All content is licensed under the [Creative Commons
Attribution-ShareAlike 4.0 International
License](https://creativecommons.org/licenses/by-sa/4.0/).
### Third party code
- [Bootstrap](http://getbootstrap.com/) is licensed under the MIT
License, Copyright (c) 2011-2015 Twitter, Inc.
- The [Font Awesome](http://fontawesome.io/) font is licensed under
the [SIL OFL 1.1](http://fontawesome.io/license/). The Font Awesome
CSS file is licensed under the MIT License.
- [jQuery](https://jquery.com/) is licensed under the MIT License,
Copyright (c) 2014 jQuery Foundation and other contributors.
- [Mapbox.js](https://github.com/mapbox/mapbox.js/) is licensed under
the [New BSD (3-clause
BSD)](https://github.com/mapbox/mapbox.js/blob/mb-pages/LICENSE.md)
License, Copyright (c) Mapbox.
- [Shariff](https://github.com/heiseonline/shariff) is licensed under
the MIT License, Copyright (c) 2014 Heise Zeitschriften Verlag GmbH
& Co. KG and other contributors.
- [D3.js](http://d3js.org) is licensed under the [New BSD (3-clause
BSD)](https://github.com/mbostock/d3/blob/master/LICENSE) License,
Copyright (c) Michael Bostock.
| {
"content_hash": "012116149d81a6a8ffca64f67408b9fb",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 86,
"avg_line_length": 26.582278481012658,
"alnum_prop": 0.6933333333333334,
"repo_name": "mitradstuttgart/mitradstuttgart.github.io",
"id": "887d53d90bd26a1461199cfb3b257163d952943e",
"size": "2491",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "11234"
},
{
"name": "HTML",
"bytes": "18825"
},
{
"name": "JavaScript",
"bytes": "8155"
},
{
"name": "Ruby",
"bytes": "3534"
},
{
"name": "Shell",
"bytes": "227"
}
],
"symlink_target": ""
} |
import Mixin from '@ember/object/mixin';
import $ from 'jquery';
export let Serializer = Mixin.create({
getAttrs: function () {
let parentAttrs = this._super();
let attrs = {
project: { serialize: 'odata-id', deserialize: 'records' },
stages: { serialize: false, deserialize: 'records' }
};
return $.extend(true, {}, parentAttrs, attrs);
},
init: function () {
this.set('attrs', this.getAttrs());
this._super(...arguments);
}
});
| {
"content_hash": "88140cd42ab61c98d15b384eb2695283",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 65,
"avg_line_length": 26.444444444444443,
"alnum_prop": 0.6071428571428571,
"repo_name": "Flexberry/ember-flexberry-designer",
"id": "f4ba08f439f21f262d14a8c51850f5c712501e60",
"size": "476",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "addon/mixins/regenerated/serializers/fd-configuration.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "HTML",
"bytes": "2043"
},
{
"name": "Handlebars",
"bytes": "535543"
},
{
"name": "JavaScript",
"bytes": "2851045"
},
{
"name": "Less",
"bytes": "51707"
},
{
"name": "Shell",
"bytes": "2699"
}
],
"symlink_target": ""
} |
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { NotFoundComponent } from './not-found.component';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', component: NotFoundComponent },
])
]
})
export class NotFoundRoutingModule { }
| {
"content_hash": "57999eac4994cf11e3b60af53e6318c9",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 58,
"avg_line_length": 23.615384615384617,
"alnum_prop": 0.6677524429967426,
"repo_name": "zurfyx/memories",
"id": "04b7ce0cd429fde724ab09dada5efe225b0e45b7",
"size": "307",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/app/not-found/not-found-routing.module.ts",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "21476"
},
{
"name": "HTML",
"bytes": "37168"
},
{
"name": "JavaScript",
"bytes": "2228"
},
{
"name": "TypeScript",
"bytes": "129466"
}
],
"symlink_target": ""
} |
echo "UseDNS no" >> /etc/ssh/sshd_config
echo "GSSAPIAuthentication no" >> /etc/ssh/sshd_config
| {
"content_hash": "9ac2a5aab40fac62755d25ef61e1bfda",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 54,
"avg_line_length": 48,
"alnum_prop": 0.7291666666666666,
"repo_name": "tukiyo/my-packer-template-files",
"id": "a4201292972b0e589607a0308a74f2808ceb5686",
"size": "109",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "wheezy/scripts/sshd.sh",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "9671"
},
{
"name": "Shell",
"bytes": "18179"
}
],
"symlink_target": ""
} |
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>Indexed Database Test</title>
<script type="text/javascript;version=1.7">
function testSteps()
{
let request = indexedDB.open("browser_forgetThisSite.js", 11);
request.onerror = grabEventAndContinueHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
let event = yield;
if (event.type == "error") {
testException = event.target.error.name;
}
else {
let db = event.target.result;
testResult = db.version;
event.target.transaction.oncomplete = finishTest;
yield;
}
yield;
}
</script>
<script type="text/javascript;version=1.7" src="browserHelpers.js"></script>
</head>
<body onload="runTest();" onunload="finishTestNow();"></body>
</html>
| {
"content_hash": "4589335c6490b1f44f3cc98d7672a5c9",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 80,
"avg_line_length": 24.41025641025641,
"alnum_prop": 0.6071428571428571,
"repo_name": "sergecodd/FireFox-OS",
"id": "831d0d471c657745d1c0a238861712c6768b7dd2",
"size": "952",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "B2G/gecko/dom/indexedDB/test/browser_forgetThisSiteAdd.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Ada",
"bytes": "443"
},
{
"name": "ApacheConf",
"bytes": "85"
},
{
"name": "Assembly",
"bytes": "5123438"
},
{
"name": "Awk",
"bytes": "46481"
},
{
"name": "Batchfile",
"bytes": "56250"
},
{
"name": "C",
"bytes": "101720951"
},
{
"name": "C#",
"bytes": "38531"
},
{
"name": "C++",
"bytes": "148896543"
},
{
"name": "CMake",
"bytes": "23541"
},
{
"name": "CSS",
"bytes": "2758664"
},
{
"name": "DIGITAL Command Language",
"bytes": "56757"
},
{
"name": "Emacs Lisp",
"bytes": "12694"
},
{
"name": "Erlang",
"bytes": "889"
},
{
"name": "FLUX",
"bytes": "34449"
},
{
"name": "GLSL",
"bytes": "26344"
},
{
"name": "Gnuplot",
"bytes": "710"
},
{
"name": "Groff",
"bytes": "447012"
},
{
"name": "HTML",
"bytes": "43343468"
},
{
"name": "IDL",
"bytes": "1455122"
},
{
"name": "Java",
"bytes": "43261012"
},
{
"name": "JavaScript",
"bytes": "46646658"
},
{
"name": "Lex",
"bytes": "38358"
},
{
"name": "Logos",
"bytes": "21054"
},
{
"name": "Makefile",
"bytes": "2733844"
},
{
"name": "Matlab",
"bytes": "67316"
},
{
"name": "Max",
"bytes": "3698"
},
{
"name": "NSIS",
"bytes": "421625"
},
{
"name": "Objective-C",
"bytes": "877657"
},
{
"name": "Objective-C++",
"bytes": "737713"
},
{
"name": "PHP",
"bytes": "17415"
},
{
"name": "Pascal",
"bytes": "6780"
},
{
"name": "Perl",
"bytes": "1153180"
},
{
"name": "Perl6",
"bytes": "1255"
},
{
"name": "PostScript",
"bytes": "1139"
},
{
"name": "PowerShell",
"bytes": "8252"
},
{
"name": "Protocol Buffer",
"bytes": "26553"
},
{
"name": "Python",
"bytes": "8453201"
},
{
"name": "Ragel in Ruby Host",
"bytes": "3481"
},
{
"name": "Ruby",
"bytes": "5116"
},
{
"name": "Scilab",
"bytes": "7"
},
{
"name": "Shell",
"bytes": "3383832"
},
{
"name": "SourcePawn",
"bytes": "23661"
},
{
"name": "TeX",
"bytes": "879606"
},
{
"name": "WebIDL",
"bytes": "1902"
},
{
"name": "XSLT",
"bytes": "13134"
},
{
"name": "Yacc",
"bytes": "112744"
}
],
"symlink_target": ""
} |
This is my first project
| {
"content_hash": "5f36e3473b7b98a181e77b14921d7b6c",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 24,
"avg_line_length": 25,
"alnum_prop": 0.8,
"repo_name": "iri6e4ka/test-project",
"id": "6cdeeae87bc48684ae824c0a5036e8500055d4a9",
"size": "40",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Python",
"bytes": "5713"
}
],
"symlink_target": ""
} |
<refentry xmlns:src="http://nwalsh.com/xmlns/litprog/fragment"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
id="annotation.js">
<refmeta>
<refentrytitle>annotation.js</refentrytitle>
<refmiscinfo role="type">boolean</refmiscinfo>
</refmeta>
<refnamediv>
<refname>annotation.js</refname>
<refpurpose>Enable annotations?</refpurpose>
</refnamediv>
<refsynopsisdiv>
<src:fragment id='annotation.js.frag'>
<xsl:param name="annotation.js"
select="'http://docbook.sourceforge.net/release/script/AnchorPosition.js
http://docbook.sourceforge.net/release/script/PopupWindow.js'"/>
</src:fragment>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>If <property>annotation.support</property> is enabled and the
document contains <sgmltag>annotation</sgmltag>s, then the URIs listed
in this parameter will be included. These JavaScript files are required
for popup annotation support.</para>
</refsect1>
</refentry>
| {
"content_hash": "b09fbf383aa4640d8636f86ca0e388ad",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 76,
"avg_line_length": 33.03448275862069,
"alnum_prop": 0.7515657620041754,
"repo_name": "conormcd/exemplar",
"id": "8e55879ae2f55c7a00621e9e1a9537d350955863",
"size": "958",
"binary": false,
"copies": "6",
"ref": "refs/heads/master",
"path": "lib/docbook-xsl/params/annotation.js.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Java",
"bytes": "1609415"
},
{
"name": "JavaScript",
"bytes": "89405"
},
{
"name": "Perl",
"bytes": "2756"
},
{
"name": "Shell",
"bytes": "27104"
}
],
"symlink_target": ""
} |
package vorquel.mod.simpleskygrid.config.prototype.point;
import net.minecraft.util.math.BlockPos;
import vorquel.mod.simpleskygrid.config.SimpleSkyGridConfigReader;
import vorquel.mod.simpleskygrid.world.generated.random.IRandom;
import vorquel.mod.simpleskygrid.world.generated.random.SingleValue;
public class PSinglePoint extends PPoint {
private BlockPos value;
public PSinglePoint(SimpleSkyGridConfigReader reader) {
super(reader);
}
@Override
protected void readLabel(SimpleSkyGridConfigReader reader, String label) {
switch(label) {
case "point": value = readPoint(reader); break;
default: reader.unknownOnce("label " + label, "single point definition");
}
}
@Override
public boolean isComplete() {
return value != null;
}
@Override
public IRandom<BlockPos> getObject() {
return new SingleValue<>(value);
}
}
| {
"content_hash": "d1861c95cd41d7d2c4b7c79ac1050427",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 85,
"avg_line_length": 28.363636363636363,
"alnum_prop": 0.7019230769230769,
"repo_name": "vorquel/SimpleSkyGrid",
"id": "39b22264c583417d0891563f688e2d643cfbb3cc",
"size": "936",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/main/java/vorquel/mod/simpleskygrid/config/prototype/point/PSinglePoint.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "114461"
}
],
"symlink_target": ""
} |
package pl.pg.gda.eti.kio.esc.bayes;
import pl.pg.gda.eti.kio.esc.data.Tuple;
import pl.pg.gda.eti.kio.esc.data.WordFeature;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author Wojciech Stanisławski
* @since 12.01.17
*/
public class BayesWordInCategoryCounter {
private BufferedReader simpleArtCatReader;
private BufferedReader simpleFeatureReader;
public /* kluczem jest nazwa kategorii */ Map<String, WordsInCategory> countWordsInCategories(String artCatFileName, String featureFileName, List<WordFeature> dictionary) throws IOException {
Map<String, WordsInCategory> resultMap = new TreeMap<>();
simpleFeatureReader = new BufferedReader(new FileReader(featureFileName));
String line;
while ((line = simpleFeatureReader.readLine()) != null) {
if(line.isEmpty() || !line.contains("#")) {
continue;
}
String artName = line.substring(0, line.indexOf('#'));
// find words
List<Tuple<String, Double>> foundWords = new ArrayList<>();
double sum = findWordsInArticle(line, foundWords);
// find category
String catName = findCategory(artCatFileName, artName);
if(catName != null) {
WordsInCategory value;
if(resultMap.containsKey(catName)) {
value = resultMap.get(catName);
}
else {
value = new WordsInCategory();
value.wordCountInThisCategory = new TreeMap<>();
}
if(BayesClassifier.USE_TFIDF) {
value.sumWordCountInThisCategory += sum;
}
else {
value.sumWordCountInThisCategory += foundWords.size();
}
for(Tuple<String, Double> wordWithTfIdf : foundWords) {
String word = wordWithTfIdf.getKey();
Optional<WordFeature> feature = dictionary.stream().filter(f -> word.equals(f.getSimpleId())).findAny();
if(feature.isPresent()) {
double newValue = 1;
if(BayesClassifier.USE_TFIDF) {
newValue = wordWithTfIdf.getValue().doubleValue();
}
if (value.wordCountInThisCategory.containsKey(feature.get())) {
Double oldCount = value.wordCountInThisCategory.get(feature.get());
value.wordCountInThisCategory.put(feature.get(), oldCount + newValue);
} else {
value.wordCountInThisCategory.put(feature.get(), newValue);
}
}
}
resultMap.put(catName, value);
}
}
simpleFeatureReader.close();
return resultMap;
}
private double findWordsInArticle(String articleString, List<Tuple<String, Double>> foundWords) {
String wordsStr = articleString.substring(articleString.indexOf('#') + 1);
String[] words = wordsStr.split(" ");
double wordCount = 0;
for(String word: words) {
double tfidf = Double.parseDouble(word.substring(word.indexOf('-') + 1));
foundWords.add(new Tuple<String, Double>(word.substring(0, word.indexOf('-')), tfidf));
wordCount += tfidf;
}
return wordCount;
}
private String findCategory(String artCatFileName, String artName) throws IOException {
simpleArtCatReader = new BufferedReader(new FileReader(artCatFileName));
String catName = null;
String artLine;
while ((artLine = simpleArtCatReader.readLine()) != null) {
if(artLine.startsWith(artName)) {
artLine = artLine.substring(artLine.indexOf('\t') + 1);
if(artLine.contains("\t")) {
catName = artLine.substring(0, artLine.indexOf('\t'));
}
else {
catName = artLine.trim();
}
}
}
simpleArtCatReader.close();
return catName;
}
public class WordsInCategory {
public String category;
public /* kluczem jest nazwa słowa */ Map<WordFeature, Double> wordCountInThisCategory;
public double sumWordCountInThisCategory;
@Override
public String toString() {
return "WordsInCategory{" +
"category='" + category + '\'' +
", wordCountInThisCategory=" + wordCountInThisCategory +
", sumWordCountInThisCategory=" + sumWordCountInThisCategory +
'}';
}
}
}
| {
"content_hash": "427818eb7759e610fafc505c14387146",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 192,
"avg_line_length": 31.385826771653544,
"alnum_prop": 0.6979427997992975,
"repo_name": "inverted-anti-gravity-cheese-jr/en-simple-wiki",
"id": "36f5ed169574646914a9ad0a5ad623b0a97346b6",
"size": "3988",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "esc/src/main/java/pl/pg/gda/eti/kio/esc/bayes/BayesWordInCategoryCounter.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "64742"
},
{
"name": "Shell",
"bytes": "123"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<!--
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.2.0
Version: 3.2.0
Author: KeenThemes
Website: http://www.keenthemes.com/
Contact: support@keenthemes.com
Follow: www.twitter.com/keenthemes
Like: www.facebook.com/keenthemes
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
-->
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8"/>
<title>Metronic | UI Features - Page Progress Bar</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta content="" name="description"/>
<meta content="" name="author"/>
<!-- BEGIN PACE PLUGIN FILES -->
<script src="../../assets/global/plugins/pace/pace.min.js" type="text/javascript"></script>
<link href="../../assets/global/plugins/pace/themes/pace-theme-flash.css" rel="stylesheet" type="text/css"/>
<!-- END PACE PLUGIN FILES -->
<!-- BEGIN GLOBAL MANDATORY STYLES -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css"/>
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN THEME STYLES -->
<link href="../../assets/global/css/components.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/global/css/plugins.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/admin/layout2/css/layout.css" rel="stylesheet" type="text/css"/>
<link id="style_color" href="../../assets/admin/layout2/css/themes/default.css" rel="stylesheet" type="text/css"/>
<link href="../../assets/admin/layout2/css/custom.css" rel="stylesheet" type="text/css"/>
<!-- END THEME STYLES -->
<link rel="shortcut icon" href="favicon.ico"/>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<!-- DOC: Apply "page-header-fixed-mobile" and "page-footer-fixed-mobile" class to body element to force fixed header or footer in mobile devices -->
<!-- DOC: Apply "page-sidebar-closed" class to the body and "page-sidebar-menu-closed" class to the sidebar menu element to hide the sidebar by default -->
<!-- DOC: Apply "page-sidebar-hide" class to the body to make the sidebar completely hidden on toggle -->
<!-- DOC: Apply "page-sidebar-closed-hide-logo" class to the body element to make the logo hidden on sidebar toggle -->
<!-- DOC: Apply "page-sidebar-hide" class to body element to completely hide the sidebar on sidebar toggle -->
<!-- DOC: Apply "page-sidebar-fixed" class to have fixed sidebar -->
<!-- DOC: Apply "page-footer-fixed" class to the body element to have fixed footer -->
<!-- DOC: Apply "page-sidebar-reversed" class to put the sidebar on the right side -->
<!-- DOC: Apply "page-full-width" class to the body element to have full width page without the sidebar menu -->
<body class="page-boxed page-header-fixed page-container-bg-solid page-sidebar-closed-hide-logo ">
<!-- BEGIN HEADER -->
<div class="page-header navbar navbar-fixed-top">
<!-- BEGIN HEADER INNER -->
<div class="page-header-inner container">
<!-- BEGIN LOGO -->
<div class="page-logo">
<a href="index.html">
<img src="../../assets/admin/layout2/img/logo-default.png" alt="logo" class="logo-default"/>
</a>
<div class="menu-toggler sidebar-toggler">
<!-- DOC: Remove the above "hide" to enable the sidebar toggler button on header -->
</div>
</div>
<!-- END LOGO -->
<!-- BEGIN RESPONSIVE MENU TOGGLER -->
<a href="javascript:;" class="menu-toggler responsive-toggler" data-toggle="collapse" data-target=".navbar-collapse">
</a>
<!-- END RESPONSIVE MENU TOGGLER -->
<!-- BEGIN PAGE ACTIONS -->
<!-- DOC: Remove "hide" class to enable the page header actions -->
<div class="page-actions hide">
<div class="btn-group">
<button type="button" class="btn btn-circle red-pink dropdown-toggle" data-toggle="dropdown">
<i class="icon-bar-chart"></i> <span class="hidden-sm hidden-xs">New </span> <i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#">
<i class="icon-user"></i> New User </a>
</li>
<li>
<a href="#">
<i class="icon-present"></i> New Event <span class="badge badge-success">4</span>
</a>
</li>
<li>
<a href="#">
<i class="icon-basket"></i> New order </a>
</li>
<li class="divider">
</li>
<li>
<a href="#">
<i class="icon-flag"></i> Pending Orders <span class="badge badge-danger">4</span>
</a>
</li>
<li>
<a href="#">
<i class="icon-users"></i> Pending Users <span class="badge badge-warning">12</span>
</a>
</li>
</ul>
</div>
<div class="btn-group">
<button type="button" class="btn btn-circle green-haze dropdown-toggle" data-toggle="dropdown">
<i class="icon-bell"></i> <span class="hidden-sm hidden-xs">Post </span> <i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#">
<i class="icon-docs"></i> New Post </a>
</li>
<li>
<a href="#">
<i class="icon-tag"></i> New Comment </a>
</li>
<li>
<a href="#">
<i class="icon-share"></i> Share </a>
</li>
<li class="divider">
</li>
<li>
<a href="#">
<i class="icon-flag"></i> Comments <span class="badge badge-success">4</span>
</a>
</li>
<li>
<a href="#">
<i class="icon-users"></i> Feedbacks <span class="badge badge-danger">2</span>
</a>
</li>
</ul>
</div>
</div>
<!-- END PAGE ACTIONS -->
<!-- BEGIN PAGE TOP -->
<div class="page-top">
<!-- BEGIN HEADER SEARCH BOX -->
<!-- DOC: Apply "search-form-expanded" right after the "search-form" class to have half expanded search box -->
<form class="search-form search-form-expanded" action="extra_search.html" method="GET">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search..." name="query">
<span class="input-group-btn">
<a href="javascript:;" class="btn submit"><i class="icon-magnifier"></i></a>
</span>
</div>
</form>
<!-- END HEADER SEARCH BOX -->
<!-- BEGIN TOP NAVIGATION MENU -->
<div class="top-menu">
<ul class="nav navbar-nav pull-right">
<!-- BEGIN NOTIFICATION DROPDOWN -->
<li class="dropdown dropdown-extended dropdown-notification" id="header_notification_bar">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-bell"></i>
<span class="badge badge-danger">
7 </span>
</a>
<ul class="dropdown-menu">
<li>
<p>
You have 14 new notifications
</p>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 250px;">
<li>
<a href="#">
<span class="label label-sm label-icon label-success">
<i class="fa fa-plus"></i>
</span>
New user registered. <span class="time">
Just now </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
Server #12 overloaded. <span class="time">
15 mins </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-warning">
<i class="fa fa-bell-o"></i>
</span>
Server #2 not responding. <span class="time">
22 mins </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-info">
<i class="fa fa-bullhorn"></i>
</span>
Application error. <span class="time">
40 mins </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
Database overloaded 68%. <span class="time">
2 hrs </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
2 user IP blocked. <span class="time">
5 hrs </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-warning">
<i class="fa fa-bell-o"></i>
</span>
Storage Server #4 not responding. <span class="time">
45 mins </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-info">
<i class="fa fa-bullhorn"></i>
</span>
System Error. <span class="time">
55 mins </span>
</a>
</li>
<li>
<a href="#">
<span class="label label-sm label-icon label-danger">
<i class="fa fa-bolt"></i>
</span>
Database overloaded 68%. <span class="time">
2 hrs </span>
</a>
</li>
</ul>
</li>
<li class="external">
<a href="#">
See all notifications <i class="icon-arrow-right"></i>
</a>
</li>
</ul>
</li>
<!-- END NOTIFICATION DROPDOWN -->
<!-- BEGIN INBOX DROPDOWN -->
<li class="dropdown dropdown-extended dropdown-inbox" id="header_inbox_bar">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-envelope-open"></i>
<span class="badge badge-primary">
4 </span>
</a>
<ul class="dropdown-menu">
<li>
<p>
You have 12 new messages
</p>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 250px;">
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout2/img/avatar2.jpg" alt=""/>
</span>
<span class="subject">
<span class="from">
Lisa Wong </span>
<span class="time">
Just Now </span>
</span>
<span class="message">
Vivamus sed auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout2/img/avatar3.jpg" alt=""/>
</span>
<span class="subject">
<span class="from">
Richard Doe </span>
<span class="time">
16 mins </span>
</span>
<span class="message">
Vivamus sed congue nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout2/img/avatar1.jpg" alt=""/>
</span>
<span class="subject">
<span class="from">
Bob Nilson </span>
<span class="time">
2 hrs </span>
</span>
<span class="message">
Vivamus sed nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout2/img/avatar2.jpg" alt=""/>
</span>
<span class="subject">
<span class="from">
Lisa Wong </span>
<span class="time">
40 mins </span>
</span>
<span class="message">
Vivamus sed auctor 40% nibh congue nibh... </span>
</a>
</li>
<li>
<a href="inbox.html?a=view">
<span class="photo">
<img src="../../assets/admin/layout2/img/avatar3.jpg" alt=""/>
</span>
<span class="subject">
<span class="from">
Richard Doe </span>
<span class="time">
46 mins </span>
</span>
<span class="message">
Vivamus sed congue nibh auctor nibh congue nibh. auctor nibh auctor nibh... </span>
</a>
</li>
</ul>
</li>
<li class="external">
<a href="inbox.html">
See all messages <i class="icon-arrow-right"></i>
</a>
</li>
</ul>
</li>
<!-- END INBOX DROPDOWN -->
<!-- BEGIN TODO DROPDOWN -->
<li class="dropdown dropdown-extended dropdown-tasks" id="header_task_bar">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<i class="icon-calendar"></i>
<span class="badge badge-success">
3 </span>
</a>
<ul class="dropdown-menu extended tasks">
<li>
<p>
You have 12 pending tasks
</p>
</li>
<li>
<ul class="dropdown-menu-list scroller" style="height: 250px;">
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
New release v1.2 </span>
<span class="percent">
30% </span>
</span>
<div class="progress">
<div style="width: 40%;" class="progress-bar progress-bar-success" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
40% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
Application deployment </span>
<span class="percent">
65% </span>
</span>
<div class="progress progress-striped">
<div style="width: 65%;" class="progress-bar progress-bar-danger" aria-valuenow="65" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
65% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
Mobile app release </span>
<span class="percent">
98% </span>
</span>
<div class="progress">
<div style="width: 98%;" class="progress-bar progress-bar-success" aria-valuenow="98" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
98% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
Database migration </span>
<span class="percent">
10% </span>
</span>
<div class="progress progress-striped">
<div style="width: 10%;" class="progress-bar progress-bar-warning" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
10% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
Web server upgrade </span>
<span class="percent">
58% </span>
</span>
<div class="progress progress-striped">
<div style="width: 58%;" class="progress-bar progress-bar-info" aria-valuenow="58" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
58% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
Mobile development </span>
<span class="percent">
85% </span>
</span>
<div class="progress progress-striped">
<div style="width: 85%;" class="progress-bar progress-bar-success" aria-valuenow="85" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
85% Complete
</div>
</div>
</div>
</a>
</li>
<li>
<a href="page_todo.html">
<span class="task">
<span class="desc">
New UI release </span>
<span class="percent">
18% </span>
</span>
<div class="progress progress-striped">
<div style="width: 18%;" class="progress-bar progress-bar-important" aria-valuenow="18" aria-valuemin="0" aria-valuemax="100">
<div class="sr-only">
18% Complete
</div>
</div>
</div>
</a>
</li>
</ul>
</li>
<li class="external">
<a href="page_todo.html">
See all tasks <i class="icon-arrow-right"></i>
</a>
</li>
</ul>
</li>
<!-- END TODO DROPDOWN -->
<!-- BEGIN QUICK SIDEBAR TOGGLER -->
<li class="dropdown dropdown-quick-sidebar-toggler hide">
<a href="javascript:;" class="dropdown-toggle">
<i class="icon-logout"></i>
</a>
</li>
<!-- END QUICK SIDEBAR TOGGLER -->
<!-- BEGIN USER LOGIN DROPDOWN -->
<li class="dropdown dropdown-user">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-close-others="true">
<img alt="" class="img-circle hide1" src="../../assets/admin/layout/img/avatar3_small.jpg"/>
<span class="username username-hide-on-mobile">
Bob </span>
<i class="fa fa-angle-down"></i>
</a>
<ul class="dropdown-menu">
<li>
<a href="extra_profile.html">
<i class="icon-user"></i> My Profile </a>
</li>
<li>
<a href="page_calendar.html">
<i class="icon-calendar"></i> My Calendar </a>
</li>
<li>
<a href="inbox.html">
<i class="icon-envelope-open"></i> My Inbox <span class="badge badge-danger">
3 </span>
</a>
</li>
<li>
<a href="page_todo.html">
<i class="icon-rocket"></i> My Tasks <span class="badge badge-success">
7 </span>
</a>
</li>
<li class="divider">
</li>
<li>
<a href="extra_lock.html">
<i class="icon-lock"></i> Lock Screen </a>
</li>
<li>
<a href="login.html">
<i class="icon-key"></i> Log Out </a>
</li>
</ul>
</li>
<!-- END USER LOGIN DROPDOWN -->
</ul>
</div>
<!-- END TOP NAVIGATION MENU -->
</div>
<!-- END PAGE TOP -->
</div>
<!-- END HEADER INNER -->
</div>
<!-- END HEADER -->
<div class="clearfix">
</div>
<div class="container">
<!-- BEGIN CONTAINER -->
<div class="page-container">
<!-- BEGIN SIDEBAR -->
<div class="page-sidebar-wrapper">
<!-- DOC: Set data-auto-scroll="false" to disable the sidebar from auto scrolling/focusing -->
<!-- DOC: Change data-auto-speed="200" to adjust the sub menu slide up/down speed -->
<div class="page-sidebar navbar-collapse collapse">
<!-- BEGIN SIDEBAR MENU -->
<ul class="page-sidebar-menu page-sidebar-menu-hover-submenu " data-auto-scroll="true" data-slide-speed="200">
<li class="start ">
<a href="index.html">
<i class="icon-home"></i>
<span class="title">Dashboard</span>
</a>
</li>
<li>
<a href="javascript:;">
<i class="icon-basket"></i>
<span class="title">eCommerce</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="ecommerce_index.html">
<i class="icon-home"></i>
Dashboard</a>
</li>
<li>
<a href="ecommerce_orders.html">
<i class="icon-basket"></i>
Orders</a>
</li>
<li>
<a href="ecommerce_orders_view.html">
<i class="icon-tag"></i>
Order View</a>
</li>
<li>
<a href="ecommerce_products.html">
<i class="icon-handbag"></i>
Products</a>
</li>
<li>
<a href="ecommerce_products_edit.html">
<i class="icon-pencil"></i>
Product Edit</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-rocket"></i>
<span class="title">Page Layouts</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="layout_fontawesome_icons.html">
<span class="badge badge-roundless badge-danger">new</span>Layout with Fontawesome Icons</a>
</li>
<li>
<a href="layout_glyphicons.html">
Layout with Glyphicon</a>
</li>
<li>
<a href="layout_full_height_content.html">
<span class="badge badge-roundless badge-warning">new</span>Full Height Content</a>
</li>
<li>
<a href="layout_sidebar_reversed.html">
<span class="badge badge-roundless badge-warning">new</span>Right Sidebar Page</a>
</li>
<li>
<a href="layout_sidebar_fixed.html">
Sidebar Fixed Page</a>
</li>
<li>
<a href="layout_sidebar_closed.html">
Sidebar Closed Page</a>
</li>
<li>
<a href="layout_ajax.html">
Content Loading via Ajax</a>
</li>
<li>
<a href="layout_disabled_menu.html">
Disabled Menu Links</a>
</li>
<li>
<a href="layout_blank_page.html">
Blank Page</a>
</li>
<li>
<a href="layout_fluid_page.html">
Fluid Page</a>
</li>
<li>
<a href="layout_language_bar.html">
Language Switch Bar</a>
</li>
</ul>
</li>
<!-- BEGIN FRONTEND THEME LINKS -->
<li>
<a href="javascript:;">
<i class="icon-star"></i>
<span class="title">
Frontend Themes </span>
<span class="arrow">
</span>
</a>
<ul class="sub-menu">
<li class="tooltips" data-container="body" data-placement="right" data-html="true" data-original-title="Complete eCommerce Frontend Theme For Metronic Admin">
<a href="http://keenthemes.com/preview/metronic/theme/templates/frontend/shop-index.html" target="_blank">
<span class="title">
eCommerce Frontend </span>
</a>
</li>
<li class="tooltips" data-container="body" data-placement="right" data-html="true" data-original-title="Complete Corporate Frontend Theme For Metronic Admin">
<a href="http://keenthemes.com/preview/metronic/theme/templates/frontend/" target="_blank">
<span class="title">
Corporate Frontend </span>
</a>
</li>
<li class="tooltips" data-container="body" data-placement="right" data-html="true" data-original-title="Complete One Page Parallax Frontend Theme For Metronic Admin">
<a href="http://keenthemes.com/preview/metronic/theme/templates/frontend/onepage-index.html" target="_blank">
<span class="title">
One Page Parallax Frontend </span>
</a>
</li>
</ul>
</li>
<!-- END FRONTEND THEME LINKS -->
<li class="active open">
<a href="javascript:;">
<i class="icon-diamond"></i>
<span class="title">UI Features</span>
<span class="selected"></span>
<span class="arrow open"></span>
</a>
<ul class="sub-menu">
<li>
<a href="ui_general.html">
General Components</a>
</li>
<li>
<a href="ui_buttons.html">
Buttons</a>
</li>
<li>
<a href="ui_icons.html">
<span class="badge badge-roundless badge-danger">new</span>Font Icons</a>
</li>
<li>
<a href="ui_colors.html">
Flat UI Colors</a>
</li>
<li>
<a href="ui_typography.html">
Typography</a>
</li>
<li>
<a href="ui_tabs_accordions_navs.html">
Tabs, Accordions & Navs</a>
</li>
<li>
<a href="ui_tree.html">
<span class="badge badge-roundless badge-danger">new</span>Tree View</a>
</li>
<li class="active">
<a href="ui_page_progress_style_1.html">
<span class="badge badge-roundless badge-warning">new</span>Page Progress Bar</a>
</li>
<li>
<a href="ui_blockui.html">
Block UI</a>
</li>
<li>
<a href="ui_notific8.html">
Notific8 Notifications</a>
</li>
<li>
<a href="ui_toastr.html">
Toastr Notifications</a>
</li>
<li>
<a href="ui_alert_dialog_api.html">
<span class="badge badge-roundless badge-danger">new</span>Alerts & Dialogs API</a>
</li>
<li>
<a href="ui_session_timeout.html">
Session Timeout</a>
</li>
<li>
<a href="ui_idle_timeout.html">
User Idle Timeout</a>
</li>
<li>
<a href="ui_modals.html">
Modals</a>
</li>
<li>
<a href="ui_extended_modals.html">
Extended Modals</a>
</li>
<li>
<a href="ui_tiles.html">
Tiles</a>
</li>
<li>
<a href="ui_datepaginator.html">
<span class="badge badge-roundless badge-success">new</span>Date Paginator</a>
</li>
<li>
<a href="ui_nestable.html">
Nestable List</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-puzzle"></i>
<span class="title">UI Components</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="components_pickers.html">
Pickers</a>
</li>
<li>
<a href="components_dropdowns.html">
Custom Dropdowns</a>
</li>
<li>
<a href="components_form_tools.html">
Form Tools</a>
</li>
<li>
<a href="components_editors.html">
Markdown & WYSIWYG Editors</a>
</li>
<li>
<a href="components_ion_sliders.html">
Ion Range Sliders</a>
</li>
<li>
<a href="components_noui_sliders.html">
NoUI Range Sliders</a>
</li>
<li>
<a href="components_jqueryui_sliders.html">
jQuery UI Sliders</a>
</li>
<li>
<a href="components_knob_dials.html">
Knob Circle Dials</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-settings"></i>
<span class="title">Form Stuff</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="form_controls.html">
Form Controls</a>
</li>
<li>
<a href="form_layouts.html">
Form Layouts</a>
</li>
<li>
<a href="form_editable.html">
<span class="badge badge-roundless badge-warning">new</span>Form X-editable</a>
</li>
<li>
<a href="form_wizard.html">
Form Wizard</a>
</li>
<li>
<a href="form_validation.html">
Form Validation</a>
</li>
<li>
<a href="form_image_crop.html">
<span class="badge badge-roundless badge-danger">new</span>Image Cropping</a>
</li>
<li>
<a href="form_fileupload.html">
Multiple File Upload</a>
</li>
<li>
<a href="form_dropzone.html">
Dropzone File Upload</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-briefcase"></i>
<span class="title">Data Tables</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="table_basic.html">
Basic Datatables</a>
</li>
<li>
<a href="table_responsive.html">
Responsive Datatables</a>
</li>
<li>
<a href="table_managed.html">
Managed Datatables</a>
</li>
<li>
<a href="table_editable.html">
Editable Datatables</a>
</li>
<li>
<a href="table_advanced.html">
Advanced Datatables</a>
</li>
<li>
<a href="table_ajax.html">
Ajax Datatables</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-wallet"></i>
<span class="title">Portlets</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="portlet_general.html">
General Portlets</a>
</li>
<li>
<a href="portlet_general2.html">
<span class="badge badge-roundless badge-danger">new</span>New Portlets #1</a>
</li>
<li>
<a href="portlet_general3.html">
<span class="badge badge-roundless badge-danger">new</span>New Portlets #2</a>
</li>
<li>
<a href="portlet_ajax.html">
Ajax Portlets</a>
</li>
<li>
<a href="portlet_draggable.html">
Draggable Portlets</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-docs"></i>
<span class="title">Pages</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="page_todo.html">
<i class="icon-hourglass"></i>
<span class="badge badge-danger">4</span>Todo</a>
</li>
<li>
<a href="inbox.html">
<i class="icon-envelope"></i>
<span class="badge badge-danger">4</span>Inbox</a>
</li>
<li>
<a href="extra_profile.html">
<i class="icon-user-following"></i>
User Profile</a>
</li>
<li>
<a href="extra_lock.html">
<i class="icon-lock"></i>
Lock Screen</a>
</li>
<li>
<a href="extra_faq.html">
<i class="icon-info"></i>
FAQ</a>
</li>
<li>
<a href="page_portfolio.html">
<i class="icon-feed"></i>
Portfolio</a>
</li>
<li>
<a href="page_timeline.html">
<i class="icon-clock"></i>
<span class="badge badge-info">4</span>Timeline</a>
</li>
<li>
<a href="page_coming_soon.html">
<i class="icon-flag"></i>
Coming Soon</a>
</li>
<li>
<a href="page_calendar.html">
<i class="icon-calendar"></i>
<span class="badge badge-danger">14</span>Calendar</a>
</li>
<li>
<a href="extra_invoice.html">
<i class="icon-flag"></i>
Invoice</a>
</li>
<li>
<a href="page_blog.html">
<i class="icon-speech"></i>
Blog</a>
</li>
<li>
<a href="page_blog_item.html">
<i class="icon-link"></i>
Blog Post</a>
</li>
<li>
<a href="page_news.html">
<i class="icon-eye"></i>
<span class="badge badge-success">9</span>News</a>
</li>
<li>
<a href="page_news_item.html">
<i class="icon-bell"></i>
News View</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-present"></i>
<span class="title">Extra</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="page_about.html">
About Us</a>
</li>
<li>
<a href="page_contact.html">
Contact Us</a>
</li>
<li>
<a href="extra_search.html">
Search Results</a>
</li>
<li>
<a href="extra_pricing_table.html">
Pricing Tables</a>
</li>
<li>
<a href="extra_404_option1.html">
404 Page Option 1</a>
</li>
<li>
<a href="extra_404_option2.html">
404 Page Option 2</a>
</li>
<li>
<a href="extra_404_option3.html">
404 Page Option 3</a>
</li>
<li>
<a href="extra_500_option1.html">
500 Page Option 1</a>
</li>
<li>
<a href="extra_500_option2.html">
500 Page Option 2</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-folder"></i>
<span class="title">Multi Level Menu</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="javascript:;">
<i class="icon-settings"></i> Item 1 <span class="arrow"></span>
</a>
<ul class="sub-menu">
<li>
<a href="javascript:;">
<i class="icon-user"></i>
Sample Link 1 <span class="arrow"></span>
</a>
<ul class="sub-menu">
<li>
<a href="#"><i class="icon-power"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-paper-plane"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-star"></i> Sample Link 1</a>
</li>
</ul>
</li>
<li>
<a href="#"><i class="icon-camera"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-link"></i> Sample Link 2</a>
</li>
<li>
<a href="#"><i class="icon-pointer"></i> Sample Link 3</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-globe"></i> Item 2 <span class="arrow"></span>
</a>
<ul class="sub-menu">
<li>
<a href="#"><i class="icon-tag"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-pencil"></i> Sample Link 1</a>
</li>
<li>
<a href="#"><i class="icon-graph"></i> Sample Link 1</a>
</li>
</ul>
</li>
<li>
<a href="#">
<i class="icon-bar-chart"></i>
Item 3 </a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-user"></i>
<span class="title">Login Options</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="login.html">
Login Form 1</a>
</li>
<li>
<a href="login_soft.html">
Login Form 2</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-envelope-open"></i>
<span class="title">Email Templates</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="email_newsletter.html">
Responsive Newsletter<br>
Email Template</a>
</li>
<li>
<a href="email_system.html">
Responsive System<br>
Email Template</a>
</li>
</ul>
</li>
<li>
<a href="javascript:;">
<i class="icon-pointer"></i>
<span class="title">Maps</span>
<span class="arrow "></span>
</a>
<ul class="sub-menu">
<li>
<a href="maps_google.html">
Google Maps</a>
</li>
<li>
<a href="maps_vector.html">
Vector Maps</a>
</li>
</ul>
</li>
<li class="last ">
<a href="charts.html">
<i class="icon-bar-chart"></i>
<span class="title">Visual Charts</span>
</a>
</li>
</ul>
<!-- END SIDEBAR MENU -->
</div>
</div>
<!-- END SIDEBAR -->
<!-- BEGIN CONTENT -->
<div class="page-content-wrapper">
<div class="page-content">
<!-- BEGIN SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<div class="modal fade" id="portlet-config" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
Widget settings form goes here
</div>
<div class="modal-footer">
<button type="button" class="btn blue">Save changes</button>
<button type="button" class="btn default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- END SAMPLE PORTLET CONFIGURATION MODAL FORM-->
<!-- BEGIN STYLE CUSTOMIZER -->
<div class="theme-panel">
<div class="toggler tooltips" data-container="body" data-placement="left" data-html="true" data-original-title="Click to open advance theme customizer panel">
<i class="icon-settings"></i>
</div>
<div class="toggler-close">
<i class="icon-close"></i>
</div>
<div class="theme-options">
<div class="theme-option theme-colors clearfix">
<span>
THEME COLOR </span>
<ul>
<li class="color-default current tooltips" data-style="default" data-container="body" data-original-title="Default">
</li>
<li class="color-grey tooltips" data-style="grey" data-container="body" data-original-title="Grey">
</li>
<li class="color-blue tooltips" data-style="blue" data-container="body" data-original-title="Blue">
</li>
<li class="color-dark tooltips" data-style="dark" data-container="body" data-original-title="Dark">
</li>
<li class="color-light tooltips" data-style="light" data-container="body" data-original-title="Light">
</li>
</ul>
</div>
<div class="theme-option">
<span>
Layout </span>
<select class="layout-option form-control input-small">
<option value="fluid" selected="selected">Fluid</option>
<option value="boxed">Boxed</option>
</select>
</div>
<div class="theme-option">
<span>
Header </span>
<select class="page-header-option form-control input-small">
<option value="fixed" selected="selected">Fixed</option>
<option value="default">Default</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Mode</span>
<select class="sidebar-option form-control input-small">
<option value="fixed">Fixed</option>
<option value="default" selected="selected">Default</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Style</span>
<select class="sidebar-style-option form-control input-small">
<option value="default" selected="selected">Default</option>
<option value="compact">Compact</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Menu </span>
<select class="sidebar-menu-option form-control input-small">
<option value="accordion" selected="selected">Accordion</option>
<option value="hover">Hover</option>
</select>
</div>
<div class="theme-option">
<span>
Sidebar Position </span>
<select class="sidebar-pos-option form-control input-small">
<option value="left" selected="selected">Left</option>
<option value="right">Right</option>
</select>
</div>
<div class="theme-option">
<span>
Footer </span>
<select class="page-footer-option form-control input-small">
<option value="fixed">Fixed</option>
<option value="default" selected="selected">Default</option>
</select>
</div>
<div class="theme-option">
<a href="{RTL_LTR_URL}" target="_blank" class="btn red-sunglo btn-block"><i class="icon-link"></i> Full RTL Version!</a></a>
</div>
</div>
</div>
<!-- END STYLE CUSTOMIZER -->
<!-- BEGIN PAGE HEADER-->
<h3 class="page-title">
Page Progress Bar <small>an automatic web page progress bar</small>
</h3>
<div class="page-bar">
<ul class="page-breadcrumb">
<li>
<i class="fa fa-home"></i>
<a href="index.html">Home</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a href="#">UI Features</a>
<i class="fa fa-angle-right"></i>
</li>
<li>
<a href="#">Page Progress Bar</a>
</li>
</ul>
<div class="page-toolbar">
<div class="btn-group pull-right">
<button type="button" class="btn btn-fit-height grey-salt dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true">
Actions <i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu pull-right" role="menu">
<li>
<a href="#">Action</a>
</li>
<li>
<a href="#">Another action</a>
</li>
<li>
<a href="#">Something else here</a>
</li>
<li class="divider">
</li>
<li>
<a href="#">Separated link</a>
</li>
</ul>
</div>
</div>
</div>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<div class="row">
<div class="col-md-12">
<div class="note note-danger note-bordered">
<h4 class="block">Pace</h4>
<p>
An automatic web page progress bar. Pace will automatically monitor your Ajax requests, event loop lag, document ready state and elements on your page to decide on the progress. For more info check the plugin documentation <a href="http://github.hubspot.com/pace" target="_blank">
here </a>
</p>
</div>
<!-- BEGIN PORTLET-->
<div class="portlet box blue-hoki">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>Pace Themes
</div>
<div class="tools">
<a href="javascript:;" class="collapse">
</a>
<a href="javascript:;" class="reload">
</a>
</div>
</div>
<div class="portlet-body">
<table class="table table-hover table-striped table-bordered">
<tr class="active">
<td>
Default Example With Spinner <code>pace-theme-flash.css</code>
</td>
<td>
<a class="btn blue" href="ui_page_progress_style_1.html">
View Demo </a>
</td>
</tr>
<tr>
<td>
"Barber Shop" Over Header <code>pace-theme-barber-shop.css</code>
</td>
<td>
<a class="btn default" href="ui_page_progress_style_2.html">
View Demo </a>
</td>
</tr>
<tr>
<td>
Big Counter <code>pace-theme-big-counter.css</code>
</td>
<td>
<a class="btn default" href="ui_page_progress_style_3.html">
View Demo </a>
</td>
</tr>
<tr>
<td>
Minimal Example Without Spinner <code>pace-theme-minimal.css</code>
</td>
<td>
<a class="btn default" href="ui_page_progress_style_4.html">
View Demo </a>
</td>
</tr>
</table>
</div>
</div>
<!-- END PORTLET-->
</div>
</div>
<!-- END PAGE CONTENT-->
</div>
</div>
<!-- END CONTENT -->
<!-- BEGIN QUICK SIDEBAR -->
<!--Cooming Soon...-->
<!-- END QUICK SIDEBAR -->
</div>
<!-- END CONTAINER -->
<!-- BEGIN FOOTER -->
<div class="page-footer">
<div class="page-footer-inner">
2014 © Metronic by keenthemes.
</div>
<div class="scroll-to-top">
<i class="icon-arrow-up"></i>
</div>
</div>
<!-- END FOOTER -->
</div>
<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<!--[if lt IE 9]>
<script src="../../assets/global/plugins/respond.min.js"></script>
<script src="../../assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
<script src="../../assets/global/plugins/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui-1.10.3.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script src="../../assets/global/plugins/jquery-ui/jquery-ui-1.10.3.custom.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="../../assets/global/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="../../assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="../../assets/admin/layout2/scripts/layout.js" type="text/javascript"></script>
<script src="../../assets/admin/layout2/scripts/demo.js" type="text/javascript"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script>
jQuery(document).ready(function() {
// initiate layout and plugins
Metronic.init(); // init metronic core components
Layout.init(); // init current layout
Demo.init(); // init demo features
});
</script>
<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html> | {
"content_hash": "033ceb1c406240d53c2a9d18869157d2",
"timestamp": "",
"source": "github",
"line_count": 1464,
"max_line_length": 289,
"avg_line_length": 33.21379781420765,
"alnum_prop": 0.5071053984575835,
"repo_name": "miragecentury/BPCA3",
"id": "357d6d423374a825450a374c08c028d2b3c1f501",
"size": "48625",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "public/templates/admin2/ui_page_progress_style_1.html",
"mode": "33261",
"license": "bsd-3-clause",
"language": [
{
"name": "ASP",
"bytes": "298"
},
{
"name": "CSS",
"bytes": "2339543"
},
{
"name": "Erlang",
"bytes": "6972"
},
{
"name": "Go",
"bytes": "7075"
},
{
"name": "JavaScript",
"bytes": "4881125"
},
{
"name": "PHP",
"bytes": "159468"
},
{
"name": "Python",
"bytes": "5844"
},
{
"name": "Shell",
"bytes": "1490"
}
],
"symlink_target": ""
} |
layout: post
title: libcloud Monthly Update (September 2011) - FLOSS weekly, OpenStack driver improvements, DNS API
published: true
tags:
- libcloud
- open source
- programming
- floss weekly
---
## [{{page.title}}][1]
Without further ado here is a Libcloud monthly update for September 2011.
### What has been accomplished in the past month
* I was a guest on FLOSS weekly (podcast about FOSS software) where I talked about
Libcloud. You can find video and audio recording of the show on [twit.tv][2].
* OpenStack and Rackspace drivers have received a lot of needed attention and
refactoring. Rackspace driver now properly inherits from the OpenStack one
instead of vice versa (thanks [Mike][8]). This will make extending the Rackspace
driver and developing other provider drivers which are based on OpenStack a lot
easier. Rackspace drivers now also support authentication with Rackspace Auth
1.1.
* Linode compute driver now supports new location in Japan.
Linode has recently [added a new location (Tokyo, Japan)][6] and this location is
now also [supported in Libcloud][6].
* DNS API development has finally started.
Base API proposal can be found [here][3]. I have also just finished a reference
implementation and a first driver for the Linode DNS as a service.
The driver can be found in [trunk][4]. Feedback is [welcome (and encouraged)][5].
### What is currently going on
* Hacking on the DNS API continues. DNS API with at least two drivers is planned
to be included in the next release (0.6.0) which should be out around November.
See you next month!
[1]: {{ page.url }}
[2]: http://twit.tv/show/floss-weekly/181
[3]: http://mail-archives.apache.org/mod_mbox/libcloud-dev/201109.mbox/%3CCAJMHEmLfWki5awUqZL9ZNsrpJFkHNHAe00Vs5SeaJXkmWSxJ7g@mail.gmail.com%3E
[4]: https://svn.apache.org/viewvc/libcloud/trunk/libcloud/dns/drivers/linode.py?view=markup
[5]: http://mail-archives.apache.org/mod_mbox/libcloud-dev/201109.mbox/%3CCAJMHEmL7M12TG5eFz0HQ-kCuA3=ZnNkTt8_veoOFNfueaG9q2w@mail.gmail.com%3E
[6]: http://blog.linode.com/2011/09/19/linode-cloud-asia-pacific/
[7]: https://svn.apache.org/viewvc/libcloud/trunk/libcloud/compute/drivers/linode.py?r1=1172808&r2=1172807&pathrev=1172808
[8]: https://issues.apache.org/jira/secure/ViewProfile.jspa?name=manganeez
| {
"content_hash": "ba2bcc34a884105e6873ebd8806198b1",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 143,
"avg_line_length": 43.698113207547166,
"alnum_prop": 0.7625215889464594,
"repo_name": "Kami/kami.github.com",
"id": "40333816cf50c9f1fa0dafb62cc8866419390d6f",
"size": "2320",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "_source/_posts/2011-09-24-libcloud-monthly-update-september-floss-weekly-openstack-improvements-dns-api.md",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "951172"
},
{
"name": "HTML",
"bytes": "2541352"
},
{
"name": "JavaScript",
"bytes": "878124"
},
{
"name": "Lua",
"bytes": "286"
},
{
"name": "Python",
"bytes": "8910"
},
{
"name": "Ruby",
"bytes": "25523"
},
{
"name": "Shell",
"bytes": "3487"
}
],
"symlink_target": ""
} |
//testing headers
//#include <mitkTestingMacros.h>
#include <mitkTestFixture.h>
#include <mitkNavigationDataRecorder.h>
#include <mitkNavigationDataPlayer.h>
#include <mitkNavigationData.h>
#include <mitkStandardFileLocations.h>
#include <mitkTestingMacros.h>
#include <mitkNavigationDataReaderXML.h>
#include <mitkNavigationDataSetWriterXML.h>
#include <Poco/Path.h>
#include <Poco/File.h>
#include <iostream>
#include <sstream>
#include <fstream>
//for exceptions
#include "mitkIGTException.h"
#include "mitkIGTIOException.h"
class mitkNavigationDataSetReaderWriterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkNavigationDataSetReaderWriterTestSuite);
MITK_TEST(TestCompareFunction);
MITK_TEST(TestReadWrite);
MITK_TEST(TestSetXMLStringException);
CPPUNIT_TEST_SUITE_END();
private:
std::string pathRead;
std::string pathWrite;
std::string pathWrong;
mitk::NavigationDataSetWriterXML writer;
mitk::NavigationDataReaderXML::Pointer reader;
mitk::NavigationDataSet::Pointer set;
public:
void setUp()
{
pathRead = GetTestDataFilePath("IGT-Data/RecordedNavigationData.xml");
pathWrite = pathRead;
pathWrite.insert(pathWrite.end()-4,'2');;//Insert 2: IGT-Data/NavigationDataSet2.xml
std::ifstream FileTest(pathWrite.c_str());
if(FileTest){
//remove file if it already exists. TODO: Löschen funktioniert nicht!!!! xxxxxxxxxxxxxxxx
FileTest.close();
std::remove(pathWrite.c_str());
}
pathWrong = GetTestDataFilePath("IGT-Data/NavigationDataTestData.xml");
reader = mitk::NavigationDataReaderXML::New();
}
void tearDown()
{
}
void TestReadWrite()
{
// Aim is to read an xml into a pointset, write that xml again, and compare the output
set = reader->Read(pathRead);
writer.Write(pathWrite, set);
//FIXME: Commented out, because test fails under linux. binary comparison of files is probably not the wa to go
// See Bug 17775
//CPPUNIT_ASSERT_MESSAGE( "Testing if read/write cycle creates identical files", CompareFiles(pathRead, pathWrite));
remove(pathWrite.c_str());
}
bool CompareFiles(std::string file1, std::string file2)
{
FILE* f1 = fopen (file1.c_str() , "r");
FILE* f2 = fopen (file2.c_str() , "r");
char buf1[10000];
char buf2[10000];
do {
size_t r1 = fread(buf1, 1, 10000, f1);
size_t r2 = fread(buf2, 1, 10000, f2);
if (r1 != r2 ||
memcmp(buf1, buf2, r1)) {
fclose(f1);
fclose(f2);
return false; // Files are not equal
}
} while (!feof(f1) && !feof(f2));
bool returnValue = feof(f1) && feof(f2);
fclose(f1);
fclose(f2);
return returnValue;
}
void TestSetXMLStringException()
{
bool exceptionThrown3=false;
try
{
std::string file = GetTestDataFilePath("IGT-Data/InvalidVersionNavigationDataTestData.xml");
mitk::NavigationDataReaderXML::Pointer reader = mitk::NavigationDataReaderXML::New();
reader->Read(file);
}
catch(mitk::IGTIOException)
{
exceptionThrown3=true;
}
MITK_TEST_CONDITION(exceptionThrown3, "Reading an invalid XML string and expecting a exception");
}
void TestCompareFunction()
{
CPPUNIT_ASSERT_MESSAGE("Asserting that compare function for files works correctly - Positive Test", CompareFiles(pathRead,
pathRead));
CPPUNIT_ASSERT_MESSAGE("Asserting that compare function for files works correctly - Negative Test", ! CompareFiles(pathRead,
pathWrong) );
}
};
MITK_TEST_SUITE_REGISTRATION(mitkNavigationDataSetReaderWriter) | {
"content_hash": "370b55cd488e0b01ecc164649fb238eb",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 128,
"avg_line_length": 28.1171875,
"alnum_prop": 0.6979716587941095,
"repo_name": "lsanzdiaz/MITK-BiiG",
"id": "8ac8b94228f83b1fc78a572bf459bd5870c6803b",
"size": "4097",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Modules/IGT/Testing/mitkNavigationDataSetReaderWriterTest.cpp",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "2597854"
},
{
"name": "C++",
"bytes": "25201686"
},
{
"name": "CMake",
"bytes": "839468"
},
{
"name": "CSS",
"bytes": "12562"
},
{
"name": "HTML",
"bytes": "6322"
},
{
"name": "Java",
"bytes": "350330"
},
{
"name": "JavaScript",
"bytes": "47660"
},
{
"name": "Makefile",
"bytes": "742"
},
{
"name": "Objective-C",
"bytes": "476189"
},
{
"name": "Perl",
"bytes": "982"
},
{
"name": "Python",
"bytes": "7545"
},
{
"name": "QML",
"bytes": "4829"
},
{
"name": "QMake",
"bytes": "5583"
},
{
"name": "Shell",
"bytes": "5433"
},
{
"name": "XSLT",
"bytes": "30684"
}
],
"symlink_target": ""
} |
ACCEPTED
#### According to
International Plant Names Index
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "0740d7f1adddc047a4752debaf687c1e",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 31,
"avg_line_length": 9.692307692307692,
"alnum_prop": 0.7063492063492064,
"repo_name": "mdoering/backbone",
"id": "1c307e47cc79fc592ae40c21bc6442d43a63f869",
"size": "187",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Cactaceae/Lobivia/Lobivia haagei/Lobivia haagei elegantula/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
<?php namespace Ambitia\Interfaces\Core;
interface ExceptionHandlerInterface
{
/**
* Output the exceptions to CLI
*/
const OUTPUT_CONSOLE = 1;
/**
* Output the exceptions to website
*/
const OUTPUT_WEB = 2;
/**
* Output the exceptions to logger
*/
const OUTPUT_LOGGER = 3;
/**
* Register the global exception handler for console output. Pass an array
* to register multiple handlers.
*
* @param int|array $output
* @return void
*/
public function register($output);
} | {
"content_hash": "991e3fc8bf53d53f92a439596ce059cd",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 78,
"avg_line_length": 18.833333333333332,
"alnum_prop": 0.6035398230088496,
"repo_name": "ambitia/ambitia",
"id": "e12ac0c27691774a89b3298a2b0b2a2cf43e9997",
"size": "565",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/Interfaces/Core/ExceptionHandlerInterface.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "129587"
}
],
"symlink_target": ""
} |
// Copyright 2021 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE
using JetBrains.Annotations;
using System.Text.RegularExpressions;
namespace Nuke.Common.Utilities
{
public static partial class StringExtensions
{
[Pure]
public static int IndexOfRegex(this string text, string expression)
{
var regex = new Regex(expression, RegexOptions.Compiled);
return regex.Match(text).Index;
}
}
}
| {
"content_hash": "c1fa32b5775e2a52c1a44bcfd5acbac2",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 75,
"avg_line_length": 27.736842105263158,
"alnum_prop": 0.6850094876660342,
"repo_name": "nuke-build/nuke",
"id": "c1245c6fc0340bfc449f283608fc3b5e383a8286",
"size": "529",
"binary": false,
"copies": "1",
"ref": "refs/heads/develop",
"path": "source/Nuke.Common/Utilities/String.IndexOf.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "414"
},
{
"name": "C#",
"bytes": "17545623"
},
{
"name": "Dockerfile",
"bytes": "184"
},
{
"name": "HTML",
"bytes": "1116292"
},
{
"name": "Kotlin",
"bytes": "12208"
},
{
"name": "PowerShell",
"bytes": "8519"
},
{
"name": "Shell",
"bytes": "6213"
}
],
"symlink_target": ""
} |
extern "Java"
{
namespace gnu
{
namespace java
{
namespace nio
{
namespace charset
{
class MacGreek;
}
}
}
}
}
class gnu::java::nio::charset::MacGreek : public ::gnu::java::nio::charset::ByteCharset
{
public:
MacGreek();
private:
static JArray< jchar > * lookup;
public:
static ::java::lang::Class class$;
};
#endif // __gnu_java_nio_charset_MacGreek__
| {
"content_hash": "42d8ac57a2753a4855b8e2203c61662a",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 87,
"avg_line_length": 14.96551724137931,
"alnum_prop": 0.5622119815668203,
"repo_name": "the-linix-project/linix-kernel-source",
"id": "df1f52fbb9377c50e082e2f644b6f9a8858c2359",
"size": "673",
"binary": false,
"copies": "160",
"ref": "refs/heads/master",
"path": "gccsrc/gcc-4.7.2/libjava/gnu/java/nio/charset/MacGreek.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "Ada",
"bytes": "38139979"
},
{
"name": "Assembly",
"bytes": "3723477"
},
{
"name": "Awk",
"bytes": "83739"
},
{
"name": "C",
"bytes": "103607293"
},
{
"name": "C#",
"bytes": "55726"
},
{
"name": "C++",
"bytes": "38577421"
},
{
"name": "CLIPS",
"bytes": "6933"
},
{
"name": "CSS",
"bytes": "32588"
},
{
"name": "Emacs Lisp",
"bytes": "13451"
},
{
"name": "FORTRAN",
"bytes": "4294984"
},
{
"name": "GAP",
"bytes": "13089"
},
{
"name": "Go",
"bytes": "11277335"
},
{
"name": "Haskell",
"bytes": "2415"
},
{
"name": "Java",
"bytes": "45298678"
},
{
"name": "JavaScript",
"bytes": "6265"
},
{
"name": "Matlab",
"bytes": "56"
},
{
"name": "OCaml",
"bytes": "148372"
},
{
"name": "Objective-C",
"bytes": "995127"
},
{
"name": "Objective-C++",
"bytes": "436045"
},
{
"name": "PHP",
"bytes": "12361"
},
{
"name": "Pascal",
"bytes": "40318"
},
{
"name": "Perl",
"bytes": "358808"
},
{
"name": "Python",
"bytes": "60178"
},
{
"name": "SAS",
"bytes": "1711"
},
{
"name": "Scilab",
"bytes": "258457"
},
{
"name": "Shell",
"bytes": "2610907"
},
{
"name": "Tcl",
"bytes": "17983"
},
{
"name": "TeX",
"bytes": "1455571"
},
{
"name": "XSLT",
"bytes": "156419"
}
],
"symlink_target": ""
} |
<?php
namespace App\Base\Models;
use Illuminate\Database\Eloquent\Model;
class Event extends Model
{
protected $fillable = ['name', 'description', 'time', 'place', 'created_by', 'eventable_type', 'eventable_id', 'cycle_id'];
}
| {
"content_hash": "001da3e2373c9a11aba4f1a471a301a9",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 127,
"avg_line_length": 23.4,
"alnum_prop": 0.6923076923076923,
"repo_name": "iluminar/goodwork",
"id": "d90fee56c90fb3e118c16d7a3eddea238e246057",
"size": "234",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "app/Base/Models/Event.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Dockerfile",
"bytes": "2133"
},
{
"name": "HTML",
"bytes": "13010"
},
{
"name": "JavaScript",
"bytes": "42172"
},
{
"name": "PHP",
"bytes": "1108328"
},
{
"name": "Shell",
"bytes": "3791"
},
{
"name": "Vue",
"bytes": "290009"
}
],
"symlink_target": ""
} |
<?php
declare(strict_types=1);
namespace Roave\BetterReflectionTest;
use Roave\BetterReflection\BetterReflection;
abstract class BetterReflectionSingleton
{
private static ?BetterReflection $betterReflection;
final private function __construct()
{
}
public static function instance(): BetterReflection
{
return self::$betterReflection ?? self::$betterReflection = new BetterReflection();
}
}
| {
"content_hash": "613b2502a3eb13b5c146d8dc3fdea364",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 91,
"avg_line_length": 20.666666666666668,
"alnum_prop": 0.7304147465437788,
"repo_name": "asgrim/better-reflection",
"id": "02b2945503266ca881c6391ee31e5e6fef4478e2",
"size": "434",
"binary": false,
"copies": "1",
"ref": "refs/heads/5.4.x",
"path": "test/unit/BetterReflectionSingleton.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "1277968"
},
{
"name": "Shell",
"bytes": "66"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Text;
using FlatRedBall;
using FlatRedBall.Input;
using FlatRedBall.Instructions;
using FlatRedBall.AI.Pathfinding;
using FlatRedBall.Graphics.Animation;
using FlatRedBall.Graphics.Particle;
using FlatRedBall.Math.Geometry;
using System.Threading.Tasks;
namespace MovingPlatformDemo.Entities
{
public partial class MovingPlatform
{
bool isDestroyed = false;
/// <summary>
/// Initialization logic which is execute only one time for this Entity (unless the Entity is pooled).
/// This method is called when the Entity is added to managers. Entities which are instantiated but not
/// added to managers will not have this method called.
/// </summary>
private void CustomInitialize()
{
StartMoving();
}
private async void StartMoving()
{
async Task AccelerateFor(float acceleration, float seconds)
{
XAcceleration = acceleration;
await TimeManager.DelaySeconds(seconds);
}
while(!isDestroyed)
{
await AccelerateFor(30, 1);
await AccelerateFor(0, 2);
await AccelerateFor(-30, 2);
await AccelerateFor(0, 2);
await AccelerateFor(30, 1);
}
}
internal void StoreBasePosition()
{
}
private void CustomActivity()
{
}
private void CustomDestroy()
{
isDestroyed = true;
}
private static void CustomLoadStaticContent(string contentManagerName)
{
}
}
}
| {
"content_hash": "84e4c5c1b95729e949b0a5eae4916788",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 111,
"avg_line_length": 25.36764705882353,
"alnum_prop": 0.5936231884057971,
"repo_name": "vchelaru/FlatRedBall",
"id": "aec3fabe8c146017ab19a32d67de34d75c898f72",
"size": "1725",
"binary": false,
"copies": "1",
"ref": "refs/heads/NetStandard",
"path": "Samples/Platformer/MovingPlatformDemo/MovingPlatformDemo/Entities/MovingPlatform.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "1314"
},
{
"name": "C",
"bytes": "335932"
},
{
"name": "C#",
"bytes": "23148115"
},
{
"name": "C++",
"bytes": "321410"
},
{
"name": "HLSL",
"bytes": "133716"
},
{
"name": "HTML",
"bytes": "83936"
},
{
"name": "JavaScript",
"bytes": "1163007"
},
{
"name": "PowerShell",
"bytes": "1086"
},
{
"name": "Smalltalk",
"bytes": "12"
}
],
"symlink_target": ""
} |
<?php
// League admins modal
$body = '<table class="table is-fullwidth">
<tbody id="league-owners-list">
</tbody>
</table>';
$this->load->view('components/modal', array('id' => 'set-admins-modal',
'title' => 'Set League Admins',
'body' => $body,
'reload_on_close' => True));
?>
<div class="section">
<div class="container">
<div class="title">Settings</div>
<div class="title is-size-5"><?=$info->league_name?></div>
<div class="is-divider"></div>
<div class="columns">
<div class="column is-one-third">
Join Password
</div>
<div class="column">
<?php $this->load->view('components/editable_text',array('id' => 'sitename',
'value' => $settings->join_password,
'url' => site_url('admin/site/ajax_change_item')));?>
</div>
</div>
<hr>
<div class="columns">
<div class="column is-one-third">
League Admins
</div>
<div class="column is-italic is-size-7">
<div class="box has-background-light">
<?php if(count($admins) > 0): ?>
<?php foreach($admins as $a): ?>
<?=$a->first_name.' '.$a->last_name?><br>
<?php endforeach?>
<?php else: ?>
(none)
<?php endif;?>
</div>
</div>
<div class="column has-text-right">
<a href="#" id="set-admins-button">Manage Admins</a>
</div>
</div>
<hr>
<div class="columns">
<div class="column">
Invite URL
</div>
<div class="column">
<?php $inviteurl = site_url('joinleague/invite/'.$info->mask_id); ?>
<a href="<?=$inviteurl?>"><?=$inviteurl?></a>
</div>
</div>
<div class="is-divider"></div>
</div>
</div>
<script>
function load_admins_and_owners()
{
var url = "<?=site_url('admin/site/ajax_get_owners')?>";
var leagueid = "<?=$info->id?>";
$.post(url,{'leagueid':leagueid},function(data){
$("#league-owners-list").html(data);
});
}
// Show modal and load list of admins
$("#set-admins-button").on('click',function(){
load_admins_and_owners();
$("#set-admins-modal").addClass('is-active');
});
$('#set-admins-modal').on('hidden.bs.modal', function (e) {
location.reload();
});
</script>
| {
"content_hash": "8cf160cb08b06e9de8de62396b661bd0",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 133,
"avg_line_length": 34.50574712643678,
"alnum_prop": 0.4050632911392405,
"repo_name": "nickfrerichs/fflproject",
"id": "ad240e7fd3d81c973622d7797e2e5e0d7f3a08ba",
"size": "3002",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "application/views/admin/site/manage_league.php",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "2283"
},
{
"name": "CSS",
"bytes": "23492"
},
{
"name": "HTML",
"bytes": "5642"
},
{
"name": "Hack",
"bytes": "2973"
},
{
"name": "JavaScript",
"bytes": "36588"
},
{
"name": "Makefile",
"bytes": "467"
},
{
"name": "PHP",
"bytes": "2830258"
},
{
"name": "Python",
"bytes": "106509"
},
{
"name": "TSQL",
"bytes": "3293725"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!--
-->
<merge
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
>
<Row
latin:keyWidth="9.0%p"
latin:backgroundType="functional"
>
<Key
latin:keyStyle="toSymbolKeyStyle"
latin:keyWidth="10.0%p" />
<include
latin:keyboardLayout="@xml/key_shortcut" />
<include
latin:keyboardLayout="@xml/key_f1" />
<include
latin:keyXPos="28.0%p"
latin:keyboardLayout="@xml/key_space"
latin:backgroundType="normal" />
<include
latin:keyboardLayout="@xml/key_question_exclamation" />
<include
latin:keyboardLayout="@xml/key_dash" />
<include
latin:keyboardLayout="@xml/key_f2" />
</Row>
</merge>
| {
"content_hash": "34b71fb0725167c1b612e47d3d6c916a",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 82,
"avg_line_length": 27.612903225806452,
"alnum_prop": 0.5490654205607477,
"repo_name": "slightfoot/android-kioskime",
"id": "969cc145e6b7dd77f0fe31604ef1b9b8dd311be2",
"size": "1473",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "res/xml-sw600dp/row_dvorak4.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "110403"
},
{
"name": "C++",
"bytes": "546579"
},
{
"name": "Java",
"bytes": "2402817"
}
],
"symlink_target": ""
} |
namespace ash {
class TestLoginShelfFlingHandler {
public:
TestLoginShelfFlingHandler() {
gesture_detection_active_ =
Shell::Get()->login_screen_controller()->SetLoginShelfGestureHandler(
base::ASCIIToUTF16("Test swipe"),
base::BindRepeating(&TestLoginShelfFlingHandler::OnFlingDetected,
base::Unretained(this)),
base::BindOnce(
&TestLoginShelfFlingHandler::OnGestureDetectionDisabled,
base::Unretained(this)));
}
~TestLoginShelfFlingHandler() {
if (gesture_detection_active_)
Shell::Get()->login_screen_controller()->ClearLoginShelfGestureHandler();
}
int GetAndResetDetectedFlingCount() {
int result = detected_flings_;
detected_flings_ = 0;
return result;
}
bool gesture_detection_active() const { return gesture_detection_active_; }
void OnFlingDetected() { ++detected_flings_; }
void OnGestureDetectionDisabled() {
EXPECT_TRUE(gesture_detection_active_);
gesture_detection_active_ = false;
}
private:
int detected_flings_ = 0;
bool gesture_detection_active_ = false;
};
class LoginShelfGestureControllerTest : public LoginTestBase {
public:
LoginShelfGestureControllerTest() = default;
LoginShelfGestureControllerTest(
const LoginShelfGestureControllerTest& other) = delete;
LoginShelfGestureControllerTest& operator=(
const LoginShelfGestureControllerTest& other) = delete;
~LoginShelfGestureControllerTest() override = default;
// LoginTestBase:
void SetUp() override {
set_start_session(false);
LoginTestBase::SetUp();
}
LoginShelfGestureController* GetLoginScreenGestureController() {
return GetPrimaryShelf()
->shelf_widget()
->login_shelf_gesture_controller_for_testing();
}
ContextualNudge* GetGestureContextualNudge() {
return GetLoginScreenGestureController()->nudge_for_testing();
}
void NotifySessionStateChanged(session_manager::SessionState state) {
GetSessionControllerClient()->SetSessionState(state);
GetSessionControllerClient()->FlushForTest();
}
void SwipeOnShelf(const gfx::Point& start, const gfx::Vector2d& direction) {
const gfx::Point end(start + direction);
const base::TimeDelta kTimeDelta = base::TimeDelta::FromMilliseconds(500);
const int kNumScrollSteps = 4;
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
}
void FlingOnShelf(const gfx::Point& start, const gfx::Vector2d& direction) {
const gfx::Point end(start + direction);
const base::TimeDelta kTimeDelta = base::TimeDelta::FromMilliseconds(10);
const int kNumScrollSteps = 4;
GetEventGenerator()->GestureScrollSequence(start, end, kTimeDelta,
kNumScrollSteps);
}
};
TEST_F(LoginShelfGestureControllerTest,
SettingGestureHandlerShowsDragHandleInOobe) {
NotifySessionStateChanged(session_manager::SessionState::OOBE);
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
// Login shelf gesture detection should not start if not in tablet mode.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_FALSE(fling_handler->gesture_detection_active());
TabletModeControllerTestApi().EnterTabletMode();
// Enter tablet mode and create another scoped login shelf gesture handler,
// and verify that makes the drag handle visible.
fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
ASSERT_TRUE(GetPrimaryShelf()
->shelf_widget()
->login_shelf_gesture_controller_for_testing()
->nudge_for_testing());
EXPECT_TRUE(GetGestureContextualNudge()->GetWidget()->IsVisible());
// The drag handle should be removed once the user logs in.
CreateUserSessions(1);
EXPECT_FALSE(fling_handler->gesture_detection_active());
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
}
TEST_F(LoginShelfGestureControllerTest, DragHandleAndNudgeAnimate) {
NotifySessionStateChanged(session_manager::SessionState::OOBE);
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
TabletModeControllerTestApi().EnterTabletMode();
ui::ScopedAnimationDurationScaleMode test_duration_mode(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
// Enter tablet mode and create a scoped login shelf gesture handler,
// and verify that makes the drag handle visible.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
DragHandle* const drag_handle =
GetPrimaryShelf()->shelf_widget()->GetDragHandle();
EXPECT_TRUE(drag_handle->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
ASSERT_TRUE(GetPrimaryShelf()
->shelf_widget()
->login_shelf_gesture_controller_for_testing()
->nudge_for_testing());
views::Widget* const nudge_widget = GetGestureContextualNudge()->GetWidget();
EXPECT_TRUE(nudge_widget->IsVisible());
base::OneShotTimer* animation_timer =
GetLoginScreenGestureController()->nudge_animation_timer_for_testing();
// The nudge and drag handler should start animating with a delay.
ASSERT_TRUE(animation_timer->IsRunning());
EXPECT_FALSE(drag_handle->layer()->GetAnimator()->is_animating());
EXPECT_FALSE(nudge_widget->GetLayer()->GetAnimator()->is_animating());
animation_timer->FireNow();
EXPECT_TRUE(drag_handle->GetVisible());
EXPECT_TRUE(drag_handle->layer()->GetAnimator()->is_animating());
EXPECT_TRUE(nudge_widget->GetLayer()->GetAnimator()->is_animating());
EXPECT_EQ(drag_handle->layer()->GetTargetTransform(),
nudge_widget->GetLayer()->GetTargetTransform());
EXPECT_FALSE(animation_timer->IsRunning());
// Once the animations complete, the drag handle and the nudge should be at
// the original position, and another animation should be scheduled.
drag_handle->layer()->GetAnimator()->StopAnimating();
nudge_widget->GetLayer()->GetAnimator()->StopAnimating();
EXPECT_EQ(drag_handle->layer()->GetTargetTransform(),
nudge_widget->GetLayer()->GetTargetTransform());
EXPECT_EQ(gfx::Transform(), nudge_widget->GetLayer()->GetTargetTransform());
ASSERT_TRUE(animation_timer->IsRunning());
// Verify that another animation is scheduled once the second set of
// animations completes.
animation_timer->FireNow();
EXPECT_TRUE(drag_handle->layer()->GetAnimator()->is_animating());
EXPECT_TRUE(nudge_widget->GetLayer()->GetAnimator()->is_animating());
drag_handle->layer()->GetAnimator()->StopAnimating();
nudge_widget->GetLayer()->GetAnimator()->StopAnimating();
EXPECT_TRUE(animation_timer->IsRunning());
}
TEST_F(LoginShelfGestureControllerTest, TappingNudgeWidgetStopsAnimations) {
NotifySessionStateChanged(session_manager::SessionState::OOBE);
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
TabletModeControllerTestApi().EnterTabletMode();
ui::ScopedAnimationDurationScaleMode test_duration_mode(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
// Enter tablet mode and create a scoped login shelf gesture handler,
// and verify that makes the drag handle visible.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
DragHandle* const drag_handle =
GetPrimaryShelf()->shelf_widget()->GetDragHandle();
EXPECT_TRUE(drag_handle->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
views::Widget* const nudge_widget = GetGestureContextualNudge()->GetWidget();
EXPECT_TRUE(nudge_widget->IsVisible());
// Start the animation.
base::OneShotTimer* animation_timer =
GetLoginScreenGestureController()->nudge_animation_timer_for_testing();
ASSERT_TRUE(animation_timer->IsRunning());
animation_timer->FireNow();
EXPECT_TRUE(drag_handle->layer()->GetAnimator()->is_animating());
EXPECT_TRUE(nudge_widget->GetLayer()->GetAnimator()->is_animating());
// Tapping the contextual nudge should schedule an animation to the original
// position.
GetEventGenerator()->GestureTapAt(
nudge_widget->GetWindowBoundsInScreen().CenterPoint());
EXPECT_EQ(drag_handle->layer()->GetTargetTransform(),
nudge_widget->GetLayer()->GetTargetTransform());
EXPECT_EQ(gfx::Transform(), nudge_widget->GetLayer()->GetTargetTransform());
// Once the "stop" animation finishes, no further animation should be
// scheduled.
drag_handle->layer()->GetAnimator()->StopAnimating();
nudge_widget->GetLayer()->GetAnimator()->StopAnimating();
EXPECT_EQ(drag_handle->layer()->GetTargetTransform(),
nudge_widget->GetLayer()->GetTargetTransform());
EXPECT_EQ(gfx::Transform(), nudge_widget->GetLayer()->GetTargetTransform());
EXPECT_FALSE(animation_timer->IsRunning());
}
TEST_F(LoginShelfGestureControllerTest,
TappingNudgeWidgetCancelsInitialScheduledAnimations) {
NotifySessionStateChanged(session_manager::SessionState::OOBE);
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
TabletModeControllerTestApi().EnterTabletMode();
ui::ScopedAnimationDurationScaleMode test_duration_mode(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
// Enter tablet mode and create a scoped login shelf gesture handler,
// and verify that makes the drag handle visible.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
DragHandle* const drag_handle =
GetPrimaryShelf()->shelf_widget()->GetDragHandle();
EXPECT_TRUE(drag_handle->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
views::Widget* const nudge_widget = GetGestureContextualNudge()->GetWidget();
EXPECT_TRUE(nudge_widget->IsVisible());
base::OneShotTimer* animation_timer =
GetLoginScreenGestureController()->nudge_animation_timer_for_testing();
ASSERT_TRUE(animation_timer->IsRunning());
// Tap the contextual nudge before the nudge animation is scheduled - that
// should stop the animation timer.
GetEventGenerator()->GestureTapAt(
nudge_widget->GetWindowBoundsInScreen().CenterPoint());
EXPECT_FALSE(animation_timer->IsRunning());
// The stop nudge animation could still be run.
drag_handle->layer()->GetAnimator()->StopAnimating();
nudge_widget->GetLayer()->GetAnimator()->StopAnimating();
EXPECT_EQ(drag_handle->layer()->GetTargetTransform(),
nudge_widget->GetLayer()->GetTargetTransform());
EXPECT_EQ(gfx::Transform(), nudge_widget->GetLayer()->GetTargetTransform());
drag_handle->layer()->GetAnimator()->StopAnimating();
nudge_widget->GetLayer()->GetAnimator()->StopAnimating();
EXPECT_FALSE(animation_timer->IsRunning());
}
TEST_F(LoginShelfGestureControllerTest,
TappingNudgeWidgetCancelsSecondScheduledAnimations) {
NotifySessionStateChanged(session_manager::SessionState::OOBE);
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
TabletModeControllerTestApi().EnterTabletMode();
ui::ScopedAnimationDurationScaleMode test_duration_mode(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
// Enter tablet mode and create a scoped login shelf gesture handler,
// and verify that makes the drag handle visible.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
DragHandle* const drag_handle =
GetPrimaryShelf()->shelf_widget()->GetDragHandle();
EXPECT_TRUE(drag_handle->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
views::Widget* const nudge_widget = GetGestureContextualNudge()->GetWidget();
EXPECT_TRUE(nudge_widget->IsVisible());
// Run the first nudge animation sequence.
base::OneShotTimer* animation_timer =
GetLoginScreenGestureController()->nudge_animation_timer_for_testing();
ASSERT_TRUE(animation_timer->IsRunning());
animation_timer->FireNow();
drag_handle->layer()->GetAnimator()->StopAnimating();
nudge_widget->GetLayer()->GetAnimator()->StopAnimating();
EXPECT_TRUE(animation_timer->IsRunning());
// Tap the contextual nudge before the nudge animation is scheduled - that
// should stop the animation timer.
GetEventGenerator()->GestureTapAt(
nudge_widget->GetWindowBoundsInScreen().CenterPoint());
EXPECT_FALSE(animation_timer->IsRunning());
// The stop nudge animation could still be run.
drag_handle->layer()->GetAnimator()->StopAnimating();
nudge_widget->GetLayer()->GetAnimator()->StopAnimating();
EXPECT_EQ(drag_handle->layer()->GetTargetTransform(),
nudge_widget->GetLayer()->GetTargetTransform());
EXPECT_EQ(gfx::Transform(), nudge_widget->GetLayer()->GetTargetTransform());
drag_handle->layer()->GetAnimator()->StopAnimating();
nudge_widget->GetLayer()->GetAnimator()->StopAnimating();
EXPECT_FALSE(animation_timer->IsRunning());
}
TEST_F(LoginShelfGestureControllerTest,
SettingGestureHandlerShowsDragHandleOnLogin) {
NotifySessionStateChanged(session_manager::SessionState::LOGIN_PRIMARY);
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
// Login shelf gesture detection should not start if not in tablet mode.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_FALSE(fling_handler->gesture_detection_active());
TabletModeControllerTestApi().EnterTabletMode();
// Enter tablet mode and create another scoped login shelf gesture handler,
// and verify that makes the drag handle visible.
fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
ASSERT_TRUE(GetGestureContextualNudge());
EXPECT_TRUE(GetGestureContextualNudge()->GetWidget()->IsVisible());
// The drag handle should be removed once the user logs in.
CreateUserSessions(1);
EXPECT_FALSE(fling_handler->gesture_detection_active());
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
}
TEST_F(LoginShelfGestureControllerTest, TabletModeExitResetsGestureDetection) {
NotifySessionStateChanged(session_manager::SessionState::OOBE);
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
// Login shelf gesture detection should not start if not in tablet mode.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_FALSE(fling_handler->gesture_detection_active());
TabletModeControllerTestApi().EnterTabletMode();
// Enter tablet mode and create another scoped login shelf gesture handler,
// and verify that makes the drag handle visible.
fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
ASSERT_TRUE(GetGestureContextualNudge());
EXPECT_TRUE(GetGestureContextualNudge()->GetWidget()->IsVisible());
// The drag handle should be removed in clamshell.
TabletModeControllerTestApi().LeaveTabletMode();
EXPECT_FALSE(fling_handler->gesture_detection_active());
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
}
TEST_F(LoginShelfGestureControllerTest,
DragHandleHiddenIfGestureHandlerIsReset) {
NotifySessionStateChanged(session_manager::SessionState::OOBE);
TabletModeControllerTestApi().EnterTabletMode();
// Login shelf gesture detection should not start if not in tablet mode.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
ASSERT_TRUE(GetGestureContextualNudge());
EXPECT_TRUE(GetGestureContextualNudge()->GetWidget()->IsVisible());
fling_handler.reset();
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
}
TEST_F(LoginShelfGestureControllerTest,
HandlerDoesNotReceiveEventsAfterGettingNotifiedOfControllerExit) {
NotifySessionStateChanged(session_manager::SessionState::OOBE);
TabletModeControllerTestApi().EnterTabletMode();
// Login shelf gesture detection should not start if not in tablet mode.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
ASSERT_TRUE(GetGestureContextualNudge());
EXPECT_TRUE(GetGestureContextualNudge()->GetWidget()->IsVisible());
TabletModeControllerTestApi().LeaveTabletMode();
EXPECT_FALSE(fling_handler->gesture_detection_active());
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
TabletModeControllerTestApi().EnterTabletMode();
EXPECT_FALSE(
GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
EXPECT_FALSE(GetLoginScreenGestureController());
// Swipe on the shelf should not be reported given that the handler was
// notified that the gesture controller was disabled (on tablet mode exit).
const gfx::Rect shelf_bounds =
GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen();
FlingOnShelf(shelf_bounds.CenterPoint(), gfx::Vector2d(0, -100));
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
}
TEST_F(LoginShelfGestureControllerTest,
RegisteringHandlerClearsThePreviousOne) {
NotifySessionStateChanged(session_manager::SessionState::OOBE);
TabletModeControllerTestApi().EnterTabletMode();
// Login shelf gesture detection should not start if not in tablet mode.
auto fling_handler_1 = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler_1->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
ASSERT_TRUE(GetGestureContextualNudge());
EXPECT_TRUE(GetGestureContextualNudge()->GetWidget()->IsVisible());
auto fling_handler_2 = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler_2->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
ASSERT_TRUE(GetGestureContextualNudge());
EXPECT_TRUE(GetGestureContextualNudge()->GetWidget()->IsVisible());
EXPECT_FALSE(fling_handler_1->gesture_detection_active());
// Only the second handler should be notified of a gesture.
const gfx::Rect shelf_bounds =
GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen();
// Fling up on shelf, and verify the gesture is detected.
FlingOnShelf(shelf_bounds.CenterPoint(), gfx::Vector2d(0, -100));
EXPECT_EQ(1, fling_handler_2->GetAndResetDetectedFlingCount());
EXPECT_EQ(0, fling_handler_1->GetAndResetDetectedFlingCount());
}
TEST_F(LoginShelfGestureControllerTest,
GracefullyHandleNudgeWidgetDestruction) {
NotifySessionStateChanged(session_manager::SessionState::OOBE);
TabletModeControllerTestApi().EnterTabletMode();
// Login shelf gesture detection should not start if not in tablet mode.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
ASSERT_TRUE(GetLoginScreenGestureController());
ASSERT_TRUE(GetGestureContextualNudge());
EXPECT_TRUE(GetGestureContextualNudge()->GetWidget()->IsVisible());
GetGestureContextualNudge()->GetWidget()->CloseNow();
// The gestures should still lbe recorded, even if the nudge widget went away.
const gfx::Rect shelf_bounds =
GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen();
// Fling up on shelf, and verify the gesture is detected.
FlingOnShelf(shelf_bounds.CenterPoint(), gfx::Vector2d(0, -100));
EXPECT_EQ(1, fling_handler->GetAndResetDetectedFlingCount());
}
TEST_F(LoginShelfGestureControllerTest, FlingDetectionInOobeFromShelf) {
const gfx::Rect shelf_bounds =
GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen();
const std::vector<gfx::Point> starting_points = {
shelf_bounds.CenterPoint(),
shelf_bounds.left_center(),
shelf_bounds.left_center() + gfx::Vector2d(20, 0),
shelf_bounds.right_center(),
shelf_bounds.right_center() + gfx::Vector2d(-20, 0),
shelf_bounds.bottom_center(),
shelf_bounds.bottom_left() + gfx::Vector2d(20, 0),
shelf_bounds.bottom_right() + gfx::Vector2d(-20, 0),
shelf_bounds.top_center(),
shelf_bounds.origin() + gfx::Vector2d(20, 0),
shelf_bounds.top_right() + gfx::Vector2d(-20, 0),
};
NotifySessionStateChanged(session_manager::SessionState::OOBE);
TabletModeControllerTestApi().EnterTabletMode();
// Enter tablet mode and create another scoped login shelf gesture handler,
// and verify that makes the drag handle visible.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
for (const auto& start : starting_points) {
SCOPED_TRACE(testing::Message()
<< "Starting point " << start.ToString()
<< " with shelf bounds " << shelf_bounds.ToString());
// Slow upward swipe should not trigger gesture detection.
SwipeOnShelf(start, gfx::Vector2d(0, -100));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
// Fling up on shelf, and verify the gesture is detected.
FlingOnShelf(start, gfx::Vector2d(0, -100));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(1, fling_handler->GetAndResetDetectedFlingCount());
// Fling down, nor swipe down should not be detected.
SwipeOnShelf(start, gfx::Vector2d(0, 20));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
FlingOnShelf(start, gfx::Vector2d(0, 20));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
}
}
TEST_F(LoginShelfGestureControllerTest, FlingDetectionOnLoginScreenFromShelf) {
const gfx::Rect shelf_bounds =
GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen();
const std::vector<gfx::Point> starting_points = {
shelf_bounds.CenterPoint(),
shelf_bounds.left_center(),
shelf_bounds.left_center() + gfx::Vector2d(20, 0),
shelf_bounds.right_center(),
shelf_bounds.right_center() + gfx::Vector2d(-20, 0),
shelf_bounds.bottom_center(),
shelf_bounds.bottom_left() + gfx::Vector2d(20, 0),
shelf_bounds.bottom_right() + gfx::Vector2d(-20, 0),
shelf_bounds.top_center(),
shelf_bounds.origin() + gfx::Vector2d(20, 0),
shelf_bounds.top_right() + gfx::Vector2d(-20, 0),
};
NotifySessionStateChanged(session_manager::SessionState::LOGIN_PRIMARY);
TabletModeControllerTestApi().EnterTabletMode();
// Enter tablet mode and create another scoped login shelf gesture handler,
// and verify that makes the drag handle visible.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
for (const auto& start : starting_points) {
SCOPED_TRACE(testing::Message()
<< "Starting point " << start.ToString()
<< " with shelf bounds " << shelf_bounds.ToString());
// Slow upward swipe should not trigger gesture detection.
SwipeOnShelf(start, gfx::Vector2d(0, -100));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
// Fling up on shelf, and verify the gesture is detected.
FlingOnShelf(start, gfx::Vector2d(0, -100));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(1, fling_handler->GetAndResetDetectedFlingCount());
// Fling down, nor swipe down should not be detected.
SwipeOnShelf(start, gfx::Vector2d(0, 20));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
FlingOnShelf(start, gfx::Vector2d(0, 20));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
}
}
TEST_F(LoginShelfGestureControllerTest, FlingFromAboveTheShelf) {
NotifySessionStateChanged(session_manager::SessionState::LOGIN_PRIMARY);
TabletModeControllerTestApi().EnterTabletMode();
// Enter tablet mode and create another scoped login shelf gesture handler,
// and verify that makes the drag handle visible.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
const gfx::Rect shelf_bounds =
GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen();
const std::vector<gfx::Point> starting_points = {
shelf_bounds.top_center() + gfx::Vector2d(0, -1),
shelf_bounds.origin() + gfx::Vector2d(20, -1),
shelf_bounds.top_right() + gfx::Vector2d(-20, -1),
};
for (const auto& start : starting_points) {
SCOPED_TRACE(testing::Message()
<< "Starting point " << start.ToString()
<< " with shelf bounds " << shelf_bounds.ToString());
SwipeOnShelf(start, gfx::Vector2d(0, -100));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
FlingOnShelf(start, gfx::Vector2d(0, -100));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
SwipeOnShelf(start, gfx::Vector2d(0, 20));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
FlingOnShelf(start, gfx::Vector2d(0, 20));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
}
}
TEST_F(LoginShelfGestureControllerTest, FlingDoesNotLeaveShelf) {
NotifySessionStateChanged(session_manager::SessionState::LOGIN_PRIMARY);
TabletModeControllerTestApi().EnterTabletMode();
// Enter tablet mode and create another scoped login shelf gesture handler,
// and verify that makes the drag handle visible.
auto fling_handler = std::make_unique<TestLoginShelfFlingHandler>();
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_TRUE(GetPrimaryShelf()->shelf_widget()->GetDragHandle()->GetVisible());
const gfx::Rect shelf_bounds =
GetPrimaryShelf()->shelf_widget()->GetWindowBoundsInScreen();
const std::vector<gfx::Point> starting_points = {
shelf_bounds.bottom_center(),
shelf_bounds.bottom_left(),
shelf_bounds.bottom_right(),
};
for (const auto& start : starting_points) {
SCOPED_TRACE(testing::Message()
<< "Starting point " << start.ToString()
<< " with shelf bounds " << shelf_bounds.ToString());
SwipeOnShelf(start, gfx::Vector2d(0, -20));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
FlingOnShelf(start, gfx::Vector2d(0, -20));
EXPECT_TRUE(fling_handler->gesture_detection_active());
EXPECT_EQ(0, fling_handler->GetAndResetDetectedFlingCount());
}
}
// Tests that shutdown is graceful if a login shelf gesture handler is still
// registered.
TEST_F(LoginShelfGestureControllerTest, HandlerExitsOnShutdown) {
NotifySessionStateChanged(session_manager::SessionState::LOGIN_PRIMARY);
TabletModeControllerTestApi().EnterTabletMode();
Shell::Get()->login_screen_controller()->SetLoginShelfGestureHandler(
base::ASCIIToUTF16("Test swipe"), base::DoNothing(), base::DoNothing());
}
} // namespace ash
| {
"content_hash": "69da5480f21d99b8eea61b04a480ee19",
"timestamp": "",
"source": "github",
"line_count": 697,
"max_line_length": 80,
"avg_line_length": 42.47632711621234,
"alnum_prop": 0.7275552252921705,
"repo_name": "endlessm/chromium-browser",
"id": "07ec27bb89280a27db1796fb1c8e1a694817ef8d",
"size": "30173",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "ash/shelf/login_shelf_gesture_controller_unittest.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [],
"symlink_target": ""
} |
FROM balenalib/asus-tinker-edge-t-debian:bookworm-run
ENV GO_VERSION 1.16.14
# gcc for cgo
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
gcc \
libc6-dev \
make \
pkg-config \
git \
&& rm -rf /var/lib/apt/lists/*
RUN set -x \
&& fetchDeps=' \
curl \
' \
&& apt-get update && apt-get install -y $fetchDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& mkdir -p /usr/local/go \
&& curl -SLO "https://storage.googleapis.com/golang/go$GO_VERSION.linux-arm64.tar.gz" \
&& echo "5e59056e36704acb25809bcdb27191f27593cb7aba4d716b523008135a1e764a go$GO_VERSION.linux-arm64.tar.gz" | sha256sum -c - \
&& tar -xzf "go$GO_VERSION.linux-arm64.tar.gz" -C /usr/local/go --strip-components=1 \
&& rm -f go$GO_VERSION.linux-arm64.tar.gz
ENV GOROOT /usr/local/go
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH
CMD ["echo","'No CMD command was set in Dockerfile! Details about CMD command could be found in Dockerfile Guide section in our Docs. Here's the link: https://balena.io/docs"]
RUN curl -SLO "https://raw.githubusercontent.com/balena-io-library/base-images/613d8e9ca8540f29a43fddf658db56a8d826fffe/scripts/assets/tests/test-stack@golang.sh" \
&& echo "Running test-stack@golang" \
&& chmod +x test-stack@golang.sh \
&& bash test-stack@golang.sh \
&& rm -rf test-stack@golang.sh
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo 'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: ARM v8 \nOS: Debian Bookworm \nVariant: run variant \nDefault variable(s): UDEV=off \nThe following software stack is preinstalled: \nGo v1.16.14 \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo '#!/bin/sh.real\nbalena-info\nrm -f /bin/sh\ncp /bin/sh.real /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& cp /bin/sh /bin/sh.real \
&& mv /bin/sh-shim /bin/sh | {
"content_hash": "d4b94d82a0d537eeb9580f1cb31c7a45",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 675,
"avg_line_length": 50.391304347826086,
"alnum_prop": 0.7057808455565142,
"repo_name": "resin-io-library/base-images",
"id": "33f22ec39aaf07b93cdabaff6aa444b694ca4cac",
"size": "2339",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "balena-base-images/golang/asus-tinker-edge-t/debian/bookworm/1.16.14/run/Dockerfile",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "71234697"
},
{
"name": "JavaScript",
"bytes": "13096"
},
{
"name": "Shell",
"bytes": "12051936"
},
{
"name": "Smarty",
"bytes": "59789"
}
],
"symlink_target": ""
} |
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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.
// ----------------------------------------------------------------------------------
using System.Management.Automation;
using Microsoft.Azure.Commands.WebApps.Properties;
namespace Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps
{
/// <summary>
/// this commandlet will let you delete an Azure web app
/// </summary>
[Cmdlet(VerbsCommon.Remove, "AzureRmWebApp", SupportsShouldProcess = true)]
public class RemoveAzureWebAppCmdlet : WebAppBaseCmdlet
{
//always delete the slots,
private bool deleteSlotsByDefault = true;
// leave behind the empty webhosting plan
private bool deleteEmptyServerFarmByDefault = false;
//always delete the metrics
private bool deleteMetricsByDefault = true;
[Parameter(Mandatory = false, HelpMessage = "Do not ask for confirmation.")]
public SwitchParameter Force { get; set; }
public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();
ConfirmAction(
Force.IsPresent,
string.Format(Properties.Resources.RemoveWebsiteWarning, Name),
Properties.Resources.RemoveWebsiteMessage,
Name,
() =>
{
WebsitesClient.RemoveWebApp(ResourceGroupName, Name, null, deleteEmptyServerFarmByDefault, deleteMetricsByDefault, deleteSlotsByDefault);
});
}
}
}
| {
"content_hash": "b83fabf1f83b98609e40412b0fe9cc77",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 157,
"avg_line_length": 36.689655172413794,
"alnum_prop": 0.6193609022556391,
"repo_name": "hungmai-msft/azure-powershell",
"id": "d7ecb02598ae122efdd75b478e880050dc30f465",
"size": "2130",
"binary": false,
"copies": "5",
"ref": "refs/heads/preview",
"path": "src/ResourceManager/Websites/Commands.Websites/Cmdlets/WebApps/RemoveAzureWebApp.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "16509"
},
{
"name": "C#",
"bytes": "39328004"
},
{
"name": "HTML",
"bytes": "209"
},
{
"name": "JavaScript",
"bytes": "4979"
},
{
"name": "PHP",
"bytes": "41"
},
{
"name": "PowerShell",
"bytes": "3983165"
},
{
"name": "Ruby",
"bytes": "265"
},
{
"name": "Shell",
"bytes": "50"
},
{
"name": "XSLT",
"bytes": "6114"
}
],
"symlink_target": ""
} |
var Abilities = require('./lib/Abilities');
var ClassUtils = require('./lib/ClassUtils');
var PlayerData = require('./lib/PlayerData');
var UI = require('./lib/UI');
var TextLabel = require('./textLabel');
var Page = require('./Page');
var PageController = require('./PageController');
var ResultsPage = function ResultsPage(data) {
var fullName = Abilities.fullNames[shortName];
Page.call(this, {
subtitle: fullName + ' Test'
});
var subSubTitle = new Label({left: 0, right: 0, top: 10}, null, Theme.textStyle,
'Your ' + fullName + ':');
var textLabel = new Text({left: 0, right: 0, top: 10}, null, Theme.textStyle,
'');
var button = new UI.Button({
left: 120,
top: 10,
width: 80,
height: 20,
string: 'OK!',
active: true,
action: '/'
});
this.layout.add(subSubTitle);
this.layout.add(textLabel);
this.layout.add(button);
this.behavior = {
shortName: data.ability,
bar: null,
layout: this.layout,
getDescription: function(score) {
var descriptions = Abilities.resultDescriptions[this.shortName];
if (score < 3) {
return descriptions[0];
} else if (score < 6) {
return descriptions[1];
} else {
return descriptions[2];
}
},
onDisplaying: function(container) {
// all our scores are 1-7
var score = PlayerData[this.shortName];
var bar = new Bar.HorizontalBar({
left: 5,
top: 5,
width: 310,
height: 20,
bgColor: '#ccc',
fgColor: '#333',
progress: score
});
if (this.bar !== null) {
this.layout.remove(this.bar);
}
this.bar = bar;
this.layout.insert(bar, textLabel);
textLabel.string = this.getDescription(score);
}
};
};
ClassUtils.subclass(ResultsPage, Page);
for (var i = 0; i < Abilities.shortNames.length; i++) {
var shortName = Abilities.shortNames[i];
exports[shortName] = new ResultsPage({
ability: shortName
});
} | {
"content_hash": "f931305bcab0c044d5997b2eb88c14eb",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 81,
"avg_line_length": 24.866666666666667,
"alnum_prop": 0.6423592493297587,
"repo_name": "savageinternet/hoedown",
"id": "ae1dbed5c7e7bdac3da9b4b4b8d9fd88081b8cdb",
"size": "1876",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "kinoma-new/role-picker/src/ResultsPage.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "4399"
},
{
"name": "JavaScript",
"bytes": "64375"
},
{
"name": "Python",
"bytes": "27197"
}
],
"symlink_target": ""
} |
package io.grpc.testing.integration;
import com.google.common.base.Preconditions;
/**
* Enum of interop test cases.
*/
public enum TestCases {
EMPTY_UNARY("empty (zero bytes) request and response"),
CACHEABLE_UNARY("cacheable unary rpc sent using GET"),
LARGE_UNARY("single request and (large) response"),
CLIENT_COMPRESSED_UNARY("client compressed unary request"),
CLIENT_COMPRESSED_UNARY_NOPROBE(
"client compressed unary request (skip initial feature-probing request)"),
SERVER_COMPRESSED_UNARY("server compressed unary response"),
CLIENT_STREAMING("request streaming with single response"),
CLIENT_COMPRESSED_STREAMING("client per-message compression on stream"),
CLIENT_COMPRESSED_STREAMING_NOPROBE(
"client per-message compression on stream (skip initial feature-probing request)"),
SERVER_STREAMING("single request with response streaming"),
SERVER_COMPRESSED_STREAMING("server per-message compression on stream"),
PING_PONG("full-duplex ping-pong streaming"),
EMPTY_STREAM("A stream that has zero-messages in both directions"),
COMPUTE_ENGINE_CREDS("large_unary with service_account auth"),
COMPUTE_ENGINE_CHANNEL_CREDENTIALS("large unary with compute engine channel builder"),
SERVICE_ACCOUNT_CREDS("large_unary with compute engine auth"),
JWT_TOKEN_CREDS("JWT-based auth"),
OAUTH2_AUTH_TOKEN("raw oauth2 access token auth"),
PER_RPC_CREDS("per rpc raw oauth2 access token auth"),
GOOGLE_DEFAULT_CREDENTIALS(
"google default credentials, i.e. GoogleManagedChannel based auth"),
CUSTOM_METADATA("unary and full duplex calls with metadata"),
STATUS_CODE_AND_MESSAGE("request error code and message"),
SPECIAL_STATUS_MESSAGE("special characters in status message"),
UNIMPLEMENTED_METHOD("call an unimplemented RPC method"),
UNIMPLEMENTED_SERVICE("call an unimplemented RPC service"),
CANCEL_AFTER_BEGIN("cancel stream after starting it"),
CANCEL_AFTER_FIRST_RESPONSE("cancel on first response"),
TIMEOUT_ON_SLEEPING_SERVER("timeout before receiving a response"),
VERY_LARGE_REQUEST("very large request"),
PICK_FIRST_UNARY("all requests are sent to one server despite multiple servers are resolved"),
RPC_SOAK("sends 'soak_iterations' large_unary rpcs in a loop, each on the same channel"),
CHANNEL_SOAK("sends 'soak_iterations' large_unary rpcs in a loop, each on a new channel"),
ORCA_PER_RPC("report backend metrics per query"),
ORCA_OOB("report backend metrics out-of-band");
private final String description;
TestCases(String description) {
this.description = description;
}
/**
* Returns a description of the test case.
*/
public String description() {
return description;
}
/**
* Returns the {@link TestCases} matching the string {@code s}. The
* matching is done case insensitive.
*/
public static TestCases fromString(String s) {
Preconditions.checkNotNull(s, "s");
return TestCases.valueOf(s.toUpperCase());
}
}
| {
"content_hash": "0fb248526a32b76683d0f8a78817fb14",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 96,
"avg_line_length": 42.457142857142856,
"alnum_prop": 0.7446164199192463,
"repo_name": "stanley-cheung/grpc-java",
"id": "85e5c31a4cbcdb1da54f238cbceec416206a68b6",
"size": "3571",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "interop-testing/src/main/java/io/grpc/testing/integration/TestCases.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "6230"
},
{
"name": "C++",
"bytes": "47647"
},
{
"name": "Dockerfile",
"bytes": "1407"
},
{
"name": "Java",
"bytes": "11243085"
},
{
"name": "Python",
"bytes": "1961"
},
{
"name": "Shell",
"bytes": "60937"
},
{
"name": "Starlark",
"bytes": "45042"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>pagesnotfound</name>
<displayName><![CDATA[Pages not found]]></displayName>
<version><![CDATA[1]]></version>
<description><![CDATA[Display the pages requested by your visitors but not found.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[analytics_stats]]></tab>
<is_configurable>0</is_configurable>
<need_instance>0</need_instance>
<limited_countries></limited_countries>
</module> | {
"content_hash": "ccf3ac9f08c82dee691db1fb058a3cab",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 99,
"avg_line_length": 39.166666666666664,
"alnum_prop": 0.7042553191489361,
"repo_name": "j1v3/lakombi",
"id": "59aa1c0c5cc20d2e73d23df212462740de9730aa",
"size": "470",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/LaKombi/ShopBundle/modules/pagesnotfound/config.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "JavaScript",
"bytes": "1927410"
},
{
"name": "PHP",
"bytes": "32090445"
}
],
"symlink_target": ""
} |
package org.apache.samoa.learners.classifiers.ensemble;
import java.util.Arrays;
import java.util.Random;
/**
* License
*/
import org.apache.samoa.core.ContentEvent;
import org.apache.samoa.core.Processor;
import org.apache.samoa.instances.Instance;
import org.apache.samoa.learners.InstanceContentEvent;
import org.apache.samoa.topology.Stream;
/**
* The Class BaggingDistributorPE.
*/
public class ShardingDistributorProcessor implements Processor {
private static final long serialVersionUID = -1550901409625192730L;
/** The ensemble size. */
private int ensembleSize;
/** The stream ensemble. */
private Stream[] ensembleStreams;
/** Ramdom number generator. */
protected Random random = new Random(); //TODO make random seed configurable
/**
* On event.
*
* @param event
* the event
* @return true, if successful
*/
public boolean process(ContentEvent event) {
InstanceContentEvent inEvent = (InstanceContentEvent) event;
if (inEvent.isLastEvent()) {
// end learning
for (Stream stream : ensembleStreams)
stream.put(event);
return false;
}
if (inEvent.isTesting()) {
Instance testInstance = inEvent.getInstance();
for (int i = 0; i < ensembleSize; i++) {
Instance instanceCopy = testInstance.copy();
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(inEvent.getInstanceIndex(), instanceCopy,
false, true);
instanceContentEvent.setClassifierIndex(i); //TODO probably not needed anymore
instanceContentEvent.setEvaluationIndex(inEvent.getEvaluationIndex()); //TODO probably not needed anymore
ensembleStreams[i].put(instanceContentEvent);
}
}
// estimate model parameters using the training data
if (inEvent.isTraining()) {
train(inEvent);
}
return false;
}
/**
* Train.
*
* @param inEvent
* the in event
*/
protected void train(InstanceContentEvent inEvent) {
Instance trainInst = inEvent.getInstance().copy();
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(inEvent.getInstanceIndex(), trainInst,
true, false);
int i = random.nextInt(ensembleSize);
instanceContentEvent.setClassifierIndex(i);
instanceContentEvent.setEvaluationIndex(inEvent.getEvaluationIndex());
ensembleStreams[i].put(instanceContentEvent);
}
/*
* (non-Javadoc)
*
* @see org.apache.s4.core.ProcessingElement#onCreate()
*/
@Override
public void onCreate(int id) {
// do nothing
}
public Stream[] getOutputStreams() {
return ensembleStreams;
}
public void setOutputStreams(Stream[] ensembleStreams) {
this.ensembleStreams = ensembleStreams;
}
/**
* Gets the size ensemble.
*
* @return the size ensemble
*/
public int getEnsembleSize() {
return ensembleSize;
}
/**
* Sets the size ensemble.
*
* @param ensembleSize
* the new size ensemble
*/
public void setEnsembleSize(int ensembleSize) {
this.ensembleSize = ensembleSize;
}
/*
* (non-Javadoc)
*
* @see samoa.core.Processor#newProcessor(samoa.core.Processor)
*/
@Override
public Processor newProcessor(Processor sourceProcessor) {
ShardingDistributorProcessor newProcessor = new ShardingDistributorProcessor();
ShardingDistributorProcessor originProcessor = (ShardingDistributorProcessor) sourceProcessor;
if (originProcessor.getOutputStreams() != null) {
newProcessor.setOutputStreams(Arrays.copyOf(originProcessor.getOutputStreams(),
originProcessor.getOutputStreams().length));
}
newProcessor.setEnsembleSize(originProcessor.getEnsembleSize());
/*
* if (originProcessor.getLearningCurve() != null){
* newProcessor.setLearningCurve((LearningCurve)
* originProcessor.getLearningCurve().copy()); }
*/
return newProcessor;
}
}
| {
"content_hash": "54112368d3dd922ffd9ded5260411a75",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 118,
"avg_line_length": 27.587412587412587,
"alnum_prop": 0.6937896070975919,
"repo_name": "mehdidb/incubator-samoa",
"id": "0e936d763228227f74fc149adac94f32b85a6fac",
"size": "4600",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "samoa-api/src/main/java/org/apache/samoa/learners/classifiers/ensemble/ShardingDistributorProcessor.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Java",
"bytes": "1614745"
},
{
"name": "Shell",
"bytes": "19822"
}
],
"symlink_target": ""
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_181) on Fri Sep 11 16:00:20 AEST 2020 -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Package au.gov.amsa.util.netcdf (parent 0.5.25 Test API)</title>
<meta name="date" content="2020-09-11">
<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 Package au.gov.amsa.util.netcdf (parent 0.5.25 Test API)";
}
}
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>Class</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-all.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?au/gov/amsa/util/netcdf/package-use.html" target="_top">Frames</a></li>
<li><a href="package-use.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Uses of Package au.gov.amsa.util.netcdf" class="title">Uses of Package<br>au.gov.amsa.util.netcdf</h1>
</div>
<div class="contentContainer">No usage of au.gov.amsa.util.netcdf</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>Class</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-all.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?au/gov/amsa/util/netcdf/package-use.html" target="_top">Frames</a></li>
<li><a href="package-use.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2020. All rights reserved.</small></p>
</body>
</html>
| {
"content_hash": "2bdf2725788901e9fe4a1f4afd008eac",
"timestamp": "",
"source": "github",
"line_count": 126,
"max_line_length": 113,
"avg_line_length": 33.666666666666664,
"alnum_prop": 0.6046676096181046,
"repo_name": "amsa-code/amsa-code.github.io",
"id": "45cd497c2b64b98c8c9a061d62f1d4522c7717f8",
"size": "4242",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "risky/testapidocs/au/gov/amsa/util/netcdf/package-use.html",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "246119"
},
{
"name": "HTML",
"bytes": "40769701"
},
{
"name": "JavaScript",
"bytes": "328279"
}
],
"symlink_target": ""
} |
% Copyright (C) 2009-2013 Biomedizinische NMR Forschungs GmbH
% http://www.biomednmr.mpg.de
% Author: Tilman Johannes Sumpf <tsumpf@gwdg.de>
%
% Distributed under the Boost Software License, Version 1.2.
% (See accompanying file LICENSE_1_0.txt or copy at
% http://www.boost.org/LICENSE_1_0.txt)
classdef asInfoTextClass < handle
properties (GetAccess = private, SetAccess = private)
ph = 0; % panel handle
cmh = 0; % context menu handle
lwfh = 0; % large window figure handle
lwph = 0; % large window panel handle
text = '';
end
methods
function obj = asInfoTextClass(parentPanelHandle, panelPosition)
obj.ph = uicontrol('Style','edit',...
'Parent',parentPanelHandle,...
'Units','normalized',...
'Position',panelPosition,...
'Max',2,...
'HorizontalAlignment','left',...
'Visible','off',...
'callback',@(src,evnt)copyInfoTextCb(obj,src));
function copyInfoTextCb(obj,src)
obj.text = get(src,'String');
set(obj.ph,'String',obj.text);
if ishandle(obj.lwfh)
if obj.lwfh ~= 0
set(obj.lwph,'String',obj.text);
end
end
end
obj.cmh = uicontextmenu;
uimenu(obj.cmh,'Label','open large window' ,...
'callback',@(src,evnt)obj.openLargeWindow);
uimenu(obj.cmh,'Label','close large window' ,...
'callback',@(src,evnt)obj.closeLargeWindow);
set(obj.ph,'uicontextmenu',obj.cmh);
end
function setInfotext(obj, infoText)
% infoText can be either a string or a struct
if isstruct(infoText) || isobject(infoText)
obj.parseStruct(infoText);
else
obj.setString(infoText);
end
end
function setString(obj, str)
obj.text = str;
set(obj.ph,'String',obj.text);
end
function str = getString(obj)
str = obj.text;
end
function setVisible(obj, OnOffStr)
set(obj.ph,'Visible',OnOffStr);
end
function OnOffStr = getVisible(obj)
OnOffStr = get(obj.ph,'Visible');
end
function openLargeWindow(obj)
parentFigureHandle = get(get(obj.ph,'Parent'),'Parent');
parentFigureTitle = get(parentFigureHandle,'name');
lwTitle = sprintf('asO %d: infoText (%s)',parentFigureHandle,parentFigureTitle);
obj.lwfh = figure( 'MenuBar','none',...
'ToolBar','none',...
'NumberTitle','off',...
'Name',lwTitle);
obj.lwph = uicontrol('Style','edit',...
'Parent',obj.lwfh,...
'Units','normalized',...
'Position',[0,0,1,1],...
'Max',2,...
'HorizontalAlignment','left',...
'Visible','on',...
'String', obj.text,...
'callback',@(src,evnt)copyInfoTextCb(obj,src));
function copyInfoTextCb(obj,src)
obj.text = get(src,'String');
set(obj.ph,'String',obj.text);
end
end
function closeLargeWindow(obj)
if ishandle(obj.lwfh)
if obj.lwfh ~= 0
delete(obj.lwfh);
end
end
end
function parseStruct(obj, struct)
if isstruct(struct) || isobject(struct)
names = evalc('disp(struct)');
names = strread(names,'%s','delimiter','\n');
txt = [ obj.getString;...
{'-- struct: --'};...
names;...
{'-end struct-'}];
obj.setString(txt);
clear struct
else
error('first argument has to be a struct');
end
end
end
methods (Access = private)
function lwCloseRequest(obj) %large window close request
% ...doesn't work yet
figure(get(parentPanelHandle,'Parent'));
obj.setString(get(obj.lwph,'String'));
delete(obj.lwfh);
end
end
end
| {
"content_hash": "49b62847dc68bd4d6bb3cc172ac2263b",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 92,
"avg_line_length": 33.41830065359477,
"alnum_prop": 0.42519069039702717,
"repo_name": "leoliuf/MRiLab",
"id": "1bbc598878055859edafcf5d6183b1c5c2b50ef7",
"size": "5113",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "External/arrayShow/asInfoTextClass.m",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "393016"
},
{
"name": "C++",
"bytes": "105503"
},
{
"name": "CMake",
"bytes": "21349"
},
{
"name": "Cuda",
"bytes": "301237"
},
{
"name": "Limbo",
"bytes": "2150"
},
{
"name": "M",
"bytes": "509"
},
{
"name": "MATLAB",
"bytes": "1941952"
}
],
"symlink_target": ""
} |
TODO: Write a gem description
## Installation
Add this line to your application's Gemfile:
gem 'konacha_like'
And then execute:
$ bundle
Or install it yourself as:
$ gem install konacha_like
## Usage
TODO: Write usage instructions here
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
| {
"content_hash": "49b94f431b6a19994f62c2ef8cabe142",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 64,
"avg_line_length": 18.37037037037037,
"alnum_prop": 0.7157258064516129,
"repo_name": "rosenfeld/konacha_like",
"id": "19d79d9b8c4bab23fdf711ef53518d22b183b5af",
"size": "511",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "README.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CoffeeScript",
"bytes": "86"
},
{
"name": "Ruby",
"bytes": "1055"
}
],
"symlink_target": ""
} |
namespace rocksdb {
class CountingLogger : public Logger {
public:
using Logger::Logv;
virtual void Logv(const char* format, va_list ap) override { log_count++; }
size_t log_count;
};
class CompactionPickerTest : public testing::Test {
public:
const Comparator* ucmp_;
InternalKeyComparator icmp_;
Options options_;
ImmutableCFOptions ioptions_;
MutableCFOptions mutable_cf_options_;
LevelCompactionPicker level_compaction_picker;
std::string cf_name_;
CountingLogger logger_;
LogBuffer log_buffer_;
uint32_t file_num_;
CompactionOptionsFIFO fifo_options_;
std::unique_ptr<VersionStorageInfo> vstorage_;
std::vector<std::unique_ptr<FileMetaData>> files_;
// does not own FileMetaData
std::unordered_map<uint32_t, std::pair<FileMetaData*, int>> file_map_;
// input files to compaction process.
std::vector<CompactionInputFiles> input_files_;
int compaction_level_start_;
CompactionPickerTest()
: ucmp_(BytewiseComparator()),
icmp_(ucmp_),
ioptions_(options_),
mutable_cf_options_(options_),
level_compaction_picker(ioptions_, &icmp_),
cf_name_("dummy"),
log_buffer_(InfoLogLevel::INFO_LEVEL, &logger_),
file_num_(1),
vstorage_(nullptr) {
fifo_options_.max_table_files_size = 1;
mutable_cf_options_.RefreshDerivedOptions(ioptions_);
ioptions_.db_paths.emplace_back("dummy",
std::numeric_limits<uint64_t>::max());
}
~CompactionPickerTest() {
}
void NewVersionStorage(int num_levels, CompactionStyle style) {
DeleteVersionStorage();
options_.num_levels = num_levels;
vstorage_.reset(new VersionStorageInfo(
&icmp_, ucmp_, options_.num_levels, style, nullptr));
vstorage_->CalculateBaseBytes(ioptions_, mutable_cf_options_);
}
void DeleteVersionStorage() {
vstorage_.reset();
files_.clear();
file_map_.clear();
input_files_.clear();
}
void Add(int level, uint32_t file_number, const char* smallest,
const char* largest, uint64_t file_size = 1, uint32_t path_id = 0,
SequenceNumber smallest_seq = 100,
SequenceNumber largest_seq = 100) {
assert(level < vstorage_->num_levels());
FileMetaData* f = new FileMetaData;
f->fd = FileDescriptor(file_number, path_id, file_size);
f->smallest = InternalKey(smallest, smallest_seq, kTypeValue);
f->largest = InternalKey(largest, largest_seq, kTypeValue);
f->smallest_seqno = smallest_seq;
f->largest_seqno = largest_seq;
f->compensated_file_size = file_size;
f->refs = 0;
vstorage_->AddFile(level, f);
files_.emplace_back(f);
file_map_.insert({file_number, {f, level}});
}
void SetCompactionInputFilesLevels(int level_count, int start_level) {
input_files_.resize(level_count);
for (int i = 0; i < level_count; ++i) {
input_files_[i].level = start_level + i;
}
compaction_level_start_ = start_level;
}
void AddToCompactionFiles(uint32_t file_number) {
auto iter = file_map_.find(file_number);
assert(iter != file_map_.end());
int level = iter->second.second;
assert(level < vstorage_->num_levels());
input_files_[level - compaction_level_start_].files.emplace_back(
iter->second.first);
}
void UpdateVersionStorageInfo() {
vstorage_->CalculateBaseBytes(ioptions_, mutable_cf_options_);
vstorage_->UpdateFilesByCompactionPri(ioptions_.compaction_pri);
vstorage_->UpdateNumNonEmptyLevels();
vstorage_->GenerateFileIndexer();
vstorage_->GenerateLevelFilesBrief();
vstorage_->ComputeCompactionScore(ioptions_, mutable_cf_options_);
vstorage_->GenerateLevel0NonOverlapping();
vstorage_->SetFinalized();
}
};
TEST_F(CompactionPickerTest, Empty) {
NewVersionStorage(6, kCompactionStyleLevel);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() == nullptr);
}
TEST_F(CompactionPickerTest, Single) {
NewVersionStorage(6, kCompactionStyleLevel);
mutable_cf_options_.level0_file_num_compaction_trigger = 2;
Add(0, 1U, "p", "q");
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() == nullptr);
}
TEST_F(CompactionPickerTest, Level0Trigger) {
NewVersionStorage(6, kCompactionStyleLevel);
mutable_cf_options_.level0_file_num_compaction_trigger = 2;
Add(0, 1U, "150", "200");
Add(0, 2U, "200", "250");
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(2U, compaction->num_input_files(0));
ASSERT_EQ(1U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(2U, compaction->input(0, 1)->fd.GetNumber());
}
TEST_F(CompactionPickerTest, Level1Trigger) {
NewVersionStorage(6, kCompactionStyleLevel);
Add(1, 66U, "150", "200", 1000000000U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(1U, compaction->num_input_files(0));
ASSERT_EQ(66U, compaction->input(0, 0)->fd.GetNumber());
}
TEST_F(CompactionPickerTest, Level1Trigger2) {
NewVersionStorage(6, kCompactionStyleLevel);
Add(1, 66U, "150", "200", 1000000001U);
Add(1, 88U, "201", "300", 1000000000U);
Add(2, 6U, "150", "179", 1000000000U);
Add(2, 7U, "180", "220", 1000000000U);
Add(2, 8U, "221", "300", 1000000000U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(1U, compaction->num_input_files(0));
ASSERT_EQ(2U, compaction->num_input_files(1));
ASSERT_EQ(66U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(6U, compaction->input(1, 0)->fd.GetNumber());
ASSERT_EQ(7U, compaction->input(1, 1)->fd.GetNumber());
}
TEST_F(CompactionPickerTest, LevelMaxScore) {
NewVersionStorage(6, kCompactionStyleLevel);
mutable_cf_options_.target_file_size_base = 10000000;
mutable_cf_options_.target_file_size_multiplier = 10;
mutable_cf_options_.max_bytes_for_level_base = 10 * 1024 * 1024;
Add(0, 1U, "150", "200", 1000000000U);
// Level 1 score 1.2
Add(1, 66U, "150", "200", 6000000U);
Add(1, 88U, "201", "300", 6000000U);
// Level 2 score 1.8. File 7 is the largest. Should be picked
Add(2, 6U, "150", "179", 60000000U);
Add(2, 7U, "180", "220", 60000001U);
Add(2, 8U, "221", "300", 60000000U);
// Level 3 score slightly larger than 1
Add(3, 26U, "150", "170", 260000000U);
Add(3, 27U, "171", "179", 260000000U);
Add(3, 28U, "191", "220", 260000000U);
Add(3, 29U, "221", "300", 260000000U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(1U, compaction->num_input_files(0));
ASSERT_EQ(7U, compaction->input(0, 0)->fd.GetNumber());
}
TEST_F(CompactionPickerTest, NeedsCompactionLevel) {
const int kLevels = 6;
const int kFileCount = 20;
for (int level = 0; level < kLevels - 1; ++level) {
NewVersionStorage(kLevels, kCompactionStyleLevel);
uint64_t file_size = vstorage_->MaxBytesForLevel(level) * 2 / kFileCount;
for (int file_count = 1; file_count <= kFileCount; ++file_count) {
// start a brand new version in each test.
NewVersionStorage(kLevels, kCompactionStyleLevel);
for (int i = 0; i < file_count; ++i) {
Add(level, i, ToString((i + 100) * 1000).c_str(),
ToString((i + 100) * 1000 + 999).c_str(),
file_size, 0, i * 100, i * 100 + 99);
}
UpdateVersionStorageInfo();
ASSERT_EQ(vstorage_->CompactionScoreLevel(0), level);
ASSERT_EQ(level_compaction_picker.NeedsCompaction(vstorage_.get()),
vstorage_->CompactionScore(0) >= 1);
// release the version storage
DeleteVersionStorage();
}
}
}
TEST_F(CompactionPickerTest, Level0TriggerDynamic) {
int num_levels = ioptions_.num_levels;
ioptions_.level_compaction_dynamic_level_bytes = true;
mutable_cf_options_.level0_file_num_compaction_trigger = 2;
mutable_cf_options_.max_bytes_for_level_base = 200;
mutable_cf_options_.max_bytes_for_level_multiplier = 10;
NewVersionStorage(num_levels, kCompactionStyleLevel);
Add(0, 1U, "150", "200");
Add(0, 2U, "200", "250");
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(2U, compaction->num_input_files(0));
ASSERT_EQ(1U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(2U, compaction->input(0, 1)->fd.GetNumber());
ASSERT_EQ(1, static_cast<int>(compaction->num_input_levels()));
ASSERT_EQ(num_levels - 1, compaction->output_level());
}
TEST_F(CompactionPickerTest, Level0TriggerDynamic2) {
int num_levels = ioptions_.num_levels;
ioptions_.level_compaction_dynamic_level_bytes = true;
mutable_cf_options_.level0_file_num_compaction_trigger = 2;
mutable_cf_options_.max_bytes_for_level_base = 200;
mutable_cf_options_.max_bytes_for_level_multiplier = 10;
NewVersionStorage(num_levels, kCompactionStyleLevel);
Add(0, 1U, "150", "200");
Add(0, 2U, "200", "250");
Add(num_levels - 1, 3U, "200", "250", 300U);
UpdateVersionStorageInfo();
ASSERT_EQ(vstorage_->base_level(), num_levels - 2);
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(2U, compaction->num_input_files(0));
ASSERT_EQ(1U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(2U, compaction->input(0, 1)->fd.GetNumber());
ASSERT_EQ(1, static_cast<int>(compaction->num_input_levels()));
ASSERT_EQ(num_levels - 2, compaction->output_level());
}
TEST_F(CompactionPickerTest, Level0TriggerDynamic3) {
int num_levels = ioptions_.num_levels;
ioptions_.level_compaction_dynamic_level_bytes = true;
mutable_cf_options_.level0_file_num_compaction_trigger = 2;
mutable_cf_options_.max_bytes_for_level_base = 200;
mutable_cf_options_.max_bytes_for_level_multiplier = 10;
NewVersionStorage(num_levels, kCompactionStyleLevel);
Add(0, 1U, "150", "200");
Add(0, 2U, "200", "250");
Add(num_levels - 1, 3U, "200", "250", 300U);
Add(num_levels - 1, 4U, "300", "350", 3000U);
UpdateVersionStorageInfo();
ASSERT_EQ(vstorage_->base_level(), num_levels - 3);
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(2U, compaction->num_input_files(0));
ASSERT_EQ(1U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(2U, compaction->input(0, 1)->fd.GetNumber());
ASSERT_EQ(1, static_cast<int>(compaction->num_input_levels()));
ASSERT_EQ(num_levels - 3, compaction->output_level());
}
TEST_F(CompactionPickerTest, Level0TriggerDynamic4) {
int num_levels = ioptions_.num_levels;
ioptions_.level_compaction_dynamic_level_bytes = true;
mutable_cf_options_.level0_file_num_compaction_trigger = 2;
mutable_cf_options_.max_bytes_for_level_base = 200;
mutable_cf_options_.max_bytes_for_level_multiplier = 10;
NewVersionStorage(num_levels, kCompactionStyleLevel);
Add(0, 1U, "150", "200");
Add(0, 2U, "200", "250");
Add(num_levels - 1, 3U, "200", "250", 300U);
Add(num_levels - 1, 4U, "300", "350", 3000U);
Add(num_levels - 3, 5U, "150", "180", 3U);
Add(num_levels - 3, 6U, "181", "300", 3U);
Add(num_levels - 3, 7U, "400", "450", 3U);
UpdateVersionStorageInfo();
ASSERT_EQ(vstorage_->base_level(), num_levels - 3);
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(2U, compaction->num_input_files(0));
ASSERT_EQ(1U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(2U, compaction->input(0, 1)->fd.GetNumber());
ASSERT_EQ(2U, compaction->num_input_files(1));
ASSERT_EQ(num_levels - 3, compaction->level(1));
ASSERT_EQ(5U, compaction->input(1, 0)->fd.GetNumber());
ASSERT_EQ(6U, compaction->input(1, 1)->fd.GetNumber());
ASSERT_EQ(2, static_cast<int>(compaction->num_input_levels()));
ASSERT_EQ(num_levels - 3, compaction->output_level());
}
TEST_F(CompactionPickerTest, LevelTriggerDynamic4) {
int num_levels = ioptions_.num_levels;
ioptions_.level_compaction_dynamic_level_bytes = true;
ioptions_.compaction_pri = kMinOverlappingRatio;
mutable_cf_options_.level0_file_num_compaction_trigger = 2;
mutable_cf_options_.max_bytes_for_level_base = 200;
mutable_cf_options_.max_bytes_for_level_multiplier = 10;
NewVersionStorage(num_levels, kCompactionStyleLevel);
Add(0, 1U, "150", "200");
Add(num_levels - 1, 3U, "200", "250", 300U);
Add(num_levels - 1, 4U, "300", "350", 3000U);
Add(num_levels - 1, 4U, "400", "450", 3U);
Add(num_levels - 2, 5U, "150", "180", 300U);
Add(num_levels - 2, 6U, "181", "350", 500U);
Add(num_levels - 2, 7U, "400", "450", 200U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(1U, compaction->num_input_files(0));
ASSERT_EQ(5U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(0, compaction->num_input_files(1));
ASSERT_EQ(1U, compaction->num_input_levels());
ASSERT_EQ(num_levels - 1, compaction->output_level());
}
// Universal and FIFO Compactions are not supported in ROCKSDB_LITE
#ifndef ROCKSDB_LITE
TEST_F(CompactionPickerTest, NeedsCompactionUniversal) {
NewVersionStorage(1, kCompactionStyleUniversal);
UniversalCompactionPicker universal_compaction_picker(
ioptions_, &icmp_);
// must return false when there's no files.
ASSERT_EQ(universal_compaction_picker.NeedsCompaction(vstorage_.get()),
false);
UpdateVersionStorageInfo();
// verify the trigger given different number of L0 files.
for (int i = 1;
i <= mutable_cf_options_.level0_file_num_compaction_trigger * 2; ++i) {
NewVersionStorage(1, kCompactionStyleUniversal);
Add(0, i, ToString((i + 100) * 1000).c_str(),
ToString((i + 100) * 1000 + 999).c_str(), 1000000, 0, i * 100,
i * 100 + 99);
UpdateVersionStorageInfo();
ASSERT_EQ(level_compaction_picker.NeedsCompaction(vstorage_.get()),
vstorage_->CompactionScore(0) >= 1);
}
}
// Tests if the files can be trivially moved in multi level
// universal compaction when allow_trivial_move option is set
// In this test as the input files overlaps, they cannot
// be trivially moved.
TEST_F(CompactionPickerTest, CannotTrivialMoveUniversal) {
const uint64_t kFileSize = 100000;
ioptions_.compaction_options_universal.allow_trivial_move = true;
NewVersionStorage(1, kCompactionStyleUniversal);
UniversalCompactionPicker universal_compaction_picker(ioptions_, &icmp_);
// must return false when there's no files.
ASSERT_EQ(universal_compaction_picker.NeedsCompaction(vstorage_.get()),
false);
NewVersionStorage(3, kCompactionStyleUniversal);
Add(0, 1U, "150", "200", kFileSize, 0, 500, 550);
Add(0, 2U, "201", "250", kFileSize, 0, 401, 450);
Add(0, 4U, "260", "300", kFileSize, 0, 260, 300);
Add(1, 5U, "100", "151", kFileSize, 0, 200, 251);
Add(1, 3U, "301", "350", kFileSize, 0, 101, 150);
Add(2, 6U, "120", "200", kFileSize, 0, 20, 100);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(
universal_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(!compaction->is_trivial_move());
}
// Tests if the files can be trivially moved in multi level
// universal compaction when allow_trivial_move option is set
// In this test as the input files doesn't overlaps, they should
// be trivially moved.
TEST_F(CompactionPickerTest, AllowsTrivialMoveUniversal) {
const uint64_t kFileSize = 100000;
ioptions_.compaction_options_universal.allow_trivial_move = true;
UniversalCompactionPicker universal_compaction_picker(ioptions_, &icmp_);
NewVersionStorage(3, kCompactionStyleUniversal);
Add(0, 1U, "150", "200", kFileSize, 0, 500, 550);
Add(0, 2U, "201", "250", kFileSize, 0, 401, 450);
Add(0, 4U, "260", "300", kFileSize, 0, 260, 300);
Add(1, 5U, "010", "080", kFileSize, 0, 200, 251);
Add(2, 3U, "301", "350", kFileSize, 0, 101, 150);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(
universal_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction->is_trivial_move());
}
TEST_F(CompactionPickerTest, NeedsCompactionFIFO) {
NewVersionStorage(1, kCompactionStyleFIFO);
const int kFileCount =
mutable_cf_options_.level0_file_num_compaction_trigger * 3;
const uint64_t kFileSize = 100000;
const uint64_t kMaxSize = kFileSize * kFileCount / 2;
fifo_options_.max_table_files_size = kMaxSize;
ioptions_.compaction_options_fifo = fifo_options_;
FIFOCompactionPicker fifo_compaction_picker(ioptions_, &icmp_);
UpdateVersionStorageInfo();
// must return false when there's no files.
ASSERT_EQ(fifo_compaction_picker.NeedsCompaction(vstorage_.get()), false);
// verify whether compaction is needed based on the current
// size of L0 files.
uint64_t current_size = 0;
for (int i = 1; i <= kFileCount; ++i) {
NewVersionStorage(1, kCompactionStyleFIFO);
Add(0, i, ToString((i + 100) * 1000).c_str(),
ToString((i + 100) * 1000 + 999).c_str(),
kFileSize, 0, i * 100, i * 100 + 99);
current_size += kFileSize;
UpdateVersionStorageInfo();
ASSERT_EQ(level_compaction_picker.NeedsCompaction(vstorage_.get()),
vstorage_->CompactionScore(0) >= 1);
}
}
#endif // ROCKSDB_LITE
TEST_F(CompactionPickerTest, CompactionPriMinOverlapping1) {
NewVersionStorage(6, kCompactionStyleLevel);
ioptions_.compaction_pri = kMinOverlappingRatio;
mutable_cf_options_.target_file_size_base = 10000000;
mutable_cf_options_.target_file_size_multiplier = 10;
mutable_cf_options_.max_bytes_for_level_base = 10 * 1024 * 1024;
Add(2, 6U, "150", "179", 50000000U);
Add(2, 7U, "180", "220", 50000000U);
Add(2, 8U, "321", "400", 50000000U); // File not overlapping
Add(2, 9U, "721", "800", 50000000U);
Add(3, 26U, "150", "170", 260000000U);
Add(3, 27U, "171", "179", 260000000U);
Add(3, 28U, "191", "220", 260000000U);
Add(3, 29U, "221", "300", 260000000U);
Add(3, 30U, "750", "900", 260000000U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(1U, compaction->num_input_files(0));
// Pick file 8 because it overlaps with 0 files on level 3.
ASSERT_EQ(8U, compaction->input(0, 0)->fd.GetNumber());
}
TEST_F(CompactionPickerTest, CompactionPriMinOverlapping2) {
NewVersionStorage(6, kCompactionStyleLevel);
ioptions_.compaction_pri = kMinOverlappingRatio;
mutable_cf_options_.target_file_size_base = 10000000;
mutable_cf_options_.target_file_size_multiplier = 10;
mutable_cf_options_.max_bytes_for_level_base = 10 * 1024 * 1024;
Add(2, 6U, "150", "175",
60000000U); // Overlaps with file 26, 27, total size 521M
Add(2, 7U, "176", "200", 60000000U); // Overlaps with file 27, 28, total size
// 520M, the smalelst overlapping
Add(2, 8U, "201", "300",
60000000U); // Overlaps with file 28, 29, total size 521M
Add(3, 26U, "100", "110", 261000000U);
Add(3, 26U, "150", "170", 261000000U);
Add(3, 27U, "171", "179", 260000000U);
Add(3, 28U, "191", "220", 260000000U);
Add(3, 29U, "221", "300", 261000000U);
Add(3, 30U, "321", "400", 261000000U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(1U, compaction->num_input_files(0));
// Picking file 7 because overlapping ratio is the biggest.
ASSERT_EQ(7U, compaction->input(0, 0)->fd.GetNumber());
}
TEST_F(CompactionPickerTest, CompactionPriMinOverlapping3) {
NewVersionStorage(6, kCompactionStyleLevel);
ioptions_.compaction_pri = kMinOverlappingRatio;
mutable_cf_options_.max_bytes_for_level_base = 10000000;
mutable_cf_options_.max_bytes_for_level_multiplier = 10;
// file 7 and 8 over lap with the same file, but file 8 is smaller so
// it will be picked.
Add(2, 6U, "150", "167", 60000000U); // Overlaps with file 26, 27
Add(2, 7U, "168", "169", 60000000U); // Overlaps with file 27
Add(2, 8U, "201", "300", 61000000U); // Overlaps with file 28, but the file
// itself is larger. Should be picked.
Add(3, 26U, "160", "165", 260000000U);
Add(3, 27U, "166", "170", 260000000U);
Add(3, 28U, "180", "400", 260000000U);
Add(3, 29U, "401", "500", 260000000U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(1U, compaction->num_input_files(0));
// Picking file 8 because overlapping ratio is the biggest.
ASSERT_EQ(8U, compaction->input(0, 0)->fd.GetNumber());
}
// This test exhibits the bug where we don't properly reset parent_index in
// PickCompaction()
TEST_F(CompactionPickerTest, ParentIndexResetBug) {
int num_levels = ioptions_.num_levels;
mutable_cf_options_.level0_file_num_compaction_trigger = 2;
mutable_cf_options_.max_bytes_for_level_base = 200;
NewVersionStorage(num_levels, kCompactionStyleLevel);
Add(0, 1U, "150", "200"); // <- marked for compaction
Add(1, 3U, "400", "500", 600); // <- this one needs compacting
Add(2, 4U, "150", "200");
Add(2, 5U, "201", "210");
Add(2, 6U, "300", "310");
Add(2, 7U, "400", "500"); // <- being compacted
vstorage_->LevelFiles(2)[3]->being_compacted = true;
vstorage_->LevelFiles(0)[0]->marked_for_compaction = true;
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
}
// This test checks ExpandWhileOverlapping() by having overlapping user keys
// ranges (with different sequence numbers) in the input files.
TEST_F(CompactionPickerTest, OverlappingUserKeys) {
NewVersionStorage(6, kCompactionStyleLevel);
ioptions_.compaction_pri = kByCompensatedSize;
Add(1, 1U, "100", "150", 1U);
// Overlapping user keys
Add(1, 2U, "200", "400", 1U);
Add(1, 3U, "400", "500", 1000000000U, 0, 0);
Add(2, 4U, "600", "700", 1U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(1U, compaction->num_input_levels());
ASSERT_EQ(2U, compaction->num_input_files(0));
ASSERT_EQ(2U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(3U, compaction->input(0, 1)->fd.GetNumber());
}
TEST_F(CompactionPickerTest, OverlappingUserKeys2) {
NewVersionStorage(6, kCompactionStyleLevel);
// Overlapping user keys on same level and output level
Add(1, 1U, "200", "400", 1000000000U);
Add(1, 2U, "400", "500", 1U, 0, 0);
Add(2, 3U, "000", "100", 1U);
Add(2, 4U, "100", "600", 1U, 0, 0);
Add(2, 5U, "600", "700", 1U, 0, 0);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(2U, compaction->num_input_levels());
ASSERT_EQ(2U, compaction->num_input_files(0));
ASSERT_EQ(3U, compaction->num_input_files(1));
ASSERT_EQ(1U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(2U, compaction->input(0, 1)->fd.GetNumber());
ASSERT_EQ(3U, compaction->input(1, 0)->fd.GetNumber());
ASSERT_EQ(4U, compaction->input(1, 1)->fd.GetNumber());
ASSERT_EQ(5U, compaction->input(1, 2)->fd.GetNumber());
}
TEST_F(CompactionPickerTest, OverlappingUserKeys3) {
NewVersionStorage(6, kCompactionStyleLevel);
// Chain of overlapping user key ranges (forces ExpandWhileOverlapping() to
// expand multiple times)
Add(1, 1U, "100", "150", 1U);
Add(1, 2U, "150", "200", 1U, 0, 0);
Add(1, 3U, "200", "250", 1000000000U, 0, 0);
Add(1, 4U, "250", "300", 1U, 0, 0);
Add(1, 5U, "300", "350", 1U, 0, 0);
// Output level overlaps with the beginning and the end of the chain
Add(2, 6U, "050", "100", 1U);
Add(2, 7U, "350", "400", 1U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(2U, compaction->num_input_levels());
ASSERT_EQ(5U, compaction->num_input_files(0));
ASSERT_EQ(2U, compaction->num_input_files(1));
ASSERT_EQ(1U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(2U, compaction->input(0, 1)->fd.GetNumber());
ASSERT_EQ(3U, compaction->input(0, 2)->fd.GetNumber());
ASSERT_EQ(4U, compaction->input(0, 3)->fd.GetNumber());
ASSERT_EQ(5U, compaction->input(0, 4)->fd.GetNumber());
ASSERT_EQ(6U, compaction->input(1, 0)->fd.GetNumber());
ASSERT_EQ(7U, compaction->input(1, 1)->fd.GetNumber());
}
TEST_F(CompactionPickerTest, OverlappingUserKeys4) {
NewVersionStorage(6, kCompactionStyleLevel);
mutable_cf_options_.max_bytes_for_level_base = 1000000;
Add(1, 1U, "100", "150", 1U);
Add(1, 2U, "150", "199", 1U, 0, 0);
Add(1, 3U, "200", "250", 1100000U, 0, 0);
Add(1, 4U, "251", "300", 1U, 0, 0);
Add(1, 5U, "300", "350", 1U, 0, 0);
Add(2, 6U, "100", "115", 1U);
Add(2, 7U, "125", "325", 1U);
Add(2, 8U, "350", "400", 1U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(2U, compaction->num_input_levels());
ASSERT_EQ(1U, compaction->num_input_files(0));
ASSERT_EQ(1U, compaction->num_input_files(1));
ASSERT_EQ(3U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(7U, compaction->input(1, 0)->fd.GetNumber());
}
TEST_F(CompactionPickerTest, NotScheduleL1IfL0WithHigherPri1) {
NewVersionStorage(6, kCompactionStyleLevel);
mutable_cf_options_.level0_file_num_compaction_trigger = 2;
mutable_cf_options_.max_bytes_for_level_base = 900000000U;
// 6 L0 files, score 3.
Add(0, 1U, "000", "400", 1U);
Add(0, 2U, "001", "400", 1U, 0, 0);
Add(0, 3U, "001", "400", 1000000000U, 0, 0);
Add(0, 31U, "001", "400", 1000000000U, 0, 0);
Add(0, 32U, "001", "400", 1000000000U, 0, 0);
Add(0, 33U, "001", "400", 1000000000U, 0, 0);
// L1 total size 2GB, score 2.2. If one file being comapcted, score 1.1.
Add(1, 4U, "050", "300", 1000000000U, 0, 0);
file_map_[4u].first->being_compacted = true;
Add(1, 5U, "301", "350", 1000000000U, 0, 0);
// Output level overlaps with the beginning and the end of the chain
Add(2, 6U, "050", "100", 1U);
Add(2, 7U, "300", "400", 1U);
// No compaction should be scheduled, if L0 has higher priority than L1
// but L0->L1 compaction is blocked by a file in L1 being compacted.
UpdateVersionStorageInfo();
ASSERT_EQ(0, vstorage_->CompactionScoreLevel(0));
ASSERT_EQ(1, vstorage_->CompactionScoreLevel(1));
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() == nullptr);
}
TEST_F(CompactionPickerTest, NotScheduleL1IfL0WithHigherPri2) {
NewVersionStorage(6, kCompactionStyleLevel);
mutable_cf_options_.level0_file_num_compaction_trigger = 2;
mutable_cf_options_.max_bytes_for_level_base = 900000000U;
// 6 L0 files, score 3.
Add(0, 1U, "000", "400", 1U);
Add(0, 2U, "001", "400", 1U, 0, 0);
Add(0, 3U, "001", "400", 1000000000U, 0, 0);
Add(0, 31U, "001", "400", 1000000000U, 0, 0);
Add(0, 32U, "001", "400", 1000000000U, 0, 0);
Add(0, 33U, "001", "400", 1000000000U, 0, 0);
// L1 total size 2GB, score 2.2. If one file being comapcted, score 1.1.
Add(1, 4U, "050", "300", 1000000000U, 0, 0);
Add(1, 5U, "301", "350", 1000000000U, 0, 0);
// Output level overlaps with the beginning and the end of the chain
Add(2, 6U, "050", "100", 1U);
Add(2, 7U, "300", "400", 1U);
// If no file in L1 being compacted, L0->L1 compaction will be scheduled.
UpdateVersionStorageInfo(); // being_compacted flag is cleared here.
ASSERT_EQ(0, vstorage_->CompactionScoreLevel(0));
ASSERT_EQ(1, vstorage_->CompactionScoreLevel(1));
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
}
TEST_F(CompactionPickerTest, NotScheduleL1IfL0WithHigherPri3) {
NewVersionStorage(6, kCompactionStyleLevel);
mutable_cf_options_.level0_file_num_compaction_trigger = 2;
mutable_cf_options_.max_bytes_for_level_base = 900000000U;
// 6 L0 files, score 3.
Add(0, 1U, "000", "400", 1U);
Add(0, 2U, "001", "400", 1U, 0, 0);
Add(0, 3U, "001", "400", 1000000000U, 0, 0);
Add(0, 31U, "001", "400", 1000000000U, 0, 0);
Add(0, 32U, "001", "400", 1000000000U, 0, 0);
Add(0, 33U, "001", "400", 1000000000U, 0, 0);
// L1 score more than 6.
Add(1, 4U, "050", "300", 1000000000U, 0, 0);
file_map_[4u].first->being_compacted = true;
Add(1, 5U, "301", "350", 1000000000U, 0, 0);
Add(1, 51U, "351", "400", 6000000000U, 0, 0);
// Output level overlaps with the beginning and the end of the chain
Add(2, 6U, "050", "100", 1U);
Add(2, 7U, "300", "400", 1U);
// If score in L1 is larger than L0, L1 compaction goes through despite
// there is pending L0 compaction.
UpdateVersionStorageInfo();
ASSERT_EQ(1, vstorage_->CompactionScoreLevel(0));
ASSERT_EQ(0, vstorage_->CompactionScoreLevel(1));
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
}
TEST_F(CompactionPickerTest, EstimateCompactionBytesNeeded1) {
int num_levels = ioptions_.num_levels;
ioptions_.level_compaction_dynamic_level_bytes = false;
mutable_cf_options_.level0_file_num_compaction_trigger = 3;
mutable_cf_options_.max_bytes_for_level_base = 1000;
mutable_cf_options_.max_bytes_for_level_multiplier = 10;
NewVersionStorage(num_levels, kCompactionStyleLevel);
Add(0, 1U, "150", "200", 200);
Add(0, 2U, "150", "200", 200);
Add(0, 3U, "150", "200", 200);
// Level 1 is over target by 200
Add(1, 4U, "400", "500", 600);
Add(1, 5U, "600", "700", 600);
// Level 2 is less than target 10000 even added size of level 1
// Size ratio of L2/L1 is 9600 / 1200 = 8
Add(2, 6U, "150", "200", 2500);
Add(2, 7U, "201", "210", 2000);
Add(2, 8U, "300", "310", 2600);
Add(2, 9U, "400", "500", 2500);
// Level 3 exceeds target 100,000 of 1000
Add(3, 10U, "400", "500", 101000);
// Level 4 exceeds target 1,000,000 by 900 after adding size from level 3
// Size ratio L4/L3 is 9.9
// After merge from L3, L4 size is 1000900
Add(4, 11U, "400", "500", 999900);
Add(5, 11U, "400", "500", 8007200);
UpdateVersionStorageInfo();
ASSERT_EQ(200u * 9u + 10900u + 900u * 9,
vstorage_->estimated_compaction_needed_bytes());
}
TEST_F(CompactionPickerTest, EstimateCompactionBytesNeeded2) {
int num_levels = ioptions_.num_levels;
ioptions_.level_compaction_dynamic_level_bytes = false;
mutable_cf_options_.level0_file_num_compaction_trigger = 3;
mutable_cf_options_.max_bytes_for_level_base = 1000;
mutable_cf_options_.max_bytes_for_level_multiplier = 10;
NewVersionStorage(num_levels, kCompactionStyleLevel);
Add(0, 1U, "150", "200", 200);
Add(0, 2U, "150", "200", 200);
Add(0, 4U, "150", "200", 200);
Add(0, 5U, "150", "200", 200);
Add(0, 6U, "150", "200", 200);
// Level 1 size will be 1400 after merging with L0
Add(1, 7U, "400", "500", 200);
Add(1, 8U, "600", "700", 200);
// Level 2 is less than target 10000 even added size of level 1
Add(2, 9U, "150", "200", 9100);
// Level 3 over the target, but since level 4 is empty, we assume it will be
// a trivial move.
Add(3, 10U, "400", "500", 101000);
UpdateVersionStorageInfo();
// estimated L1->L2 merge: 400 * (9100.0 / 1400.0 + 1.0)
ASSERT_EQ(1400u + 3000u, vstorage_->estimated_compaction_needed_bytes());
}
TEST_F(CompactionPickerTest, EstimateCompactionBytesNeeded3) {
int num_levels = ioptions_.num_levels;
ioptions_.level_compaction_dynamic_level_bytes = false;
mutable_cf_options_.level0_file_num_compaction_trigger = 3;
mutable_cf_options_.max_bytes_for_level_base = 1000;
mutable_cf_options_.max_bytes_for_level_multiplier = 10;
NewVersionStorage(num_levels, kCompactionStyleLevel);
Add(0, 1U, "150", "200", 2000);
Add(0, 2U, "150", "200", 2000);
Add(0, 4U, "150", "200", 2000);
Add(0, 5U, "150", "200", 2000);
Add(0, 6U, "150", "200", 1000);
// Level 1 size will be 10000 after merging with L0
Add(1, 7U, "400", "500", 500);
Add(1, 8U, "600", "700", 500);
Add(2, 9U, "150", "200", 10000);
UpdateVersionStorageInfo();
ASSERT_EQ(10000u + 18000u, vstorage_->estimated_compaction_needed_bytes());
}
TEST_F(CompactionPickerTest, EstimateCompactionBytesNeededDynamicLevel) {
int num_levels = ioptions_.num_levels;
ioptions_.level_compaction_dynamic_level_bytes = true;
mutable_cf_options_.level0_file_num_compaction_trigger = 3;
mutable_cf_options_.max_bytes_for_level_base = 1000;
mutable_cf_options_.max_bytes_for_level_multiplier = 10;
NewVersionStorage(num_levels, kCompactionStyleLevel);
// Set Last level size 50000
// num_levels - 1 target 5000
// num_levels - 2 is base level with taret 500
Add(num_levels - 1, 10U, "400", "500", 50000);
Add(0, 1U, "150", "200", 200);
Add(0, 2U, "150", "200", 200);
Add(0, 4U, "150", "200", 200);
Add(0, 5U, "150", "200", 200);
Add(0, 6U, "150", "200", 200);
// num_levels - 3 is over target by 100 + 1000
Add(num_levels - 3, 7U, "400", "500", 300);
Add(num_levels - 3, 8U, "600", "700", 300);
// num_levels - 2 is over target by 1100 + 200
Add(num_levels - 2, 9U, "150", "200", 5200);
UpdateVersionStorageInfo();
// Merging to the second last level: (5200 / 1600 + 1) * 1100
// Merging to the last level: (50000 / 6300 + 1) * 1300
ASSERT_EQ(1600u + 4675u + 11617u,
vstorage_->estimated_compaction_needed_bytes());
}
TEST_F(CompactionPickerTest, IsBottommostLevelTest) {
// case 1: Higher levels are empty
NewVersionStorage(6, kCompactionStyleLevel);
Add(0, 1U, "a", "m");
Add(0, 2U, "c", "z");
Add(1, 3U, "d", "e");
Add(1, 4U, "l", "p");
Add(2, 5U, "g", "i");
Add(2, 6U, "x", "z");
UpdateVersionStorageInfo();
SetCompactionInputFilesLevels(2, 1);
AddToCompactionFiles(3U);
AddToCompactionFiles(5U);
bool result =
Compaction::TEST_IsBottommostLevel(2, vstorage_.get(), input_files_);
ASSERT_TRUE(result);
// case 2: Higher levels have no overlap
NewVersionStorage(6, kCompactionStyleLevel);
Add(0, 1U, "a", "m");
Add(0, 2U, "c", "z");
Add(1, 3U, "d", "e");
Add(1, 4U, "l", "p");
Add(2, 5U, "g", "i");
Add(2, 6U, "x", "z");
Add(3, 7U, "k", "p");
Add(3, 8U, "t", "w");
Add(4, 9U, "a", "b");
Add(5, 10U, "c", "cc");
UpdateVersionStorageInfo();
SetCompactionInputFilesLevels(2, 1);
AddToCompactionFiles(3U);
AddToCompactionFiles(5U);
result = Compaction::TEST_IsBottommostLevel(2, vstorage_.get(), input_files_);
ASSERT_TRUE(result);
// case 3.1: Higher levels (level 3) have overlap
NewVersionStorage(6, kCompactionStyleLevel);
Add(0, 1U, "a", "m");
Add(0, 2U, "c", "z");
Add(1, 3U, "d", "e");
Add(1, 4U, "l", "p");
Add(2, 5U, "g", "i");
Add(2, 6U, "x", "z");
Add(3, 7U, "e", "g");
Add(3, 8U, "h", "k");
Add(4, 9U, "a", "b");
Add(5, 10U, "c", "cc");
UpdateVersionStorageInfo();
SetCompactionInputFilesLevels(2, 1);
AddToCompactionFiles(3U);
AddToCompactionFiles(5U);
result = Compaction::TEST_IsBottommostLevel(2, vstorage_.get(), input_files_);
ASSERT_FALSE(result);
// case 3.2: Higher levels (level 5) have overlap
DeleteVersionStorage();
NewVersionStorage(6, kCompactionStyleLevel);
Add(0, 1U, "a", "m");
Add(0, 2U, "c", "z");
Add(1, 3U, "d", "e");
Add(1, 4U, "l", "p");
Add(2, 5U, "g", "i");
Add(2, 6U, "x", "z");
Add(3, 7U, "j", "k");
Add(3, 8U, "l", "m");
Add(4, 9U, "a", "b");
Add(5, 10U, "c", "cc");
Add(5, 11U, "h", "k");
Add(5, 12U, "y", "yy");
Add(5, 13U, "z", "zz");
UpdateVersionStorageInfo();
SetCompactionInputFilesLevels(2, 1);
AddToCompactionFiles(3U);
AddToCompactionFiles(5U);
result = Compaction::TEST_IsBottommostLevel(2, vstorage_.get(), input_files_);
ASSERT_FALSE(result);
// case 3.3: Higher levels (level 5) have overlap, but it's only overlapping
// one key ("d")
NewVersionStorage(6, kCompactionStyleLevel);
Add(0, 1U, "a", "m");
Add(0, 2U, "c", "z");
Add(1, 3U, "d", "e");
Add(1, 4U, "l", "p");
Add(2, 5U, "g", "i");
Add(2, 6U, "x", "z");
Add(3, 7U, "j", "k");
Add(3, 8U, "l", "m");
Add(4, 9U, "a", "b");
Add(5, 10U, "c", "cc");
Add(5, 11U, "ccc", "d");
Add(5, 12U, "y", "yy");
Add(5, 13U, "z", "zz");
UpdateVersionStorageInfo();
SetCompactionInputFilesLevels(2, 1);
AddToCompactionFiles(3U);
AddToCompactionFiles(5U);
result = Compaction::TEST_IsBottommostLevel(2, vstorage_.get(), input_files_);
ASSERT_FALSE(result);
// Level 0 files overlap
NewVersionStorage(6, kCompactionStyleLevel);
Add(0, 1U, "s", "t");
Add(0, 2U, "a", "m");
Add(0, 3U, "b", "z");
Add(0, 4U, "e", "f");
Add(5, 10U, "y", "z");
UpdateVersionStorageInfo();
SetCompactionInputFilesLevels(1, 0);
AddToCompactionFiles(1U);
AddToCompactionFiles(2U);
AddToCompactionFiles(3U);
AddToCompactionFiles(4U);
result = Compaction::TEST_IsBottommostLevel(2, vstorage_.get(), input_files_);
ASSERT_FALSE(result);
// Level 0 files don't overlap
NewVersionStorage(6, kCompactionStyleLevel);
Add(0, 1U, "s", "t");
Add(0, 2U, "a", "m");
Add(0, 3U, "b", "k");
Add(0, 4U, "e", "f");
Add(5, 10U, "y", "z");
UpdateVersionStorageInfo();
SetCompactionInputFilesLevels(1, 0);
AddToCompactionFiles(1U);
AddToCompactionFiles(2U);
AddToCompactionFiles(3U);
AddToCompactionFiles(4U);
result = Compaction::TEST_IsBottommostLevel(2, vstorage_.get(), input_files_);
ASSERT_TRUE(result);
// Level 1 files overlap
NewVersionStorage(6, kCompactionStyleLevel);
Add(0, 1U, "s", "t");
Add(0, 2U, "a", "m");
Add(0, 3U, "b", "k");
Add(0, 4U, "e", "f");
Add(1, 5U, "a", "m");
Add(1, 6U, "n", "o");
Add(1, 7U, "w", "y");
Add(5, 10U, "y", "z");
UpdateVersionStorageInfo();
SetCompactionInputFilesLevels(2, 0);
AddToCompactionFiles(1U);
AddToCompactionFiles(2U);
AddToCompactionFiles(3U);
AddToCompactionFiles(4U);
AddToCompactionFiles(5U);
AddToCompactionFiles(6U);
AddToCompactionFiles(7U);
result = Compaction::TEST_IsBottommostLevel(2, vstorage_.get(), input_files_);
ASSERT_FALSE(result);
DeleteVersionStorage();
}
TEST_F(CompactionPickerTest, MaxCompactionBytesHit) {
mutable_cf_options_.max_bytes_for_level_base = 1000000u;
mutable_cf_options_.max_compaction_bytes = 800000u;
ioptions_.level_compaction_dynamic_level_bytes = false;
NewVersionStorage(6, kCompactionStyleLevel);
// A compaction should be triggered and pick file 2 and 5.
// It cannot expand because adding file 1 and 3, the compaction size will
// exceed mutable_cf_options_.max_bytes_for_level_base.
Add(1, 1U, "100", "150", 300000U);
Add(1, 2U, "151", "200", 300001U, 0, 0);
Add(1, 3U, "201", "250", 300000U, 0, 0);
Add(1, 4U, "251", "300", 300000U, 0, 0);
Add(2, 5U, "160", "256", 1U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(2U, compaction->num_input_levels());
ASSERT_EQ(1U, compaction->num_input_files(0));
ASSERT_EQ(1U, compaction->num_input_files(1));
ASSERT_EQ(2U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(5U, compaction->input(1, 0)->fd.GetNumber());
}
TEST_F(CompactionPickerTest, MaxCompactionBytesNotHit) {
mutable_cf_options_.max_bytes_for_level_base = 1000000u;
mutable_cf_options_.max_compaction_bytes = 1000000u;
ioptions_.level_compaction_dynamic_level_bytes = false;
NewVersionStorage(6, kCompactionStyleLevel);
// A compaction should be triggered and pick file 2 and 5.
// and it expands to file 1 and 3 too.
Add(1, 1U, "100", "150", 300000U);
Add(1, 2U, "151", "200", 300001U, 0, 0);
Add(1, 3U, "201", "250", 300000U, 0, 0);
Add(1, 4U, "251", "300", 300000U, 0, 0);
Add(2, 5U, "000", "233", 1U);
UpdateVersionStorageInfo();
std::unique_ptr<Compaction> compaction(level_compaction_picker.PickCompaction(
cf_name_, mutable_cf_options_, vstorage_.get(), &log_buffer_));
ASSERT_TRUE(compaction.get() != nullptr);
ASSERT_EQ(2U, compaction->num_input_levels());
ASSERT_EQ(3U, compaction->num_input_files(0));
ASSERT_EQ(1U, compaction->num_input_files(1));
ASSERT_EQ(1U, compaction->input(0, 0)->fd.GetNumber());
ASSERT_EQ(2U, compaction->input(0, 1)->fd.GetNumber());
ASSERT_EQ(3U, compaction->input(0, 2)->fd.GetNumber());
ASSERT_EQ(5U, compaction->input(1, 0)->fd.GetNumber());
}
} // namespace rocksdb
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| {
"content_hash": "e15c766af3197c953e3166f93a93f195",
"timestamp": "",
"source": "github",
"line_count": 1104,
"max_line_length": 80,
"avg_line_length": 38.93115942028985,
"alnum_prop": 0.6637040483946022,
"repo_name": "norton/rocksdb",
"id": "e23c8e87da59279338c1a9101110f201db92ec7a",
"size": "43512",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "db/compaction_picker_test.cc",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "81942"
},
{
"name": "C++",
"bytes": "7150118"
},
{
"name": "CMake",
"bytes": "31959"
},
{
"name": "Java",
"bytes": "876787"
},
{
"name": "Makefile",
"bytes": "81387"
},
{
"name": "PHP",
"bytes": "48342"
},
{
"name": "Perl",
"bytes": "244299"
},
{
"name": "PowerShell",
"bytes": "9458"
},
{
"name": "Python",
"bytes": "20674"
},
{
"name": "Ruby",
"bytes": "700"
},
{
"name": "Shell",
"bytes": "82760"
}
],
"symlink_target": ""
} |
/* Written by Paul Eggert. */
#include <config.h>
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>
#include "system.h"
#include "error.h"
#include "sig2str.h"
#include "operand2sig.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "kill"
#define AUTHORS proper_name ("Paul Eggert")
#if ! (HAVE_DECL_STRSIGNAL || defined strsignal)
# if ! (HAVE_DECL_SYS_SIGLIST || defined sys_siglist)
# if HAVE_DECL__SYS_SIGLIST || defined _sys_siglist
# define sys_siglist _sys_siglist
# elif HAVE_DECL___SYS_SIGLIST || defined __sys_siglist
# define sys_siglist __sys_siglist
# endif
# endif
# if HAVE_DECL_SYS_SIGLIST || defined sys_siglist
# define strsignal(signum) (0 <= (signum) && (signum) <= SIGNUM_BOUND \
? sys_siglist[signum] \
: 0)
# endif
# ifndef strsignal
# define strsignal(signum) 0
# endif
#endif
static char const short_options[] =
"0::1::2::3::4::5::6::7::8::9::"
"A::B::C::D::E::F::G::H::I::J::K::L::M::"
"N::O::P::Q::R::S::T::U::V::W::X::Y::Z::"
"ln:s:t";
static struct option const long_options[] =
{
{"list", no_argument, NULL, 'l'},
{"signal", required_argument, NULL, 's'},
{"table", no_argument, NULL, 't'},
{GETOPT_HELP_OPTION_DECL},
{GETOPT_VERSION_OPTION_DECL},
{NULL, 0, NULL, 0}
};
void
usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
printf (_("\
Usage: %s [-s SIGNAL | -SIGNAL] PID...\n\
or: %s -l [SIGNAL]...\n\
or: %s -t [SIGNAL]...\n\
"),
program_name, program_name, program_name);
fputs (_("\
Send signals to processes, or list signals.\n\
\n\
"), stdout);
fputs (_("\
Mandatory arguments to long options are mandatory for short options too.\n\
"), stdout);
fputs (_("\
-s, --signal=SIGNAL, -SIGNAL\n\
specify the name or number of the signal to be sent\n\
-l, --list list signal names, or convert signal names to/from numbers\n\
-t, --table print a table of signal information\n\
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
fputs (_("\n\
SIGNAL may be a signal name like `HUP', or a signal number like `1',\n\
or the exit status of a process terminated by a signal.\n\
PID is an integer; if negative it identifies a process group.\n\
"), stdout);
printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME);
emit_ancillary_info ();
}
exit (status);
}
/* Print a row of `kill -t' output. NUM_WIDTH is the maximum signal
number width, and SIGNUM is the signal number to print. The
maximum name width is NAME_WIDTH, and SIGNAME is the name to print. */
static void
print_table_row (unsigned int num_width, int signum,
unsigned int name_width, char const *signame)
{
char const *description = strsignal (signum);
printf ("%*d %-*s %s\n", num_width, signum, name_width, signame,
description ? description : "?");
}
/* Print a list of signal names. If TABLE, print a table.
Print the names specified by ARGV if nonzero; otherwise,
print all known names. Return a suitable exit status. */
static int
list_signals (bool table, char *const *argv)
{
int signum;
int status = EXIT_SUCCESS;
char signame[SIG2STR_MAX];
if (table)
{
unsigned int name_width = 0;
/* Compute the maximum width of a signal number. */
unsigned int num_width = 1;
for (signum = 1; signum <= SIGNUM_BOUND / 10; signum *= 10)
num_width++;
/* Compute the maximum width of a signal name. */
for (signum = 1; signum <= SIGNUM_BOUND; signum++)
if (sig2str (signum, signame) == 0)
{
size_t len = strlen (signame);
if (name_width < len)
name_width = len;
}
if (argv)
for (; *argv; argv++)
{
signum = operand2sig (*argv, signame);
if (signum < 0)
status = EXIT_FAILURE;
else
print_table_row (num_width, signum, name_width, signame);
}
else
for (signum = 1; signum <= SIGNUM_BOUND; signum++)
if (sig2str (signum, signame) == 0)
print_table_row (num_width, signum, name_width, signame);
}
else
{
if (argv)
for (; *argv; argv++)
{
signum = operand2sig (*argv, signame);
if (signum < 0)
status = EXIT_FAILURE;
else
{
if (ISDIGIT (**argv))
puts (signame);
else
printf ("%d\n", signum);
}
}
else
for (signum = 1; signum <= SIGNUM_BOUND; signum++)
if (sig2str (signum, signame) == 0)
puts (signame);
}
return status;
}
/* Send signal SIGNUM to all the processes or process groups specified
by ARGV. Return a suitable exit status. */
static int
send_signals (int signum, char *const *argv)
{
int status = EXIT_SUCCESS;
char const *arg = *argv;
do
{
char *endp;
intmax_t n = (errno = 0, strtoimax (arg, &endp, 10));
pid_t pid = n;
if (errno == ERANGE || pid != n || arg == endp || *endp)
{
error (0, 0, _("%s: invalid process id"), arg);
status = EXIT_FAILURE;
}
else if (kill (pid, signum) != 0)
{
error (0, errno, "%s", arg);
status = EXIT_FAILURE;
}
}
while ((arg = *++argv));
return status;
}
int
main (int argc, char **argv)
{
int optc;
bool list = false;
bool table = false;
int signum = -1;
char signame[SIG2STR_MAX];
initialize_main (&argc, &argv);
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
atexit (close_stdout);
while ((optc = getopt_long (argc, argv, short_options, long_options, NULL))
!= -1)
switch (optc)
{
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (optind != 2)
{
/* This option is actually a process-id. */
optind--;
goto no_more_options;
}
/* Fall through. */
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y':
case 'Z':
if (! optarg)
optarg = argv[optind - 1] + strlen (argv[optind - 1]);
if (optarg != argv[optind - 1] + 2)
{
error (0, 0, _("invalid option -- %c"), optc);
usage (EXIT_FAILURE);
}
optarg--;
/* Fall through. */
case 'n': /* -n is not documented, but is for Bash compatibility. */
case 's':
if (0 <= signum)
{
error (0, 0, _("%s: multiple signals specified"), optarg);
usage (EXIT_FAILURE);
}
signum = operand2sig (optarg, signame);
if (signum < 0)
usage (EXIT_FAILURE);
break;
case 't':
table = true;
/* Fall through. */
case 'l':
if (list)
{
error (0, 0, _("multiple -l or -t options specified"));
usage (EXIT_FAILURE);
}
list = true;
break;
case_GETOPT_HELP_CHAR;
case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
default:
usage (EXIT_FAILURE);
}
no_more_options:;
if (signum < 0)
signum = SIGTERM;
else if (list)
{
error (0, 0, _("cannot combine signal with -l or -t"));
usage (EXIT_FAILURE);
}
if ( ! list && argc <= optind)
{
error (0, 0, _("no process ID specified"));
usage (EXIT_FAILURE);
}
return (list
? list_signals (table, optind < argc ? argv + optind : NULL)
: send_signals (signum, argv + optind));
}
| {
"content_hash": "9d44cdae9b4679aee1e246000e54a0fc",
"timestamp": "",
"source": "github",
"line_count": 306,
"max_line_length": 80,
"avg_line_length": 26.96732026143791,
"alnum_prop": 0.536597188560349,
"repo_name": "ucsd-progsys/csolve",
"id": "abf8cd10b6da17518379462cccf88b77fa07fd8c",
"size": "9005",
"binary": false,
"copies": "4",
"ref": "refs/heads/master",
"path": "external/gnu-coreutils/src/kill.c",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "C",
"bytes": "17555732"
},
{
"name": "C++",
"bytes": "705971"
},
{
"name": "Common Lisp",
"bytes": "29486"
},
{
"name": "DOT",
"bytes": "167595"
},
{
"name": "Go",
"bytes": "3361"
},
{
"name": "Java",
"bytes": "330824"
},
{
"name": "JavaScript",
"bytes": "1020851"
},
{
"name": "Logos",
"bytes": "120742"
},
{
"name": "OCaml",
"bytes": "3738844"
},
{
"name": "Objective-C",
"bytes": "60280"
},
{
"name": "PHP",
"bytes": "5108"
},
{
"name": "Perl",
"bytes": "896390"
},
{
"name": "Prolog",
"bytes": "17049"
},
{
"name": "Python",
"bytes": "30924"
},
{
"name": "Racket",
"bytes": "38583"
},
{
"name": "Ruby",
"bytes": "3638"
},
{
"name": "Scala",
"bytes": "272"
},
{
"name": "Scheme",
"bytes": "471"
},
{
"name": "Shell",
"bytes": "906099"
}
],
"symlink_target": ""
} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {
"content_hash": "ca510479be2a2fc18a365aa29f1cfb62",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 39,
"avg_line_length": 10.23076923076923,
"alnum_prop": 0.6917293233082706,
"repo_name": "mdoering/backbone",
"id": "8b0d0386df0e56c09605fdde1695542586834545",
"size": "201",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "life/Plantae/Magnoliophyta/Magnoliopsida/Asterales/Asteraceae/Ageratina sotarensis/ Syn. Eupatorium sotarense breviflora/README.md",
"mode": "33188",
"license": "apache-2.0",
"language": [],
"symlink_target": ""
} |
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("WindowsApplication1")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Microsoft")>
<Assembly: AssemblyProduct("WindowsApplication1")>
<Assembly: AssemblyCopyright("Copyright © Microsoft 2013")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("9580062c-5e0d-47be-86d3-204bd352cffc")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
| {
"content_hash": "ab88503b1f46ce78ea422488ec2bd685",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 83,
"avg_line_length": 33.457142857142856,
"alnum_prop": 0.753202391118702,
"repo_name": "biosan/RaDAS",
"id": "15b7f3226742cff6480457649c5b0548af6c05f5",
"size": "1174",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "VB/RaDAS/My Project/AssemblyInfo.vb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Arduino",
"bytes": "4558"
},
{
"name": "Visual Basic",
"bytes": "76194"
}
],
"symlink_target": ""
} |
#pragma once
#include "ls_eventing.h"
#include "ls_htable.h"
/**
* Event binding information. This structure is created for each call to
* ls_event_bind with a unique callback.
*/
typedef struct _ls_event_binding_t
{
ls_event_notify_callback cb;
void* arg;
struct _ls_event_binding_t* next;
bool unbound;
/**
* Binding status. True if it is already bound before an event is
* triggered. It is false by default and marked as true at the very
* beginning of an event trigger. Within an event trigger, false
* implies a callback that is bound in the current event and should
* not be executed until the next time this event is triggered.
*/
bool normal_bound;
} ls_event_binding_t;
/**
* Event triggering information. This describes a "moment in time" of an
* event.
*/
typedef struct _ls_event_moment_t
{
struct _ls_event_data_t evt;
ls_event_result_callback result_cb;
void* result_arg;
ls_event_binding_t* bindings;
struct _ls_event_moment_t* next;
} ls_event_moment_t;
/**
* Dispatcher members. This is the structure underlying ls_event_dispatcher.
*/
typedef struct _ls_event_dispatch_t
{
void* source;
ls_htable* events;
ls_event* running;
ls_event_moment_t* moment_queue_tail;
ls_event_moment_t* next_moment;
bool destroy_pending;
} ls_event_dispatch_t;
/**
* Notifier members. This is the structure underlying ls_event.
*/
typedef struct _ls_event_t
{
ls_event_dispatch_t* dispatcher;
const void* source;
const char* name;
ls_event_binding_t* bindings;
} ls_event_notifier_t;
| {
"content_hash": "63f88e2ef36968429798477b636d3d12",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 76,
"avg_line_length": 26.609375,
"alnum_prop": 0.6465061655901351,
"repo_name": "palerikm/lslib",
"id": "737efe294519422464dc608cd69b33420cda48ed",
"size": "1884",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "src/ls_eventing_int.h",
"mode": "33188",
"license": "bsd-2-clause",
"language": [
{
"name": "C",
"bytes": "250513"
},
{
"name": "C++",
"bytes": "14602"
},
{
"name": "CMake",
"bytes": "33750"
},
{
"name": "Shell",
"bytes": "491"
}
],
"symlink_target": ""
} |
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('socketUdpDispatcher')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
import time
import threading
from pydispatch import dispatcher
import socketUdp
import coapUtils as u
class socketUdpDispatcher(socketUdp.socketUdp):
def __init__(self,ipAddress,udpPort,callback):
# log
log.debug('creating instance')
# initialize the parent class
socketUdp.socketUdp.__init__(self,ipAddress,udpPort,callback)
# change name
self.name = 'socketUdpDispatcher@{0}:{1}'.format(self.ipAddress,self.udpPort)
self.gotMsgSem = threading.Semaphore()
# connect to dispatcher
dispatcher.connect(
receiver = self._messageNotification,
signal = (self.ipAddress,self.udpPort),
)
# start myself
self.start()
#======================== public ==========================================
def sendUdp(self,destIp,destPort,msg):
# send over dispatcher
dispatcher.send(
signal = (destIp,destPort),
sender = (self.ipAddress,self.udpPort),
data = msg
)
# update stats
self._incrementTx()
def close(self):
# disconnect from dispatcher
dispatcher.disconnect(
receiver = self._messageNotification,
signal = (self.ipAddress,self.udpPort),
)
# stop
self.goOn = False
self.gotMsgSem.release()
#======================== private =========================================
def _messageNotification(self,signal,sender,data):
# get reception time
timestamp = time.time()
# log
log.debug("got {2} from {1} at {0}".format(timestamp,sender,u.formatBuf(data)))
# call the callback
self.callback(timestamp,sender,data)
# update stats
self._incrementRx()
# release the lock
self.gotMsgSem.release()
def run(self):
while self.goOn:
self.gotMsgSem.acquire() | {
"content_hash": "3e7744efab1bd014c611d6cc67996669",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 91,
"avg_line_length": 26.471264367816094,
"alnum_prop": 0.532783326096396,
"repo_name": "bostjanmikelj/coap",
"id": "cf210a573f30fb46ee4b5cd63ccf55dbd843aa7e",
"size": "2303",
"binary": false,
"copies": "2",
"ref": "refs/heads/develop",
"path": "coap/socketUdpDispatcher.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Python",
"bytes": "110212"
}
],
"symlink_target": ""
} |
import sys
builds= []
try:
#read db names from file, this file is also used in galaxy/util.py
for line in open("static/ucsc/builds.txt"):
if line[0:1] == "#": continue
try:
fields = line.replace("\r","").replace("\n","").split("\t")
builds.append((fields[1], fields[0], False))
except: continue
except Exception, exc:
print >>sys.stdout, 'axt_to_fasta_code.py initialization error -> %s' % exc
#return available builds
def get_available_builds():
try:
available_options = builds[0:]
except:
available_options = []
if len(available_options) < 1:
available_options.append(('unspecified','?',True))
return available_options
| {
"content_hash": "1b48e15e71642e68e8239017681b6751",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 80,
"avg_line_length": 32.47826086956522,
"alnum_prop": 0.5876840696117804,
"repo_name": "jmchilton/galaxy-central",
"id": "c2335e14249735c2261f2f9bac95130175df3e38",
"size": "778",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tools/filters/axt_to_fasta_code.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "32128"
},
{
"name": "HTML",
"bytes": "96150"
},
{
"name": "JavaScript",
"bytes": "37270"
},
{
"name": "Makefile",
"bytes": "1035"
},
{
"name": "Python",
"bytes": "1341118"
},
{
"name": "Shell",
"bytes": "3787"
}
],
"symlink_target": ""
} |
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveSlugFromPollsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('polls', function(Blueprint $table) {
$table->dropColumn('slug');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('polls', function(Blueprint $table) {
$table->string('slug')->unique();
});
}
}
| {
"content_hash": "60d10fe01c5e5bc765e15062e328a78a",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 59,
"avg_line_length": 19.35483870967742,
"alnum_prop": 0.55,
"repo_name": "glgeorgiev/pi-project",
"id": "5451abd1e717ce08093feb38e0e90665092c9fd9",
"size": "600",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "database/migrations/2015_12_31_161037_remove_slug_from_polls_table.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "412"
},
{
"name": "CSS",
"bytes": "72"
},
{
"name": "HTML",
"bytes": "213"
},
{
"name": "JavaScript",
"bytes": "98318"
},
{
"name": "PHP",
"bytes": "288136"
}
],
"symlink_target": ""
} |
(function () {
"use strict";
angular
.module('mnMemoryQuota', [
'mnServices',
'mnFocus'
])
.directive('mnMemoryQuota', mnMemoryQuotaDirective);
function mnMemoryQuotaDirective() {
var mnMemoryQuota = {
restrict: 'A',
scope: {
config: '=mnMemoryQuota',
errors: "=",
rbac: "=",
mnIsEnterprise: "="
},
templateUrl: 'app/components/directives/mn_memory_quota/mn_memory_quota.html',
controller: controller
};
return mnMemoryQuota;
function controller($scope) {
//hack for avoiding access to $parent scope from child scope via propery "$parent"
//should be removed after implementation of Controller As syntax
$scope.mnMemoryQuotaController = $scope;
}
}
})();
| {
"content_hash": "003b2bccd7069a79f03f68964eccf287",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 88,
"avg_line_length": 24.71875,
"alnum_prop": 0.6118836915297092,
"repo_name": "membase/ns_server",
"id": "b1d41092c80a1aeeec7fffd0e4146d568d3a584a",
"size": "791",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "priv/public/ui/app/components/directives/mn_memory_quota/mn_memory_quota.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Awk",
"bytes": "5687"
},
{
"name": "CMake",
"bytes": "16397"
},
{
"name": "CSS",
"bytes": "208892"
},
{
"name": "Emacs Lisp",
"bytes": "1761"
},
{
"name": "Erlang",
"bytes": "3357367"
},
{
"name": "Go",
"bytes": "3078"
},
{
"name": "HTML",
"bytes": "660602"
},
{
"name": "JavaScript",
"bytes": "9352813"
},
{
"name": "Makefile",
"bytes": "2049"
},
{
"name": "Python",
"bytes": "78015"
},
{
"name": "Ruby",
"bytes": "76599"
},
{
"name": "Shell",
"bytes": "41037"
}
],
"symlink_target": ""
} |
/**
* Created by Agile on 8/25/14.
* Description : Start up script
*/
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/'); | {
"content_hash": "f6180cea74613ebdcdbb5829741c6db8",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 56,
"avg_line_length": 28.545454545454547,
"alnum_prop": 0.6369426751592356,
"repo_name": "tuad/BeerBeer",
"id": "56bf478dea06a202b9d218e2a3d596756fa11f53",
"size": "314",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "index.js",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "JavaScript",
"bytes": "314"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ivy-report.xsl"?>
<ivy-report version="1.0">
<info
organisation="default"
module="scala-build"
revision="0.1-SNAPSHOT"
extra-scalaVersion="2.10"
extra-sbtVersion="0.13"
conf="compile"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20150827150611"/>
<dependencies>
<module organisation="com.github.gseitz" name="sbt-protobuf">
<revision name="0.3.3" status="release" pubdate="20140523163015" resolver="sbt-chain" artresolver="sbt-chain" extra-scalaVersion="2.10" extra-sbtVersion="0.13" downloaded="false" searched="false" default="false" conf="compile, default(compile)" position="1">
<metadata-artifact status="no" details="" size="1428" time="0" location="/home/mjzhu/.ivy2/cache/scala_2.10/sbt_0.13/com.github.gseitz/sbt-protobuf/ivy-0.3.3.xml" searched="false" origin-is-local="false" origin-location="https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.github.gseitz/sbt-protobuf/scala_2.10/sbt_0.13/0.3.3/ivys/ivy.xml"/>
<caller organisation="default" name="scala-build" conf="compile" rev="0.3.3" rev-constraint-default="0.3.3" rev-constraint-dynamic="0.3.3" callerrev="0.1-SNAPSHOT" extra-scalaVersion="2.10" extra-sbtVersion="0.13"/>
<artifacts>
<artifact name="sbt-protobuf" type="jar" ext="jar" status="no" details="" size="54044" time="0" location="/home/mjzhu/.ivy2/cache/scala_2.10/sbt_0.13/com.github.gseitz/sbt-protobuf/jars/sbt-protobuf-0.3.3.jar">
<origin-location is-local="false" location="https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.github.gseitz/sbt-protobuf/scala_2.10/sbt_0.13/0.3.3/jars/sbt-protobuf.jar"/>
</artifact>
</artifacts>
</revision>
</module>
<module organisation="com.eed3si9n" name="sbt-assembly">
<revision name="0.10.2" status="release" pubdate="20140104201410" resolver="sbt-chain" artresolver="sbt-chain" extra-scalaVersion="2.10" extra-sbtVersion="0.13" downloaded="false" searched="false" default="false" conf="compile, default(compile)" position="0">
<license name="MIT License" url="https://github.com/sbt/sbt-assembly/blob/master/LICENSE"/>
<metadata-artifact status="no" details="" size="1564" time="0" location="/home/mjzhu/.ivy2/cache/scala_2.10/sbt_0.13/com.eed3si9n/sbt-assembly/ivy-0.10.2.xml" searched="false" origin-is-local="false" origin-location="https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.10/sbt_0.13/0.10.2/ivys/ivy.xml"/>
<caller organisation="default" name="scala-build" conf="compile" rev="0.10.2" rev-constraint-default="0.10.2" rev-constraint-dynamic="0.10.2" callerrev="0.1-SNAPSHOT" extra-scalaVersion="2.10" extra-sbtVersion="0.13"/>
<artifacts>
<artifact name="sbt-assembly" type="jar" ext="jar" status="no" details="" size="150604" time="0" location="/home/mjzhu/.ivy2/cache/scala_2.10/sbt_0.13/com.eed3si9n/sbt-assembly/jars/sbt-assembly-0.10.2.jar">
<origin-location is-local="false" location="https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.eed3si9n/sbt-assembly/scala_2.10/sbt_0.13/0.10.2/jars/sbt-assembly.jar"/>
</artifact>
</artifacts>
</revision>
</module>
</dependencies>
</ivy-report>
| {
"content_hash": "b25716c85a25e228e2eab0fb326040ec",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 353,
"avg_line_length": 87.73684210526316,
"alnum_prop": 0.7201559688062388,
"repo_name": "xytosis/dataworx",
"id": "8d8269ed25688fdc418ad13139a17d1db1829aaa",
"size": "3334",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "twitter_classifier/scala/project/target/resolution-cache/reports/default-scala-build-compile.xml",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "CSS",
"bytes": "4371"
},
{
"name": "Java",
"bytes": "5680"
},
{
"name": "Python",
"bytes": "3251"
},
{
"name": "Scala",
"bytes": "38334"
},
{
"name": "Shell",
"bytes": "4101"
},
{
"name": "XSLT",
"bytes": "20993"
}
],
"symlink_target": ""
} |
//
// Macro.h
// tumblr-p
//
// Created by JiFeng on 16/1/22.
// Copyright © 2016年 jeffsss. All rights reserved.
//
#ifndef Macro_h
#define Macro_h
#define WeakSelf __typeof(&*self) __weak wSelf = self;
#define StrongSelf __typeof(&*self) __strong sSelf = wSelf;
#define CommonTagBase 1000
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define RGBA(r, g, b, a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r, g, b) RGBA(r, g, b, 1.0f)
#endif /* Macro_h */
| {
"content_hash": "66712e08a09b35233246113a11d8167f",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 153,
"avg_line_length": 35.08695652173913,
"alnum_prop": 0.6468401486988847,
"repo_name": "jeffssss/tumblr-P",
"id": "52d858bef8e942893fd621bb1eb718f011ee1985",
"size": "810",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tumblr-p/tumblr-p/Macro.h",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C",
"bytes": "45757"
},
{
"name": "C++",
"bytes": "20447"
},
{
"name": "Objective-C",
"bytes": "254629"
},
{
"name": "Ruby",
"bytes": "412"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<!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" xml:lang="en" lang="en">
<head>
<title>ActionController::LogSubscriber</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<div class="banner">
<span>Ruby on Rails 4.0.0</span><br />
<h1>
<span class="type">Class</span>
ActionController::LogSubscriber
<span class="parent"><
<a href="../ActiveSupport/LogSubscriber.html">ActiveSupport::LogSubscriber</a>
</span>
</h1>
<ul class="files">
<li><a href="../../files/__/__/_rvm/gems/ruby-2_1_2/gems/actionpack-4_0_0/lib/action_controller/log_subscriber_rb.html">/Users/alec/.rvm/gems/ruby-2.1.2/gems/actionpack-4.0.0/lib/action_controller/log_subscriber.rb</a></li>
</ul>
</div>
<div id="bodyContent">
<div id="content">
<!-- Method ref -->
<div class="sectiontitle">Methods</div>
<dl class="methods">
<dt>H</dt>
<dd>
<ul>
<li>
<a href="#method-i-halted_callback">halted_callback</a>
</li>
</ul>
</dd>
<dt>L</dt>
<dd>
<ul>
<li>
<a href="#method-i-logger">logger</a>
</li>
</ul>
</dd>
<dt>P</dt>
<dd>
<ul>
<li>
<a href="#method-i-process_action">process_action</a>
</li>
</ul>
</dd>
<dt>R</dt>
<dd>
<ul>
<li>
<a href="#method-i-redirect_to">redirect_to</a>
</li>
</ul>
</dd>
<dt>S</dt>
<dd>
<ul>
<li>
<a href="#method-i-send_data">send_data</a>,
</li>
<li>
<a href="#method-i-send_file">send_file</a>,
</li>
<li>
<a href="#method-i-start_processing">start_processing</a>
</li>
</ul>
</dd>
<dt>U</dt>
<dd>
<ul>
<li>
<a href="#method-i-unpermitted_parameters">unpermitted_parameters</a>
</li>
</ul>
</dd>
</dl>
<!-- Section constants -->
<div class="sectiontitle">Constants</div>
<table border='0' cellpadding='5'>
<tr valign='top'>
<td class="attr-name">INTERNAL_PARAMS</td>
<td>=</td>
<td class="attr-value">%w(controller action format _method only_path)</td>
</tr>
<tr valign='top'>
<td> </td>
<td colspan="2" class="attr-desc"></td>
</tr>
</table>
<!-- Methods -->
<div class="sectiontitle">Instance Public methods</div>
<div class="method">
<div class="title method-title" id="method-i-halted_callback">
<b>halted_callback</b>(event)
<a href="../../classes/ActionController/LogSubscriber.html#method-i-halted_callback" name="method-i-halted_callback" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-halted_callback_source')" id="l_method-i-halted_callback_source">show</a>
</p>
<div id="method-i-halted_callback_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../../.rvm/gems/ruby-2.1.2/gems/actionpack-4.0.0/lib/action_controller/log_subscriber.rb, line 35</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">halted_callback</span>(<span class="ruby-identifier">event</span>)
<span class="ruby-identifier">info</span>(<span class="ruby-node">"Filter chain halted as #{event.payload[:filter]} rendered or redirected"</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-logger">
<b>logger</b>()
<a href="../../classes/ActionController/LogSubscriber.html#method-i-logger" name="method-i-logger" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-logger_source')" id="l_method-i-logger_source">show</a>
</p>
<div id="method-i-logger_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../../.rvm/gems/ruby-2.1.2/gems/actionpack-4.0.0/lib/action_controller/log_subscriber.rb, line 68</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">logger</span>
<span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">logger</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-process_action">
<b>process_action</b>(event)
<a href="../../classes/ActionController/LogSubscriber.html#method-i-process_action" name="method-i-process_action" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-process_action_source')" id="l_method-i-process_action_source">show</a>
</p>
<div id="method-i-process_action_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../../.rvm/gems/ruby-2.1.2/gems/actionpack-4.0.0/lib/action_controller/log_subscriber.rb, line 18</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">process_action</span>(<span class="ruby-identifier">event</span>)
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info?</span>
<span class="ruby-identifier">payload</span> = <span class="ruby-identifier">event</span>.<span class="ruby-identifier">payload</span>
<span class="ruby-identifier">additions</span> = <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">log_process_action</span>(<span class="ruby-identifier">payload</span>)
<span class="ruby-identifier">status</span> = <span class="ruby-identifier">payload</span>[<span class="ruby-value">:status</span>]
<span class="ruby-keyword">if</span> <span class="ruby-identifier">status</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">payload</span>[<span class="ruby-value">:exception</span>].<span class="ruby-identifier">present?</span>
<span class="ruby-identifier">exception_class_name</span> = <span class="ruby-identifier">payload</span>[<span class="ruby-value">:exception</span>].<span class="ruby-identifier">first</span>
<span class="ruby-identifier">status</span> = <span class="ruby-constant">ActionDispatch</span><span class="ruby-operator">::</span><span class="ruby-constant">ExceptionWrapper</span>.<span class="ruby-identifier">status_code_for_exception</span>(<span class="ruby-identifier">exception_class_name</span>)
<span class="ruby-keyword">end</span>
<span class="ruby-identifier">message</span> = <span class="ruby-node">"Completed #{status} #{Rack::Utils::HTTP_STATUS_CODES[status]} in #{event.duration.round}ms"</span>
<span class="ruby-identifier">message</span> <span class="ruby-operator"><<</span> <span class="ruby-node">" (#{additions.join(" | ")})"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">additions</span>.<span class="ruby-identifier">blank?</span>
<span class="ruby-identifier">info</span>(<span class="ruby-identifier">message</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-redirect_to">
<b>redirect_to</b>(event)
<a href="../../classes/ActionController/LogSubscriber.html#method-i-redirect_to" name="method-i-redirect_to" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-redirect_to_source')" id="l_method-i-redirect_to_source">show</a>
</p>
<div id="method-i-redirect_to_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../../.rvm/gems/ruby-2.1.2/gems/actionpack-4.0.0/lib/action_controller/log_subscriber.rb, line 43</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">redirect_to</span>(<span class="ruby-identifier">event</span>)
<span class="ruby-identifier">info</span>(<span class="ruby-node">"Redirected to #{event.payload[:location]}"</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-send_data">
<b>send_data</b>(event)
<a href="../../classes/ActionController/LogSubscriber.html#method-i-send_data" name="method-i-send_data" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-send_data_source')" id="l_method-i-send_data_source">show</a>
</p>
<div id="method-i-send_data_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../../.rvm/gems/ruby-2.1.2/gems/actionpack-4.0.0/lib/action_controller/log_subscriber.rb, line 47</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">send_data</span>(<span class="ruby-identifier">event</span>)
<span class="ruby-identifier">info</span>(<span class="ruby-node">"Sent data #{event.payload[:filename]} (#{event.duration.round(1)}ms)"</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-send_file">
<b>send_file</b>(event)
<a href="../../classes/ActionController/LogSubscriber.html#method-i-send_file" name="method-i-send_file" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-send_file_source')" id="l_method-i-send_file_source">show</a>
</p>
<div id="method-i-send_file_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../../.rvm/gems/ruby-2.1.2/gems/actionpack-4.0.0/lib/action_controller/log_subscriber.rb, line 39</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">send_file</span>(<span class="ruby-identifier">event</span>)
<span class="ruby-identifier">info</span>(<span class="ruby-node">"Sent file #{event.payload[:path]} (#{event.duration.round(1)}ms)"</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-start_processing">
<b>start_processing</b>(event)
<a href="../../classes/ActionController/LogSubscriber.html#method-i-start_processing" name="method-i-start_processing" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-start_processing_source')" id="l_method-i-start_processing_source">show</a>
</p>
<div id="method-i-start_processing_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../../.rvm/gems/ruby-2.1.2/gems/actionpack-4.0.0/lib/action_controller/log_subscriber.rb, line 6</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">start_processing</span>(<span class="ruby-identifier">event</span>)
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">logger</span>.<span class="ruby-identifier">info?</span>
<span class="ruby-identifier">payload</span> = <span class="ruby-identifier">event</span>.<span class="ruby-identifier">payload</span>
<span class="ruby-identifier">params</span> = <span class="ruby-identifier">payload</span>[<span class="ruby-value">:params</span>].<span class="ruby-identifier">except</span>(<span class="ruby-operator">*</span><span class="ruby-constant">INTERNAL_PARAMS</span>)
<span class="ruby-identifier">format</span> = <span class="ruby-identifier">payload</span>[<span class="ruby-value">:format</span>]
<span class="ruby-identifier">format</span> = <span class="ruby-identifier">format</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">format</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>)
<span class="ruby-identifier">info</span> <span class="ruby-node">"Processing by #{payload[:controller]}##{payload[:action]} as #{format}"</span>
<span class="ruby-identifier">info</span> <span class="ruby-node">" Parameters: #{params.inspect}"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">empty?</span>
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
<div class="method">
<div class="title method-title" id="method-i-unpermitted_parameters">
<b>unpermitted_parameters</b>(event)
<a href="../../classes/ActionController/LogSubscriber.html#method-i-unpermitted_parameters" name="method-i-unpermitted_parameters" class="permalink">Link</a>
</div>
<div class="description">
</div>
<div class="sourcecode">
<p class="source-link">
Source:
<a href="javascript:toggleSource('method-i-unpermitted_parameters_source')" id="l_method-i-unpermitted_parameters_source">show</a>
</p>
<div id="method-i-unpermitted_parameters_source" class="dyn-source">
<pre><span class="ruby-comment"># File ../../.rvm/gems/ruby-2.1.2/gems/actionpack-4.0.0/lib/action_controller/log_subscriber.rb, line 51</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">unpermitted_parameters</span>(<span class="ruby-identifier">event</span>)
<span class="ruby-identifier">unpermitted_keys</span> = <span class="ruby-identifier">event</span>.<span class="ruby-identifier">payload</span>[<span class="ruby-value">:keys</span>]
<span class="ruby-identifier">debug</span>(<span class="ruby-node">"Unpermitted parameters: #{unpermitted_keys.join(", ")}"</span>)
<span class="ruby-keyword">end</span></pre>
</div>
</div>
</div>
</div>
</div>
</body>
</html> | {
"content_hash": "ddf82c5cd51330a8e3694113da71da0e",
"timestamp": "",
"source": "github",
"line_count": 504,
"max_line_length": 345,
"avg_line_length": 38.285714285714285,
"alnum_prop": 0.5246165008291874,
"repo_name": "alombardo4/Agendue",
"id": "44a81df3f6a426030589eace000246233bfa3da1",
"size": "19296",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "AgendueWeb/doc/api/classes/ActionController/LogSubscriber.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "138782"
},
{
"name": "CoffeeScript",
"bytes": "3689"
},
{
"name": "HTML",
"bytes": "13251982"
},
{
"name": "Java",
"bytes": "308126"
},
{
"name": "JavaScript",
"bytes": "15185870"
},
{
"name": "Objective-C",
"bytes": "361506"
},
{
"name": "Perl",
"bytes": "1361"
},
{
"name": "Ruby",
"bytes": "150857"
}
],
"symlink_target": ""
} |
namespace NLog.LayoutRenderers
{
using System;
using System.ComponentModel;
using System.Text;
using NLog.Config;
using NLog.Internal;
/// <summary>
/// The time in a 24-hour, sortable format HH:mm:ss.mmmm.
/// </summary>
[LayoutRenderer("time")]
[ThreadAgnostic]
[ThreadSafe]
public class TimeLayoutRenderer : LayoutRenderer
{
/// <summary>
/// Gets or sets a value indicating whether to output UTC time instead of local time.
/// </summary>
/// <docgen category='Rendering Options' order='10' />
[DefaultValue(false)]
public bool UniversalTime { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to output in culture invariant format
/// </summary>
/// <docgen category='Rendering Options' order='10' />
[DefaultValue(false)]
public bool Invariant { get; set; }
/// <summary>
/// Renders time in the 24-h format (HH:mm:ss.mmm) and appends it to the specified <see cref="StringBuilder" />.
/// </summary>
/// <param name="builder">The <see cref="StringBuilder"/> to append the rendered data to.</param>
/// <param name="logEvent">Logging event.</param>
protected override void Append(StringBuilder builder, LogEventInfo logEvent)
{
DateTime dt = logEvent.TimeStamp;
if (UniversalTime)
{
dt = dt.ToUniversalTime();
}
string timeSeparator = ":";
string ticksSeparator = ".";
if (!Invariant)
{
var culture = GetCulture(logEvent);
if (culture != null)
{
#if !SILVERLIGHT && !NETSTANDARD1_0
timeSeparator = culture.DateTimeFormat.TimeSeparator;
#endif
ticksSeparator = culture.NumberFormat.NumberDecimalSeparator;
}
}
builder.Append2DigitsZeroPadded(dt.Hour);
builder.Append(timeSeparator);
builder.Append2DigitsZeroPadded(dt.Minute);
builder.Append(timeSeparator);
builder.Append2DigitsZeroPadded(dt.Second);
builder.Append(ticksSeparator);
builder.Append4DigitsZeroPadded((int)(dt.Ticks % 10000000) / 1000);
}
}
}
| {
"content_hash": "c1347ee705da675ea4f1e9eadc8c058e",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 120,
"avg_line_length": 35.298507462686565,
"alnum_prop": 0.5763213530655391,
"repo_name": "nazim9214/NLog",
"id": "b2dfdba0b8f94d989f91cb411732a4aca855a45b",
"size": "4031",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "src/NLog/LayoutRenderers/TimeLayoutRenderer.cs",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "Batchfile",
"bytes": "513"
},
{
"name": "C#",
"bytes": "4556523"
},
{
"name": "Makefile",
"bytes": "3639"
},
{
"name": "Perl",
"bytes": "1590"
},
{
"name": "PowerShell",
"bytes": "1596"
}
],
"symlink_target": ""
} |
#ifndef RECRING_POISSON_BVP_PROBLEMTYPE_H
#define RECRING_POISSON_BVP_PROBLEMTYPE_H
#include "main/generic_problemtype_module.h"
#include "raw/elliptic_bvp_containers.h"
#include "dm_aggframe.h"
#include "dm_qframe.h"
namespace recring
{
namespace poisson_bvp
{
class ProblemType : public GenericProblemTypeModule< RawProblemModule< PoissonBvpContainer<2> >,
DM_AggFrame, DM_QFrame >
{
void setupNamesAndDescription() override;
void setupExamples() override;
};
}
}
#endif // RECRING_POISSON_BVP_PROBLEMTYPE_H
| {
"content_hash": "780809e3ac1fb5af78900ad1b32f942d",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 96,
"avg_line_length": 19.4,
"alnum_prop": 0.6907216494845361,
"repo_name": "wavelet-and-multiscale-library/Marburg_Software_Library",
"id": "2b9d0f8b28e79ed5e24f12bf231f2e1b8cdfa3c6",
"size": "1748",
"binary": false,
"copies": "3",
"ref": "refs/heads/master",
"path": "MSL_GUI/sources/plugin/main/recring/poisson_bvp/problemtype.h",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "16443"
},
{
"name": "C++",
"bytes": "9445888"
},
{
"name": "Makefile",
"bytes": "19540"
},
{
"name": "QMake",
"bytes": "10712"
}
],
"symlink_target": ""
} |
const $ = require('../../program/commands');
const errors = require('../errors');
const err = require('../errors').errors;
const t = require('../tokenizer/tokenizer');
const CompileBlock = require('../compiler/CompileBlock').CompileBlock;
const CompileVars = require('../compiler/CompileVars').CompileVars;
const CompileObjct = require('../compiler/CompileObjct').CompileObjct;
const Proc = require('../types/Proc').Proc;
const Record = require('../types/Record').Record;
const Objct = require('../types/Objct').Objct;
const Var = require('../types/Var');
exports.CompileProc = class extends CompileBlock {
constructor(opts) {
super(opts);
this._main = false;
this._objct = null;
this._startEntryPoint = null;
this._compileObjct = null;
}
getCompileObjct() {
if (!this._compileObjct) {
this._compileObjct = new CompileObjct({
compiler: this._compiler,
program: this._program,
scope: this._scope
});
}
return this._compileObjct;
}
/**
* Check if the super object has a proc with the same name and if so then check if the parameters are the same.
**/
validateSuperProc(token) {
let scope = this._scope;
let vars = scope.getVars();
let name = scope.getName();
let superObjct = this._objct.getParentScope();
let superProc = null;
while (superObjct) {
superProc = superObjct.getVarsByName()[name];
if (superProc) {
break;
}
superObjct = superObjct.getParentScope();
}
if (!superProc) {
return;
}
superProc = superProc.getProc();
if (superProc.getParamCount() !== this._scope.getParamCount()) {
throw errors.createError(err.PROC_DOES_NOT_MATCH_SUPER_PROC, token, 'Proc does not match super proc declaration.');
}
for (let i = 0; i < superProc.getParamCount(); i++) {
let v1 = superProc.getVars()[3 + i];
let v2 = vars[3 + i];
if ((v1.getName() !== v2.getName()) || (v1.getType().type !== v2.getType().type) || (v1.getArraySize() !== v2.getArraySize())) {
throw errors.createError(err.PROC_DOES_NOT_MATCH_SUPER_PROC, token, 'Proc does not match super proc declaration.');
}
}
}
compileParameters(iterator) {
let linter = this._compiler.getLinter();
let token = iterator.skipWhiteSpace().next();
let parameters = iterator.nextUntilLexeme([t.LEXEME_NEWLINE]);
let scope = this._scope;
let program = this._program;
let tokens = parameters.tokens;
tokens.pop();
this._main = false;
if (scope.getName() === t.LEXEME_MAIN) {
if (tokens.length) {
throw errors.createError(err.SYNTAX_ERROR_MAIN_PROC_PARAMS, token, 'Proc "main" should not have parameters');
}
if (scope.getParentScope().getEntryPoint() !== null) {
throw errors.createError(err.MAIN_PROC_ALREADY_DEFINED, token, 'Main proc already defined.');
}
scope.getParentScope().setEntryPoint(this._startEntryPoint);
this._main = true;
program.setEntryPoint(this._startEntryPoint);
} else {
this._compiler.setEventProc(scope.getName(), this._startEntryPoint);
scope.addVar({
compiler: this._compiler,
unionId: 0,
token: null,
name: '!____CODE_RETURN____',
type: t.LEXEME_NUMBER,
typePointer: false,
arraySize: false
});
scope.addVar({
compiler: this._compiler,
unionId: 0,
token: null,
name: '!____STACK_RETURN____',
type: t.LEXEME_NUMBER,
typePointer: false,
arraySize: false
});
}
scope.setEntryPoint(this._startEntryPoint);
if (this._objct) {
scope.addVar({
compiler: this._compiler,
unionId: 0,
token: null,
name: '!____SELF_POINTER____',
type: t.LEXEME_NUMBER,
typePointer: false,
arraySize: false
});
}
let index = 0;
let expectType = true;
let expectComma = false;
let type = null;
let typePointer = false;
let paramCount = 0;
let pointer = false;
while (index < tokens.length) {
token = tokens[index];
switch (token.cls) {
case t.TOKEN_TYPE:
if (expectType) {
type = token.lexeme;
expectType = false;
}
break;
case t.TOKEN_POINTER:
if (expectType) {
typePointer = true;
} else {
pointer = true;
}
break;
case t.TOKEN_IDENTIFIER:
if (expectType) {
type = scope.findType(token.lexeme);
if (type === null) {
throw errors.createError(err.UNDEFINED_IDENTIFIER, token, 'Undefined identifier "' + token.lexeme + '".');
}
expectType = false;
} else if (!scope.getVarsLocked() && scope.findLocalVar(token.lexeme)) {
throw errors.createError(err.DUPLICATE_IDENTIFIER, token, 'Duplicate identifier "' + token.lexeme + '".');
} else {
paramCount++;
let arraySize = [];
let done = false;
while (!done) {
if (tokens[index + 1] && (tokens[index + 1].cls === t.TOKEN_BRACKET_OPEN)) {
index++;
if (!tokens[index + 1] || (tokens[index + 1].cls !== t.TOKEN_NUMBER)) {
throw errors.createError(err.NUMBER_CONSTANT_EXPECTED, token, 'Number constant expected.');
}
arraySize.push(tokens[index + 1].value);
index++;
if (!tokens[index + 1] || (tokens[index + 1].cls !== t.TOKEN_BRACKET_CLOSE)) {
throw errors.createError(err.SYNTAX_ERROR_BRACKET_CLOSE_EXPECTED, token, '"]" Expected.');
}
index++;
if (!tokens[index + 1] || (tokens[index + 1].cls !== t.TOKEN_BRACKET_OPEN)) {
done = true;
}
} else {
done = true;
}
}
linter && linter.addParam(token);
if (typePointer && !(type instanceof Record)) {
throw errors.createError(err.RECORD_OR_OBJECT_TYPE_EXPECTED, token, 'Record or object type expected.');
}
scope.addVar({
compiler: this._compiler,
unionId: 0,
token: token,
name: token.lexeme,
type: type,
typePointer: typePointer,
arraySize: Var.getArraySize(arraySize),
pointer: pointer,
ignoreString: true,
isParam: true
});
typePointer = false;
expectComma = true;
}
pointer = false;
break;
case t.TOKEN_COMMA:
expectComma = false;
expectType = true;
break;
default:
if (expectType && (token.lexeme === t.LEXEME_PROC)) {
type = t.LEXEME_PROC;
expectType = false;
}
break;
}
index++;
}
scope.setParamCount(paramCount);
if (this._objct) {
this.validateSuperProc(tokens[0]);
}
}
compileInitGlobalVars() {
let program = this._program;
this._scope.getParentScope().getVars().forEach((vr) => {
let stringConstantOffset = vr.getStringConstantOffset();
if (stringConstantOffset !== null) {
program.addCommand(
$.CMD_SET, $.T_NUM_G, $.REG_SRC, $.T_NUM_C, 1,
$.CMD_SET, $.T_NUM_G, $.REG_PTR, $.T_NUM_C, vr.getOffset(),
$.CMD_MOD, $.T_NUM_C, 10, $.T_NUM_C, 0, // STRING_ALLOCATE_GLOBAL_STRING
$.CMD_SETS, $.T_NUM_G, vr.getOffset(), $.T_NUM_C, vr.getStringConstantOffset()
);
}
if (!vr.getPointer() && !vr.getType().typePointer) {
this.getCompileObjct().compileConstructorCalls(vr);
}
});
return this;
}
compileInitGlobalObjects() {
this._scope.getParentScope().getRecords().forEach((record) => {
if (record instanceof Objct) {
this.getCompileObjct().compileMethodTable(record);
}
});
return this;
}
compileProcName(iterator, token) {
let procNameToken = token;
let procName = token.lexeme;
let procUsed = false;
let objctNameToken = null;
let objectName = '';
this._objct = null;
if ((iterator.skipWhiteSpace().peek() ? iterator.peek().lexeme : '') === t.LEXEME_DOT) {
iterator.next();
objctNameToken = token;
objectName = procName;
let objct = this._scope.findIdentifier(objectName);
if (objct instanceof Object) {
this._objct = objct;
} else {
throw errors.createError(err.OBJECT_TYPE_EXPECTED, token, 'Object type expected.');
}
procNameToken = iterator.skipWhiteSpace().next();
procName = (procNameToken === null) ? '' : procNameToken.lexeme;
procUsed = true;
} else {
procName = this.getNamespacedProcName(procName);
procUsed = this._compiler.getUseInfo().getUsedProc(procName);
}
return {
objctNameToken: objctNameToken,
objctName: objectName,
nameToken: procNameToken,
name: procName,
used: procUsed
};
}
compileMethodSetup(token, procName) {
let scope = this._scope;
let objct = this._objct;
objct
.addVar({
compiler: this._compiler,
unionId: 0,
token: token,
name: procName.name,
type: t.LEXEME_PROC,
typePointer: false,
arraySize: false,
pointer: false,
ignoreString: false
})
.setProc(scope);
scope.setMethod(true);
this._compiler.getUseInfo().addUseMethod(objct.getName());
// Add self to the with stack...
scope
.setSelf(new Var.Var({
compiler: this._compiler,
unionId: 0,
offset: 0,
token: null,
name: '!____SELF_POINTER_RECORD____',
global: false,
type: scope.pushSelf(objct),
typePointer: false,
pointer: false,
arraySize: false
}).setWithOffset(0))
.incStackOffset();
// Find the super object proc....
if (this._objct.getParentScope()) {
let superProc = null;
let superObjct = objct.getParentScope();
while (superObjct) {
let varsByName = superObjct.getVarsByName();
if (procName.name in varsByName) {
superProc = varsByName[procName.name].getProc();
break;
}
superObjct = superObjct.getParentScope();
}
scope.setSuper(superProc);
}
}
compileProc(iterator, token) {
let program = this._program;
let linter = this._compiler.getLinter();
let procName = this.compileProcName(iterator, token);
this._startEntryPoint = program.getLength();
program.setCodeUsed(procName.used); // Only add code when the proc was used...
linter && linter.addProc(procName);
this._scope = new Proc(this._scope, procName.name, false, this._compiler.getNamespace())
.setToken(token)
.setCodeOffset(this._startEntryPoint);
if (procName.used instanceof Proc) {
this._scope.setVarsLocked(procName.used);
}
if (this._objct === null) {
// Check duplicate identifier...
let identifier = this._scope.getParentScope().findIdentifier(procName.name);
if ((identifier !== null) && (procName.name !== t.LEXEME_MAIN)) {
throw errors.createError(err.DUPLICATE_IDENTIFIER, token, 'Duplicate identifier.');
}
this._scope.getParentScope().addProc(this._scope);
}
this.compileParameters(iterator);
// Check if it's the main proc...
if ((token.lexeme === t.LEXEME_MAIN) && (this._compiler.getPass() === 1)) {
this
.compileInitGlobalObjects()
.compileInitGlobalVars();
}
// If it's an object then add the proc as method...
if (this._objct) {
this.compileMethodSetup(token, procName);
}
this.compileBlock(iterator, null);
if (this._objct) {
// Remove self from the with stack...
this._scope
.popSelf()
.decStackOffset();
}
// Release the allocated strings...
if (!this._main) {
new CompileVars({
compiler: this._compiler,
program: this._program,
scope: this._scope
}).compileStringRelease(iterator.current());
program.addCommand($.CMD_RET, 0, 0, 0, 0);
}
}
compileProcVar(expression, token) {
if (expression.tokens.length !== 0) {
return false;
}
let linter = this._compiler.getLinter();
linter && linter.addParam(token);
this._scope.addVar({
compiler: this._compiler,
unionId: 0,
token: token,
name: token.lexeme,
type: t.LEXEME_PROC,
typePointer: false,
arraySize: false
});
return true;
}
compile(iterator) {
let token = iterator.skipWhiteSpace().next();
if (this._scope instanceof Proc) {
let procVarExpression = iterator.nextUntilLexeme([t.LEXEME_COMMA, t.LEXEME_NEWLINE]);
if (this.compileProcVar(procVarExpression, token)) {
return;
}
throw errors.createError(err.NO_LOCAL_PROC_SUPPORTED, token, 'No local proc allowed.');
}
this.compileProc(iterator, token);
}
getNamespacedProcName(name) {
return (name === t.LEXEME_MAIN) ? name : (this._compiler.getNamespace().getCurrentNamespace() + name);
}
};
| {
"content_hash": "6cb62f08cd607b203ab9fcfd18957a4a",
"timestamp": "",
"source": "github",
"line_count": 406,
"max_line_length": 140,
"avg_line_length": 40.652709359605915,
"alnum_prop": 0.4677370493789761,
"repo_name": "ArnoVanDerVegt/wheel",
"id": "3e0d239fdb1c38ec3dc6eff6e43e81c3f0291d81",
"size": "16660",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "js/frontend/compiler/keyword/CompileProc.js",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "113289"
},
{
"name": "CSS",
"bytes": "526894"
},
{
"name": "HTML",
"bytes": "1657447"
},
{
"name": "JavaScript",
"bytes": "4667529"
},
{
"name": "Rich Text Format",
"bytes": "496"
}
],
"symlink_target": ""
} |
<?php
require_once 'bootstrap.php';
$injector->make('Kastilyo\RabbitHole\Spec\Subscriber')->consume();
| {
"content_hash": "92be211edb857cbb79f9e936a38ea544",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 66,
"avg_line_length": 26,
"alnum_prop": 0.7403846153846154,
"repo_name": "kastilyo/rabbit-hole",
"id": "08a414eadaf50c52a2aecfd51521c50b1e830954",
"size": "104",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "dev/consumer.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "36535"
}
],
"symlink_target": ""
} |
<?php
/**
* CreateDatabaseStatementTest class file.
*
* This test tests the CreateDatabaseStatement class.
*
* @author Anastaszor
*/
class CreateDatabaseStatementTest extends AbstractStatementTest
{
/**
* (non-PHPdoc)
* @see AbstractStatementTest::setUpStatement()
*/
protected function setUpStatement()
{
$statement = new CreateDatabaseStatement($this->_cachalot);
$statement->setDatabaseName("test_database");
return $statement;
}
}
| {
"content_hash": "5f53bd92b4ad1b465d9ac47ed557cb7a",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 63,
"avg_line_length": 19.333333333333332,
"alnum_prop": 0.7219827586206896,
"repo_name": "Anastaszor/Cachalot",
"id": "8565ea6d86498aad127ebbd29aa15ef370d6075e",
"size": "464",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "tests/statements/exec/CreateDatabaseStatementTest.php",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "PHP",
"bytes": "674870"
},
{
"name": "Shell",
"bytes": "111"
}
],
"symlink_target": ""
} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>dpdgraph: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.14.1 / dpdgraph - 0.6.5</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
dpdgraph
<small>
0.6.5
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2021-12-29 02:51:29 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2021-12-29 02:51:29 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
conf-gmp 3 Virtual package relying on a GMP lib system installation
coq 8.14.1 Formal proof management system
dune 2.9.1 Fast, portable, and opinionated build system
ocaml 4.06.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.06.1 Official 4.06.1 release
ocaml-config 1 OCaml Switch Configuration
ocaml-secondary-compiler 4.08.1-1 OCaml 4.08.1 Secondary Switch Compiler
ocamlfind 1.9.1 A library manager for OCaml
ocamlfind-secondary 1.9.1 Adds support for ocaml-secondary-compiler to ocamlfind
zarith 1.12 Implements arithmetic and logical operations over arbitrary-precision integers
# opam file:
opam-version: "2.0"
maintainer: "yves.bertot@inria.fr"
license: "LGPL-2.1-only"
homepage: "https://github.com/karmaki/coq-dpdgraph"
build: [
["./configure"]
["echo" "%{jobs}%" "jobs for the linter"]
[make "-j%{jobs}%"]
]
bug-reports: "https://github.com/karmaki/coq-dpdgraph/issues"
dev-repo: "git+https://github.com/karmaki/coq-dpdgraph.git"
install: [
[make "install" "BINDIR=%{bin}%"]
]
depends: [
"ocaml" {< "4.10.0"}
"coq" {>= "8.9" & < "8.10~"}
"ocamlgraph"
]
authors: [ "Anne Pacalet" "Yves Bertot"]
synopsis: "Compute dependencies between Coq objects (definitions, theorems) and produce graphs"
url {
src:
"https://github.com/Karmaki/coq-dpdgraph/releases/download/v0.6.5/coq-dpdgraph-0.6.5.tgz"
checksum: "sha256=539d49b739a4f173e03a3194453f8367051e808c8e329773648ba1c0a495a07f"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-dpdgraph.0.6.5 coq.8.14.1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.14.1).
The following dependencies couldn't be met:
- coq-dpdgraph -> coq < 8.10~ -> ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-dpdgraph.0.6.5</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {
"content_hash": "92e035014f826c70bcc3cf2a87a2a595",
"timestamp": "",
"source": "github",
"line_count": 170,
"max_line_length": 159,
"avg_line_length": 41.71176470588235,
"alnum_prop": 0.5375828515019038,
"repo_name": "coq-bench/coq-bench.github.io",
"id": "c2395822993d30930511052ea1253aca0dc230cb",
"size": "7116",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "clean/Linux-x86_64-4.06.1-2.0.5/released/8.14.1/dpdgraph/0.6.5.html",
"mode": "33188",
"license": "mit",
"language": [],
"symlink_target": ""
} |
package com.transloadit.sdk.response;
import com.transloadit.sdk.MockHttpService;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.mockserver.client.MockServerClient;
import org.mockserver.junit.MockServerRule;
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;
import static org.junit.Assert.assertEquals;
/**
* Unit Test class for {@link Response}. Api-Responses are simulated by mocking the server's response.
*/
public class ResponseTest extends MockHttpService {
/**
* MockServer can be run using the MockServerRule.
*/
@Rule
public MockServerRule mockServerRule = new MockServerRule(this, true, PORT);
/**
* MockServerClient makes HTTP requests to a MockServer instance.
*/
private MockServerClient mockServerClient;
/**
* Resets MockserverClient before each Test run.
*/
@Before
public void setUp() {
mockServerClient.reset();
}
/**
* This Test checks if the {@link Response#json()} method converts a received server response body
* to a valid {@link org.json.JSONObject}.
* @throws Exception if the Test resource "assembly.json" is missing, a JSON Key cannot be found or if HTTP or
* non-HTTP errors have occurred.
*/
@Test
public void json() throws Exception {
mockServerClient.when(HttpRequest.request()
.withPath("/assemblies").withMethod("POST"))
.respond(HttpResponse.response().withBody(getJson("assembly.json")));
AssemblyResponse response = newAssemblyWithoutID().save(false);
assertEquals(response.json().getString("ok"), "ASSEMBLY_COMPLETED");
}
/**
* This Test checks if {@link Response#status()} returns status code from a defined server response.
* @throws Exception if the Test resource "assembly.json" is missing or if HTTP or non-HTTP errors have occurred.
*/
@Test
public void status() throws Exception {
mockServerClient.when(HttpRequest.request()
.withPath("/assemblies").withMethod("POST"))
.respond(HttpResponse.response().withBody(getJson("assembly.json")));
AssemblyResponse response = newAssemblyWithoutID().save(false);
assertEquals(response.status(), 200);
}
}
| {
"content_hash": "130a6dc03e9257bbee4155910d247dd8",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 118,
"avg_line_length": 34.294117647058826,
"alnum_prop": 0.6865351629502573,
"repo_name": "transloadit/java-sdk",
"id": "f22131dab4e5023d966348ebfb30c42865aac8cf",
"size": "2332",
"binary": false,
"copies": "1",
"ref": "refs/heads/main",
"path": "src/test/java/com/transloadit/sdk/response/ResponseTest.java",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Java",
"bytes": "208381"
}
],
"symlink_target": ""
} |
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
from c7n import cache
from c7n.executor import ThreadPoolExecutor
from c7n.registry import PluginRegistry
try:
from c7n.resources.aws import AWS
resources = AWS.resources
except ImportError:
resources = PluginRegistry('resources')
from c7n.utils import dumps
class ResourceManager(object):
filter_registry = None
action_registry = None
executor_factory = ThreadPoolExecutor
retry = None
def __init__(self, ctx, data):
self.ctx = ctx
self.session_factory = ctx.session_factory
self.config = ctx.options
self.data = data
self.log_dir = ctx.log_dir
self._cache = cache.factory(self.ctx.options)
self.log = logging.getLogger('custodian.resources.%s' % (
self.__class__.__name__.lower()))
if self.filter_registry:
self.filters = self.filter_registry.parse(
self.data.get('filters', []), self)
if self.action_registry:
self.actions = self.action_registry.parse(
self.data.get('actions', []), self)
def format_json(self, resources, fh):
return dumps(resources, fh, indent=2)
def match_ids(self, ids):
"""return ids that match this resource type's id format."""
return ids
@classmethod
def get_permissions(cls):
return ()
def get_resources(self, resource_ids):
"""Retrieve a set of resources by id."""
return []
def resources(self):
raise NotImplementedError("")
def get_resource_manager(self, resource_type, data=None):
klass = resources.get(resource_type)
if klass is None:
raise ValueError(resource_type)
# if we're already querying via config carry it forward
if not data and self.source_type == 'config' and getattr(
klass.get_model(), 'config_type', None):
return klass(self.ctx, {'source': self.config_type})
return klass(self.ctx, data or {})
def filter_resources(self, resources, event=None):
original = len(resources)
if event and event.get('debug', False):
self.log.info(
"Filtering resources with %s", self.filters)
for f in self.filters:
if not resources:
break
rcount = len(resources)
resources = f.process(resources, event)
if event and event.get('debug', False):
self.log.debug(
"applied filter %s %d->%d", f, rcount, len(resources))
self.log.debug("Filtered from %d to %d %s" % (
original, len(resources), self.__class__.__name__.lower()))
return resources
def get_model(self):
"""Returns the resource meta-model.
"""
return self.query.resolve(self.resource_type)
| {
"content_hash": "6852259b928b2a981180d040b5c39cc5",
"timestamp": "",
"source": "github",
"line_count": 89,
"max_line_length": 82,
"avg_line_length": 32.97752808988764,
"alnum_prop": 0.6034071550255536,
"repo_name": "taohungyang/cloud-custodian",
"id": "04787ee3f91ccafbe4ec1d458a048e1df76bb67d",
"size": "3525",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "c7n/manager.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "517"
},
{
"name": "Go",
"bytes": "131325"
},
{
"name": "HTML",
"bytes": "31"
},
{
"name": "Makefile",
"bytes": "10146"
},
{
"name": "Python",
"bytes": "3444793"
},
{
"name": "Shell",
"bytes": "2294"
}
],
"symlink_target": ""
} |
import os
import sys
import time
import random
import subprocess
import requests
from panda import Panda
from nose.tools import timed, assert_equal, assert_less, assert_greater
def connect_wo_esp():
# connect to the panda
p = Panda()
# power down the ESP
p.set_esp_power(False)
# clear old junk
while len(p.can_recv()) > 0:
pass
return p
def connect_wifi():
p = Panda()
dongle_id, pw = p.get_serial()
assert(dongle_id.isalnum())
_connect_wifi(dongle_id, pw)
def _connect_wifi(dongle_id, pw, insecure_okay=False):
ssid = str("panda-" + dongle_id)
print("WIFI: connecting to %s" % ssid)
while 1:
if sys.platform == "darwin":
os.system("networksetup -setairportnetwork en0 %s %s" % (ssid, pw))
else:
wlan_interface = subprocess.check_output(["sh", "-c", "iw dev | awk '/Interface/ {print $2}'"]).strip()
cnt = 0
MAX_TRIES = 10
while cnt < MAX_TRIES:
print "WIFI: scanning %d" % cnt
os.system("sudo iwlist %s scanning > /dev/null" % wlan_interface)
os.system("nmcli device wifi rescan")
wifi_scan = filter(lambda x: ssid in x, subprocess.check_output(["nmcli","dev", "wifi", "list"]).split("\n"))
if len(wifi_scan) != 0:
break
time.sleep(0.1)
# MAX_TRIES tries, ~10 seconds max
cnt += 1
assert cnt < MAX_TRIES
if "-pair" in wifi_scan[0]:
os.system("nmcli d wifi connect %s-pair" % (ssid))
if insecure_okay:
break
# fetch webpage
print "connecting to insecure network to secure"
r = requests.get("http://192.168.0.10/")
assert r.status_code==200
print "securing"
try:
r = requests.get("http://192.168.0.10/secure", timeout=0.01)
except requests.exceptions.Timeout:
pass
else:
os.system("nmcli d wifi connect %s password %s" % (ssid, pw))
break
# TODO: confirm that it's connected to the right panda
def time_many_sends(p, bus, precv=None, msg_count=100, msg_id=None):
if precv == None:
precv = p
if msg_id == None:
msg_id = random.randint(0x100, 0x200)
st = time.time()
p.can_send_many([(msg_id, 0, "\xaa"*8, bus)]*msg_count)
r = []
while len(r) < (msg_count*2) and (time.time() - st) < 3:
r.extend(precv.can_recv())
sent_echo = filter(lambda x: x[3] == 0x80 | bus and x[0] == msg_id, r)
loopback_resp = filter(lambda x: x[3] == bus and x[0] == msg_id, r)
assert_equal(len(sent_echo), msg_count)
assert_equal(len(loopback_resp), msg_count)
et = (time.time()-st)*1000.0
comp_kbps = (1+11+1+1+1+4+8*8+15+1+1+1+7)*msg_count / et
return comp_kbps
| {
"content_hash": "7e703648a30c4b429b9f8037b8940705",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 117,
"avg_line_length": 28.189473684210526,
"alnum_prop": 0.5985810306198656,
"repo_name": "TheMutley/openpilot",
"id": "1ddced117980ee68c6fef46858866ca010636558",
"size": "2678",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "panda/tests/automated/helpers.py",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Assembly",
"bytes": "44568"
},
{
"name": "C",
"bytes": "4364048"
},
{
"name": "C++",
"bytes": "2357790"
},
{
"name": "CSS",
"bytes": "6270"
},
{
"name": "Cap'n Proto",
"bytes": "164218"
},
{
"name": "JavaScript",
"bytes": "6264"
},
{
"name": "Makefile",
"bytes": "24346"
},
{
"name": "NSIS",
"bytes": "7977"
},
{
"name": "Python",
"bytes": "3431284"
},
{
"name": "Shell",
"bytes": "4273"
}
],
"symlink_target": ""
} |
namespace Protobuild.Tests
{
using System.IO;
using Xunit;
public class NuGetPortableLibraryDetectedWithRootPathDotSlashTest : ProtobuildTest
{
[Fact]
public void GenerationIsCorrect()
{
this.SetupTest("NuGetPortableLibraryDetectedWithRootPathDotSlash");
this.Generate("Windows");
Assert.True(File.Exists(this.GetPath(@"Module.Windows.sln")));
Assert.True(File.Exists(this.GetPath(@"Console.Windows.csproj")));
var consoleContents = this.ReadFile(@"Console.Windows.csproj");
Assert.Contains("portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid", consoleContents);
Assert.Contains("Test.dll", consoleContents);
Assert.Contains("<HintPath>packages", consoleContents);
Assert.DoesNotContain("<HintPath>..\\packages", consoleContents);
}
}
} | {
"content_hash": "51bf4800701d80e28fa8fb0f358b8211",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 103,
"avg_line_length": 34.84615384615385,
"alnum_prop": 0.6545253863134658,
"repo_name": "TukekeSoft/Protobuild",
"id": "b03e1ed1d82aef492a78a22c46e24ad8c5fa03fe",
"size": "908",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "Protobuild.FunctionalTests/NuGetPortableLibraryDetectedWithRootPathDotSlashTest.cs",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "C",
"bytes": "291"
},
{
"name": "C#",
"bytes": "766323"
},
{
"name": "C++",
"bytes": "116"
},
{
"name": "HTML",
"bytes": "1415"
},
{
"name": "PowerShell",
"bytes": "2954"
},
{
"name": "Shell",
"bytes": "2784"
},
{
"name": "XSLT",
"bytes": "193999"
}
],
"symlink_target": ""
} |
import json
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponseForbidden
from django.views.decorators.http import require_POST
from django.utils.translation import ugettext as _
from corehq.apps.users.forms import MultipleSelectionForm
from corehq.apps.users.models import Permissions, CommCareUser
from corehq.apps.groups.models import Group, DeleteGroupRecord
from corehq.apps.users.decorators import require_permission
from dimagi.utils.couch.resource_conflict import repeat
require_can_edit_groups = require_permission(Permissions.edit_commcare_users)
@require_POST
@require_can_edit_groups
def add_group(request, domain):
group_name = request.POST['group_name']
if not group_name:
messages.error(request, _(
"We could not create the group; "
"please give it a name first"
))
return HttpResponseRedirect(request.META['HTTP_REFERER'])
group = Group.by_name(domain, group_name, one=False).first()
if group:
messages.warning(request, _(
"A group with this name already exists: instead of making "
"a new one, we've brought you to the existing one."
))
else:
group = Group(name=group_name, domain=domain)
group.save()
return HttpResponseRedirect(
reverse("group_members", args=(domain, group.get_id))
)
@require_POST
@require_can_edit_groups
def delete_group(request, domain, group_id):
group = Group.get(group_id)
if group.domain == domain:
record = group.soft_delete()
if record:
messages.success(request, _(
"You have deleted a group. "
'<a href="{url}" class="post-link">Undo</a>'
).format(
url=reverse('undo_delete_group', args=[domain, record.get_id])
), extra_tags="html")
return HttpResponseRedirect(reverse("all_groups", args=(domain, )))
else:
return HttpResponseForbidden()
@require_POST
@require_can_edit_groups
def undo_delete_group(request, domain, record_id):
record = DeleteGroupRecord.get(record_id)
record.undo()
return HttpResponseRedirect(
reverse('group_members', args=[domain, record.doc_id])
)
@require_can_edit_groups
def edit_group(request, domain, group_id):
group = Group.get(group_id)
if group.domain == domain:
name = request.POST.get('name')
case_sharing = request.POST.get('case_sharing')
reporting = request.POST.get('reporting')
if name is not None and group.name != name:
dupe = Group.by_name(domain, name, one=False).first()
if dupe:
messages.warning(request, _(
"We didn't rename your group because there's already "
"another group with that name."
))
else:
group.name = name
if case_sharing in ('true', 'false'):
group.case_sharing = json.loads(case_sharing)
if reporting in ('true', 'false'):
group.reporting = json.loads(reporting)
group.save()
return HttpResponseRedirect(
reverse("group_members", args=[domain, group_id])
)
else:
return HttpResponseForbidden()
@require_can_edit_groups
@require_POST
def update_group_data(request, domain, group_id):
group = Group.get(group_id)
if group.domain == domain:
updated_data = json.loads(request.POST["group-data"])
group.metadata = updated_data
group.save()
messages.success(request, _("Group '%s' data updated!") % group.name)
return HttpResponseRedirect(
reverse("group_members", args=[domain, group_id])
)
else:
return HttpResponseForbidden()
@require_can_edit_groups
@require_POST
def update_group_membership(request, domain, group_id):
group = Group.get(group_id)
if group.domain != domain:
return HttpResponseForbidden()
form = MultipleSelectionForm(request.POST)
form.fields['selected_ids'].choices = [(id, 'throwaway') for id in CommCareUser.ids_by_domain(domain)]
if form.is_valid():
group.users = form.cleaned_data['selected_ids']
group.save()
messages.success(request, _("Group %s updated!") % group.name)
else:
messages.error(request, _("Form not valid. A user may have been deleted while you were viewing this page"
"Please try again."))
return HttpResponseRedirect(reverse("group_members", args=[domain, group_id]))
| {
"content_hash": "33448f4bbbfb695eeaf6668ea1948c5b",
"timestamp": "",
"source": "github",
"line_count": 127,
"max_line_length": 113,
"avg_line_length": 36.55118110236221,
"alnum_prop": 0.6415338216286084,
"repo_name": "gmimano/commcaretest",
"id": "40cfab6cff9d08951265d2ac6d62b5c49419982a",
"size": "4642",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "corehq/apps/groups/views.py",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "ActionScript",
"bytes": "15950"
},
{
"name": "CSS",
"bytes": "282577"
},
{
"name": "JavaScript",
"bytes": "2731012"
},
{
"name": "Python",
"bytes": "4738450"
},
{
"name": "Shell",
"bytes": "22454"
}
],
"symlink_target": ""
} |
class LucidCM::Session < LucidClient::Session
attr_reader :token
def initialize( options = {} )
@token = options[:token]
super( options )
end
# +model+ must implement +#token+.
#
def self.for_model( model, options = {} )
options.merge!( :token => model.token )
new( options )
end
def parse_resource( response )
parse_response( response )
end
private
def _middleware
%i{ Retry CallLogger Token }.map do |middleware|
LucidCM::Middleware.const_get( middleware )
end
end
def _headers
{
'Authorization' => "Bearer #{token}",
'Content-Type' => 'application/json'
}
end
def _request_path( path )
"/api/v3.1/#{path}.json"
end
def _default_uri
'https://api.createsend.com/api/v3.1'
end
end
| {
"content_hash": "0e601c338ead4867229d3025aa932d70",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 52,
"avg_line_length": 17.217391304347824,
"alnum_prop": 0.6098484848484849,
"repo_name": "luciddesign/lucid_cm",
"id": "8a8136ed7490043ecf7ba5e78fc78622a1edf990",
"size": "792",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/lucid_cm/session.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "6165"
}
],
"symlink_target": ""
} |
layout: post
title: "Call of Duty WWII trailer revealed"
categories: news
tags: [COD Trailer Reveal WWII]
image:
feature: ww2.png
teaser: ww2.png
credit:
creditlink: "www.gamezone.com"
author: "Danny"
---
<h1>COD WW2 Trailer Reveal</h1>
<div class="video">
<iframe width="560" height="315" src="https://www.youtube.com/embed/D4Q_XYVescc" frameborder="0" allowfullscreen></iframe>
</div>
| {
"content_hash": "1a429a5594b0a7d178d7df22f1e9b2ed",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 124,
"avg_line_length": 23.470588235294116,
"alnum_prop": 0.7117794486215538,
"repo_name": "CodingGabe/512-Goons",
"id": "b89523fab858a5a25609397380867f4f895795c8",
"size": "403",
"binary": false,
"copies": "1",
"ref": "refs/heads/gh-pages",
"path": "_posts/2017-04-26-Call-Of-Duty-WWII.html",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "10470"
},
{
"name": "HTML",
"bytes": "56196"
}
],
"symlink_target": ""
} |
module MongoJazz::Mix
end
require File.expand_path(File.dirname(__FILE__)) + "/mix/core"
require File.expand_path(File.dirname(__FILE__)) + "/mix/validator" | {
"content_hash": "c92c4d8af0b18574808a20fddc1f1341",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 67,
"avg_line_length": 31.4,
"alnum_prop": 0.7133757961783439,
"repo_name": "benmyles/mongo_jazz",
"id": "e113fc4bc526c92591556d228086bfd4cadecfe5",
"size": "157",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "lib/mongo_jazz/mix.rb",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Ruby",
"bytes": "7051"
}
],
"symlink_target": ""
} |
Additional header content
Initializes a new instance of the <a href="T_iTin_Export_Model_EmptyLineModel">EmptyLineModel</a> class.
**Namespace:** <a href="N_iTin_Export_Model">iTin.Export.Model</a><br />**Assembly:** iTin.Export.Core (in iTin.Export.Core.dll) Version: 2.0.0.0 (2.0.0.0)
## Syntax
**C#**<br />
``` C#
public EmptyLineModel()
```
**VB**<br />
``` VB
Public Sub New
```
## Remarks
\[Missing <remarks> documentation for "M:iTin.Export.Model.EmptyLineModel.#ctor"\]
## See Also
#### Reference
<a href="T_iTin_Export_Model_EmptyLineModel">EmptyLineModel Class</a><br /><a href="N_iTin_Export_Model">iTin.Export.Model Namespace</a><br /> | {
"content_hash": "0ae1ceed7d2127479223a76f3d627382",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 165,
"avg_line_length": 24.74074074074074,
"alnum_prop": 0.6856287425149701,
"repo_name": "iAJTin/iExportEngine",
"id": "beddd70564438fccf690061d3000e7b62856111f",
"size": "698",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "source/documentation/iTin.Export.Documentation/Documentation/M_iTin_Export_Model_EmptyLineModel__ctor.md",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "Batchfile",
"bytes": "2298"
},
{
"name": "C#",
"bytes": "2815693"
},
{
"name": "Smalltalk",
"bytes": "7632"
},
{
"name": "XSLT",
"bytes": "14099"
}
],
"symlink_target": ""
} |
from __future__ import unicode_literals
from __future__ import absolute_import
from scalyr_agent import compat
__author__ = "czerwin@scalyr.com"
import six
def serialize_as_length_prefixed_string(value, output_buffer):
"""Serializes the str or unicode value using the length-prefixed format special to Scalyr.
This is a bit more efficient since the value does not need to be blackslash or quote escaped.
@param value: The string value to serialize.
@param output_buffer: The buffer to serialize the string to.
@type value: str or unicode
@type output_buffer: BytesIO
"""
output_buffer.write(b"`s")
if type(value) is six.text_type:
to_serialize = value.encode("utf-8")
else:
to_serialize = value
# 2->TODO struct.pack|unpack in python < 2.7.7 does not allow unicode format string.
output_buffer.write(compat.struct_pack_unicode(">i", len(to_serialize)))
output_buffer.write(to_serialize)
| {
"content_hash": "3040305d41a4a58660a2654ab29e17df",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 97,
"avg_line_length": 34.357142857142854,
"alnum_prop": 0.7068607068607069,
"repo_name": "imron/scalyr-agent-2",
"id": "60092467258c759cb3e1d19cac1d06623f19b4b8",
"size": "1661",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "scalyr_agent/json_lib/serializer.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "1297"
},
{
"name": "Dockerfile",
"bytes": "1461"
},
{
"name": "Python",
"bytes": "2093708"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- From: file:/C:/Users/ddiorio/Documents/SEL0630/android/Cardboard%20Version/app/src/main/res/values-v11/styles.xml -->
<eat-comment/>
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
</resources> | {
"content_hash": "8507007732aa26803ec433c10b1594d4",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 126,
"avg_line_length": 43.25,
"alnum_prop": 0.6676300578034682,
"repo_name": "ddmendes/R3V-Remote3DViewer",
"id": "d72519297b3c6601b563aaab19a9db999992dcff",
"size": "346",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "android/Cardboard Version/app/build/intermediates/res/merged/release/values-v11/values-v11.xml",
"mode": "33188",
"license": "mit",
"language": [
{
"name": "CSS",
"bytes": "1858"
},
{
"name": "GLSL",
"bytes": "16218"
},
{
"name": "HTML",
"bytes": "6316"
},
{
"name": "Java",
"bytes": "47541"
},
{
"name": "JavaScript",
"bytes": "1045"
},
{
"name": "Python",
"bytes": "6107"
},
{
"name": "Shell",
"bytes": "195"
},
{
"name": "TeX",
"bytes": "44324"
}
],
"symlink_target": ""
} |
<?xml version="1.0" encoding="UTF-8"?>
<package packagerversion="1.4.10" version="2.0"
xmlns="http://pear.php.net/dtd/package-2.0"
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
http://pear.php.net/dtd/tasks-1.0.xsd
http://pear.php.net/dtd/package-2.0
http://pear.php.net/dtd/package-2.0.xsd">
<name>PHPUnit_TicketListener_Trac</name>
<channel>pear.phpunit.de</channel>
<summary>A ticket listener for PHPUnit that interacts with the Trac issue API.</summary>
<description>A ticket listener for PHPUnit that interacts with the Trac issue API.</description>
<lead>
<name>Sebastian Bergmann</name>
<user>sb</user>
<email>sebastian@phpunit.de</email>
<active>yes</active>
</lead>
<date>2011-09-05</date>
<version>
<release>1.0.0</release>
<api>1.0.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license>The BSD 3-Clause License</license>
<notes>http://github.com/sebastianbergmann/phpunit-ticketlistener-trac/blob/master/README.markdown</notes>
<contents>
<dir name="/">
<dir name="PHPUnit">
<dir name="Extensions">
<dir name="TicketListener">
<file baseinstalldir="/" name="Trac.php" role="php">
<tasks:replace from="@package_version@" to="version" type="package-info" />
</file>
</dir>
</dir>
</dir>
<file baseinstalldir="/" name="ChangeLog.markdown" role="doc"/>
<file baseinstalldir="/" name="LICENSE" role="doc"/>
</dir>
</contents>
<dependencies>
<required>
<php>
<min>5.2.7</min>
</php>
<pearinstaller>
<min>1.9.4</min>
</pearinstaller>
<package>
<name>PHPUnit</name>
<channel>pear.phpunit.de</channel>
<min>3.6.0RC1</min>
</package>
<package>
<name>XML_RPC2</name>
<channel>pear.php.net</channel>
</package>
</required>
</dependencies>
<phprelease/>
</package>
| {
"content_hash": "04fe463bef24c55c30631788c490b828",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 107,
"avg_line_length": 30.803030303030305,
"alnum_prop": 0.6414166256763404,
"repo_name": "phpunit/phpunit-ticketlistener-trac",
"id": "69a8bbbc19b47e34396744dc872d9cc5628ac4cf",
"size": "2033",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "package.xml",
"mode": "33188",
"license": "bsd-3-clause",
"language": [
{
"name": "PHP",
"bytes": "6544"
}
],
"symlink_target": ""
} |
<div class="cbp-l-inline">
<div class="cbp-l-inline-left">
<img src="assets/img/team/img4-md.html" alt="Dashboard" class="cbp-l-project-img">
</div>
<div class="cbp-l-inline-right">
<div class="cbp-l-inline-title text-uppercase">Paul Flavius</div>
<div class="cbp-l-inline-subtitle">Developer</div>
<div class="cbp-l-inline-desc">Minus commodi consequatur provident quae. Nihil, alias, vel consequatur ab aliquam aspernatur optio harum facilis excepturi mollitia autem voluptas cum ex veniam numquam quia repudiandae in iure. Assumenda, vel provident molestiae perferendis officia commodi asperiores earum sapiente inventore quam deleniti mollitia consequatur expedita quaerat natus praesentium beatae!</div>
<hr>
<p><strong>Phone:</strong> +444 123456789</p>
<p><strong>Email:</strong> paulfalvious@gmail.com</p><br>
<ul class="list-inline team-social">
<li><a class="fb" href="#"><i class="fa fa-facebook"></i></a></li>
<li><a class="tw" href="#"><i class="fa fa-twitter"></i></a></li>
<li><a class="gp" href="#"><i class="fa fa-google-plus"></i></a></li>
</ul>
</div>
</div>
| {
"content_hash": "0092d07e672868b54aa24aa288f3f3c2",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 417,
"avg_line_length": 53.47826086956522,
"alnum_prop": 0.6317073170731707,
"repo_name": "sidaurukfreddy/mtt-application",
"id": "42aad24195fc24e4f74c7cf43d77359ef9ac8c65",
"size": "1230",
"binary": false,
"copies": "2",
"ref": "refs/heads/master",
"path": "resources/frontend/ajax/cube-portfolio/team1.html",
"mode": "33261",
"license": "mit",
"language": [
{
"name": "ApacheConf",
"bytes": "676"
},
{
"name": "CSS",
"bytes": "2593625"
},
{
"name": "HTML",
"bytes": "3597737"
},
{
"name": "JavaScript",
"bytes": "4238054"
},
{
"name": "PHP",
"bytes": "2643141"
}
],
"symlink_target": ""
} |
package com.amazonaws.services.apigatewayv2.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.apigatewayv2.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* GetRouteResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetRouteResultJsonUnmarshaller implements Unmarshaller<GetRouteResult, JsonUnmarshallerContext> {
public GetRouteResult unmarshall(JsonUnmarshallerContext context) throws Exception {
GetRouteResult getRouteResult = new GetRouteResult();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return getRouteResult;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("apiKeyRequired", targetDepth)) {
context.nextToken();
getRouteResult.setApiKeyRequired(context.getUnmarshaller(Boolean.class).unmarshall(context));
}
if (context.testExpression("authorizationScopes", targetDepth)) {
context.nextToken();
getRouteResult.setAuthorizationScopes(new ListUnmarshaller<String>(context.getUnmarshaller(String.class)).unmarshall(context));
}
if (context.testExpression("authorizationType", targetDepth)) {
context.nextToken();
getRouteResult.setAuthorizationType(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("authorizerId", targetDepth)) {
context.nextToken();
getRouteResult.setAuthorizerId(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("modelSelectionExpression", targetDepth)) {
context.nextToken();
getRouteResult.setModelSelectionExpression(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("operationName", targetDepth)) {
context.nextToken();
getRouteResult.setOperationName(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("requestModels", targetDepth)) {
context.nextToken();
getRouteResult.setRequestModels(new MapUnmarshaller<String, String>(context.getUnmarshaller(String.class), context
.getUnmarshaller(String.class)).unmarshall(context));
}
if (context.testExpression("requestParameters", targetDepth)) {
context.nextToken();
getRouteResult.setRequestParameters(new MapUnmarshaller<String, ParameterConstraints>(context.getUnmarshaller(String.class),
ParameterConstraintsJsonUnmarshaller.getInstance()).unmarshall(context));
}
if (context.testExpression("routeId", targetDepth)) {
context.nextToken();
getRouteResult.setRouteId(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("routeKey", targetDepth)) {
context.nextToken();
getRouteResult.setRouteKey(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("routeResponseSelectionExpression", targetDepth)) {
context.nextToken();
getRouteResult.setRouteResponseSelectionExpression(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("target", targetDepth)) {
context.nextToken();
getRouteResult.setTarget(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return getRouteResult;
}
private static GetRouteResultJsonUnmarshaller instance;
public static GetRouteResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new GetRouteResultJsonUnmarshaller();
return instance;
}
}
| {
"content_hash": "974254468bbe999efc10e13c3c2e8daa",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 147,
"avg_line_length": 47.79816513761468,
"alnum_prop": 0.6170825335892515,
"repo_name": "jentfoo/aws-sdk-java",
"id": "7de1940b17a03c8c709b3c45eb9e53ba5071b306",
"size": "5790",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/transform/GetRouteResultJsonUnmarshaller.java",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Batchfile",
"bytes": "270"
},
{
"name": "FreeMarker",
"bytes": "173637"
},
{
"name": "Gherkin",
"bytes": "25063"
},
{
"name": "Java",
"bytes": "356214839"
},
{
"name": "Scilab",
"bytes": "3924"
},
{
"name": "Shell",
"bytes": "295"
}
],
"symlink_target": ""
} |
import unittest
from unittest import mock
from google.datacatalog_connectors.tableau import sync
__SYNC_PACKAGE = 'google.datacatalog_connectors.tableau.sync'
@mock.patch(f'{__SYNC_PACKAGE}.workbooks_synchronizer'
f'.WorkbooksSynchronizer.run')
@mock.patch(f'{__SYNC_PACKAGE}.sites_synchronizer.SitesSynchronizer.run')
@mock.patch(f'{__SYNC_PACKAGE}.dashboards_synchronizer'
f'.DashboardsSynchronizer.run')
class DataCatalogSynchronizerTest(unittest.TestCase):
def setUp(self):
self.__synchronizer = sync.DataCatalogSynchronizer(
tableau_server_address='test-server',
tableau_api_version='test-api-version',
tableau_username='test-api-username',
tableau_password='test-api-password',
tableau_site='test-site',
datacatalog_project_id='test-project-id',
datacatalog_location_id='test-location-id')
def test_constructor_should_set_instance_attributes(
self, mock_dashboards_sync, mock_sites_sync,
mock_workbooks_sync): # noqa: E125
attrs = self.__synchronizer.__dict__
self.assertIsNotNone(
attrs['_DataCatalogSynchronizer__dashboards_synchronizer'])
self.assertIsNotNone(
attrs['_DataCatalogSynchronizer__sites_synchronizer'])
self.assertIsNotNone(
attrs['_DataCatalogSynchronizer__workbooks_synchronizer'])
def test_run_should_synchronize_all_asset_types_full_sync(
self, mock_dashboards_sync, mock_sites_sync,
mock_workbooks_sync): # noqa: E125
self.__synchronizer.run()
mock_sites_sync.assert_called_once()
mock_workbooks_sync.assert_not_called()
mock_dashboards_sync.assert_called_once()
def test_run_should_synchronize_specific_asset_types_partial_sync(
self, mock_dashboards_sync, mock_sites_sync,
mock_workbooks_sync): # noqa: E125
query_filters = {'workbooks': {'luid': '123456789'}}
self.__synchronizer.run(query_filters=query_filters)
mock_sites_sync.assert_not_called()
mock_workbooks_sync.assert_called_once()
mock_dashboards_sync.assert_called_once()
| {
"content_hash": "731c2710e70075cfcd434184eeac5735",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 73,
"avg_line_length": 38.327586206896555,
"alnum_prop": 0.6653171390013495,
"repo_name": "GoogleCloudPlatform/datacatalog-connectors-bi",
"id": "3103fdaac889ed4ab44fcbaf8e8d58645987fd2d",
"size": "2819",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "google-datacatalog-tableau-connector/tests/google/datacatalog_connectors/tableau/sync/datacatalog_synchronizer_test.py",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "Dockerfile",
"bytes": "3191"
},
{
"name": "Python",
"bytes": "980579"
},
{
"name": "Shell",
"bytes": "9469"
}
],
"symlink_target": ""
} |
using System;
using System.Collections.Generic;
using System.Text;
namespace Esri_Telecom_Tools.Core
{
/// <summary>
/// Encapsulates a combination of buffer tube and fiber count
/// </summary>
public class FiberCableConfiguration
{
private string _displayName = "";
private string _detailDesc = "";
private int _bufferCount = -1;
private int _totalFiberCount = -1;
private int _fibersPerTube = -1;
/// <summary>
/// Constructs a new FiberCableConfiguration
/// </summary>
/// <param name="bufferCount">Total number of buffer tubes</param>
/// <param name="fiberCount">Total Number of fiber strands</param>
public FiberCableConfiguration(int bufferCount, int totalFiberCount)
{
_bufferCount = bufferCount;
_totalFiberCount = totalFiberCount;
_fibersPerTube = totalFiberCount / bufferCount;
}
/// <summary>
/// Constructs a new FiberCableConfiguration
/// </summary>
/// <param name="bufferCount">Total number of buffer tubes</param>
/// <param name="strandsPerTube">Number of fiber strands per tube</param>
/// <param name="displayName">Name that will appear in any dropdowns</param>
/// <param name="detailDesc">Name or text that will appear in detailed descriptions</param>
public FiberCableConfiguration(int bufferCount, int strandsPerTube, string displayName, string detailDesc)
{
_bufferCount = bufferCount;
_fibersPerTube = strandsPerTube;
_totalFiberCount = bufferCount * strandsPerTube;
_displayName = displayName;
_detailDesc = detailDesc;
}
/// <summary>
/// The display name
/// </summary>
public string DisplayName
{
get
{
return _displayName;
}
}
/// <summary>
/// The detail name
/// </summary>
public string DetailDesc
{
get
{
return _detailDesc;
}
}
/// <summary>
/// The total number of buffer tubes
/// </summary>
public int BufferCount
{
get
{
return _bufferCount;
}
}
/// <summary>
/// The total number of fiber strands
/// </summary>
public int TotalFiberCount
{
get
{
return _totalFiberCount;
}
}
/// <summary>
/// The calculated (rounded if necessary) number of fiber strands
/// </summary>
public int FibersPerTube
{
get
{
return _fibersPerTube;
}
}
/// <summary>
/// A clear representation of the configuration.
/// </summary>
/// <returns>string</returns>
public override string ToString()
{
return string.Format("{0} x {1} ({2} strands)", _bufferCount, _fibersPerTube, _totalFiberCount);
}
}
}
| {
"content_hash": "092e5f097768786c3c17a00fcc4d919e",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 114,
"avg_line_length": 28.451327433628318,
"alnum_prop": 0.5269051321928461,
"repo_name": "Esri/utilities-telecom-desktop-addins",
"id": "420207f6e06258800aacce377fc44b714c95f07b",
"size": "3819",
"binary": false,
"copies": "1",
"ref": "refs/heads/master",
"path": "Core/FiberCableConfiguration.cs",
"mode": "33188",
"license": "apache-2.0",
"language": [
{
"name": "C#",
"bytes": "535182"
}
],
"symlink_target": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.